| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460 |
- /*!
- * OpenLayers v6.15.1 (https://openlayers.org/)
- * Copyright 2005-present, OpenLayers Contributors All rights reserved.
- * Licensed under BSD 2-Clause License (https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
- *
- * @license BSD-2-Clause
- */
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define([], factory);
- else if(typeof exports === 'object')
- exports["ol"] = factory();
- else
- root["ol"] = factory();
- })(self, function() {
- return /******/ (function() { // webpackBootstrap
- /******/ var __webpack_modules__ = ({
- /***/ 341:
- /***/ (function(module) {
- !function(t,i){ true?module.exports=i():0}(this,function(){"use strict";function t(t,r,e,a,h){!function t(n,r,e,a,h){for(;a>e;){if(a-e>600){var o=a-e+1,s=r-e+1,l=Math.log(o),f=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*f*(o-f)/o)*(s-o/2<0?-1:1),m=Math.max(e,Math.floor(r-s*f/o+u)),c=Math.min(a,Math.floor(r+(o-s)*f/o+u));t(n,r,m,c,h)}var p=n[r],d=e,x=a;for(i(n,e,r),h(n[a],p)>0&&i(n,e,a);d<x;){for(i(n,d,x),d++,x--;h(n[d],p)<0;)d++;for(;h(n[x],p)>0;)x--}0===h(n[e],p)?i(n,e,x):i(n,++x,a),x<=r&&(e=x+1),r<=x&&(a=x-1)}}(t,r,e||0,a||t.length-1,h||n)}function i(t,i,n){var r=t[i];t[i]=t[n],t[n]=r}function n(t,i){return t<i?-1:t>i?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function e(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r<i.length;r++)if(n(t,i[r]))return r;return-1}function a(t,i){h(t,0,t.children.length,i,t)}function h(t,i,n,r,e){e||(e=p(null)),e.minX=1/0,e.minY=1/0,e.maxX=-1/0,e.maxY=-1/0;for(var a=i;a<n;a++){var h=t.children[a];o(e,t.leaf?r(h):h)}return e}function o(t,i){return t.minX=Math.min(t.minX,i.minX),t.minY=Math.min(t.minY,i.minY),t.maxX=Math.max(t.maxX,i.maxX),t.maxY=Math.max(t.maxY,i.maxY),t}function s(t,i){return t.minX-i.minX}function l(t,i){return t.minY-i.minY}function f(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function u(t){return t.maxX-t.minX+(t.maxY-t.minY)}function m(t,i){return t.minX<=i.minX&&t.minY<=i.minY&&i.maxX<=t.maxX&&i.maxY<=t.maxY}function c(t,i){return i.minX<=t.maxX&&i.minY<=t.maxY&&i.maxX>=t.minX&&i.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,e,a){for(var h=[n,r];h.length;)if(!((r=h.pop())-(n=h.pop())<=e)){var o=n+Math.ceil((r-n)/e/2)*e;t(i,o,n,r,a),h.push(n,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var i=this.data,n=[];if(!c(t,i))return n;for(var r=this.toBBox,e=[];i;){for(var a=0;a<i.children.length;a++){var h=i.children[a],o=i.leaf?r(h):h;c(t,o)&&(i.leaf?n.push(h):m(t,o)?this._all(h,n):e.push(h))}i=e.pop()}return n},r.prototype.collides=function(t){var i=this.data;if(!c(t,i))return!1;for(var n=[];i;){for(var r=0;r<i.children.length;r++){var e=i.children[r],a=i.leaf?this.toBBox(e):e;if(c(t,a)){if(i.leaf||m(t,a))return!0;n.push(e)}}i=n.pop()}return!1},r.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var i=0;i<t.length;i++)this.insert(t[i]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},r.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},r.prototype.clear=function(){return this.data=p([]),this},r.prototype.remove=function(t,i){if(!t)return this;for(var n,r,a,h=this.data,o=this.toBBox(t),s=[],l=[];h||s.length;){if(h||(h=s.pop(),r=s[s.length-1],n=l.pop(),a=!0),h.leaf){var f=e(t,h.children,i);if(-1!==f)return h.children.splice(f,1),s.push(h),this._condense(s),this}a||h.leaf||!m(h,o)?r?(n++,h=r.children[n],a=!1):h=null:(s.push(h),l.push(n),n=0,r=h,h=h.children[0])}return this},r.prototype.toBBox=function(t){return t},r.prototype.compareMinX=function(t,i){return t.minX-i.minX},r.prototype.compareMinY=function(t,i){return t.minY-i.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(t){return this.data=t,this},r.prototype._all=function(t,i){for(var n=[];t;)t.leaf?i.push.apply(i,t.children):n.push.apply(n,t.children),t=n.pop();return i},r.prototype._build=function(t,i,n,r){var e,h=n-i+1,o=this._maxEntries;if(h<=o)return a(e=p(t.slice(i,n+1)),this.toBBox),e;r||(r=Math.ceil(Math.log(h)/Math.log(o)),o=Math.ceil(h/Math.pow(o,r-1))),(e=p([])).leaf=!1,e.height=r;var s=Math.ceil(h/o),l=s*Math.ceil(Math.sqrt(o));d(t,i,n,l,this.compareMinX);for(var f=i;f<=n;f+=l){var u=Math.min(f+l-1,n);d(t,f,u,s,this.compareMinY);for(var m=f;m<=u;m+=s){var c=Math.min(m+s-1,u);e.children.push(this._build(t,m,c,r-1))}}return a(e,this.toBBox),e},r.prototype._chooseSubtree=function(t,i,n,r){for(;r.push(i),!i.leaf&&r.length-1!==n;){for(var e=1/0,a=1/0,h=void 0,o=0;o<i.children.length;o++){var s=i.children[o],l=f(s),u=(m=t,c=s,(Math.max(c.maxX,m.maxX)-Math.min(c.minX,m.minX))*(Math.max(c.maxY,m.maxY)-Math.min(c.minY,m.minY))-l);u<a?(a=u,e=l<e?l:e,h=s):u===a&&l<e&&(e=l,h=s)}i=h||i.children[0]}var m,c;return i},r.prototype._insert=function(t,i,n){var r=n?t:this.toBBox(t),e=[],a=this._chooseSubtree(r,this.data,i,e);for(a.children.push(t),o(a,r);i>=0&&e[i].children.length>this._maxEntries;)this._split(e,i),i--;this._adjustParentBBoxes(r,e,i)},r.prototype._split=function(t,i){var n=t[i],r=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,r);var h=this._chooseSplitIndex(n,e,r),o=p(n.children.splice(h,n.children.length-h));o.height=n.height,o.leaf=n.leaf,a(n,this.toBBox),a(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},r.prototype._splitRoot=function(t,i){this.data=p([t,i]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,i,n){for(var r,e,a,o,s,l,u,m=1/0,c=1/0,p=i;p<=n-i;p++){var d=h(t,0,p,this.toBBox),x=h(t,p,n,this.toBBox),v=(e=d,a=x,o=void 0,s=void 0,l=void 0,u=void 0,o=Math.max(e.minX,a.minX),s=Math.max(e.minY,a.minY),l=Math.min(e.maxX,a.maxX),u=Math.min(e.maxY,a.maxY),Math.max(0,l-o)*Math.max(0,u-s)),M=f(d)+f(x);v<m?(m=v,r=p,c=M<c?M:c):v===m&&M<c&&(c=M,r=p)}return r||n-i},r.prototype._chooseSplitAxis=function(t,i,n){var r=t.leaf?this.compareMinX:s,e=t.leaf?this.compareMinY:l;this._allDistMargin(t,i,n,r)<this._allDistMargin(t,i,n,e)&&t.children.sort(r)},r.prototype._allDistMargin=function(t,i,n,r){t.children.sort(r);for(var e=this.toBBox,a=h(t,0,i,e),s=h(t,n-i,n,e),l=u(a)+u(s),f=i;f<n-i;f++){var m=t.children[f];o(a,t.leaf?e(m):m),l+=u(a)}for(var c=n-i-1;c>=i;c--){var p=t.children[c];o(s,t.leaf?e(p):p),l+=u(s)}return l},r.prototype._adjustParentBBoxes=function(t,i,n){for(var r=n;r>=0;r--)o(i[r],t)},r.prototype._condense=function(t){for(var i=t.length-1,n=void 0;i>=0;i--)0===t[i].children.length?i>0?(n=t[i-1].children).splice(n.indexOf(t[i]),1):this.clear():a(t[i],this.toBBox)},r});
- /***/ })
- /******/ });
- /************************************************************************/
- /******/ // The module cache
- /******/ var __webpack_module_cache__ = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
- /******/ if (cachedModule !== undefined) {
- /******/ return cachedModule.exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = __webpack_module_cache__[moduleId] = {
- /******/ // no module.id needed
- /******/ // no module.loaded needed
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /************************************************************************/
- /******/ /* webpack/runtime/define property getters */
- /******/ !function() {
- /******/ // define getter functions for harmony exports
- /******/ __webpack_require__.d = function(exports, definition) {
- /******/ for(var key in definition) {
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
- /******/ }
- /******/ }
- /******/ };
- /******/ }();
- /******/
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
- /******/ !function() {
- /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
- /******/ }();
- /******/
- /************************************************************************/
- var __webpack_exports__ = {};
- // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
- !function() {
- "use strict";
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, {
- "default": function() { return /* binding */ src_ol; }
- });
- ;// ./node_modules/ol/events/Event.js
- /**
- * @module ol/events/Event
- */
- /**
- * @classdesc
- * Stripped down implementation of the W3C DOM Level 2 Event interface.
- * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface.
- *
- * This implementation only provides `type` and `target` properties, and
- * `stopPropagation` and `preventDefault` methods. It is meant as base class
- * for higher level events defined in the library, and works with
- * {@link module:ol/events/Target~Target}.
- */
- var BaseEvent = /** @class */ (function () {
- /**
- * @param {string} type Type.
- */
- function BaseEvent(type) {
- /**
- * @type {boolean}
- */
- this.propagationStopped;
- /**
- * @type {boolean}
- */
- this.defaultPrevented;
- /**
- * The event type.
- * @type {string}
- * @api
- */
- this.type = type;
- /**
- * The event target.
- * @type {Object}
- * @api
- */
- this.target = null;
- }
- /**
- * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events
- * will be fired.
- * @api
- */
- BaseEvent.prototype.preventDefault = function () {
- this.defaultPrevented = true;
- };
- /**
- * Stop event propagation.
- * @api
- */
- BaseEvent.prototype.stopPropagation = function () {
- this.propagationStopped = true;
- };
- return BaseEvent;
- }());
- /**
- * @param {Event|import("./Event.js").default} evt Event
- */
- function stopPropagation(evt) {
- evt.stopPropagation();
- }
- /**
- * @param {Event|import("./Event.js").default} evt Event
- */
- function preventDefault(evt) {
- evt.preventDefault();
- }
- /* harmony default export */ var Event = (BaseEvent);
- //# sourceMappingURL=Event.js.map
- ;// ./node_modules/ol/ObjectEventType.js
- /**
- * @module ol/ObjectEventType
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var ObjectEventType = ({
- /**
- * Triggered when a property is changed.
- * @event module:ol/Object.ObjectEvent#propertychange
- * @api
- */
- PROPERTYCHANGE: 'propertychange',
- });
- /**
- * @typedef {'propertychange'} Types
- */
- //# sourceMappingURL=ObjectEventType.js.map
- ;// ./node_modules/ol/Disposable.js
- /**
- * @module ol/Disposable
- */
- /**
- * @classdesc
- * Objects that need to clean up after themselves.
- */
- var Disposable = /** @class */ (function () {
- function Disposable() {
- /**
- * The object has already been disposed.
- * @type {boolean}
- * @protected
- */
- this.disposed = false;
- }
- /**
- * Clean up.
- */
- Disposable.prototype.dispose = function () {
- if (!this.disposed) {
- this.disposed = true;
- this.disposeInternal();
- }
- };
- /**
- * Extension point for disposable objects.
- * @protected
- */
- Disposable.prototype.disposeInternal = function () { };
- return Disposable;
- }());
- /* harmony default export */ var ol_Disposable = (Disposable);
- //# sourceMappingURL=Disposable.js.map
- ;// ./node_modules/ol/array.js
- /**
- * @module ol/array
- */
- /**
- * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.
- * https://github.com/darkskyapp/binary-search
- *
- * @param {Array<*>} haystack Items to search through.
- * @param {*} needle The item to look for.
- * @param {Function} [opt_comparator] Comparator function.
- * @return {number} The index of the item if found, -1 if not.
- */
- function binarySearch(haystack, needle, opt_comparator) {
- var mid, cmp;
- var comparator = opt_comparator || numberSafeCompareFunction;
- var low = 0;
- var high = haystack.length;
- var found = false;
- while (low < high) {
- /* Note that "(low + high) >>> 1" may overflow, and results in a typecast
- * to double (which gives the wrong results). */
- mid = low + ((high - low) >> 1);
- cmp = +comparator(haystack[mid], needle);
- if (cmp < 0.0) {
- /* Too low. */
- low = mid + 1;
- }
- else {
- /* Key found or too high */
- high = mid;
- found = !cmp;
- }
- }
- /* Key not found. */
- return found ? low : ~low;
- }
- /**
- * Compare function for array sort that is safe for numbers.
- * @param {*} a The first object to be compared.
- * @param {*} b The second object to be compared.
- * @return {number} A negative number, zero, or a positive number as the first
- * argument is less than, equal to, or greater than the second.
- */
- function numberSafeCompareFunction(a, b) {
- return a > b ? 1 : a < b ? -1 : 0;
- }
- /**
- * Whether the array contains the given object.
- * @param {Array<*>} arr The array to test for the presence of the element.
- * @param {*} obj The object for which to test.
- * @return {boolean} The object is in the array.
- */
- function includes(arr, obj) {
- return arr.indexOf(obj) >= 0;
- }
- /**
- * {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution} can use a function
- * of this type to determine which nearest resolution to use.
- *
- * This function takes a `{number}` representing a value between two array entries,
- * a `{number}` representing the value of the nearest higher entry and
- * a `{number}` representing the value of the nearest lower entry
- * as arguments and returns a `{number}`. If a negative number or zero is returned
- * the lower value will be used, if a positive number is returned the higher value
- * will be used.
- * @typedef {function(number, number, number): number} NearestDirectionFunction
- * @api
- */
- /**
- * @param {Array<number>} arr Array in descending order.
- * @param {number} target Target.
- * @param {number|NearestDirectionFunction} direction
- * 0 means return the nearest,
- * > 0 means return the largest nearest,
- * < 0 means return the smallest nearest.
- * @return {number} Index.
- */
- function linearFindNearest(arr, target, direction) {
- var n = arr.length;
- if (arr[0] <= target) {
- return 0;
- }
- else if (target <= arr[n - 1]) {
- return n - 1;
- }
- else {
- var i = void 0;
- if (direction > 0) {
- for (i = 1; i < n; ++i) {
- if (arr[i] < target) {
- return i - 1;
- }
- }
- }
- else if (direction < 0) {
- for (i = 1; i < n; ++i) {
- if (arr[i] <= target) {
- return i;
- }
- }
- }
- else {
- for (i = 1; i < n; ++i) {
- if (arr[i] == target) {
- return i;
- }
- else if (arr[i] < target) {
- if (typeof direction === 'function') {
- if (direction(target, arr[i - 1], arr[i]) > 0) {
- return i - 1;
- }
- else {
- return i;
- }
- }
- else if (arr[i - 1] - target < target - arr[i]) {
- return i - 1;
- }
- else {
- return i;
- }
- }
- }
- }
- return n - 1;
- }
- }
- /**
- * @param {Array<*>} arr Array.
- * @param {number} begin Begin index.
- * @param {number} end End index.
- */
- function reverseSubArray(arr, begin, end) {
- while (begin < end) {
- var tmp = arr[begin];
- arr[begin] = arr[end];
- arr[end] = tmp;
- ++begin;
- --end;
- }
- }
- /**
- * @param {Array<VALUE>} arr The array to modify.
- * @param {!Array<VALUE>|VALUE} data The elements or arrays of elements to add to arr.
- * @template VALUE
- */
- function array_extend(arr, data) {
- var extension = Array.isArray(data) ? data : [data];
- var length = extension.length;
- for (var i = 0; i < length; i++) {
- arr[arr.length] = extension[i];
- }
- }
- /**
- * @param {Array<VALUE>} arr The array to modify.
- * @param {VALUE} obj The element to remove.
- * @template VALUE
- * @return {boolean} If the element was removed.
- */
- function remove(arr, obj) {
- var i = arr.indexOf(obj);
- var found = i > -1;
- if (found) {
- arr.splice(i, 1);
- }
- return found;
- }
- /**
- * @param {Array<VALUE>} arr The array to search in.
- * @param {function(VALUE, number, ?) : boolean} func The function to compare.
- * @template VALUE
- * @return {VALUE|null} The element found or null.
- */
- function find(arr, func) {
- var length = arr.length >>> 0;
- var value;
- for (var i = 0; i < length; i++) {
- value = arr[i];
- if (func(value, i, arr)) {
- return value;
- }
- }
- return null;
- }
- /**
- * @param {Array|Uint8ClampedArray} arr1 The first array to compare.
- * @param {Array|Uint8ClampedArray} arr2 The second array to compare.
- * @return {boolean} Whether the two arrays are equal.
- */
- function equals(arr1, arr2) {
- var len1 = arr1.length;
- if (len1 !== arr2.length) {
- return false;
- }
- for (var i = 0; i < len1; i++) {
- if (arr1[i] !== arr2[i]) {
- return false;
- }
- }
- return true;
- }
- /**
- * Sort the passed array such that the relative order of equal elements is preserved.
- * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.
- * @param {Array<*>} arr The array to sort (modifies original).
- * @param {!function(*, *): number} compareFnc Comparison function.
- * @api
- */
- function stableSort(arr, compareFnc) {
- var length = arr.length;
- var tmp = Array(arr.length);
- var i;
- for (i = 0; i < length; i++) {
- tmp[i] = { index: i, value: arr[i] };
- }
- tmp.sort(function (a, b) {
- return compareFnc(a.value, b.value) || a.index - b.index;
- });
- for (i = 0; i < arr.length; i++) {
- arr[i] = tmp[i].value;
- }
- }
- /**
- * @param {Array<*>} arr The array to search in.
- * @param {Function} func Comparison function.
- * @return {number} Return index.
- */
- function findIndex(arr, func) {
- var index;
- var found = !arr.every(function (el, idx) {
- index = idx;
- return !func(el, idx, arr);
- });
- return found ? index : -1;
- }
- /**
- * @param {Array<*>} arr The array to test.
- * @param {Function} [opt_func] Comparison function.
- * @param {boolean} [opt_strict] Strictly sorted (default false).
- * @return {boolean} Return index.
- */
- function isSorted(arr, opt_func, opt_strict) {
- var compare = opt_func || numberSafeCompareFunction;
- return arr.every(function (currentVal, index) {
- if (index === 0) {
- return true;
- }
- var res = compare(arr[index - 1], currentVal);
- return !(res > 0 || (opt_strict && res === 0));
- });
- }
- //# sourceMappingURL=array.js.map
- ;// ./node_modules/ol/functions.js
- /**
- * @module ol/functions
- */
- /**
- * Always returns true.
- * @return {boolean} true.
- */
- function TRUE() {
- return true;
- }
- /**
- * Always returns false.
- * @return {boolean} false.
- */
- function functions_FALSE() {
- return false;
- }
- /**
- * A reusable function, used e.g. as a default for callbacks.
- *
- * @return {void} Nothing.
- */
- function VOID() { }
- /**
- * Wrap a function in another function that remembers the last return. If the
- * returned function is called twice in a row with the same arguments and the same
- * this object, it will return the value from the first call in the second call.
- *
- * @param {function(...any): ReturnType} fn The function to memoize.
- * @return {function(...any): ReturnType} The memoized function.
- * @template ReturnType
- */
- function memoizeOne(fn) {
- var called = false;
- /** @type {ReturnType} */
- var lastResult;
- /** @type {Array<any>} */
- var lastArgs;
- var lastThis;
- return function () {
- var nextArgs = Array.prototype.slice.call(arguments);
- if (!called || this !== lastThis || !equals(nextArgs, lastArgs)) {
- called = true;
- lastThis = this;
- lastArgs = nextArgs;
- lastResult = fn.apply(this, arguments);
- }
- return lastResult;
- };
- }
- /**
- * @template T
- * @param {function(): (T | Promise<T>)} getter A function that returns a value or a promise for a value.
- * @return {Promise<T>} A promise for the value.
- */
- function toPromise(getter) {
- function promiseGetter() {
- var value;
- try {
- value = getter();
- }
- catch (err) {
- return Promise.reject(err);
- }
- if (value instanceof Promise) {
- return value;
- }
- return Promise.resolve(value);
- }
- return promiseGetter();
- }
- //# sourceMappingURL=functions.js.map
- ;// ./node_modules/ol/obj.js
- /**
- * @module ol/obj
- */
- /**
- * Polyfill for Object.assign(). Assigns enumerable and own properties from
- * one or more source objects to a target object.
- * See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign.
- *
- * @param {!Object} target The target object.
- * @param {...Object} var_sources The source object(s).
- * @return {!Object} The modified target object.
- */
- var obj_assign = typeof Object.assign === 'function'
- ? Object.assign
- : function (target, var_sources) {
- if (target === undefined || target === null) {
- throw new TypeError('Cannot convert undefined or null to object');
- }
- var output = Object(target);
- for (var i = 1, ii = arguments.length; i < ii; ++i) {
- var source = arguments[i];
- if (source !== undefined && source !== null) {
- for (var key in source) {
- if (source.hasOwnProperty(key)) {
- output[key] = source[key];
- }
- }
- }
- }
- return output;
- };
- /**
- * Removes all properties from an object.
- * @param {Object} object The object to clear.
- */
- function clear(object) {
- for (var property in object) {
- delete object[property];
- }
- }
- /**
- * Polyfill for Object.values(). Get an array of property values from an object.
- * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values
- *
- * @param {!Object<K,V>} object The object from which to get the values.
- * @return {!Array<V>} The property values.
- * @template K,V
- */
- var getValues = typeof Object.values === 'function'
- ? Object.values
- : function (object) {
- var values = [];
- for (var property in object) {
- values.push(object[property]);
- }
- return values;
- };
- /**
- * Determine if an object has any properties.
- * @param {Object} object The object to check.
- * @return {boolean} The object is empty.
- */
- function obj_isEmpty(object) {
- var property;
- for (property in object) {
- return false;
- }
- return !property;
- }
- //# sourceMappingURL=obj.js.map
- ;// ./node_modules/ol/events/Target.js
- var __extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/events/Target
- */
- /**
- * @typedef {EventTarget|Target} EventTargetLike
- */
- /**
- * @classdesc
- * A simplified implementation of the W3C DOM Level 2 EventTarget interface.
- * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget.
- *
- * There are two important simplifications compared to the specification:
- *
- * 1. The handling of `useCapture` in `addEventListener` and
- * `removeEventListener`. There is no real capture model.
- * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.
- * There is no event target hierarchy. When a listener calls
- * `stopPropagation` or `preventDefault` on an event object, it means that no
- * more listeners after this one will be called. Same as when the listener
- * returns false.
- */
- var Target = /** @class */ (function (_super) {
- __extends(Target, _super);
- /**
- * @param {*} [opt_target] Default event target for dispatched events.
- */
- function Target(opt_target) {
- var _this = _super.call(this) || this;
- /**
- * @private
- * @type {*}
- */
- _this.eventTarget_ = opt_target;
- /**
- * @private
- * @type {Object<string, number>}
- */
- _this.pendingRemovals_ = null;
- /**
- * @private
- * @type {Object<string, number>}
- */
- _this.dispatching_ = null;
- /**
- * @private
- * @type {Object<string, Array<import("../events.js").Listener>>}
- */
- _this.listeners_ = null;
- return _this;
- }
- /**
- * @param {string} type Type.
- * @param {import("../events.js").Listener} listener Listener.
- */
- Target.prototype.addEventListener = function (type, listener) {
- if (!type || !listener) {
- return;
- }
- var listeners = this.listeners_ || (this.listeners_ = {});
- var listenersForType = listeners[type] || (listeners[type] = []);
- if (listenersForType.indexOf(listener) === -1) {
- listenersForType.push(listener);
- }
- };
- /**
- * Dispatches an event and calls all listeners listening for events
- * of this type. The event parameter can either be a string or an
- * Object with a `type` property.
- *
- * @param {import("./Event.js").default|string} event Event object.
- * @return {boolean|undefined} `false` if anyone called preventDefault on the
- * event object or if any of the listeners returned false.
- * @api
- */
- Target.prototype.dispatchEvent = function (event) {
- var isString = typeof event === 'string';
- var type = isString ? event : event.type;
- var listeners = this.listeners_ && this.listeners_[type];
- if (!listeners) {
- return;
- }
- var evt = isString ? new Event(event) : /** @type {Event} */ (event);
- if (!evt.target) {
- evt.target = this.eventTarget_ || this;
- }
- var dispatching = this.dispatching_ || (this.dispatching_ = {});
- var pendingRemovals = this.pendingRemovals_ || (this.pendingRemovals_ = {});
- if (!(type in dispatching)) {
- dispatching[type] = 0;
- pendingRemovals[type] = 0;
- }
- ++dispatching[type];
- var propagate;
- for (var i = 0, ii = listeners.length; i < ii; ++i) {
- if ('handleEvent' in listeners[i]) {
- propagate = /** @type {import("../events.js").ListenerObject} */ (listeners[i]).handleEvent(evt);
- }
- else {
- propagate = /** @type {import("../events.js").ListenerFunction} */ (listeners[i]).call(this, evt);
- }
- if (propagate === false || evt.propagationStopped) {
- propagate = false;
- break;
- }
- }
- if (--dispatching[type] === 0) {
- var pr = pendingRemovals[type];
- delete pendingRemovals[type];
- while (pr--) {
- this.removeEventListener(type, VOID);
- }
- delete dispatching[type];
- }
- return propagate;
- };
- /**
- * Clean up.
- */
- Target.prototype.disposeInternal = function () {
- this.listeners_ && clear(this.listeners_);
- };
- /**
- * Get the listeners for a specified event type. Listeners are returned in the
- * order that they will be called in.
- *
- * @param {string} type Type.
- * @return {Array<import("../events.js").Listener>|undefined} Listeners.
- */
- Target.prototype.getListeners = function (type) {
- return (this.listeners_ && this.listeners_[type]) || undefined;
- };
- /**
- * @param {string} [opt_type] Type. If not provided,
- * `true` will be returned if this event target has any listeners.
- * @return {boolean} Has listeners.
- */
- Target.prototype.hasListener = function (opt_type) {
- if (!this.listeners_) {
- return false;
- }
- return opt_type
- ? opt_type in this.listeners_
- : Object.keys(this.listeners_).length > 0;
- };
- /**
- * @param {string} type Type.
- * @param {import("../events.js").Listener} listener Listener.
- */
- Target.prototype.removeEventListener = function (type, listener) {
- var listeners = this.listeners_ && this.listeners_[type];
- if (listeners) {
- var index = listeners.indexOf(listener);
- if (index !== -1) {
- if (this.pendingRemovals_ && type in this.pendingRemovals_) {
- // make listener a no-op, and remove later in #dispatchEvent()
- listeners[index] = VOID;
- ++this.pendingRemovals_[type];
- }
- else {
- listeners.splice(index, 1);
- if (listeners.length === 0) {
- delete this.listeners_[type];
- }
- }
- }
- }
- };
- return Target;
- }(ol_Disposable));
- /* harmony default export */ var events_Target = (Target);
- //# sourceMappingURL=Target.js.map
- ;// ./node_modules/ol/events/EventType.js
- /**
- * @module ol/events/EventType
- */
- /**
- * @enum {string}
- * @const
- */
- /* harmony default export */ var EventType = ({
- /**
- * Generic change event. Triggered when the revision counter is increased.
- * @event module:ol/events/Event~BaseEvent#change
- * @api
- */
- CHANGE: 'change',
- /**
- * Generic error event. Triggered when an error occurs.
- * @event module:ol/events/Event~BaseEvent#error
- * @api
- */
- ERROR: 'error',
- BLUR: 'blur',
- CLEAR: 'clear',
- CONTEXTMENU: 'contextmenu',
- CLICK: 'click',
- DBLCLICK: 'dblclick',
- DRAGENTER: 'dragenter',
- DRAGOVER: 'dragover',
- DROP: 'drop',
- FOCUS: 'focus',
- KEYDOWN: 'keydown',
- KEYPRESS: 'keypress',
- LOAD: 'load',
- RESIZE: 'resize',
- TOUCHMOVE: 'touchmove',
- WHEEL: 'wheel',
- });
- //# sourceMappingURL=EventType.js.map
- ;// ./node_modules/ol/events.js
- /**
- * @module ol/events
- */
- /**
- * Key to use with {@link module:ol/Observable.unByKey}.
- * @typedef {Object} EventsKey
- * @property {ListenerFunction} listener Listener.
- * @property {import("./events/Target.js").EventTargetLike} target Target.
- * @property {string} type Type.
- * @api
- */
- /**
- * Listener function. This function is called with an event object as argument.
- * When the function returns `false`, event propagation will stop.
- *
- * @typedef {function((Event|import("./events/Event.js").default)): (void|boolean)} ListenerFunction
- * @api
- */
- /**
- * @typedef {Object} ListenerObject
- * @property {ListenerFunction} handleEvent HandleEvent listener function.
- */
- /**
- * @typedef {ListenerFunction|ListenerObject} Listener
- */
- /**
- * Registers an event listener on an event target. Inspired by
- * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
- *
- * This function efficiently binds a `listener` to a `this` object, and returns
- * a key for use with {@link module:ol/events.unlistenByKey}.
- *
- * @param {import("./events/Target.js").EventTargetLike} target Event target.
- * @param {string} type Event type.
- * @param {ListenerFunction} listener Listener.
- * @param {Object} [opt_this] Object referenced by the `this` keyword in the
- * listener. Default is the `target`.
- * @param {boolean} [opt_once] If true, add the listener as one-off listener.
- * @return {EventsKey} Unique key for the listener.
- */
- function listen(target, type, listener, opt_this, opt_once) {
- if (opt_this && opt_this !== target) {
- listener = listener.bind(opt_this);
- }
- if (opt_once) {
- var originalListener_1 = listener;
- listener = function () {
- target.removeEventListener(type, listener);
- originalListener_1.apply(this, arguments);
- };
- }
- var eventsKey = {
- target: target,
- type: type,
- listener: listener,
- };
- target.addEventListener(type, listener);
- return eventsKey;
- }
- /**
- * Registers a one-off event listener on an event target. Inspired by
- * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
- *
- * This function efficiently binds a `listener` as self-unregistering listener
- * to a `this` object, and returns a key for use with
- * {@link module:ol/events.unlistenByKey} in case the listener needs to be
- * unregistered before it is called.
- *
- * When {@link module:ol/events.listen} is called with the same arguments after this
- * function, the self-unregistering listener will be turned into a permanent
- * listener.
- *
- * @param {import("./events/Target.js").EventTargetLike} target Event target.
- * @param {string} type Event type.
- * @param {ListenerFunction} listener Listener.
- * @param {Object} [opt_this] Object referenced by the `this` keyword in the
- * listener. Default is the `target`.
- * @return {EventsKey} Key for unlistenByKey.
- */
- function listenOnce(target, type, listener, opt_this) {
- return listen(target, type, listener, opt_this, true);
- }
- /**
- * Unregisters event listeners on an event target. Inspired by
- * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
- *
- * The argument passed to this function is the key returned from
- * {@link module:ol/events.listen} or {@link module:ol/events.listenOnce}.
- *
- * @param {EventsKey} key The key.
- */
- function unlistenByKey(key) {
- if (key && key.target) {
- key.target.removeEventListener(key.type, key.listener);
- clear(key);
- }
- }
- //# sourceMappingURL=events.js.map
- ;// ./node_modules/ol/Observable.js
- var Observable_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/Observable
- */
- /***
- * @template {string} Type
- * @template {Event|import("./events/Event.js").default} EventClass
- * @template Return
- * @typedef {(type: Type, listener: (event: EventClass) => ?) => Return} OnSignature
- */
- /***
- * @template {string} Type
- * @template Return
- * @typedef {(type: Type[], listener: (event: Event|import("./events/Event").default) => ?) => Return extends void ? void : Return[]} CombinedOnSignature
- */
- /**
- * @typedef {'change'|'error'} EventTypes
- */
- /***
- * @template Return
- * @typedef {OnSignature<EventTypes, import("./events/Event.js").default, Return> & CombinedOnSignature<EventTypes, Return>} ObservableOnSignature
- */
- /**
- * @classdesc
- * Abstract base class; normally only used for creating subclasses and not
- * instantiated in apps.
- * An event target providing convenient methods for listener registration
- * and unregistration. A generic `change` event is always available through
- * {@link module:ol/Observable~Observable#changed}.
- *
- * @fires import("./events/Event.js").default
- * @api
- */
- var Observable = /** @class */ (function (_super) {
- Observable_extends(Observable, _super);
- function Observable() {
- var _this = _super.call(this) || this;
- _this.on =
- /** @type {ObservableOnSignature<import("./events").EventsKey>} */ (_this.onInternal);
- _this.once =
- /** @type {ObservableOnSignature<import("./events").EventsKey>} */ (_this.onceInternal);
- _this.un = /** @type {ObservableOnSignature<void>} */ (_this.unInternal);
- /**
- * @private
- * @type {number}
- */
- _this.revision_ = 0;
- return _this;
- }
- /**
- * Increases the revision counter and dispatches a 'change' event.
- * @api
- */
- Observable.prototype.changed = function () {
- ++this.revision_;
- this.dispatchEvent(EventType.CHANGE);
- };
- /**
- * Get the version number for this object. Each time the object is modified,
- * its version number will be incremented.
- * @return {number} Revision.
- * @api
- */
- Observable.prototype.getRevision = function () {
- return this.revision_;
- };
- /**
- * @param {string|Array<string>} type Type.
- * @param {function((Event|import("./events/Event").default)): ?} listener Listener.
- * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Event key.
- * @protected
- */
- Observable.prototype.onInternal = function (type, listener) {
- if (Array.isArray(type)) {
- var len = type.length;
- var keys = new Array(len);
- for (var i = 0; i < len; ++i) {
- keys[i] = listen(this, type[i], listener);
- }
- return keys;
- }
- else {
- return listen(this, /** @type {string} */ (type), listener);
- }
- };
- /**
- * @param {string|Array<string>} type Type.
- * @param {function((Event|import("./events/Event").default)): ?} listener Listener.
- * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Event key.
- * @protected
- */
- Observable.prototype.onceInternal = function (type, listener) {
- var key;
- if (Array.isArray(type)) {
- var len = type.length;
- key = new Array(len);
- for (var i = 0; i < len; ++i) {
- key[i] = listenOnce(this, type[i], listener);
- }
- }
- else {
- key = listenOnce(this, /** @type {string} */ (type), listener);
- }
- /** @type {Object} */ (listener).ol_key = key;
- return key;
- };
- /**
- * Unlisten for a certain type of event.
- * @param {string|Array<string>} type Type.
- * @param {function((Event|import("./events/Event").default)): ?} listener Listener.
- * @protected
- */
- Observable.prototype.unInternal = function (type, listener) {
- var key = /** @type {Object} */ (listener).ol_key;
- if (key) {
- unByKey(key);
- }
- else if (Array.isArray(type)) {
- for (var i = 0, ii = type.length; i < ii; ++i) {
- this.removeEventListener(type[i], listener);
- }
- }
- else {
- this.removeEventListener(type, listener);
- }
- };
- return Observable;
- }(events_Target));
- /**
- * Listen for a certain type of event.
- * @function
- * @param {string|Array<string>} type The event type or array of event types.
- * @param {function((Event|import("./events/Event").default)): ?} listener The listener function.
- * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
- * called with an array of event types as the first argument, the return
- * will be an array of keys.
- * @api
- */
- Observable.prototype.on;
- /**
- * Listen once for a certain type of event.
- * @function
- * @param {string|Array<string>} type The event type or array of event types.
- * @param {function((Event|import("./events/Event").default)): ?} listener The listener function.
- * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
- * called with an array of event types as the first argument, the return
- * will be an array of keys.
- * @api
- */
- Observable.prototype.once;
- /**
- * Unlisten for a certain type of event.
- * @function
- * @param {string|Array<string>} type The event type or array of event types.
- * @param {function((Event|import("./events/Event").default)): ?} listener The listener function.
- * @api
- */
- Observable.prototype.un;
- /**
- * Removes an event listener using the key returned by `on()` or `once()`.
- * @param {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} key The key returned by `on()`
- * or `once()` (or an array of keys).
- * @api
- */
- function unByKey(key) {
- if (Array.isArray(key)) {
- for (var i = 0, ii = key.length; i < ii; ++i) {
- unlistenByKey(key[i]);
- }
- }
- else {
- unlistenByKey(/** @type {import("./events.js").EventsKey} */ (key));
- }
- }
- /* harmony default export */ var ol_Observable = (Observable);
- //# sourceMappingURL=Observable.js.map
- ;// ./node_modules/ol/util.js
- /**
- * @module ol/util
- */
- /**
- * @return {?} Any return.
- */
- function util_abstract() {
- return /** @type {?} */ ((function () {
- throw new Error('Unimplemented abstract method.');
- })());
- }
- /**
- * Counter for getUid.
- * @type {number}
- * @private
- */
- var uidCounter_ = 0;
- /**
- * Gets a unique ID for an object. This mutates the object so that further calls
- * with the same object as a parameter returns the same value. Unique IDs are generated
- * as a strictly increasing sequence. Adapted from goog.getUid.
- *
- * @param {Object} obj The object to get the unique ID for.
- * @return {string} The unique ID for the object.
- * @api
- */
- function getUid(obj) {
- return obj.ol_uid || (obj.ol_uid = String(++uidCounter_));
- }
- /**
- * OpenLayers version.
- * @type {string}
- */
- var VERSION = '6.15.1';
- //# sourceMappingURL=util.js.map
- ;// ./node_modules/ol/Object.js
- var Object_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/Object
- */
- /**
- * @classdesc
- * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.
- */
- var ObjectEvent = /** @class */ (function (_super) {
- Object_extends(ObjectEvent, _super);
- /**
- * @param {string} type The event type.
- * @param {string} key The property name.
- * @param {*} oldValue The old value for `key`.
- */
- function ObjectEvent(type, key, oldValue) {
- var _this = _super.call(this, type) || this;
- /**
- * The name of the property whose value is changing.
- * @type {string}
- * @api
- */
- _this.key = key;
- /**
- * The old value. To get the new value use `e.target.get(e.key)` where
- * `e` is the event object.
- * @type {*}
- * @api
- */
- _this.oldValue = oldValue;
- return _this;
- }
- return ObjectEvent;
- }(Event));
- /***
- * @template Return
- * @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
- * import("./Observable").OnSignature<import("./ObjectEventType").Types, ObjectEvent, Return> &
- * import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|import("./ObjectEventType").Types, Return>} ObjectOnSignature
- */
- /**
- * @classdesc
- * Abstract base class; normally only used for creating subclasses and not
- * instantiated in apps.
- * Most non-trivial classes inherit from this.
- *
- * This extends {@link module:ol/Observable~Observable} with observable
- * properties, where each property is observable as well as the object as a
- * whole.
- *
- * Classes that inherit from this have pre-defined properties, to which you can
- * add your owns. The pre-defined properties are listed in this documentation as
- * 'Observable Properties', and have their own accessors; for example,
- * {@link module:ol/Map~Map} has a `target` property, accessed with
- * `getTarget()` and changed with `setTarget()`. Not all properties are however
- * settable. There are also general-purpose accessors `get()` and `set()`. For
- * example, `get('target')` is equivalent to `getTarget()`.
- *
- * The `set` accessors trigger a change event, and you can monitor this by
- * registering a listener. For example, {@link module:ol/View~View} has a
- * `center` property, so `view.on('change:center', function(evt) {...});` would
- * call the function whenever the value of the center property changes. Within
- * the function, `evt.target` would be the view, so `evt.target.getCenter()`
- * would return the new center.
- *
- * You can add your own observable properties with
- * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`.
- * You can listen for changes on that property value with
- * `object.on('change:prop', listener)`. You can get a list of all
- * properties with {@link module:ol/Object~BaseObject#getProperties}.
- *
- * Note that the observable properties are separate from standard JS properties.
- * You can, for example, give your map object a title with
- * `map.title='New title'` and with `map.set('title', 'Another title')`. The
- * first will be a `hasOwnProperty`; the second will appear in
- * `getProperties()`. Only the second is observable.
- *
- * Properties can be deleted by using the unset method. E.g.
- * object.unset('foo').
- *
- * @fires ObjectEvent
- * @api
- */
- var BaseObject = /** @class */ (function (_super) {
- Object_extends(BaseObject, _super);
- /**
- * @param {Object<string, *>} [opt_values] An object with key-value pairs.
- */
- function BaseObject(opt_values) {
- var _this = _super.call(this) || this;
- /***
- * @type {ObjectOnSignature<import("./events").EventsKey>}
- */
- _this.on;
- /***
- * @type {ObjectOnSignature<import("./events").EventsKey>}
- */
- _this.once;
- /***
- * @type {ObjectOnSignature<void>}
- */
- _this.un;
- // Call {@link module:ol/util.getUid} to ensure that the order of objects' ids is
- // the same as the order in which they were created. This also helps to
- // ensure that object properties are always added in the same order, which
- // helps many JavaScript engines generate faster code.
- getUid(_this);
- /**
- * @private
- * @type {Object<string, *>}
- */
- _this.values_ = null;
- if (opt_values !== undefined) {
- _this.setProperties(opt_values);
- }
- return _this;
- }
- /**
- * Gets a value.
- * @param {string} key Key name.
- * @return {*} Value.
- * @api
- */
- BaseObject.prototype.get = function (key) {
- var value;
- if (this.values_ && this.values_.hasOwnProperty(key)) {
- value = this.values_[key];
- }
- return value;
- };
- /**
- * Get a list of object property names.
- * @return {Array<string>} List of property names.
- * @api
- */
- BaseObject.prototype.getKeys = function () {
- return (this.values_ && Object.keys(this.values_)) || [];
- };
- /**
- * Get an object of all property names and values.
- * @return {Object<string, *>} Object.
- * @api
- */
- BaseObject.prototype.getProperties = function () {
- return (this.values_ && obj_assign({}, this.values_)) || {};
- };
- /**
- * @return {boolean} The object has properties.
- */
- BaseObject.prototype.hasProperties = function () {
- return !!this.values_;
- };
- /**
- * @param {string} key Key name.
- * @param {*} oldValue Old value.
- */
- BaseObject.prototype.notify = function (key, oldValue) {
- var eventType;
- eventType = "change:".concat(key);
- if (this.hasListener(eventType)) {
- this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));
- }
- eventType = ObjectEventType.PROPERTYCHANGE;
- if (this.hasListener(eventType)) {
- this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));
- }
- };
- /**
- * @param {string} key Key name.
- * @param {import("./events.js").Listener} listener Listener.
- */
- BaseObject.prototype.addChangeListener = function (key, listener) {
- this.addEventListener("change:".concat(key), listener);
- };
- /**
- * @param {string} key Key name.
- * @param {import("./events.js").Listener} listener Listener.
- */
- BaseObject.prototype.removeChangeListener = function (key, listener) {
- this.removeEventListener("change:".concat(key), listener);
- };
- /**
- * Sets a value.
- * @param {string} key Key name.
- * @param {*} value Value.
- * @param {boolean} [opt_silent] Update without triggering an event.
- * @api
- */
- BaseObject.prototype.set = function (key, value, opt_silent) {
- var values = this.values_ || (this.values_ = {});
- if (opt_silent) {
- values[key] = value;
- }
- else {
- var oldValue = values[key];
- values[key] = value;
- if (oldValue !== value) {
- this.notify(key, oldValue);
- }
- }
- };
- /**
- * Sets a collection of key-value pairs. Note that this changes any existing
- * properties and adds new ones (it does not remove any existing properties).
- * @param {Object<string, *>} values Values.
- * @param {boolean} [opt_silent] Update without triggering an event.
- * @api
- */
- BaseObject.prototype.setProperties = function (values, opt_silent) {
- for (var key in values) {
- this.set(key, values[key], opt_silent);
- }
- };
- /**
- * Apply any properties from another object without triggering events.
- * @param {BaseObject} source The source object.
- * @protected
- */
- BaseObject.prototype.applyProperties = function (source) {
- if (!source.values_) {
- return;
- }
- obj_assign(this.values_ || (this.values_ = {}), source.values_);
- };
- /**
- * Unsets a property.
- * @param {string} key Key name.
- * @param {boolean} [opt_silent] Unset without triggering an event.
- * @api
- */
- BaseObject.prototype.unset = function (key, opt_silent) {
- if (this.values_ && key in this.values_) {
- var oldValue = this.values_[key];
- delete this.values_[key];
- if (obj_isEmpty(this.values_)) {
- this.values_ = null;
- }
- if (!opt_silent) {
- this.notify(key, oldValue);
- }
- }
- };
- return BaseObject;
- }(ol_Observable));
- /* harmony default export */ var ol_Object = (BaseObject);
- //# sourceMappingURL=Object.js.map
- ;// ./node_modules/ol/MapEventType.js
- /**
- * @module ol/MapEventType
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var MapEventType = ({
- /**
- * Triggered after a map frame is rendered.
- * @event module:ol/MapEvent~MapEvent#postrender
- * @api
- */
- POSTRENDER: 'postrender',
- /**
- * Triggered when the map starts moving.
- * @event module:ol/MapEvent~MapEvent#movestart
- * @api
- */
- MOVESTART: 'movestart',
- /**
- * Triggered after the map is moved.
- * @event module:ol/MapEvent~MapEvent#moveend
- * @api
- */
- MOVEEND: 'moveend',
- /**
- * Triggered when loading of additional map data (tiles, images, features) starts.
- * @event module:ol/MapEvent~MapEvent#loadstart
- * @api
- */
- LOADSTART: 'loadstart',
- /**
- * Triggered when loading of additional map data has completed.
- * @event module:ol/MapEvent~MapEvent#loadend
- * @api
- */
- LOADEND: 'loadend',
- });
- /***
- * @typedef {'postrender'|'movestart'|'moveend'|'loadstart'|'loadend'} Types
- */
- //# sourceMappingURL=MapEventType.js.map
- ;// ./node_modules/ol/has.js
- /**
- * @module ol/has
- */
- var ua = typeof navigator !== 'undefined' && typeof navigator.userAgent !== 'undefined'
- ? navigator.userAgent.toLowerCase()
- : '';
- /**
- * User agent string says we are dealing with Firefox as browser.
- * @type {boolean}
- */
- var FIREFOX = ua.indexOf('firefox') !== -1;
- /**
- * User agent string says we are dealing with Safari as browser.
- * @type {boolean}
- */
- var SAFARI = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') == -1;
- /**
- * https://bugs.webkit.org/show_bug.cgi?id=237906
- * @type {boolean}
- */
- var SAFARI_BUG_237906 = SAFARI &&
- !!(ua.indexOf('version/15.4') >= 0 ||
- ua.match(/cpu (os|iphone os) 15_4 like mac os x/));
- /**
- * User agent string says we are dealing with a WebKit engine.
- * @type {boolean}
- */
- var WEBKIT = ua.indexOf('webkit') !== -1 && ua.indexOf('edge') == -1;
- /**
- * User agent string says we are dealing with a Mac as platform.
- * @type {boolean}
- */
- var has_MAC = ua.indexOf('macintosh') !== -1;
- /**
- * The ratio between physical pixels and device-independent pixels
- * (dips) on the device (`window.devicePixelRatio`).
- * @const
- * @type {number}
- * @api
- */
- var DEVICE_PIXEL_RATIO = typeof devicePixelRatio !== 'undefined' ? devicePixelRatio : 1;
- /**
- * The execution context is a worker with OffscreenCanvas available.
- * @const
- * @type {boolean}
- */
- var WORKER_OFFSCREEN_CANVAS = typeof WorkerGlobalScope !== 'undefined' &&
- typeof OffscreenCanvas !== 'undefined' &&
- self instanceof WorkerGlobalScope; //eslint-disable-line
- /**
- * Image.prototype.decode() is supported.
- * @type {boolean}
- */
- var IMAGE_DECODE = typeof Image !== 'undefined' && Image.prototype.decode;
- /**
- * @type {boolean}
- */
- var PASSIVE_EVENT_LISTENERS = (function () {
- var passive = false;
- try {
- var options = Object.defineProperty({}, 'passive', {
- get: function () {
- passive = true;
- },
- });
- window.addEventListener('_', null, options);
- window.removeEventListener('_', null, options);
- }
- catch (error) {
- // passive not supported
- }
- return passive;
- })();
- //# sourceMappingURL=has.js.map
- ;// ./node_modules/ol/dom.js
- /**
- * @module ol/dom
- */
- //FIXME Move this function to the canvas module
- /**
- * Create an html canvas element and returns its 2d context.
- * @param {number} [opt_width] Canvas width.
- * @param {number} [opt_height] Canvas height.
- * @param {Array<HTMLCanvasElement>} [opt_canvasPool] Canvas pool to take existing canvas from.
- * @param {CanvasRenderingContext2DSettings} [opt_Context2DSettings] CanvasRenderingContext2DSettings
- * @return {CanvasRenderingContext2D} The context.
- */
- function createCanvasContext2D(opt_width, opt_height, opt_canvasPool, opt_Context2DSettings) {
- /** @type {HTMLCanvasElement|OffscreenCanvas} */
- var canvas;
- if (opt_canvasPool && opt_canvasPool.length) {
- canvas = opt_canvasPool.shift();
- }
- else if (WORKER_OFFSCREEN_CANVAS) {
- canvas = new OffscreenCanvas(opt_width || 300, opt_height || 300);
- }
- else {
- canvas = document.createElement('canvas');
- }
- if (opt_width) {
- canvas.width = opt_width;
- }
- if (opt_height) {
- canvas.height = opt_height;
- }
- //FIXME Allow OffscreenCanvasRenderingContext2D as return type
- return /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d', opt_Context2DSettings));
- }
- /**
- * Releases canvas memory to avoid exceeding memory limits in Safari.
- * See https://pqina.nl/blog/total-canvas-memory-use-exceeds-the-maximum-limit/
- * @param {CanvasRenderingContext2D} context Context.
- */
- function releaseCanvas(context) {
- var canvas = context.canvas;
- canvas.width = 1;
- canvas.height = 1;
- context.clearRect(0, 0, 1, 1);
- }
- /**
- * Get the current computed width for the given element including margin,
- * padding and border.
- * Equivalent to jQuery's `$(el).outerWidth(true)`.
- * @param {!HTMLElement} element Element.
- * @return {number} The width.
- */
- function dom_outerWidth(element) {
- var width = element.offsetWidth;
- var style = getComputedStyle(element);
- width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
- return width;
- }
- /**
- * Get the current computed height for the given element including margin,
- * padding and border.
- * Equivalent to jQuery's `$(el).outerHeight(true)`.
- * @param {!HTMLElement} element Element.
- * @return {number} The height.
- */
- function dom_outerHeight(element) {
- var height = element.offsetHeight;
- var style = getComputedStyle(element);
- height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
- return height;
- }
- /**
- * @param {Node} newNode Node to replace old node
- * @param {Node} oldNode The node to be replaced
- */
- function replaceNode(newNode, oldNode) {
- var parent = oldNode.parentNode;
- if (parent) {
- parent.replaceChild(newNode, oldNode);
- }
- }
- /**
- * @param {Node} node The node to remove.
- * @return {Node|null} The node that was removed or null.
- */
- function removeNode(node) {
- return node && node.parentNode ? node.parentNode.removeChild(node) : null;
- }
- /**
- * @param {Node} node The node to remove the children from.
- */
- function removeChildren(node) {
- while (node.lastChild) {
- node.removeChild(node.lastChild);
- }
- }
- /**
- * Transform the children of a parent node so they match the
- * provided list of children. This function aims to efficiently
- * remove, add, and reorder child nodes while maintaining a simple
- * implementation (it is not guaranteed to minimize DOM operations).
- * @param {Node} node The parent node whose children need reworking.
- * @param {Array<Node>} children The desired children.
- */
- function replaceChildren(node, children) {
- var oldChildren = node.childNodes;
- for (var i = 0; true; ++i) {
- var oldChild = oldChildren[i];
- var newChild = children[i];
- // check if our work is done
- if (!oldChild && !newChild) {
- break;
- }
- // check if children match
- if (oldChild === newChild) {
- continue;
- }
- // check if a new child needs to be added
- if (!oldChild) {
- node.appendChild(newChild);
- continue;
- }
- // check if an old child needs to be removed
- if (!newChild) {
- node.removeChild(oldChild);
- --i;
- continue;
- }
- // reorder
- node.insertBefore(newChild, oldChild);
- }
- }
- //# sourceMappingURL=dom.js.map
- ;// ./node_modules/ol/control/Control.js
- var Control_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/control/Control
- */
- /**
- * @typedef {Object} Options
- * @property {HTMLElement} [element] The element is the control's
- * container element. This only needs to be specified if you're developing
- * a custom control.
- * @property {function(import("../MapEvent.js").default):void} [render] Function called when
- * the control should be re-rendered. This is called in a `requestAnimationFrame`
- * callback.
- * @property {HTMLElement|string} [target] Specify a target if you want
- * the control to be rendered outside of the map's viewport.
- */
- /**
- * @classdesc
- * A control is a visible widget with a DOM element in a fixed position on the
- * screen. They can involve user input (buttons), or be informational only;
- * the position is determined using CSS. By default these are placed in the
- * container with CSS class name `ol-overlaycontainer-stopevent`, but can use
- * any outside DOM element.
- *
- * This is the base class for controls. You can use it for simple custom
- * controls by creating the element with listeners, creating an instance:
- * ```js
- * var myControl = new Control({element: myElement});
- * ```
- * and then adding this to the map.
- *
- * The main advantage of having this as a control rather than a simple separate
- * DOM element is that preventing propagation is handled for you. Controls
- * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.
- *
- * You can also extend this base for your own control class. See
- * examples/custom-controls for an example of how to do this.
- *
- * @api
- */
- var Control = /** @class */ (function (_super) {
- Control_extends(Control, _super);
- /**
- * @param {Options} options Control options.
- */
- function Control(options) {
- var _this = _super.call(this) || this;
- var element = options.element;
- if (element && !options.target && !element.style.pointerEvents) {
- element.style.pointerEvents = 'auto';
- }
- /**
- * @protected
- * @type {HTMLElement}
- */
- _this.element = element ? element : null;
- /**
- * @private
- * @type {HTMLElement}
- */
- _this.target_ = null;
- /**
- * @private
- * @type {import("../PluggableMap.js").default|null}
- */
- _this.map_ = null;
- /**
- * @protected
- * @type {!Array<import("../events.js").EventsKey>}
- */
- _this.listenerKeys = [];
- if (options.render) {
- _this.render = options.render;
- }
- if (options.target) {
- _this.setTarget(options.target);
- }
- return _this;
- }
- /**
- * Clean up.
- */
- Control.prototype.disposeInternal = function () {
- removeNode(this.element);
- _super.prototype.disposeInternal.call(this);
- };
- /**
- * Get the map associated with this control.
- * @return {import("../PluggableMap.js").default|null} Map.
- * @api
- */
- Control.prototype.getMap = function () {
- return this.map_;
- };
- /**
- * Remove the control from its current map and attach it to the new map.
- * Pass `null` to just remove the control from the current map.
- * Subclasses may set up event handlers to get notified about changes to
- * the map here.
- * @param {import("../PluggableMap.js").default|null} map Map.
- * @api
- */
- Control.prototype.setMap = function (map) {
- if (this.map_) {
- removeNode(this.element);
- }
- for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
- unlistenByKey(this.listenerKeys[i]);
- }
- this.listenerKeys.length = 0;
- this.map_ = map;
- if (map) {
- var target = this.target_
- ? this.target_
- : map.getOverlayContainerStopEvent();
- target.appendChild(this.element);
- if (this.render !== VOID) {
- this.listenerKeys.push(listen(map, MapEventType.POSTRENDER, this.render, this));
- }
- map.render();
- }
- };
- /**
- * Renders the control.
- * @param {import("../MapEvent.js").default} mapEvent Map event.
- * @api
- */
- Control.prototype.render = function (mapEvent) { };
- /**
- * This function is used to set a target element for the control. It has no
- * effect if it is called after the control has been added to the map (i.e.
- * after `setMap` is called on the control). If no `target` is set in the
- * options passed to the control constructor and if `setTarget` is not called
- * then the control is added to the map's overlay container.
- * @param {HTMLElement|string} target Target.
- * @api
- */
- Control.prototype.setTarget = function (target) {
- this.target_ =
- typeof target === 'string' ? document.getElementById(target) : target;
- };
- return Control;
- }(ol_Object));
- /* harmony default export */ var control_Control = (Control);
- //# sourceMappingURL=Control.js.map
- ;// ./node_modules/ol/css.js
- /**
- * @module ol/css
- */
- /**
- * @typedef {Object} FontParameters
- * @property {string} style Style.
- * @property {string} variant Variant.
- * @property {string} weight Weight.
- * @property {string} size Size.
- * @property {string} lineHeight LineHeight.
- * @property {string} family Family.
- * @property {Array<string>} families Families.
- */
- /**
- * The CSS class for hidden feature.
- *
- * @const
- * @type {string}
- */
- var CLASS_HIDDEN = 'ol-hidden';
- /**
- * The CSS class that we'll give the DOM elements to have them selectable.
- *
- * @const
- * @type {string}
- */
- var CLASS_SELECTABLE = 'ol-selectable';
- /**
- * The CSS class that we'll give the DOM elements to have them unselectable.
- *
- * @const
- * @type {string}
- */
- var CLASS_UNSELECTABLE = 'ol-unselectable';
- /**
- * The CSS class for unsupported feature.
- *
- * @const
- * @type {string}
- */
- var CLASS_UNSUPPORTED = 'ol-unsupported';
- /**
- * The CSS class for controls.
- *
- * @const
- * @type {string}
- */
- var CLASS_CONTROL = 'ol-control';
- /**
- * The CSS class that we'll give the DOM elements that are collapsed, i.e.
- * to those elements which usually can be expanded.
- *
- * @const
- * @type {string}
- */
- var CLASS_COLLAPSED = 'ol-collapsed';
- /**
- * From https://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font
- * @type {RegExp}
- */
- var fontRegEx = new RegExp([
- '^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)',
- '(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)',
- '(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)',
- '(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?',
- '(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))',
- '(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))',
- '?\\s*([-,\\"\\\'\\sa-z]+?)\\s*$',
- ].join(''), 'i');
- var fontRegExMatchIndex = [
- 'style',
- 'variant',
- 'weight',
- 'size',
- 'lineHeight',
- 'family',
- ];
- /**
- * Get the list of font families from a font spec. Note that this doesn't work
- * for font families that have commas in them.
- * @param {string} fontSpec The CSS font property.
- * @return {FontParameters|null} The font parameters (or null if the input spec is invalid).
- */
- var getFontParameters = function (fontSpec) {
- var match = fontSpec.match(fontRegEx);
- if (!match) {
- return null;
- }
- var style = /** @type {FontParameters} */ ({
- lineHeight: 'normal',
- size: '1.2em',
- style: 'normal',
- weight: 'normal',
- variant: 'normal',
- });
- for (var i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) {
- var value = match[i + 1];
- if (value !== undefined) {
- style[fontRegExMatchIndex[i]] = value;
- }
- }
- style.families = style.family.split(/,\s?/);
- return style;
- };
- //# sourceMappingURL=css.js.map
- ;// ./node_modules/ol/layer/Property.js
- /**
- * @module ol/layer/Property
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var Property = ({
- OPACITY: 'opacity',
- VISIBLE: 'visible',
- EXTENT: 'extent',
- Z_INDEX: 'zIndex',
- MAX_RESOLUTION: 'maxResolution',
- MIN_RESOLUTION: 'minResolution',
- MAX_ZOOM: 'maxZoom',
- MIN_ZOOM: 'minZoom',
- SOURCE: 'source',
- MAP: 'map',
- });
- //# sourceMappingURL=Property.js.map
- ;// ./node_modules/ol/AssertionError.js
- var AssertionError_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/AssertionError
- */
- /**
- * Error object thrown when an assertion failed. This is an ECMA-262 Error,
- * extended with a `code` property.
- * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error.
- */
- var AssertionError = /** @class */ (function (_super) {
- AssertionError_extends(AssertionError, _super);
- /**
- * @param {number} code Error code.
- */
- function AssertionError(code) {
- var _this = this;
- var path = VERSION === 'latest' ? VERSION : 'v' + VERSION.split('-')[0];
- var message = 'Assertion failed. See https://openlayers.org/en/' +
- path +
- '/doc/errors/#' +
- code +
- ' for details.';
- _this = _super.call(this, message) || this;
- /**
- * Error code. The meaning of the code can be found on
- * https://openlayers.org/en/latest/doc/errors/ (replace `latest` with
- * the version found in the OpenLayers script's header comment if a version
- * other than the latest is used).
- * @type {number}
- * @api
- */
- _this.code = code;
- /**
- * @type {string}
- */
- _this.name = 'AssertionError';
- // Re-assign message, see https://github.com/Rich-Harris/buble/issues/40
- _this.message = message;
- return _this;
- }
- return AssertionError;
- }(Error));
- /* harmony default export */ var ol_AssertionError = (AssertionError);
- //# sourceMappingURL=AssertionError.js.map
- ;// ./node_modules/ol/asserts.js
- /**
- * @module ol/asserts
- */
- /**
- * @param {*} assertion Assertion we expected to be truthy.
- * @param {number} errorCode Error code.
- */
- function asserts_assert(assertion, errorCode) {
- if (!assertion) {
- throw new ol_AssertionError(errorCode);
- }
- }
- //# sourceMappingURL=asserts.js.map
- ;// ./node_modules/ol/math.js
- /**
- * @module ol/math
- */
- /**
- * Takes a number and clamps it to within the provided bounds.
- * @param {number} value The input number.
- * @param {number} min The minimum value to return.
- * @param {number} max The maximum value to return.
- * @return {number} The input number if it is within bounds, or the nearest
- * number within the bounds.
- */
- function math_clamp(value, min, max) {
- return Math.min(Math.max(value, min), max);
- }
- /**
- * Return the hyperbolic cosine of a given number. The method will use the
- * native `Math.cosh` function if it is available, otherwise the hyperbolic
- * cosine will be calculated via the reference implementation of the Mozilla
- * developer network.
- *
- * @param {number} x X.
- * @return {number} Hyperbolic cosine of x.
- */
- var cosh = (function () {
- // Wrapped in a iife, to save the overhead of checking for the native
- // implementation on every invocation.
- var cosh;
- if ('cosh' in Math) {
- // The environment supports the native Math.cosh function, use it…
- cosh = Math.cosh;
- }
- else {
- // … else, use the reference implementation of MDN:
- cosh = function (x) {
- var y = /** @type {Math} */ (Math).exp(x);
- return (y + 1 / y) / 2;
- };
- }
- return cosh;
- })();
- /**
- * Return the base 2 logarithm of a given number. The method will use the
- * native `Math.log2` function if it is available, otherwise the base 2
- * logarithm will be calculated via the reference implementation of the
- * Mozilla developer network.
- *
- * @param {number} x X.
- * @return {number} Base 2 logarithm of x.
- */
- var log2 = (function () {
- // Wrapped in a iife, to save the overhead of checking for the native
- // implementation on every invocation.
- var log2;
- if ('log2' in Math) {
- // The environment supports the native Math.log2 function, use it…
- log2 = Math.log2;
- }
- else {
- // … else, use the reference implementation of MDN:
- log2 = function (x) {
- return Math.log(x) * Math.LOG2E;
- };
- }
- return log2;
- })();
- /**
- * Returns the square of the closest distance between the point (x, y) and the
- * line segment (x1, y1) to (x2, y2).
- * @param {number} x X.
- * @param {number} y Y.
- * @param {number} x1 X1.
- * @param {number} y1 Y1.
- * @param {number} x2 X2.
- * @param {number} y2 Y2.
- * @return {number} Squared distance.
- */
- function squaredSegmentDistance(x, y, x1, y1, x2, y2) {
- var dx = x2 - x1;
- var dy = y2 - y1;
- if (dx !== 0 || dy !== 0) {
- var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);
- if (t > 1) {
- x1 = x2;
- y1 = y2;
- }
- else if (t > 0) {
- x1 += dx * t;
- y1 += dy * t;
- }
- }
- return math_squaredDistance(x, y, x1, y1);
- }
- /**
- * Returns the square of the distance between the points (x1, y1) and (x2, y2).
- * @param {number} x1 X1.
- * @param {number} y1 Y1.
- * @param {number} x2 X2.
- * @param {number} y2 Y2.
- * @return {number} Squared distance.
- */
- function math_squaredDistance(x1, y1, x2, y2) {
- var dx = x2 - x1;
- var dy = y2 - y1;
- return dx * dx + dy * dy;
- }
- /**
- * Solves system of linear equations using Gaussian elimination method.
- *
- * @param {Array<Array<number>>} mat Augmented matrix (n x n + 1 column)
- * in row-major order.
- * @return {Array<number>} The resulting vector.
- */
- function solveLinearSystem(mat) {
- var n = mat.length;
- for (var i = 0; i < n; i++) {
- // Find max in the i-th column (ignoring i - 1 first rows)
- var maxRow = i;
- var maxEl = Math.abs(mat[i][i]);
- for (var r = i + 1; r < n; r++) {
- var absValue = Math.abs(mat[r][i]);
- if (absValue > maxEl) {
- maxEl = absValue;
- maxRow = r;
- }
- }
- if (maxEl === 0) {
- return null; // matrix is singular
- }
- // Swap max row with i-th (current) row
- var tmp = mat[maxRow];
- mat[maxRow] = mat[i];
- mat[i] = tmp;
- // Subtract the i-th row to make all the remaining rows 0 in the i-th column
- for (var j = i + 1; j < n; j++) {
- var coef = -mat[j][i] / mat[i][i];
- for (var k = i; k < n + 1; k++) {
- if (i == k) {
- mat[j][k] = 0;
- }
- else {
- mat[j][k] += coef * mat[i][k];
- }
- }
- }
- }
- // Solve Ax=b for upper triangular matrix A (mat)
- var x = new Array(n);
- for (var l = n - 1; l >= 0; l--) {
- x[l] = mat[l][n] / mat[l][l];
- for (var m = l - 1; m >= 0; m--) {
- mat[m][n] -= mat[m][l] * x[l];
- }
- }
- return x;
- }
- /**
- * Converts radians to to degrees.
- *
- * @param {number} angleInRadians Angle in radians.
- * @return {number} Angle in degrees.
- */
- function math_toDegrees(angleInRadians) {
- return (angleInRadians * 180) / Math.PI;
- }
- /**
- * Converts degrees to radians.
- *
- * @param {number} angleInDegrees Angle in degrees.
- * @return {number} Angle in radians.
- */
- function math_toRadians(angleInDegrees) {
- return (angleInDegrees * Math.PI) / 180;
- }
- /**
- * Returns the modulo of a / b, depending on the sign of b.
- *
- * @param {number} a Dividend.
- * @param {number} b Divisor.
- * @return {number} Modulo.
- */
- function math_modulo(a, b) {
- var r = a % b;
- return r * b < 0 ? r + b : r;
- }
- /**
- * Calculates the linearly interpolated value of x between a and b.
- *
- * @param {number} a Number
- * @param {number} b Number
- * @param {number} x Value to be interpolated.
- * @return {number} Interpolated value.
- */
- function lerp(a, b, x) {
- return a + x * (b - a);
- }
- /**
- * Returns a number with a limited number of decimal digits.
- * @param {number} n The input number.
- * @param {number} decimals The maximum number of decimal digits.
- * @return {number} The input number with a limited number of decimal digits.
- */
- function toFixed(n, decimals) {
- var factor = Math.pow(10, decimals);
- return Math.round(n * factor) / factor;
- }
- /**
- * Rounds a number to the nearest integer value considering only the given number
- * of decimal digits (with rounding on the final digit).
- * @param {number} n The input number.
- * @param {number} decimals The maximum number of decimal digits.
- * @return {number} The nearest integer.
- */
- function round(n, decimals) {
- return Math.round(toFixed(n, decimals));
- }
- /**
- * Rounds a number to the next smaller integer considering only the given number
- * of decimal digits (with rounding on the final digit).
- * @param {number} n The input number.
- * @param {number} decimals The maximum number of decimal digits.
- * @return {number} The next smaller integer.
- */
- function floor(n, decimals) {
- return Math.floor(toFixed(n, decimals));
- }
- /**
- * Rounds a number to the next bigger integer considering only the given number
- * of decimal digits (with rounding on the final digit).
- * @param {number} n The input number.
- * @param {number} decimals The maximum number of decimal digits.
- * @return {number} The next bigger integer.
- */
- function ceil(n, decimals) {
- return Math.ceil(toFixed(n, decimals));
- }
- //# sourceMappingURL=math.js.map
- ;// ./node_modules/ol/layer/Base.js
- var Base_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/layer/Base
- */
- /**
- * A css color, or a function called with a view resolution returning a css color.
- *
- * @typedef {string|function(number):string} BackgroundColor
- * @api
- */
- /**
- * @typedef {import("../ObjectEventType").Types|'change:extent'|'change:maxResolution'|'change:maxZoom'|
- * 'change:minResolution'|'change:minZoom'|'change:opacity'|'change:visible'|'change:zIndex'} BaseLayerObjectEventTypes
- */
- /***
- * @template Return
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
- * import("../Observable").OnSignature<BaseLayerObjectEventTypes, import("../Object").ObjectEvent, Return> &
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|BaseLayerObjectEventTypes, Return>} BaseLayerOnSignature
- */
- /**
- * @typedef {Object} Options
- * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
- * @property {number} [opacity=1] Opacity (0, 1).
- * @property {boolean} [visible=true] Visibility.
- * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
- * rendered outside of this extent.
- * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
- * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
- * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
- * method was used.
- * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
- * visible.
- * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
- * be visible.
- * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
- * visible.
- * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
- * be visible.
- * @property {BackgroundColor} [background] Background color for the layer. If not specified, no background
- * will be rendered.
- * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
- */
- /**
- * @classdesc
- * Abstract base class; normally only used for creating subclasses and not
- * instantiated in apps.
- * Note that with {@link module:ol/layer/Base~BaseLayer} and all its subclasses, any property set in
- * the options is set as a {@link module:ol/Object~BaseObject} property on the layer object, so
- * is observable, and has get/set accessors.
- *
- * @api
- */
- var BaseLayer = /** @class */ (function (_super) {
- Base_extends(BaseLayer, _super);
- /**
- * @param {Options} options Layer options.
- */
- function BaseLayer(options) {
- var _this = _super.call(this) || this;
- /***
- * @type {BaseLayerOnSignature<import("../events").EventsKey>}
- */
- _this.on;
- /***
- * @type {BaseLayerOnSignature<import("../events").EventsKey>}
- */
- _this.once;
- /***
- * @type {BaseLayerOnSignature<void>}
- */
- _this.un;
- /**
- * @type {BackgroundColor|false}
- * @private
- */
- _this.background_ = options.background;
- /**
- * @type {Object<string, *>}
- */
- var properties = obj_assign({}, options);
- if (typeof options.properties === 'object') {
- delete properties.properties;
- obj_assign(properties, options.properties);
- }
- properties[Property.OPACITY] =
- options.opacity !== undefined ? options.opacity : 1;
- asserts_assert(typeof properties[Property.OPACITY] === 'number', 64); // Layer opacity must be a number
- properties[Property.VISIBLE] =
- options.visible !== undefined ? options.visible : true;
- properties[Property.Z_INDEX] = options.zIndex;
- properties[Property.MAX_RESOLUTION] =
- options.maxResolution !== undefined ? options.maxResolution : Infinity;
- properties[Property.MIN_RESOLUTION] =
- options.minResolution !== undefined ? options.minResolution : 0;
- properties[Property.MIN_ZOOM] =
- options.minZoom !== undefined ? options.minZoom : -Infinity;
- properties[Property.MAX_ZOOM] =
- options.maxZoom !== undefined ? options.maxZoom : Infinity;
- /**
- * @type {string}
- * @private
- */
- _this.className_ =
- properties.className !== undefined ? properties.className : 'ol-layer';
- delete properties.className;
- _this.setProperties(properties);
- /**
- * @type {import("./Layer.js").State}
- * @private
- */
- _this.state_ = null;
- return _this;
- }
- /**
- * Get the background for this layer.
- * @return {BackgroundColor|false} Layer background.
- */
- BaseLayer.prototype.getBackground = function () {
- return this.background_;
- };
- /**
- * @return {string} CSS class name.
- */
- BaseLayer.prototype.getClassName = function () {
- return this.className_;
- };
- /**
- * This method is not meant to be called by layers or layer renderers because the state
- * is incorrect if the layer is included in a layer group.
- *
- * @param {boolean} [opt_managed] Layer is managed.
- * @return {import("./Layer.js").State} Layer state.
- */
- BaseLayer.prototype.getLayerState = function (opt_managed) {
- /** @type {import("./Layer.js").State} */
- var state = this.state_ ||
- /** @type {?} */ ({
- layer: this,
- managed: opt_managed === undefined ? true : opt_managed,
- });
- var zIndex = this.getZIndex();
- state.opacity = math_clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);
- state.visible = this.getVisible();
- state.extent = this.getExtent();
- state.zIndex = zIndex === undefined && !state.managed ? Infinity : zIndex;
- state.maxResolution = this.getMaxResolution();
- state.minResolution = Math.max(this.getMinResolution(), 0);
- state.minZoom = this.getMinZoom();
- state.maxZoom = this.getMaxZoom();
- this.state_ = state;
- return state;
- };
- /**
- * @abstract
- * @param {Array<import("./Layer.js").default>} [opt_array] Array of layers (to be
- * modified in place).
- * @return {Array<import("./Layer.js").default>} Array of layers.
- */
- BaseLayer.prototype.getLayersArray = function (opt_array) {
- return util_abstract();
- };
- /**
- * @abstract
- * @param {Array<import("./Layer.js").State>} [opt_states] Optional list of layer
- * states (to be modified in place).
- * @return {Array<import("./Layer.js").State>} List of layer states.
- */
- BaseLayer.prototype.getLayerStatesArray = function (opt_states) {
- return util_abstract();
- };
- /**
- * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it
- * will be visible regardless of extent.
- * @return {import("../extent.js").Extent|undefined} The layer extent.
- * @observable
- * @api
- */
- BaseLayer.prototype.getExtent = function () {
- return /** @type {import("../extent.js").Extent|undefined} */ (this.get(Property.EXTENT));
- };
- /**
- * Return the maximum resolution of the layer.
- * @return {number} The maximum resolution of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.getMaxResolution = function () {
- return /** @type {number} */ (this.get(Property.MAX_RESOLUTION));
- };
- /**
- * Return the minimum resolution of the layer.
- * @return {number} The minimum resolution of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.getMinResolution = function () {
- return /** @type {number} */ (this.get(Property.MIN_RESOLUTION));
- };
- /**
- * Return the minimum zoom level of the layer.
- * @return {number} The minimum zoom level of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.getMinZoom = function () {
- return /** @type {number} */ (this.get(Property.MIN_ZOOM));
- };
- /**
- * Return the maximum zoom level of the layer.
- * @return {number} The maximum zoom level of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.getMaxZoom = function () {
- return /** @type {number} */ (this.get(Property.MAX_ZOOM));
- };
- /**
- * Return the opacity of the layer (between 0 and 1).
- * @return {number} The opacity of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.getOpacity = function () {
- return /** @type {number} */ (this.get(Property.OPACITY));
- };
- /**
- * @abstract
- * @return {import("../source/Source.js").State} Source state.
- */
- BaseLayer.prototype.getSourceState = function () {
- return util_abstract();
- };
- /**
- * Return the visibility of the layer (`true` or `false`).
- * @return {boolean} The visibility of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.getVisible = function () {
- return /** @type {boolean} */ (this.get(Property.VISIBLE));
- };
- /**
- * Return the Z-index of the layer, which is used to order layers before
- * rendering. The default Z-index is 0.
- * @return {number} The Z-index of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.getZIndex = function () {
- return /** @type {number} */ (this.get(Property.Z_INDEX));
- };
- /**
- * Sets the background color.
- * @param {BackgroundColor} [opt_background] Background color.
- */
- BaseLayer.prototype.setBackground = function (opt_background) {
- this.background_ = opt_background;
- this.changed();
- };
- /**
- * Set the extent at which the layer is visible. If `undefined`, the layer
- * will be visible at all extents.
- * @param {import("../extent.js").Extent|undefined} extent The extent of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.setExtent = function (extent) {
- this.set(Property.EXTENT, extent);
- };
- /**
- * Set the maximum resolution at which the layer is visible.
- * @param {number} maxResolution The maximum resolution of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.setMaxResolution = function (maxResolution) {
- this.set(Property.MAX_RESOLUTION, maxResolution);
- };
- /**
- * Set the minimum resolution at which the layer is visible.
- * @param {number} minResolution The minimum resolution of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.setMinResolution = function (minResolution) {
- this.set(Property.MIN_RESOLUTION, minResolution);
- };
- /**
- * Set the maximum zoom (exclusive) at which the layer is visible.
- * Note that the zoom levels for layer visibility are based on the
- * view zoom level, which may be different from a tile source zoom level.
- * @param {number} maxZoom The maximum zoom of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.setMaxZoom = function (maxZoom) {
- this.set(Property.MAX_ZOOM, maxZoom);
- };
- /**
- * Set the minimum zoom (inclusive) at which the layer is visible.
- * Note that the zoom levels for layer visibility are based on the
- * view zoom level, which may be different from a tile source zoom level.
- * @param {number} minZoom The minimum zoom of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.setMinZoom = function (minZoom) {
- this.set(Property.MIN_ZOOM, minZoom);
- };
- /**
- * Set the opacity of the layer, allowed values range from 0 to 1.
- * @param {number} opacity The opacity of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.setOpacity = function (opacity) {
- asserts_assert(typeof opacity === 'number', 64); // Layer opacity must be a number
- this.set(Property.OPACITY, opacity);
- };
- /**
- * Set the visibility of the layer (`true` or `false`).
- * @param {boolean} visible The visibility of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.setVisible = function (visible) {
- this.set(Property.VISIBLE, visible);
- };
- /**
- * Set Z-index of the layer, which is used to order layers before rendering.
- * The default Z-index is 0.
- * @param {number} zindex The z-index of the layer.
- * @observable
- * @api
- */
- BaseLayer.prototype.setZIndex = function (zindex) {
- this.set(Property.Z_INDEX, zindex);
- };
- /**
- * Clean up.
- */
- BaseLayer.prototype.disposeInternal = function () {
- if (this.state_) {
- this.state_.layer = null;
- this.state_ = null;
- }
- _super.prototype.disposeInternal.call(this);
- };
- return BaseLayer;
- }(ol_Object));
- /* harmony default export */ var Base = (BaseLayer);
- //# sourceMappingURL=Base.js.map
- ;// ./node_modules/ol/render/EventType.js
- /**
- * @module ol/render/EventType
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var render_EventType = ({
- /**
- * Triggered before a layer is rendered.
- * @event module:ol/render/Event~RenderEvent#prerender
- * @api
- */
- PRERENDER: 'prerender',
- /**
- * Triggered after a layer is rendered.
- * @event module:ol/render/Event~RenderEvent#postrender
- * @api
- */
- POSTRENDER: 'postrender',
- /**
- * Triggered before layers are composed. When dispatched by the map, the event object will not have
- * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only
- * WebGL layers currently dispatch this event.
- * @event module:ol/render/Event~RenderEvent#precompose
- * @api
- */
- PRECOMPOSE: 'precompose',
- /**
- * Triggered after layers are composed. When dispatched by the map, the event object will not have
- * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only
- * WebGL layers currently dispatch this event.
- * @event module:ol/render/Event~RenderEvent#postcompose
- * @api
- */
- POSTCOMPOSE: 'postcompose',
- /**
- * Triggered when rendering is complete, i.e. all sources and tiles have
- * finished loading for the current viewport, and all tiles are faded in.
- * The event object will not have a `context` set.
- * @event module:ol/render/Event~RenderEvent#rendercomplete
- * @api
- */
- RENDERCOMPLETE: 'rendercomplete',
- });
- /**
- * @typedef {'postrender'|'precompose'|'postcompose'|'rendercomplete'} MapRenderEventTypes
- */
- /**
- * @typedef {'postrender'|'prerender'} LayerRenderEventTypes
- */
- //# sourceMappingURL=EventType.js.map
- ;// ./node_modules/ol/layer/Layer.js
- var Layer_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/layer/Layer
- */
- /**
- * @typedef {function(import("../PluggableMap.js").FrameState):HTMLElement} RenderFunction
- */
- /***
- * @template Return
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
- * import("../Observable").OnSignature<import("./Base").BaseLayerObjectEventTypes|
- * 'change:source', import("../Object").ObjectEvent, Return> &
- * import("../Observable").OnSignature<import("../render/EventType").LayerRenderEventTypes, import("../render/Event").default, Return> &
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("./Base").BaseLayerObjectEventTypes|'change:source'|
- * import("../render/EventType").LayerRenderEventTypes, Return>} LayerOnSignature
- */
- /**
- * @template {import("../source/Source.js").default} [SourceType=import("../source/Source.js").default]
- * @typedef {Object} Options
- * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
- * @property {number} [opacity=1] Opacity (0, 1).
- * @property {boolean} [visible=true] Visibility.
- * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
- * rendered outside of this extent.
- * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
- * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
- * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
- * method was used.
- * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
- * visible.
- * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
- * be visible.
- * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
- * visible.
- * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
- * be visible.
- * @property {SourceType} [source] Source for this layer. If not provided to the constructor,
- * the source can be set by calling {@link module:ol/layer/Layer~Layer#setSource layer.setSource(source)} after
- * construction.
- * @property {import("../PluggableMap.js").default|null} [map] Map.
- * @property {RenderFunction} [render] Render function. Takes the frame state as input and is expected to return an
- * HTML element. Will overwrite the default rendering for the layer.
- * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
- */
- /**
- * @typedef {Object} State
- * @property {import("./Layer.js").default} layer Layer.
- * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.
- * @property {boolean} visible Visible.
- * @property {boolean} managed Managed.
- * @property {import("../extent.js").Extent} [extent] Extent.
- * @property {number} zIndex ZIndex.
- * @property {number} maxResolution Maximum resolution.
- * @property {number} minResolution Minimum resolution.
- * @property {number} minZoom Minimum zoom.
- * @property {number} maxZoom Maximum zoom.
- */
- /**
- * @classdesc
- * Base class from which all layer types are derived. This should only be instantiated
- * in the case where a custom layer is added to the map with a custom `render` function.
- * Such a function can be specified in the `options` object, and is expected to return an HTML element.
- *
- * A visual representation of raster or vector map data.
- * Layers group together those properties that pertain to how the data is to be
- * displayed, irrespective of the source of that data.
- *
- * Layers are usually added to a map with {@link import("../PluggableMap.js").default#addLayer map.addLayer()}. Components
- * like {@link module:ol/interaction/Draw~Draw} use unmanaged layers
- * internally. These unmanaged layers are associated with the map using
- * {@link module:ol/layer/Layer~Layer#setMap} instead.
- *
- * A generic `change` event is fired when the state of the source changes.
- *
- * Please note that for performance reasons several layers might get rendered to
- * the same HTML element, which will cause {@link import("../PluggableMap.js").default#forEachLayerAtPixel map.forEachLayerAtPixel()} to
- * give false positives. To avoid this, apply different `className` properties to the
- * layers at creation time.
- *
- * @fires import("../render/Event.js").RenderEvent#prerender
- * @fires import("../render/Event.js").RenderEvent#postrender
- *
- * @template {import("../source/Source.js").default} [SourceType=import("../source/Source.js").default]
- * @template {import("../renderer/Layer.js").default} [RendererType=import("../renderer/Layer.js").default]
- * @api
- */
- var Layer = /** @class */ (function (_super) {
- Layer_extends(Layer, _super);
- /**
- * @param {Options<SourceType>} options Layer options.
- */
- function Layer(options) {
- var _this = this;
- var baseOptions = obj_assign({}, options);
- delete baseOptions.source;
- _this = _super.call(this, baseOptions) || this;
- /***
- * @type {LayerOnSignature<import("../events").EventsKey>}
- */
- _this.on;
- /***
- * @type {LayerOnSignature<import("../events").EventsKey>}
- */
- _this.once;
- /***
- * @type {LayerOnSignature<void>}
- */
- _this.un;
- /**
- * @private
- * @type {?import("../events.js").EventsKey}
- */
- _this.mapPrecomposeKey_ = null;
- /**
- * @private
- * @type {?import("../events.js").EventsKey}
- */
- _this.mapRenderKey_ = null;
- /**
- * @private
- * @type {?import("../events.js").EventsKey}
- */
- _this.sourceChangeKey_ = null;
- /**
- * @private
- * @type {RendererType}
- */
- _this.renderer_ = null;
- /**
- * @protected
- * @type {boolean}
- */
- _this.rendered = false;
- // Overwrite default render method with a custom one
- if (options.render) {
- _this.render = options.render;
- }
- if (options.map) {
- _this.setMap(options.map);
- }
- _this.addChangeListener(Property.SOURCE, _this.handleSourcePropertyChange_);
- var source = options.source
- ? /** @type {SourceType} */ (options.source)
- : null;
- _this.setSource(source);
- return _this;
- }
- /**
- * @param {Array<import("./Layer.js").default>} [opt_array] Array of layers (to be modified in place).
- * @return {Array<import("./Layer.js").default>} Array of layers.
- */
- Layer.prototype.getLayersArray = function (opt_array) {
- var array = opt_array ? opt_array : [];
- array.push(this);
- return array;
- };
- /**
- * @param {Array<import("./Layer.js").State>} [opt_states] Optional list of layer states (to be modified in place).
- * @return {Array<import("./Layer.js").State>} List of layer states.
- */
- Layer.prototype.getLayerStatesArray = function (opt_states) {
- var states = opt_states ? opt_states : [];
- states.push(this.getLayerState());
- return states;
- };
- /**
- * Get the layer source.
- * @return {SourceType|null} The layer source (or `null` if not yet set).
- * @observable
- * @api
- */
- Layer.prototype.getSource = function () {
- return /** @type {SourceType} */ (this.get(Property.SOURCE)) || null;
- };
- /**
- * @return {SourceType|null} The source being rendered.
- */
- Layer.prototype.getRenderSource = function () {
- return this.getSource();
- };
- /**
- * @return {import("../source/Source.js").State} Source state.
- */
- Layer.prototype.getSourceState = function () {
- var source = this.getSource();
- return !source ? 'undefined' : source.getState();
- };
- /**
- * @private
- */
- Layer.prototype.handleSourceChange_ = function () {
- this.changed();
- };
- /**
- * @private
- */
- Layer.prototype.handleSourcePropertyChange_ = function () {
- if (this.sourceChangeKey_) {
- unlistenByKey(this.sourceChangeKey_);
- this.sourceChangeKey_ = null;
- }
- var source = this.getSource();
- if (source) {
- this.sourceChangeKey_ = listen(source, EventType.CHANGE, this.handleSourceChange_, this);
- }
- this.changed();
- };
- /**
- * @param {import("../pixel").Pixel} pixel Pixel.
- * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with
- * an array of features.
- */
- Layer.prototype.getFeatures = function (pixel) {
- if (!this.renderer_) {
- return new Promise(function (resolve) { return resolve([]); });
- }
- return this.renderer_.getFeatures(pixel);
- };
- /**
- * @param {import("../pixel").Pixel} pixel Pixel.
- * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
- */
- Layer.prototype.getData = function (pixel) {
- if (!this.renderer_ || !this.rendered) {
- return null;
- }
- return this.renderer_.getData(pixel);
- };
- /**
- * In charge to manage the rendering of the layer. One layer type is
- * bounded with one layer renderer.
- * @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
- * @param {HTMLElement} target Target which the renderer may (but need not) use
- * for rendering its content.
- * @return {HTMLElement} The rendered element.
- */
- Layer.prototype.render = function (frameState, target) {
- var layerRenderer = this.getRenderer();
- if (layerRenderer.prepareFrame(frameState)) {
- this.rendered = true;
- return layerRenderer.renderFrame(frameState, target);
- }
- };
- /**
- * Called when a layer is not visible during a map render.
- */
- Layer.prototype.unrender = function () {
- this.rendered = false;
- };
- /**
- * For use inside the library only.
- * @param {import("../PluggableMap.js").default|null} map Map.
- */
- Layer.prototype.setMapInternal = function (map) {
- if (!map) {
- this.unrender();
- }
- this.set(Property.MAP, map);
- };
- /**
- * For use inside the library only.
- * @return {import("../PluggableMap.js").default|null} Map.
- */
- Layer.prototype.getMapInternal = function () {
- return this.get(Property.MAP);
- };
- /**
- * Sets the layer to be rendered on top of other layers on a map. The map will
- * not manage this layer in its layers collection, and the callback in
- * {@link module:ol/Map~Map#forEachLayerAtPixel} will receive `null` as layer. This
- * is useful for temporary layers. To remove an unmanaged layer from the map,
- * use `#setMap(null)`.
- *
- * To add the layer to a map and have it managed by the map, use
- * {@link module:ol/Map~Map#addLayer} instead.
- * @param {import("../PluggableMap.js").default|null} map Map.
- * @api
- */
- Layer.prototype.setMap = function (map) {
- if (this.mapPrecomposeKey_) {
- unlistenByKey(this.mapPrecomposeKey_);
- this.mapPrecomposeKey_ = null;
- }
- if (!map) {
- this.changed();
- }
- if (this.mapRenderKey_) {
- unlistenByKey(this.mapRenderKey_);
- this.mapRenderKey_ = null;
- }
- if (map) {
- this.mapPrecomposeKey_ = listen(map, render_EventType.PRECOMPOSE, function (evt) {
- var renderEvent =
- /** @type {import("../render/Event.js").default} */ (evt);
- var layerStatesArray = renderEvent.frameState.layerStatesArray;
- var layerState = this.getLayerState(false);
- // A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both.
- asserts_assert(!layerStatesArray.some(function (arrayLayerState) {
- return arrayLayerState.layer === layerState.layer;
- }), 67);
- layerStatesArray.push(layerState);
- }, this);
- this.mapRenderKey_ = listen(this, EventType.CHANGE, map.render, map);
- this.changed();
- }
- };
- /**
- * Set the layer source.
- * @param {SourceType|null} source The layer source.
- * @observable
- * @api
- */
- Layer.prototype.setSource = function (source) {
- this.set(Property.SOURCE, source);
- };
- /**
- * Get the renderer for this layer.
- * @return {RendererType|null} The layer renderer.
- */
- Layer.prototype.getRenderer = function () {
- if (!this.renderer_) {
- this.renderer_ = this.createRenderer();
- }
- return this.renderer_;
- };
- /**
- * @return {boolean} The layer has a renderer.
- */
- Layer.prototype.hasRenderer = function () {
- return !!this.renderer_;
- };
- /**
- * Create a renderer for this layer.
- * @return {RendererType} A layer renderer.
- * @protected
- */
- Layer.prototype.createRenderer = function () {
- return null;
- };
- /**
- * Clean up.
- */
- Layer.prototype.disposeInternal = function () {
- if (this.renderer_) {
- this.renderer_.dispose();
- delete this.renderer_;
- }
- this.setSource(null);
- _super.prototype.disposeInternal.call(this);
- };
- return Layer;
- }(Base));
- /**
- * Return `true` if the layer is visible and if the provided view state
- * has resolution and zoom levels that are in range of the layer's min/max.
- * @param {State} layerState Layer state.
- * @param {import("../View.js").State} viewState View state.
- * @return {boolean} The layer is visible at the given view state.
- */
- function inView(layerState, viewState) {
- if (!layerState.visible) {
- return false;
- }
- var resolution = viewState.resolution;
- if (resolution < layerState.minResolution ||
- resolution >= layerState.maxResolution) {
- return false;
- }
- var zoom = viewState.zoom;
- return zoom > layerState.minZoom && zoom <= layerState.maxZoom;
- }
- /* harmony default export */ var layer_Layer = (Layer);
- //# sourceMappingURL=Layer.js.map
- ;// ./node_modules/ol/control/Attribution.js
- var Attribution_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/control/Attribution
- */
- /**
- * @typedef {Object} Options
- * @property {string} [className='ol-attribution'] CSS class name.
- * @property {HTMLElement|string} [target] Specify a target if you
- * want the control to be rendered outside of the map's
- * viewport.
- * @property {boolean} [collapsible] Specify if attributions can
- * be collapsed. If not specified, sources control this behavior with their
- * `attributionsCollapsible` setting.
- * @property {boolean} [collapsed=true] Specify if attributions should
- * be collapsed at startup.
- * @property {string} [tipLabel='Attributions'] Text label to use for the button tip.
- * @property {string|HTMLElement} [label='i'] Text label to use for the
- * collapsed attributions button.
- * Instead of text, also an element (e.g. a `span` element) can be used.
- * @property {string} [expandClassName=className + '-expand'] CSS class name for the
- * collapsed attributions button.
- * @property {string|HTMLElement} [collapseLabel='›'] Text label to use
- * for the expanded attributions button.
- * Instead of text, also an element (e.g. a `span` element) can be used.
- * @property {string} [collapseClassName=className + '-collapse'] CSS class name for the
- * expanded attributions button.
- * @property {function(import("../MapEvent.js").default):void} [render] Function called when
- * the control should be re-rendered. This is called in a `requestAnimationFrame`
- * callback.
- */
- /**
- * @classdesc
- * Control to show all the attributions associated with the layer sources
- * in the map. This control is one of the default controls included in maps.
- * By default it will show in the bottom right portion of the map, but this can
- * be changed by using a css selector for `.ol-attribution`.
- *
- * @api
- */
- var Attribution = /** @class */ (function (_super) {
- Attribution_extends(Attribution, _super);
- /**
- * @param {Options} [opt_options] Attribution options.
- */
- function Attribution(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- _this = _super.call(this, {
- element: document.createElement('div'),
- render: options.render,
- target: options.target,
- }) || this;
- /**
- * @private
- * @type {HTMLElement}
- */
- _this.ulElement_ = document.createElement('ul');
- /**
- * @private
- * @type {boolean}
- */
- _this.collapsed_ =
- options.collapsed !== undefined ? options.collapsed : true;
- /**
- * @private
- * @type {boolean}
- */
- _this.userCollapsed_ = _this.collapsed_;
- /**
- * @private
- * @type {boolean}
- */
- _this.overrideCollapsible_ = options.collapsible !== undefined;
- /**
- * @private
- * @type {boolean}
- */
- _this.collapsible_ =
- options.collapsible !== undefined ? options.collapsible : true;
- if (!_this.collapsible_) {
- _this.collapsed_ = false;
- }
- var className = options.className !== undefined ? options.className : 'ol-attribution';
- var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Attributions';
- var expandClassName = options.expandClassName !== undefined
- ? options.expandClassName
- : className + '-expand';
- var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u203A';
- var collapseClassName = options.collapseClassName !== undefined
- ? options.collapseClassName
- : className + '-collapse';
- if (typeof collapseLabel === 'string') {
- /**
- * @private
- * @type {HTMLElement}
- */
- _this.collapseLabel_ = document.createElement('span');
- _this.collapseLabel_.textContent = collapseLabel;
- _this.collapseLabel_.className = collapseClassName;
- }
- else {
- _this.collapseLabel_ = collapseLabel;
- }
- var label = options.label !== undefined ? options.label : 'i';
- if (typeof label === 'string') {
- /**
- * @private
- * @type {HTMLElement}
- */
- _this.label_ = document.createElement('span');
- _this.label_.textContent = label;
- _this.label_.className = expandClassName;
- }
- else {
- _this.label_ = label;
- }
- var activeLabel = _this.collapsible_ && !_this.collapsed_ ? _this.collapseLabel_ : _this.label_;
- /**
- * @private
- * @type {HTMLElement}
- */
- _this.toggleButton_ = document.createElement('button');
- _this.toggleButton_.setAttribute('type', 'button');
- _this.toggleButton_.setAttribute('aria-expanded', String(!_this.collapsed_));
- _this.toggleButton_.title = tipLabel;
- _this.toggleButton_.appendChild(activeLabel);
- _this.toggleButton_.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false);
- var cssClasses = className +
- ' ' +
- CLASS_UNSELECTABLE +
- ' ' +
- CLASS_CONTROL +
- (_this.collapsed_ && _this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +
- (_this.collapsible_ ? '' : ' ol-uncollapsible');
- var element = _this.element;
- element.className = cssClasses;
- element.appendChild(_this.toggleButton_);
- element.appendChild(_this.ulElement_);
- /**
- * A list of currently rendered resolutions.
- * @type {Array<string>}
- * @private
- */
- _this.renderedAttributions_ = [];
- /**
- * @private
- * @type {boolean}
- */
- _this.renderedVisible_ = true;
- return _this;
- }
- /**
- * Collect a list of visible attributions and set the collapsible state.
- * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
- * @return {Array<string>} Attributions.
- * @private
- */
- Attribution.prototype.collectSourceAttributions_ = function (frameState) {
- /**
- * Used to determine if an attribution already exists.
- * @type {!Object<string, boolean>}
- */
- var lookup = {};
- /**
- * A list of visible attributions.
- * @type {Array<string>}
- */
- var visibleAttributions = [];
- var collapsible = true;
- var layerStatesArray = frameState.layerStatesArray;
- for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
- var layerState = layerStatesArray[i];
- if (!inView(layerState, frameState.viewState)) {
- continue;
- }
- var source = /** @type {import("../layer/Layer.js").default} */ (layerState.layer).getSource();
- if (!source) {
- continue;
- }
- var attributionGetter = source.getAttributions();
- if (!attributionGetter) {
- continue;
- }
- var attributions = attributionGetter(frameState);
- if (!attributions) {
- continue;
- }
- collapsible =
- collapsible && source.getAttributionsCollapsible() !== false;
- if (Array.isArray(attributions)) {
- for (var j = 0, jj = attributions.length; j < jj; ++j) {
- if (!(attributions[j] in lookup)) {
- visibleAttributions.push(attributions[j]);
- lookup[attributions[j]] = true;
- }
- }
- }
- else {
- if (!(attributions in lookup)) {
- visibleAttributions.push(attributions);
- lookup[attributions] = true;
- }
- }
- }
- if (!this.overrideCollapsible_) {
- this.setCollapsible(collapsible);
- }
- return visibleAttributions;
- };
- /**
- * @private
- * @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
- */
- Attribution.prototype.updateElement_ = function (frameState) {
- if (!frameState) {
- if (this.renderedVisible_) {
- this.element.style.display = 'none';
- this.renderedVisible_ = false;
- }
- return;
- }
- var attributions = this.collectSourceAttributions_(frameState);
- var visible = attributions.length > 0;
- if (this.renderedVisible_ != visible) {
- this.element.style.display = visible ? '' : 'none';
- this.renderedVisible_ = visible;
- }
- if (equals(attributions, this.renderedAttributions_)) {
- return;
- }
- removeChildren(this.ulElement_);
- // append the attributions
- for (var i = 0, ii = attributions.length; i < ii; ++i) {
- var element = document.createElement('li');
- element.innerHTML = attributions[i];
- this.ulElement_.appendChild(element);
- }
- this.renderedAttributions_ = attributions;
- };
- /**
- * @param {MouseEvent} event The event to handle
- * @private
- */
- Attribution.prototype.handleClick_ = function (event) {
- event.preventDefault();
- this.handleToggle_();
- this.userCollapsed_ = this.collapsed_;
- };
- /**
- * @private
- */
- Attribution.prototype.handleToggle_ = function () {
- this.element.classList.toggle(CLASS_COLLAPSED);
- if (this.collapsed_) {
- replaceNode(this.collapseLabel_, this.label_);
- }
- else {
- replaceNode(this.label_, this.collapseLabel_);
- }
- this.collapsed_ = !this.collapsed_;
- this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));
- };
- /**
- * Return `true` if the attribution is collapsible, `false` otherwise.
- * @return {boolean} True if the widget is collapsible.
- * @api
- */
- Attribution.prototype.getCollapsible = function () {
- return this.collapsible_;
- };
- /**
- * Set whether the attribution should be collapsible.
- * @param {boolean} collapsible True if the widget is collapsible.
- * @api
- */
- Attribution.prototype.setCollapsible = function (collapsible) {
- if (this.collapsible_ === collapsible) {
- return;
- }
- this.collapsible_ = collapsible;
- this.element.classList.toggle('ol-uncollapsible');
- if (this.userCollapsed_) {
- this.handleToggle_();
- }
- };
- /**
- * Collapse or expand the attribution according to the passed parameter. Will
- * not do anything if the attribution isn't collapsible or if the current
- * collapsed state is already the one requested.
- * @param {boolean} collapsed True if the widget is collapsed.
- * @api
- */
- Attribution.prototype.setCollapsed = function (collapsed) {
- this.userCollapsed_ = collapsed;
- if (!this.collapsible_ || this.collapsed_ === collapsed) {
- return;
- }
- this.handleToggle_();
- };
- /**
- * Return `true` when the attribution is currently collapsed or `false`
- * otherwise.
- * @return {boolean} True if the widget is collapsed.
- * @api
- */
- Attribution.prototype.getCollapsed = function () {
- return this.collapsed_;
- };
- /**
- * Update the attribution element.
- * @param {import("../MapEvent.js").default} mapEvent Map event.
- * @override
- */
- Attribution.prototype.render = function (mapEvent) {
- this.updateElement_(mapEvent.frameState);
- };
- return Attribution;
- }(control_Control));
- /* harmony default export */ var control_Attribution = (Attribution);
- //# sourceMappingURL=Attribution.js.map
- ;// ./node_modules/ol/pointer/EventType.js
- /**
- * @module ol/pointer/EventType
- */
- /**
- * Constants for event names.
- * @enum {string}
- */
- /* harmony default export */ var pointer_EventType = ({
- POINTERMOVE: 'pointermove',
- POINTERDOWN: 'pointerdown',
- POINTERUP: 'pointerup',
- POINTEROVER: 'pointerover',
- POINTEROUT: 'pointerout',
- POINTERENTER: 'pointerenter',
- POINTERLEAVE: 'pointerleave',
- POINTERCANCEL: 'pointercancel',
- });
- //# sourceMappingURL=EventType.js.map
- ;// ./node_modules/ol/proj/Units.js
- /**
- * @module ol/proj/Units
- */
- /**
- * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or
- * `'us-ft'`.
- * @enum {string}
- */
- var Units = {
- /**
- * Radians
- * @api
- */
- RADIANS: 'radians',
- /**
- * Degrees
- * @api
- */
- DEGREES: 'degrees',
- /**
- * Feet
- * @api
- */
- FEET: 'ft',
- /**
- * Meters
- * @api
- */
- METERS: 'm',
- /**
- * Pixels
- * @api
- */
- PIXELS: 'pixels',
- /**
- * Tile Pixels
- * @api
- */
- TILE_PIXELS: 'tile-pixels',
- /**
- * US Feet
- * @api
- */
- USFEET: 'us-ft',
- };
- /**
- * See http://duff.ess.washington.edu/data/raster/drg/docs/geotiff.txt
- * @type {Object<number, Units>}
- */
- var unitByCode = {
- '9001': Units.METERS,
- '9002': Units.FEET,
- '9003': Units.USFEET,
- '9101': Units.RADIANS,
- '9102': Units.DEGREES,
- };
- /**
- * @param {number} code Unit code.
- * @return {Units} Units.
- */
- function fromCode(code) {
- return unitByCode[code];
- }
- /**
- * Meters per unit lookup table.
- * @const
- * @type {Object<Units, number>}
- * @api
- */
- var Units_METERS_PER_UNIT = {};
- // use the radius of the Normal sphere
- Units_METERS_PER_UNIT[Units.RADIANS] = 6370997 / (2 * Math.PI);
- Units_METERS_PER_UNIT[Units.DEGREES] = (2 * Math.PI * 6370997) / 360;
- Units_METERS_PER_UNIT[Units.FEET] = 0.3048;
- Units_METERS_PER_UNIT[Units.METERS] = 1;
- Units_METERS_PER_UNIT[Units.USFEET] = 1200 / 3937;
- /* harmony default export */ var proj_Units = (Units);
- //# sourceMappingURL=Units.js.map
- ;// ./node_modules/ol/proj/Projection.js
- /**
- * @module ol/proj/Projection
- */
- /**
- * @typedef {Object} Options
- * @property {string} code The SRS identifier code, e.g. `EPSG:4326`.
- * @property {import("./Units.js").default|string} [units] Units. Required unless a
- * proj4 projection is defined for `code`.
- * @property {import("../extent.js").Extent} [extent] The validity extent for the SRS.
- * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4.
- * @property {boolean} [global=false] Whether the projection is valid for the whole globe.
- * @property {number} [metersPerUnit] The meters per unit for the SRS.
- * If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT}
- * lookup table.
- * @property {import("../extent.js").Extent} [worldExtent] The world extent for the SRS.
- * @property {function(number, import("../coordinate.js").Coordinate):number} [getPointResolution]
- * Function to determine resolution at a point. The function is called with a
- * `number` view resolution and a {@link module:ol/coordinate~Coordinate Coordinate} as arguments, and returns
- * the `number` resolution in projection units at the passed coordinate. If this is `undefined`,
- * the default {@link module:ol/proj.getPointResolution getPointResolution()} function will be used.
- */
- /**
- * @classdesc
- * Projection definition class. One of these is created for each projection
- * supported in the application and stored in the {@link module:ol/proj} namespace.
- * You can use these in applications, but this is not required, as API params
- * and options use {@link module:ol/proj~ProjectionLike} which means the simple string
- * code will suffice.
- *
- * You can use {@link module:ol/proj.get} to retrieve the object for a particular
- * projection.
- *
- * The library includes definitions for `EPSG:4326` and `EPSG:3857`, together
- * with the following aliases:
- * * `EPSG:4326`: CRS:84, urn:ogc:def:crs:EPSG:6.6:4326,
- * urn:ogc:def:crs:OGC:1.3:CRS84, urn:ogc:def:crs:OGC:2:84,
- * http://www.opengis.net/gml/srs/epsg.xml#4326,
- * urn:x-ogc:def:crs:EPSG:4326
- * * `EPSG:3857`: EPSG:102100, EPSG:102113, EPSG:900913,
- * urn:ogc:def:crs:EPSG:6.18:3:3857,
- * http://www.opengis.net/gml/srs/epsg.xml#3857
- *
- * If you use [proj4js](https://github.com/proj4js/proj4js), aliases can
- * be added using `proj4.defs()`. After all required projection definitions are
- * added, call the {@link module:ol/proj/proj4.register} function.
- *
- * @api
- */
- var Projection = /** @class */ (function () {
- /**
- * @param {Options} options Projection options.
- */
- function Projection(options) {
- /**
- * @private
- * @type {string}
- */
- this.code_ = options.code;
- /**
- * Units of projected coordinates. When set to `TILE_PIXELS`, a
- * `this.extent_` and `this.worldExtent_` must be configured properly for each
- * tile.
- * @private
- * @type {import("./Units.js").default}
- */
- this.units_ = /** @type {import("./Units.js").default} */ (options.units);
- /**
- * Validity extent of the projection in projected coordinates. For projections
- * with `TILE_PIXELS` units, this is the extent of the tile in
- * tile pixel space.
- * @private
- * @type {import("../extent.js").Extent}
- */
- this.extent_ = options.extent !== undefined ? options.extent : null;
- /**
- * Extent of the world in EPSG:4326. For projections with
- * `TILE_PIXELS` units, this is the extent of the tile in
- * projected coordinate space.
- * @private
- * @type {import("../extent.js").Extent}
- */
- this.worldExtent_ =
- options.worldExtent !== undefined ? options.worldExtent : null;
- /**
- * @private
- * @type {string}
- */
- this.axisOrientation_ =
- options.axisOrientation !== undefined ? options.axisOrientation : 'enu';
- /**
- * @private
- * @type {boolean}
- */
- this.global_ = options.global !== undefined ? options.global : false;
- /**
- * @private
- * @type {boolean}
- */
- this.canWrapX_ = !!(this.global_ && this.extent_);
- /**
- * @private
- * @type {function(number, import("../coordinate.js").Coordinate):number|undefined}
- */
- this.getPointResolutionFunc_ = options.getPointResolution;
- /**
- * @private
- * @type {import("../tilegrid/TileGrid.js").default}
- */
- this.defaultTileGrid_ = null;
- /**
- * @private
- * @type {number|undefined}
- */
- this.metersPerUnit_ = options.metersPerUnit;
- }
- /**
- * @return {boolean} The projection is suitable for wrapping the x-axis
- */
- Projection.prototype.canWrapX = function () {
- return this.canWrapX_;
- };
- /**
- * Get the code for this projection, e.g. 'EPSG:4326'.
- * @return {string} Code.
- * @api
- */
- Projection.prototype.getCode = function () {
- return this.code_;
- };
- /**
- * Get the validity extent for this projection.
- * @return {import("../extent.js").Extent} Extent.
- * @api
- */
- Projection.prototype.getExtent = function () {
- return this.extent_;
- };
- /**
- * Get the units of this projection.
- * @return {import("./Units.js").default} Units.
- * @api
- */
- Projection.prototype.getUnits = function () {
- return this.units_;
- };
- /**
- * Get the amount of meters per unit of this projection. If the projection is
- * not configured with `metersPerUnit` or a units identifier, the return is
- * `undefined`.
- * @return {number|undefined} Meters.
- * @api
- */
- Projection.prototype.getMetersPerUnit = function () {
- return this.metersPerUnit_ || Units_METERS_PER_UNIT[this.units_];
- };
- /**
- * Get the world extent for this projection.
- * @return {import("../extent.js").Extent} Extent.
- * @api
- */
- Projection.prototype.getWorldExtent = function () {
- return this.worldExtent_;
- };
- /**
- * Get the axis orientation of this projection.
- * Example values are:
- * enu - the default easting, northing, elevation.
- * neu - northing, easting, up - useful for "lat/long" geographic coordinates,
- * or south orientated transverse mercator.
- * wnu - westing, northing, up - some planetary coordinate systems have
- * "west positive" coordinate systems
- * @return {string} Axis orientation.
- * @api
- */
- Projection.prototype.getAxisOrientation = function () {
- return this.axisOrientation_;
- };
- /**
- * Is this projection a global projection which spans the whole world?
- * @return {boolean} Whether the projection is global.
- * @api
- */
- Projection.prototype.isGlobal = function () {
- return this.global_;
- };
- /**
- * Set if the projection is a global projection which spans the whole world
- * @param {boolean} global Whether the projection is global.
- * @api
- */
- Projection.prototype.setGlobal = function (global) {
- this.global_ = global;
- this.canWrapX_ = !!(global && this.extent_);
- };
- /**
- * @return {import("../tilegrid/TileGrid.js").default} The default tile grid.
- */
- Projection.prototype.getDefaultTileGrid = function () {
- return this.defaultTileGrid_;
- };
- /**
- * @param {import("../tilegrid/TileGrid.js").default} tileGrid The default tile grid.
- */
- Projection.prototype.setDefaultTileGrid = function (tileGrid) {
- this.defaultTileGrid_ = tileGrid;
- };
- /**
- * Set the validity extent for this projection.
- * @param {import("../extent.js").Extent} extent Extent.
- * @api
- */
- Projection.prototype.setExtent = function (extent) {
- this.extent_ = extent;
- this.canWrapX_ = !!(this.global_ && extent);
- };
- /**
- * Set the world extent for this projection.
- * @param {import("../extent.js").Extent} worldExtent World extent
- * [minlon, minlat, maxlon, maxlat].
- * @api
- */
- Projection.prototype.setWorldExtent = function (worldExtent) {
- this.worldExtent_ = worldExtent;
- };
- /**
- * Set the getPointResolution function (see {@link module:ol/proj.getPointResolution}
- * for this projection.
- * @param {function(number, import("../coordinate.js").Coordinate):number} func Function
- * @api
- */
- Projection.prototype.setGetPointResolution = function (func) {
- this.getPointResolutionFunc_ = func;
- };
- /**
- * Get the custom point resolution function for this projection (if set).
- * @return {function(number, import("../coordinate.js").Coordinate):number|undefined} The custom point
- * resolution function (if set).
- */
- Projection.prototype.getPointResolutionFunc = function () {
- return this.getPointResolutionFunc_;
- };
- return Projection;
- }());
- /* harmony default export */ var proj_Projection = (Projection);
- //# sourceMappingURL=Projection.js.map
- ;// ./node_modules/ol/proj/epsg3857.js
- var epsg3857_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/proj/epsg3857
- */
- /**
- * Radius of WGS84 sphere
- *
- * @const
- * @type {number}
- */
- var RADIUS = 6378137;
- /**
- * @const
- * @type {number}
- */
- var HALF_SIZE = Math.PI * RADIUS;
- /**
- * @const
- * @type {import("../extent.js").Extent}
- */
- var EXTENT = [-HALF_SIZE, -HALF_SIZE, HALF_SIZE, HALF_SIZE];
- /**
- * @const
- * @type {import("../extent.js").Extent}
- */
- var WORLD_EXTENT = [-180, -85, 180, 85];
- /**
- * Maximum safe value in y direction
- * @const
- * @type {number}
- */
- var MAX_SAFE_Y = RADIUS * Math.log(Math.tan(Math.PI / 2));
- /**
- * @classdesc
- * Projection object for web/spherical Mercator (EPSG:3857).
- */
- var EPSG3857Projection = /** @class */ (function (_super) {
- epsg3857_extends(EPSG3857Projection, _super);
- /**
- * @param {string} code Code.
- */
- function EPSG3857Projection(code) {
- return _super.call(this, {
- code: code,
- units: proj_Units.METERS,
- extent: EXTENT,
- global: true,
- worldExtent: WORLD_EXTENT,
- getPointResolution: function (resolution, point) {
- return resolution / cosh(point[1] / RADIUS);
- },
- }) || this;
- }
- return EPSG3857Projection;
- }(proj_Projection));
- /**
- * Projections equal to EPSG:3857.
- *
- * @const
- * @type {Array<import("./Projection.js").default>}
- */
- var PROJECTIONS = [
- new EPSG3857Projection('EPSG:3857'),
- new EPSG3857Projection('EPSG:102100'),
- new EPSG3857Projection('EPSG:102113'),
- new EPSG3857Projection('EPSG:900913'),
- new EPSG3857Projection('http://www.opengis.net/def/crs/EPSG/0/3857'),
- new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857'),
- ];
- /**
- * Transformation from EPSG:4326 to EPSG:3857.
- *
- * @param {Array<number>} input Input array of coordinate values.
- * @param {Array<number>} [opt_output] Output array of coordinate values.
- * @param {number} [opt_dimension] Dimension (default is `2`).
- * @return {Array<number>} Output array of coordinate values.
- */
- function fromEPSG4326(input, opt_output, opt_dimension) {
- var length = input.length;
- var dimension = opt_dimension > 1 ? opt_dimension : 2;
- var output = opt_output;
- if (output === undefined) {
- if (dimension > 2) {
- // preserve values beyond second dimension
- output = input.slice();
- }
- else {
- output = new Array(length);
- }
- }
- for (var i = 0; i < length; i += dimension) {
- output[i] = (HALF_SIZE * input[i]) / 180;
- var y = RADIUS * Math.log(Math.tan((Math.PI * (+input[i + 1] + 90)) / 360));
- if (y > MAX_SAFE_Y) {
- y = MAX_SAFE_Y;
- }
- else if (y < -MAX_SAFE_Y) {
- y = -MAX_SAFE_Y;
- }
- output[i + 1] = y;
- }
- return output;
- }
- /**
- * Transformation from EPSG:3857 to EPSG:4326.
- *
- * @param {Array<number>} input Input array of coordinate values.
- * @param {Array<number>} [opt_output] Output array of coordinate values.
- * @param {number} [opt_dimension] Dimension (default is `2`).
- * @return {Array<number>} Output array of coordinate values.
- */
- function toEPSG4326(input, opt_output, opt_dimension) {
- var length = input.length;
- var dimension = opt_dimension > 1 ? opt_dimension : 2;
- var output = opt_output;
- if (output === undefined) {
- if (dimension > 2) {
- // preserve values beyond second dimension
- output = input.slice();
- }
- else {
- output = new Array(length);
- }
- }
- for (var i = 0; i < length; i += dimension) {
- output[i] = (180 * input[i]) / HALF_SIZE;
- output[i + 1] =
- (360 * Math.atan(Math.exp(input[i + 1] / RADIUS))) / Math.PI - 90;
- }
- return output;
- }
- //# sourceMappingURL=epsg3857.js.map
- ;// ./node_modules/ol/proj/epsg4326.js
- var epsg4326_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/proj/epsg4326
- */
- /**
- * Semi-major radius of the WGS84 ellipsoid.
- *
- * @const
- * @type {number}
- */
- var epsg4326_RADIUS = 6378137;
- /**
- * Extent of the EPSG:4326 projection which is the whole world.
- *
- * @const
- * @type {import("../extent.js").Extent}
- */
- var epsg4326_EXTENT = [-180, -90, 180, 90];
- /**
- * @const
- * @type {number}
- */
- var epsg4326_METERS_PER_UNIT = (Math.PI * epsg4326_RADIUS) / 180;
- /**
- * @classdesc
- * Projection object for WGS84 geographic coordinates (EPSG:4326).
- *
- * Note that OpenLayers does not strictly comply with the EPSG definition.
- * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x).
- * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates.
- */
- var EPSG4326Projection = /** @class */ (function (_super) {
- epsg4326_extends(EPSG4326Projection, _super);
- /**
- * @param {string} code Code.
- * @param {string} [opt_axisOrientation] Axis orientation.
- */
- function EPSG4326Projection(code, opt_axisOrientation) {
- return _super.call(this, {
- code: code,
- units: proj_Units.DEGREES,
- extent: epsg4326_EXTENT,
- axisOrientation: opt_axisOrientation,
- global: true,
- metersPerUnit: epsg4326_METERS_PER_UNIT,
- worldExtent: epsg4326_EXTENT,
- }) || this;
- }
- return EPSG4326Projection;
- }(proj_Projection));
- /**
- * Projections equal to EPSG:4326.
- *
- * @const
- * @type {Array<import("./Projection.js").default>}
- */
- var epsg4326_PROJECTIONS = [
- new EPSG4326Projection('CRS:84'),
- new EPSG4326Projection('EPSG:4326', 'neu'),
- new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'),
- new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'),
- new EPSG4326Projection('http://www.opengis.net/def/crs/OGC/1.3/CRS84'),
- new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),
- new EPSG4326Projection('http://www.opengis.net/def/crs/EPSG/0/4326', 'neu'),
- ];
- //# sourceMappingURL=epsg4326.js.map
- ;// ./node_modules/ol/proj/projections.js
- /**
- * @module ol/proj/projections
- */
- /**
- * @type {Object<string, import("./Projection.js").default>}
- */
- var cache = {};
- /**
- * Clear the projections cache.
- */
- function projections_clear() {
- cache = {};
- }
- /**
- * Get a cached projection by code.
- * @param {string} code The code for the projection.
- * @return {import("./Projection.js").default} The projection (if cached).
- */
- function get(code) {
- return (cache[code] ||
- cache[code.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/, 'EPSG:$3')] ||
- null);
- }
- /**
- * Add a projection to the cache.
- * @param {string} code The projection code.
- * @param {import("./Projection.js").default} projection The projection to cache.
- */
- function add(code, projection) {
- cache[code] = projection;
- }
- //# sourceMappingURL=projections.js.map
- ;// ./node_modules/ol/proj/transforms.js
- /**
- * @module ol/proj/transforms
- */
- /**
- * @private
- * @type {!Object<string, Object<string, import("../proj.js").TransformFunction>>}
- */
- var transforms = {};
- /**
- * Clear the transform cache.
- */
- function transforms_clear() {
- transforms = {};
- }
- /**
- * Registers a conversion function to convert coordinates from the source
- * projection to the destination projection.
- *
- * @param {import("./Projection.js").default} source Source.
- * @param {import("./Projection.js").default} destination Destination.
- * @param {import("../proj.js").TransformFunction} transformFn Transform.
- */
- function transforms_add(source, destination, transformFn) {
- var sourceCode = source.getCode();
- var destinationCode = destination.getCode();
- if (!(sourceCode in transforms)) {
- transforms[sourceCode] = {};
- }
- transforms[sourceCode][destinationCode] = transformFn;
- }
- /**
- * Unregisters the conversion function to convert coordinates from the source
- * projection to the destination projection. This method is used to clean up
- * cached transforms during testing.
- *
- * @param {import("./Projection.js").default} source Source projection.
- * @param {import("./Projection.js").default} destination Destination projection.
- * @return {import("../proj.js").TransformFunction} transformFn The unregistered transform.
- */
- function transforms_remove(source, destination) {
- var sourceCode = source.getCode();
- var destinationCode = destination.getCode();
- var transform = transforms[sourceCode][destinationCode];
- delete transforms[sourceCode][destinationCode];
- if (isEmpty(transforms[sourceCode])) {
- delete transforms[sourceCode];
- }
- return transform;
- }
- /**
- * Get a transform given a source code and a destination code.
- * @param {string} sourceCode The code for the source projection.
- * @param {string} destinationCode The code for the destination projection.
- * @return {import("../proj.js").TransformFunction|undefined} The transform function (if found).
- */
- function transforms_get(sourceCode, destinationCode) {
- var transform;
- if (sourceCode in transforms && destinationCode in transforms[sourceCode]) {
- transform = transforms[sourceCode][destinationCode];
- }
- return transform;
- }
- //# sourceMappingURL=transforms.js.map
- ;// ./node_modules/ol/extent/Relationship.js
- /**
- * @module ol/extent/Relationship
- */
- /**
- * Relationship to an extent.
- * @enum {number}
- */
- /* harmony default export */ var Relationship = ({
- UNKNOWN: 0,
- INTERSECTING: 1,
- ABOVE: 2,
- RIGHT: 4,
- BELOW: 8,
- LEFT: 16,
- });
- //# sourceMappingURL=Relationship.js.map
- ;// ./node_modules/ol/extent.js
- /**
- * @module ol/extent
- */
- /**
- * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.
- * @typedef {Array<number>} Extent
- * @api
- */
- /**
- * Extent corner.
- * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} Corner
- */
- /**
- * Build an extent that includes all given coordinates.
- *
- * @param {Array<import("./coordinate.js").Coordinate>} coordinates Coordinates.
- * @return {Extent} Bounding extent.
- * @api
- */
- function boundingExtent(coordinates) {
- var extent = createEmpty();
- for (var i = 0, ii = coordinates.length; i < ii; ++i) {
- extendCoordinate(extent, coordinates[i]);
- }
- return extent;
- }
- /**
- * @param {Array<number>} xs Xs.
- * @param {Array<number>} ys Ys.
- * @param {Extent} [opt_extent] Destination extent.
- * @private
- * @return {Extent} Extent.
- */
- function _boundingExtentXYs(xs, ys, opt_extent) {
- var minX = Math.min.apply(null, xs);
- var minY = Math.min.apply(null, ys);
- var maxX = Math.max.apply(null, xs);
- var maxY = Math.max.apply(null, ys);
- return createOrUpdate(minX, minY, maxX, maxY, opt_extent);
- }
- /**
- * Return extent increased by the provided value.
- * @param {Extent} extent Extent.
- * @param {number} value The amount by which the extent should be buffered.
- * @param {Extent} [opt_extent] Extent.
- * @return {Extent} Extent.
- * @api
- */
- function buffer(extent, value, opt_extent) {
- if (opt_extent) {
- opt_extent[0] = extent[0] - value;
- opt_extent[1] = extent[1] - value;
- opt_extent[2] = extent[2] + value;
- opt_extent[3] = extent[3] + value;
- return opt_extent;
- }
- else {
- return [
- extent[0] - value,
- extent[1] - value,
- extent[2] + value,
- extent[3] + value,
- ];
- }
- }
- /**
- * Creates a clone of an extent.
- *
- * @param {Extent} extent Extent to clone.
- * @param {Extent} [opt_extent] Extent.
- * @return {Extent} The clone.
- */
- function clone(extent, opt_extent) {
- if (opt_extent) {
- opt_extent[0] = extent[0];
- opt_extent[1] = extent[1];
- opt_extent[2] = extent[2];
- opt_extent[3] = extent[3];
- return opt_extent;
- }
- else {
- return extent.slice();
- }
- }
- /**
- * @param {Extent} extent Extent.
- * @param {number} x X.
- * @param {number} y Y.
- * @return {number} Closest squared distance.
- */
- function closestSquaredDistanceXY(extent, x, y) {
- var dx, dy;
- if (x < extent[0]) {
- dx = extent[0] - x;
- }
- else if (extent[2] < x) {
- dx = x - extent[2];
- }
- else {
- dx = 0;
- }
- if (y < extent[1]) {
- dy = extent[1] - y;
- }
- else if (extent[3] < y) {
- dy = y - extent[3];
- }
- else {
- dy = 0;
- }
- return dx * dx + dy * dy;
- }
- /**
- * Check if the passed coordinate is contained or on the edge of the extent.
- *
- * @param {Extent} extent Extent.
- * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
- * @return {boolean} The coordinate is contained in the extent.
- * @api
- */
- function containsCoordinate(extent, coordinate) {
- return containsXY(extent, coordinate[0], coordinate[1]);
- }
- /**
- * Check if one extent contains another.
- *
- * An extent is deemed contained if it lies completely within the other extent,
- * including if they share one or more edges.
- *
- * @param {Extent} extent1 Extent 1.
- * @param {Extent} extent2 Extent 2.
- * @return {boolean} The second extent is contained by or on the edge of the
- * first.
- * @api
- */
- function containsExtent(extent1, extent2) {
- return (extent1[0] <= extent2[0] &&
- extent2[2] <= extent1[2] &&
- extent1[1] <= extent2[1] &&
- extent2[3] <= extent1[3]);
- }
- /**
- * Check if the passed coordinate is contained or on the edge of the extent.
- *
- * @param {Extent} extent Extent.
- * @param {number} x X coordinate.
- * @param {number} y Y coordinate.
- * @return {boolean} The x, y values are contained in the extent.
- * @api
- */
- function containsXY(extent, x, y) {
- return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];
- }
- /**
- * Get the relationship between a coordinate and extent.
- * @param {Extent} extent The extent.
- * @param {import("./coordinate.js").Coordinate} coordinate The coordinate.
- * @return {import("./extent/Relationship.js").default} The relationship (bitwise compare with
- * import("./extent/Relationship.js").Relationship).
- */
- function coordinateRelationship(extent, coordinate) {
- var minX = extent[0];
- var minY = extent[1];
- var maxX = extent[2];
- var maxY = extent[3];
- var x = coordinate[0];
- var y = coordinate[1];
- var relationship = Relationship.UNKNOWN;
- if (x < minX) {
- relationship = relationship | Relationship.LEFT;
- }
- else if (x > maxX) {
- relationship = relationship | Relationship.RIGHT;
- }
- if (y < minY) {
- relationship = relationship | Relationship.BELOW;
- }
- else if (y > maxY) {
- relationship = relationship | Relationship.ABOVE;
- }
- if (relationship === Relationship.UNKNOWN) {
- relationship = Relationship.INTERSECTING;
- }
- return relationship;
- }
- /**
- * Create an empty extent.
- * @return {Extent} Empty extent.
- * @api
- */
- function createEmpty() {
- return [Infinity, Infinity, -Infinity, -Infinity];
- }
- /**
- * Create a new extent or update the provided extent.
- * @param {number} minX Minimum X.
- * @param {number} minY Minimum Y.
- * @param {number} maxX Maximum X.
- * @param {number} maxY Maximum Y.
- * @param {Extent} [opt_extent] Destination extent.
- * @return {Extent} Extent.
- */
- function createOrUpdate(minX, minY, maxX, maxY, opt_extent) {
- if (opt_extent) {
- opt_extent[0] = minX;
- opt_extent[1] = minY;
- opt_extent[2] = maxX;
- opt_extent[3] = maxY;
- return opt_extent;
- }
- else {
- return [minX, minY, maxX, maxY];
- }
- }
- /**
- * Create a new empty extent or make the provided one empty.
- * @param {Extent} [opt_extent] Extent.
- * @return {Extent} Extent.
- */
- function createOrUpdateEmpty(opt_extent) {
- return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, opt_extent);
- }
- /**
- * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
- * @param {Extent} [opt_extent] Extent.
- * @return {Extent} Extent.
- */
- function createOrUpdateFromCoordinate(coordinate, opt_extent) {
- var x = coordinate[0];
- var y = coordinate[1];
- return createOrUpdate(x, y, x, y, opt_extent);
- }
- /**
- * @param {Array<import("./coordinate.js").Coordinate>} coordinates Coordinates.
- * @param {Extent} [opt_extent] Extent.
- * @return {Extent} Extent.
- */
- function createOrUpdateFromCoordinates(coordinates, opt_extent) {
- var extent = createOrUpdateEmpty(opt_extent);
- return extendCoordinates(extent, coordinates);
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {Extent} [opt_extent] Extent.
- * @return {Extent} Extent.
- */
- function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end, stride, opt_extent) {
- var extent = createOrUpdateEmpty(opt_extent);
- return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);
- }
- /**
- * @param {Array<Array<import("./coordinate.js").Coordinate>>} rings Rings.
- * @param {Extent} [opt_extent] Extent.
- * @return {Extent} Extent.
- */
- function createOrUpdateFromRings(rings, opt_extent) {
- var extent = createOrUpdateEmpty(opt_extent);
- return extendRings(extent, rings);
- }
- /**
- * Determine if two extents are equivalent.
- * @param {Extent} extent1 Extent 1.
- * @param {Extent} extent2 Extent 2.
- * @return {boolean} The two extents are equivalent.
- * @api
- */
- function extent_equals(extent1, extent2) {
- return (extent1[0] == extent2[0] &&
- extent1[2] == extent2[2] &&
- extent1[1] == extent2[1] &&
- extent1[3] == extent2[3]);
- }
- /**
- * Determine if two extents are approximately equivalent.
- * @param {Extent} extent1 Extent 1.
- * @param {Extent} extent2 Extent 2.
- * @param {number} tolerance Tolerance in extent coordinate units.
- * @return {boolean} The two extents differ by less than the tolerance.
- */
- function approximatelyEquals(extent1, extent2, tolerance) {
- return (Math.abs(extent1[0] - extent2[0]) < tolerance &&
- Math.abs(extent1[2] - extent2[2]) < tolerance &&
- Math.abs(extent1[1] - extent2[1]) < tolerance &&
- Math.abs(extent1[3] - extent2[3]) < tolerance);
- }
- /**
- * Modify an extent to include another extent.
- * @param {Extent} extent1 The extent to be modified.
- * @param {Extent} extent2 The extent that will be included in the first.
- * @return {Extent} A reference to the first (extended) extent.
- * @api
- */
- function extent_extend(extent1, extent2) {
- if (extent2[0] < extent1[0]) {
- extent1[0] = extent2[0];
- }
- if (extent2[2] > extent1[2]) {
- extent1[2] = extent2[2];
- }
- if (extent2[1] < extent1[1]) {
- extent1[1] = extent2[1];
- }
- if (extent2[3] > extent1[3]) {
- extent1[3] = extent2[3];
- }
- return extent1;
- }
- /**
- * @param {Extent} extent Extent.
- * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
- */
- function extendCoordinate(extent, coordinate) {
- if (coordinate[0] < extent[0]) {
- extent[0] = coordinate[0];
- }
- if (coordinate[0] > extent[2]) {
- extent[2] = coordinate[0];
- }
- if (coordinate[1] < extent[1]) {
- extent[1] = coordinate[1];
- }
- if (coordinate[1] > extent[3]) {
- extent[3] = coordinate[1];
- }
- }
- /**
- * @param {Extent} extent Extent.
- * @param {Array<import("./coordinate.js").Coordinate>} coordinates Coordinates.
- * @return {Extent} Extent.
- */
- function extendCoordinates(extent, coordinates) {
- for (var i = 0, ii = coordinates.length; i < ii; ++i) {
- extendCoordinate(extent, coordinates[i]);
- }
- return extent;
- }
- /**
- * @param {Extent} extent Extent.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @return {Extent} Extent.
- */
- function extendFlatCoordinates(extent, flatCoordinates, offset, end, stride) {
- for (; offset < end; offset += stride) {
- extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);
- }
- return extent;
- }
- /**
- * @param {Extent} extent Extent.
- * @param {Array<Array<import("./coordinate.js").Coordinate>>} rings Rings.
- * @return {Extent} Extent.
- */
- function extendRings(extent, rings) {
- for (var i = 0, ii = rings.length; i < ii; ++i) {
- extendCoordinates(extent, rings[i]);
- }
- return extent;
- }
- /**
- * @param {Extent} extent Extent.
- * @param {number} x X.
- * @param {number} y Y.
- */
- function extendXY(extent, x, y) {
- extent[0] = Math.min(extent[0], x);
- extent[1] = Math.min(extent[1], y);
- extent[2] = Math.max(extent[2], x);
- extent[3] = Math.max(extent[3], y);
- }
- /**
- * This function calls `callback` for each corner of the extent. If the
- * callback returns a truthy value the function returns that value
- * immediately. Otherwise the function returns `false`.
- * @param {Extent} extent Extent.
- * @param {function(import("./coordinate.js").Coordinate): S} callback Callback.
- * @return {S|boolean} Value.
- * @template S
- */
- function forEachCorner(extent, callback) {
- var val;
- val = callback(getBottomLeft(extent));
- if (val) {
- return val;
- }
- val = callback(getBottomRight(extent));
- if (val) {
- return val;
- }
- val = callback(getTopRight(extent));
- if (val) {
- return val;
- }
- val = callback(getTopLeft(extent));
- if (val) {
- return val;
- }
- return false;
- }
- /**
- * Get the size of an extent.
- * @param {Extent} extent Extent.
- * @return {number} Area.
- * @api
- */
- function getArea(extent) {
- var area = 0;
- if (!extent_isEmpty(extent)) {
- area = extent_getWidth(extent) * getHeight(extent);
- }
- return area;
- }
- /**
- * Get the bottom left coordinate of an extent.
- * @param {Extent} extent Extent.
- * @return {import("./coordinate.js").Coordinate} Bottom left coordinate.
- * @api
- */
- function getBottomLeft(extent) {
- return [extent[0], extent[1]];
- }
- /**
- * Get the bottom right coordinate of an extent.
- * @param {Extent} extent Extent.
- * @return {import("./coordinate.js").Coordinate} Bottom right coordinate.
- * @api
- */
- function getBottomRight(extent) {
- return [extent[2], extent[1]];
- }
- /**
- * Get the center coordinate of an extent.
- * @param {Extent} extent Extent.
- * @return {import("./coordinate.js").Coordinate} Center.
- * @api
- */
- function getCenter(extent) {
- return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];
- }
- /**
- * Get a corner coordinate of an extent.
- * @param {Extent} extent Extent.
- * @param {Corner} corner Corner.
- * @return {import("./coordinate.js").Coordinate} Corner coordinate.
- */
- function getCorner(extent, corner) {
- var coordinate;
- if (corner === 'bottom-left') {
- coordinate = getBottomLeft(extent);
- }
- else if (corner === 'bottom-right') {
- coordinate = getBottomRight(extent);
- }
- else if (corner === 'top-left') {
- coordinate = getTopLeft(extent);
- }
- else if (corner === 'top-right') {
- coordinate = getTopRight(extent);
- }
- else {
- asserts_assert(false, 13); // Invalid corner
- }
- return coordinate;
- }
- /**
- * @param {Extent} extent1 Extent 1.
- * @param {Extent} extent2 Extent 2.
- * @return {number} Enlarged area.
- */
- function getEnlargedArea(extent1, extent2) {
- var minX = Math.min(extent1[0], extent2[0]);
- var minY = Math.min(extent1[1], extent2[1]);
- var maxX = Math.max(extent1[2], extent2[2]);
- var maxY = Math.max(extent1[3], extent2[3]);
- return (maxX - minX) * (maxY - minY);
- }
- /**
- * @param {import("./coordinate.js").Coordinate} center Center.
- * @param {number} resolution Resolution.
- * @param {number} rotation Rotation.
- * @param {import("./size.js").Size} size Size.
- * @param {Extent} [opt_extent] Destination extent.
- * @return {Extent} Extent.
- */
- function getForViewAndSize(center, resolution, rotation, size, opt_extent) {
- var _a = getRotatedViewport(center, resolution, rotation, size), x0 = _a[0], y0 = _a[1], x1 = _a[2], y1 = _a[3], x2 = _a[4], y2 = _a[5], x3 = _a[6], y3 = _a[7];
- return createOrUpdate(Math.min(x0, x1, x2, x3), Math.min(y0, y1, y2, y3), Math.max(x0, x1, x2, x3), Math.max(y0, y1, y2, y3), opt_extent);
- }
- /**
- * @param {import("./coordinate.js").Coordinate} center Center.
- * @param {number} resolution Resolution.
- * @param {number} rotation Rotation.
- * @param {import("./size.js").Size} size Size.
- * @return {Array<number>} Linear ring representing the viewport.
- */
- function getRotatedViewport(center, resolution, rotation, size) {
- var dx = (resolution * size[0]) / 2;
- var dy = (resolution * size[1]) / 2;
- var cosRotation = Math.cos(rotation);
- var sinRotation = Math.sin(rotation);
- var xCos = dx * cosRotation;
- var xSin = dx * sinRotation;
- var yCos = dy * cosRotation;
- var ySin = dy * sinRotation;
- var x = center[0];
- var y = center[1];
- return [
- x - xCos + ySin,
- y - xSin - yCos,
- x - xCos - ySin,
- y - xSin + yCos,
- x + xCos - ySin,
- y + xSin + yCos,
- x + xCos + ySin,
- y + xSin - yCos,
- x - xCos + ySin,
- y - xSin - yCos,
- ];
- }
- /**
- * Get the height of an extent.
- * @param {Extent} extent Extent.
- * @return {number} Height.
- * @api
- */
- function getHeight(extent) {
- return extent[3] - extent[1];
- }
- /**
- * @param {Extent} extent1 Extent 1.
- * @param {Extent} extent2 Extent 2.
- * @return {number} Intersection area.
- */
- function getIntersectionArea(extent1, extent2) {
- var intersection = getIntersection(extent1, extent2);
- return getArea(intersection);
- }
- /**
- * Get the intersection of two extents.
- * @param {Extent} extent1 Extent 1.
- * @param {Extent} extent2 Extent 2.
- * @param {Extent} [opt_extent] Optional extent to populate with intersection.
- * @return {Extent} Intersecting extent.
- * @api
- */
- function getIntersection(extent1, extent2, opt_extent) {
- var intersection = opt_extent ? opt_extent : createEmpty();
- if (intersects(extent1, extent2)) {
- if (extent1[0] > extent2[0]) {
- intersection[0] = extent1[0];
- }
- else {
- intersection[0] = extent2[0];
- }
- if (extent1[1] > extent2[1]) {
- intersection[1] = extent1[1];
- }
- else {
- intersection[1] = extent2[1];
- }
- if (extent1[2] < extent2[2]) {
- intersection[2] = extent1[2];
- }
- else {
- intersection[2] = extent2[2];
- }
- if (extent1[3] < extent2[3]) {
- intersection[3] = extent1[3];
- }
- else {
- intersection[3] = extent2[3];
- }
- }
- else {
- createOrUpdateEmpty(intersection);
- }
- return intersection;
- }
- /**
- * @param {Extent} extent Extent.
- * @return {number} Margin.
- */
- function getMargin(extent) {
- return extent_getWidth(extent) + getHeight(extent);
- }
- /**
- * Get the size (width, height) of an extent.
- * @param {Extent} extent The extent.
- * @return {import("./size.js").Size} The extent size.
- * @api
- */
- function getSize(extent) {
- return [extent[2] - extent[0], extent[3] - extent[1]];
- }
- /**
- * Get the top left coordinate of an extent.
- * @param {Extent} extent Extent.
- * @return {import("./coordinate.js").Coordinate} Top left coordinate.
- * @api
- */
- function getTopLeft(extent) {
- return [extent[0], extent[3]];
- }
- /**
- * Get the top right coordinate of an extent.
- * @param {Extent} extent Extent.
- * @return {import("./coordinate.js").Coordinate} Top right coordinate.
- * @api
- */
- function getTopRight(extent) {
- return [extent[2], extent[3]];
- }
- /**
- * Get the width of an extent.
- * @param {Extent} extent Extent.
- * @return {number} Width.
- * @api
- */
- function extent_getWidth(extent) {
- return extent[2] - extent[0];
- }
- /**
- * Determine if one extent intersects another.
- * @param {Extent} extent1 Extent 1.
- * @param {Extent} extent2 Extent.
- * @return {boolean} The two extents intersect.
- * @api
- */
- function intersects(extent1, extent2) {
- return (extent1[0] <= extent2[2] &&
- extent1[2] >= extent2[0] &&
- extent1[1] <= extent2[3] &&
- extent1[3] >= extent2[1]);
- }
- /**
- * Determine if an extent is empty.
- * @param {Extent} extent Extent.
- * @return {boolean} Is empty.
- * @api
- */
- function extent_isEmpty(extent) {
- return extent[2] < extent[0] || extent[3] < extent[1];
- }
- /**
- * @param {Extent} extent Extent.
- * @param {Extent} [opt_extent] Extent.
- * @return {Extent} Extent.
- */
- function returnOrUpdate(extent, opt_extent) {
- if (opt_extent) {
- opt_extent[0] = extent[0];
- opt_extent[1] = extent[1];
- opt_extent[2] = extent[2];
- opt_extent[3] = extent[3];
- return opt_extent;
- }
- else {
- return extent;
- }
- }
- /**
- * @param {Extent} extent Extent.
- * @param {number} value Value.
- */
- function scaleFromCenter(extent, value) {
- var deltaX = ((extent[2] - extent[0]) / 2) * (value - 1);
- var deltaY = ((extent[3] - extent[1]) / 2) * (value - 1);
- extent[0] -= deltaX;
- extent[2] += deltaX;
- extent[1] -= deltaY;
- extent[3] += deltaY;
- }
- /**
- * Determine if the segment between two coordinates intersects (crosses,
- * touches, or is contained by) the provided extent.
- * @param {Extent} extent The extent.
- * @param {import("./coordinate.js").Coordinate} start Segment start coordinate.
- * @param {import("./coordinate.js").Coordinate} end Segment end coordinate.
- * @return {boolean} The segment intersects the extent.
- */
- function intersectsSegment(extent, start, end) {
- var intersects = false;
- var startRel = coordinateRelationship(extent, start);
- var endRel = coordinateRelationship(extent, end);
- if (startRel === Relationship.INTERSECTING ||
- endRel === Relationship.INTERSECTING) {
- intersects = true;
- }
- else {
- var minX = extent[0];
- var minY = extent[1];
- var maxX = extent[2];
- var maxY = extent[3];
- var startX = start[0];
- var startY = start[1];
- var endX = end[0];
- var endY = end[1];
- var slope = (endY - startY) / (endX - startX);
- var x = void 0, y = void 0;
- if (!!(endRel & Relationship.ABOVE) && !(startRel & Relationship.ABOVE)) {
- // potentially intersects top
- x = endX - (endY - maxY) / slope;
- intersects = x >= minX && x <= maxX;
- }
- if (!intersects &&
- !!(endRel & Relationship.RIGHT) &&
- !(startRel & Relationship.RIGHT)) {
- // potentially intersects right
- y = endY - (endX - maxX) * slope;
- intersects = y >= minY && y <= maxY;
- }
- if (!intersects &&
- !!(endRel & Relationship.BELOW) &&
- !(startRel & Relationship.BELOW)) {
- // potentially intersects bottom
- x = endX - (endY - minY) / slope;
- intersects = x >= minX && x <= maxX;
- }
- if (!intersects &&
- !!(endRel & Relationship.LEFT) &&
- !(startRel & Relationship.LEFT)) {
- // potentially intersects left
- y = endY - (endX - minX) * slope;
- intersects = y >= minY && y <= maxY;
- }
- }
- return intersects;
- }
- /**
- * Apply a transform function to the extent.
- * @param {Extent} extent Extent.
- * @param {import("./proj.js").TransformFunction} transformFn Transform function.
- * Called with `[minX, minY, maxX, maxY]` extent coordinates.
- * @param {Extent} [opt_extent] Destination extent.
- * @param {number} [opt_stops] Number of stops per side used for the transform.
- * By default only the corners are used.
- * @return {Extent} Extent.
- * @api
- */
- function applyTransform(extent, transformFn, opt_extent, opt_stops) {
- var coordinates = [];
- if (opt_stops > 1) {
- var width = extent[2] - extent[0];
- var height = extent[3] - extent[1];
- for (var i = 0; i < opt_stops; ++i) {
- coordinates.push(extent[0] + (width * i) / opt_stops, extent[1], extent[2], extent[1] + (height * i) / opt_stops, extent[2] - (width * i) / opt_stops, extent[3], extent[0], extent[3] - (height * i) / opt_stops);
- }
- }
- else {
- coordinates = [
- extent[0],
- extent[1],
- extent[2],
- extent[1],
- extent[2],
- extent[3],
- extent[0],
- extent[3],
- ];
- }
- transformFn(coordinates, coordinates, 2);
- var xs = [];
- var ys = [];
- for (var i = 0, l = coordinates.length; i < l; i += 2) {
- xs.push(coordinates[i]);
- ys.push(coordinates[i + 1]);
- }
- return _boundingExtentXYs(xs, ys, opt_extent);
- }
- /**
- * Modifies the provided extent in-place to be within the real world
- * extent.
- *
- * @param {Extent} extent Extent.
- * @param {import("./proj/Projection.js").default} projection Projection
- * @return {Extent} The extent within the real world extent.
- */
- function wrapX(extent, projection) {
- var projectionExtent = projection.getExtent();
- var center = getCenter(extent);
- if (projection.canWrapX() &&
- (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])) {
- var worldWidth = extent_getWidth(projectionExtent);
- var worldsAway = Math.floor((center[0] - projectionExtent[0]) / worldWidth);
- var offset = worldsAway * worldWidth;
- extent[0] -= offset;
- extent[2] -= offset;
- }
- return extent;
- }
- /**
- * Fits the extent to the real world
- *
- * If the extent does not cross the anti meridian, this will return the extent in an array
- * If the extent crosses the anti meridian, the extent will be sliced, so each part fits within the
- * real world
- *
- *
- * @param {Extent} extent Extent.
- * @param {import("./proj/Projection.js").default} projection Projection
- * @return {Array<Extent>} The extent within the real world extent.
- */
- function wrapAndSliceX(extent, projection) {
- if (projection.canWrapX()) {
- var projectionExtent = projection.getExtent();
- if (!isFinite(extent[0]) || !isFinite(extent[2])) {
- return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];
- }
- wrapX(extent, projection);
- var worldWidth = extent_getWidth(projectionExtent);
- if (extent_getWidth(extent) > worldWidth) {
- // the extent wraps around on itself
- return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];
- }
- else if (extent[0] < projectionExtent[0]) {
- // the extent crosses the anti meridian, so it needs to be sliced
- return [
- [extent[0] + worldWidth, extent[1], projectionExtent[2], extent[3]],
- [projectionExtent[0], extent[1], extent[2], extent[3]],
- ];
- }
- else if (extent[2] > projectionExtent[2]) {
- // the extent crosses the anti meridian, so it needs to be sliced
- return [
- [extent[0], extent[1], projectionExtent[2], extent[3]],
- [projectionExtent[0], extent[1], extent[2] - worldWidth, extent[3]],
- ];
- }
- }
- return [extent];
- }
- //# sourceMappingURL=extent.js.map
- ;// ./node_modules/ol/coordinate.js
- /**
- * @module ol/coordinate
- */
- /**
- * An array of numbers representing an xy coordinate. Example: `[16, 48]`.
- * @typedef {Array<number>} Coordinate
- * @api
- */
- /**
- * A function that takes a {@link module:ol/coordinate~Coordinate} and
- * transforms it into a `{string}`.
- *
- * @typedef {function((Coordinate|undefined)): string} CoordinateFormat
- * @api
- */
- /**
- * Add `delta` to `coordinate`. `coordinate` is modified in place and returned
- * by the function.
- *
- * Example:
- *
- * import {add} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * add(coord, [-2, 4]);
- * // coord is now [5.85, 51.983333]
- *
- * @param {Coordinate} coordinate Coordinate.
- * @param {Coordinate} delta Delta.
- * @return {Coordinate} The input coordinate adjusted by
- * the given delta.
- * @api
- */
- function coordinate_add(coordinate, delta) {
- coordinate[0] += +delta[0];
- coordinate[1] += +delta[1];
- return coordinate;
- }
- /**
- * Calculates the point closest to the passed coordinate on the passed circle.
- *
- * @param {Coordinate} coordinate The coordinate.
- * @param {import("./geom/Circle.js").default} circle The circle.
- * @return {Coordinate} Closest point on the circumference.
- */
- function closestOnCircle(coordinate, circle) {
- var r = circle.getRadius();
- var center = circle.getCenter();
- var x0 = center[0];
- var y0 = center[1];
- var x1 = coordinate[0];
- var y1 = coordinate[1];
- var dx = x1 - x0;
- var dy = y1 - y0;
- if (dx === 0 && dy === 0) {
- dx = 1;
- }
- var d = Math.sqrt(dx * dx + dy * dy);
- var x = x0 + (r * dx) / d;
- var y = y0 + (r * dy) / d;
- return [x, y];
- }
- /**
- * Calculates the point closest to the passed coordinate on the passed segment.
- * This is the foot of the perpendicular of the coordinate to the segment when
- * the foot is on the segment, or the closest segment coordinate when the foot
- * is outside the segment.
- *
- * @param {Coordinate} coordinate The coordinate.
- * @param {Array<Coordinate>} segment The two coordinates
- * of the segment.
- * @return {Coordinate} The foot of the perpendicular of
- * the coordinate to the segment.
- */
- function closestOnSegment(coordinate, segment) {
- var x0 = coordinate[0];
- var y0 = coordinate[1];
- var start = segment[0];
- var end = segment[1];
- var x1 = start[0];
- var y1 = start[1];
- var x2 = end[0];
- var y2 = end[1];
- var dx = x2 - x1;
- var dy = y2 - y1;
- var along = dx === 0 && dy === 0
- ? 0
- : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0);
- var x, y;
- if (along <= 0) {
- x = x1;
- y = y1;
- }
- else if (along >= 1) {
- x = x2;
- y = y2;
- }
- else {
- x = x1 + along * dx;
- y = y1 + along * dy;
- }
- return [x, y];
- }
- /**
- * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be
- * used to format
- * a {Coordinate} to a string.
- *
- * Example without specifying the fractional digits:
- *
- * import {createStringXY} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var stringifyFunc = createStringXY();
- * var out = stringifyFunc(coord);
- * // out is now '8, 48'
- *
- * Example with explicitly specifying 2 fractional digits:
- *
- * import {createStringXY} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var stringifyFunc = createStringXY(2);
- * var out = stringifyFunc(coord);
- * // out is now '7.85, 47.98'
- *
- * @param {number} [opt_fractionDigits] The number of digits to include
- * after the decimal point. Default is `0`.
- * @return {CoordinateFormat} Coordinate format.
- * @api
- */
- function createStringXY(opt_fractionDigits) {
- return (
- /**
- * @param {Coordinate} coordinate Coordinate.
- * @return {string} String XY.
- */
- function (coordinate) {
- return toStringXY(coordinate, opt_fractionDigits);
- });
- }
- /**
- * @param {string} hemispheres Hemispheres.
- * @param {number} degrees Degrees.
- * @param {number} [opt_fractionDigits] The number of digits to include
- * after the decimal point. Default is `0`.
- * @return {string} String.
- */
- function degreesToStringHDMS(hemispheres, degrees, opt_fractionDigits) {
- var normalizedDegrees = modulo(degrees + 180, 360) - 180;
- var x = Math.abs(3600 * normalizedDegrees);
- var dflPrecision = opt_fractionDigits || 0;
- var precision = Math.pow(10, dflPrecision);
- var deg = Math.floor(x / 3600);
- var min = Math.floor((x - deg * 3600) / 60);
- var sec = x - deg * 3600 - min * 60;
- sec = Math.ceil(sec * precision) / precision;
- if (sec >= 60) {
- sec = 0;
- min += 1;
- }
- if (min >= 60) {
- min = 0;
- deg += 1;
- }
- return (deg +
- '\u00b0 ' +
- padNumber(min, 2) +
- '\u2032 ' +
- padNumber(sec, 2, dflPrecision) +
- '\u2033' +
- (normalizedDegrees == 0
- ? ''
- : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0)));
- }
- /**
- * Transforms the given {@link module:ol/coordinate~Coordinate} to a string
- * using the given string template. The strings `{x}` and `{y}` in the template
- * will be replaced with the first and second coordinate values respectively.
- *
- * Example without specifying the fractional digits:
- *
- * import {format} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var template = 'Coordinate is ({x}|{y}).';
- * var out = format(coord, template);
- * // out is now 'Coordinate is (8|48).'
- *
- * Example explicitly specifying the fractional digits:
- *
- * import {format} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var template = 'Coordinate is ({x}|{y}).';
- * var out = format(coord, template, 2);
- * // out is now 'Coordinate is (7.85|47.98).'
- *
- * @param {Coordinate} coordinate Coordinate.
- * @param {string} template A template string with `{x}` and `{y}` placeholders
- * that will be replaced by first and second coordinate values.
- * @param {number} [opt_fractionDigits] The number of digits to include
- * after the decimal point. Default is `0`.
- * @return {string} Formatted coordinate.
- * @api
- */
- function format(coordinate, template, opt_fractionDigits) {
- if (coordinate) {
- return template
- .replace('{x}', coordinate[0].toFixed(opt_fractionDigits))
- .replace('{y}', coordinate[1].toFixed(opt_fractionDigits));
- }
- else {
- return '';
- }
- }
- /**
- * @param {Coordinate} coordinate1 First coordinate.
- * @param {Coordinate} coordinate2 Second coordinate.
- * @return {boolean} The two coordinates are equal.
- */
- function coordinate_equals(coordinate1, coordinate2) {
- var equals = true;
- for (var i = coordinate1.length - 1; i >= 0; --i) {
- if (coordinate1[i] != coordinate2[i]) {
- equals = false;
- break;
- }
- }
- return equals;
- }
- /**
- * Rotate `coordinate` by `angle`. `coordinate` is modified in place and
- * returned by the function.
- *
- * Example:
- *
- * import {rotate} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var rotateRadians = Math.PI / 2; // 90 degrees
- * rotate(coord, rotateRadians);
- * // coord is now [-47.983333, 7.85]
- *
- * @param {Coordinate} coordinate Coordinate.
- * @param {number} angle Angle in radian.
- * @return {Coordinate} Coordinate.
- * @api
- */
- function rotate(coordinate, angle) {
- var cosAngle = Math.cos(angle);
- var sinAngle = Math.sin(angle);
- var x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;
- var y = coordinate[1] * cosAngle + coordinate[0] * sinAngle;
- coordinate[0] = x;
- coordinate[1] = y;
- return coordinate;
- }
- /**
- * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned
- * by the function.
- *
- * Example:
- *
- * import {scale as scaleCoordinate} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var scale = 1.2;
- * scaleCoordinate(coord, scale);
- * // coord is now [9.42, 57.5799996]
- *
- * @param {Coordinate} coordinate Coordinate.
- * @param {number} scale Scale factor.
- * @return {Coordinate} Coordinate.
- */
- function scale(coordinate, scale) {
- coordinate[0] *= scale;
- coordinate[1] *= scale;
- return coordinate;
- }
- /**
- * @param {Coordinate} coord1 First coordinate.
- * @param {Coordinate} coord2 Second coordinate.
- * @return {number} Squared distance between coord1 and coord2.
- */
- function coordinate_squaredDistance(coord1, coord2) {
- var dx = coord1[0] - coord2[0];
- var dy = coord1[1] - coord2[1];
- return dx * dx + dy * dy;
- }
- /**
- * @param {Coordinate} coord1 First coordinate.
- * @param {Coordinate} coord2 Second coordinate.
- * @return {number} Distance between coord1 and coord2.
- */
- function distance(coord1, coord2) {
- return Math.sqrt(coordinate_squaredDistance(coord1, coord2));
- }
- /**
- * Calculate the squared distance from a coordinate to a line segment.
- *
- * @param {Coordinate} coordinate Coordinate of the point.
- * @param {Array<Coordinate>} segment Line segment (2
- * coordinates).
- * @return {number} Squared distance from the point to the line segment.
- */
- function squaredDistanceToSegment(coordinate, segment) {
- return coordinate_squaredDistance(coordinate, closestOnSegment(coordinate, segment));
- }
- /**
- * Format a geographic coordinate with the hemisphere, degrees, minutes, and
- * seconds.
- *
- * Example without specifying fractional digits:
- *
- * import {toStringHDMS} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var out = toStringHDMS(coord);
- * // out is now '47° 58′ 60″ N 7° 50′ 60″ E'
- *
- * Example explicitly specifying 1 fractional digit:
- *
- * import {toStringHDMS} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var out = toStringHDMS(coord, 1);
- * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'
- *
- * @param {Coordinate} coordinate Coordinate.
- * @param {number} [opt_fractionDigits] The number of digits to include
- * after the decimal point. Default is `0`.
- * @return {string} Hemisphere, degrees, minutes and seconds.
- * @api
- */
- function toStringHDMS(coordinate, opt_fractionDigits) {
- if (coordinate) {
- return (degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) +
- ' ' +
- degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits));
- }
- else {
- return '';
- }
- }
- /**
- * Format a coordinate as a comma delimited string.
- *
- * Example without specifying fractional digits:
- *
- * import {toStringXY} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var out = toStringXY(coord);
- * // out is now '8, 48'
- *
- * Example explicitly specifying 1 fractional digit:
- *
- * import {toStringXY} from 'ol/coordinate';
- *
- * var coord = [7.85, 47.983333];
- * var out = toStringXY(coord, 1);
- * // out is now '7.8, 48.0'
- *
- * @param {Coordinate} coordinate Coordinate.
- * @param {number} [opt_fractionDigits] The number of digits to include
- * after the decimal point. Default is `0`.
- * @return {string} XY.
- * @api
- */
- function toStringXY(coordinate, opt_fractionDigits) {
- return format(coordinate, '{x}, {y}', opt_fractionDigits);
- }
- /**
- * Modifies the provided coordinate in-place to be within the real world
- * extent. The lower projection extent boundary is inclusive, the upper one
- * exclusive.
- *
- * @param {Coordinate} coordinate Coordinate.
- * @param {import("./proj/Projection.js").default} projection Projection.
- * @return {Coordinate} The coordinate within the real world extent.
- */
- function coordinate_wrapX(coordinate, projection) {
- if (projection.canWrapX()) {
- var worldWidth = extent_getWidth(projection.getExtent());
- var worldsAway = coordinate_getWorldsAway(coordinate, projection, worldWidth);
- if (worldsAway) {
- coordinate[0] -= worldsAway * worldWidth;
- }
- }
- return coordinate;
- }
- /**
- * @param {Coordinate} coordinate Coordinate.
- * @param {import("./proj/Projection.js").default} projection Projection.
- * @param {number} [opt_sourceExtentWidth] Width of the source extent.
- * @return {number} Offset in world widths.
- */
- function coordinate_getWorldsAway(coordinate, projection, opt_sourceExtentWidth) {
- var projectionExtent = projection.getExtent();
- var worldsAway = 0;
- if (projection.canWrapX() &&
- (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])) {
- var sourceExtentWidth = opt_sourceExtentWidth || extent_getWidth(projectionExtent);
- worldsAway = Math.floor((coordinate[0] - projectionExtent[0]) / sourceExtentWidth);
- }
- return worldsAway;
- }
- //# sourceMappingURL=coordinate.js.map
- ;// ./node_modules/ol/sphere.js
- /**
- * @module ol/sphere
- */
- /**
- * Object literal with options for the {@link getLength} or {@link getArea}
- * functions.
- * @typedef {Object} SphereMetricOptions
- * @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857']
- * Projection of the geometry. By default, the geometry is assumed to be in
- * Web Mercator.
- * @property {number} [radius=6371008.8] Sphere radius. By default, the
- * [mean Earth radius](https://en.wikipedia.org/wiki/Earth_radius#Mean_radius)
- * for the WGS84 ellipsoid is used.
- */
- /**
- * The mean Earth radius (1/3 * (2a + b)) for the WGS84 ellipsoid.
- * https://en.wikipedia.org/wiki/Earth_radius#Mean_radius
- * @type {number}
- */
- var DEFAULT_RADIUS = 6371008.8;
- /**
- * Get the great circle distance (in meters) between two geographic coordinates.
- * @param {Array} c1 Starting coordinate.
- * @param {Array} c2 Ending coordinate.
- * @param {number} [opt_radius] The sphere radius to use. Defaults to the Earth's
- * mean radius using the WGS84 ellipsoid.
- * @return {number} The great circle distance between the points (in meters).
- * @api
- */
- function getDistance(c1, c2, opt_radius) {
- var radius = opt_radius || DEFAULT_RADIUS;
- var lat1 = math_toRadians(c1[1]);
- var lat2 = math_toRadians(c2[1]);
- var deltaLatBy2 = (lat2 - lat1) / 2;
- var deltaLonBy2 = math_toRadians(c2[0] - c1[0]) / 2;
- var a = Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) +
- Math.sin(deltaLonBy2) *
- Math.sin(deltaLonBy2) *
- Math.cos(lat1) *
- Math.cos(lat2);
- return 2 * radius * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
- }
- /**
- * Get the cumulative great circle length of linestring coordinates (geographic).
- * @param {Array} coordinates Linestring coordinates.
- * @param {number} radius The sphere radius to use.
- * @return {number} The length (in meters).
- */
- function getLengthInternal(coordinates, radius) {
- var length = 0;
- for (var i = 0, ii = coordinates.length; i < ii - 1; ++i) {
- length += getDistance(coordinates[i], coordinates[i + 1], radius);
- }
- return length;
- }
- /**
- * Get the spherical length of a geometry. This length is the sum of the
- * great circle distances between coordinates. For polygons, the length is
- * the sum of all rings. For points, the length is zero. For multi-part
- * geometries, the length is the sum of the length of each part.
- * @param {import("./geom/Geometry.js").default} geometry A geometry.
- * @param {SphereMetricOptions} [opt_options] Options for the
- * length calculation. By default, geometries are assumed to be in 'EPSG:3857'.
- * You can change this by providing a `projection` option.
- * @return {number} The spherical length (in meters).
- * @api
- */
- function getLength(geometry, opt_options) {
- var options = opt_options || {};
- var radius = options.radius || DEFAULT_RADIUS;
- var projection = options.projection || 'EPSG:3857';
- var type = geometry.getType();
- if (type !== 'GeometryCollection') {
- geometry = geometry.clone().transform(projection, 'EPSG:4326');
- }
- var length = 0;
- var coordinates, coords, i, ii, j, jj;
- switch (type) {
- case 'Point':
- case 'MultiPoint': {
- break;
- }
- case 'LineString':
- case 'LinearRing': {
- coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates();
- length = getLengthInternal(coordinates, radius);
- break;
- }
- case 'MultiLineString':
- case 'Polygon': {
- coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates();
- for (i = 0, ii = coordinates.length; i < ii; ++i) {
- length += getLengthInternal(coordinates[i], radius);
- }
- break;
- }
- case 'MultiPolygon': {
- coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates();
- for (i = 0, ii = coordinates.length; i < ii; ++i) {
- coords = coordinates[i];
- for (j = 0, jj = coords.length; j < jj; ++j) {
- length += getLengthInternal(coords[j], radius);
- }
- }
- break;
- }
- case 'GeometryCollection': {
- var geometries =
- /** @type {import("./geom/GeometryCollection.js").default} */ (geometry).getGeometries();
- for (i = 0, ii = geometries.length; i < ii; ++i) {
- length += getLength(geometries[i], opt_options);
- }
- break;
- }
- default: {
- throw new Error('Unsupported geometry type: ' + type);
- }
- }
- return length;
- }
- /**
- * Returns the spherical area for a list of coordinates.
- *
- * [Reference](https://trs.jpl.nasa.gov/handle/2014/40409)
- * Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for
- * Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion
- * Laboratory, Pasadena, CA, June 2007
- *
- * @param {Array<import("./coordinate.js").Coordinate>} coordinates List of coordinates of a linear
- * ring. If the ring is oriented clockwise, the area will be positive,
- * otherwise it will be negative.
- * @param {number} radius The sphere radius.
- * @return {number} Area (in square meters).
- */
- function getAreaInternal(coordinates, radius) {
- var area = 0;
- var len = coordinates.length;
- var x1 = coordinates[len - 1][0];
- var y1 = coordinates[len - 1][1];
- for (var i = 0; i < len; i++) {
- var x2 = coordinates[i][0];
- var y2 = coordinates[i][1];
- area +=
- toRadians(x2 - x1) *
- (2 + Math.sin(toRadians(y1)) + Math.sin(toRadians(y2)));
- x1 = x2;
- y1 = y2;
- }
- return (area * radius * radius) / 2.0;
- }
- /**
- * Get the spherical area of a geometry. This is the area (in meters) assuming
- * that polygon edges are segments of great circles on a sphere.
- * @param {import("./geom/Geometry.js").default} geometry A geometry.
- * @param {SphereMetricOptions} [opt_options] Options for the area
- * calculation. By default, geometries are assumed to be in 'EPSG:3857'.
- * You can change this by providing a `projection` option.
- * @return {number} The spherical area (in square meters).
- * @api
- */
- function sphere_getArea(geometry, opt_options) {
- var options = opt_options || {};
- var radius = options.radius || DEFAULT_RADIUS;
- var projection = options.projection || 'EPSG:3857';
- var type = geometry.getType();
- if (type !== 'GeometryCollection') {
- geometry = geometry.clone().transform(projection, 'EPSG:4326');
- }
- var area = 0;
- var coordinates, coords, i, ii, j, jj;
- switch (type) {
- case 'Point':
- case 'MultiPoint':
- case 'LineString':
- case 'MultiLineString':
- case 'LinearRing': {
- break;
- }
- case 'Polygon': {
- coordinates = /** @type {import("./geom/Polygon.js").default} */ (geometry).getCoordinates();
- area = Math.abs(getAreaInternal(coordinates[0], radius));
- for (i = 1, ii = coordinates.length; i < ii; ++i) {
- area -= Math.abs(getAreaInternal(coordinates[i], radius));
- }
- break;
- }
- case 'MultiPolygon': {
- coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates();
- for (i = 0, ii = coordinates.length; i < ii; ++i) {
- coords = coordinates[i];
- area += Math.abs(getAreaInternal(coords[0], radius));
- for (j = 1, jj = coords.length; j < jj; ++j) {
- area -= Math.abs(getAreaInternal(coords[j], radius));
- }
- }
- break;
- }
- case 'GeometryCollection': {
- var geometries =
- /** @type {import("./geom/GeometryCollection.js").default} */ (geometry).getGeometries();
- for (i = 0, ii = geometries.length; i < ii; ++i) {
- area += sphere_getArea(geometries[i], opt_options);
- }
- break;
- }
- default: {
- throw new Error('Unsupported geometry type: ' + type);
- }
- }
- return area;
- }
- /**
- * Returns the coordinate at the given distance and bearing from `c1`.
- *
- * @param {import("./coordinate.js").Coordinate} c1 The origin point (`[lon, lat]` in degrees).
- * @param {number} distance The great-circle distance between the origin
- * point and the target point.
- * @param {number} bearing The bearing (in radians).
- * @param {number} [opt_radius] The sphere radius to use. Defaults to the Earth's
- * mean radius using the WGS84 ellipsoid.
- * @return {import("./coordinate.js").Coordinate} The target point.
- */
- function offset(c1, distance, bearing, opt_radius) {
- var radius = opt_radius || DEFAULT_RADIUS;
- var lat1 = toRadians(c1[1]);
- var lon1 = toRadians(c1[0]);
- var dByR = distance / radius;
- var lat = Math.asin(Math.sin(lat1) * Math.cos(dByR) +
- Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing));
- var lon = lon1 +
- Math.atan2(Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1), Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat));
- return [toDegrees(lon), toDegrees(lat)];
- }
- //# sourceMappingURL=sphere.js.map
- ;// ./node_modules/ol/proj.js
- /**
- * @module ol/proj
- */
- /**
- * The ol/proj module stores:
- * * a list of {@link module:ol/proj/Projection~Projection}
- * objects, one for each projection supported by the application
- * * a list of transform functions needed to convert coordinates in one projection
- * into another.
- *
- * The static functions are the methods used to maintain these.
- * Each transform function can handle not only simple coordinate pairs, but also
- * large arrays of coordinates such as vector geometries.
- *
- * When loaded, the library adds projection objects for EPSG:4326 (WGS84
- * geographic coordinates) and EPSG:3857 (Web or Spherical Mercator, as used
- * for example by Bing Maps or OpenStreetMap), together with the relevant
- * transform functions.
- *
- * Additional transforms may be added by using the http://proj4js.org/
- * library (version 2.2 or later). You can use the full build supplied by
- * Proj4js, or create a custom build to support those projections you need; see
- * the Proj4js website for how to do this. You also need the Proj4js definitions
- * for the required projections. These definitions can be obtained from
- * https://epsg.io/, and are a JS function, so can be loaded in a script
- * tag (as in the examples) or pasted into your application.
- *
- * After all required projection definitions are added to proj4's registry (by
- * using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4`
- * package. Existing transforms are not changed by this function. See
- * examples/wms-image-custom-proj for an example of this.
- *
- * Additional projection definitions can be registered with `proj4.defs()` any
- * time. Just make sure to call `register(proj4)` again; for example, with user-supplied data where you don't
- * know in advance what projections are needed, you can initially load minimal
- * support and then load whichever are requested.
- *
- * Note that Proj4js does not support projection extents. If you want to add
- * one for creating default tile grids, you can add it after the Projection
- * object has been created with `setExtent`, for example,
- * `get('EPSG:1234').setExtent(extent)`.
- *
- * In addition to Proj4js support, any transform functions can be added with
- * {@link module:ol/proj.addCoordinateTransforms}. To use this, you must first create
- * a {@link module:ol/proj/Projection~Projection} object for the new projection and add it with
- * {@link module:ol/proj.addProjection}. You can then add the forward and inverse
- * functions with {@link module:ol/proj.addCoordinateTransforms}. See
- * examples/wms-custom-proj for an example of this.
- *
- * Note that if no transforms are needed and you only need to define the
- * projection, just add a {@link module:ol/proj/Projection~Projection} with
- * {@link module:ol/proj.addProjection}. See examples/wms-no-proj for an example of
- * this.
- */
- /**
- * A projection as {@link module:ol/proj/Projection~Projection}, SRS identifier
- * string or undefined.
- * @typedef {Projection|string|undefined} ProjectionLike
- * @api
- */
- /**
- * A transform function accepts an array of input coordinate values, an optional
- * output array, and an optional dimension (default should be 2). The function
- * transforms the input coordinate values, populates the output array, and
- * returns the output array.
- *
- * @typedef {function(Array<number>, Array<number>=, number=): Array<number>} TransformFunction
- * @api
- */
- var showCoordinateWarning = true;
- /**
- * @param {boolean} [opt_disable = true] Disable console info about `useGeographic()`
- */
- function disableCoordinateWarning(opt_disable) {
- var hide = opt_disable === undefined ? true : opt_disable;
- showCoordinateWarning = !hide;
- }
- /**
- * @param {Array<number>} input Input coordinate array.
- * @param {Array<number>} [opt_output] Output array of coordinate values.
- * @param {number} [opt_dimension] Dimension.
- * @return {Array<number>} Output coordinate array (new array, same coordinate
- * values).
- */
- function cloneTransform(input, opt_output, opt_dimension) {
- var output;
- if (opt_output !== undefined) {
- for (var i = 0, ii = input.length; i < ii; ++i) {
- opt_output[i] = input[i];
- }
- output = opt_output;
- }
- else {
- output = input.slice();
- }
- return output;
- }
- /**
- * @param {Array<number>} input Input coordinate array.
- * @param {Array<number>} [opt_output] Output array of coordinate values.
- * @param {number} [opt_dimension] Dimension.
- * @return {Array<number>} Input coordinate array (same array as input).
- */
- function identityTransform(input, opt_output, opt_dimension) {
- if (opt_output !== undefined && input !== opt_output) {
- for (var i = 0, ii = input.length; i < ii; ++i) {
- opt_output[i] = input[i];
- }
- input = opt_output;
- }
- return input;
- }
- /**
- * Add a Projection object to the list of supported projections that can be
- * looked up by their code.
- *
- * @param {Projection} projection Projection instance.
- * @api
- */
- function addProjection(projection) {
- add(projection.getCode(), projection);
- transforms_add(projection, projection, cloneTransform);
- }
- /**
- * @param {Array<Projection>} projections Projections.
- */
- function addProjections(projections) {
- projections.forEach(addProjection);
- }
- /**
- * Fetches a Projection object for the code specified.
- *
- * @param {ProjectionLike} projectionLike Either a code string which is
- * a combination of authority and identifier such as "EPSG:4326", or an
- * existing projection object, or undefined.
- * @return {Projection|null} Projection object, or null if not in list.
- * @api
- */
- function proj_get(projectionLike) {
- return typeof projectionLike === 'string'
- ? get(/** @type {string} */ (projectionLike))
- : /** @type {Projection} */ (projectionLike) || null;
- }
- /**
- * Get the resolution of the point in degrees or distance units.
- * For projections with degrees as the unit this will simply return the
- * provided resolution. For other projections the point resolution is
- * by default estimated by transforming the `point` pixel to EPSG:4326,
- * measuring its width and height on the normal sphere,
- * and taking the average of the width and height.
- * A custom function can be provided for a specific projection, either
- * by setting the `getPointResolution` option in the
- * {@link module:ol/proj/Projection~Projection} constructor or by using
- * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing
- * projection object.
- * @param {ProjectionLike} projection The projection.
- * @param {number} resolution Nominal resolution in projection units.
- * @param {import("./coordinate.js").Coordinate} point Point to find adjusted resolution at.
- * @param {import("./proj/Units.js").default} [opt_units] Units to get the point resolution in.
- * Default is the projection's units.
- * @return {number} Point resolution.
- * @api
- */
- function getPointResolution(projection, resolution, point, opt_units) {
- projection = proj_get(projection);
- var pointResolution;
- var getter = projection.getPointResolutionFunc();
- if (getter) {
- pointResolution = getter(resolution, point);
- if (opt_units && opt_units !== projection.getUnits()) {
- var metersPerUnit = projection.getMetersPerUnit();
- if (metersPerUnit) {
- pointResolution =
- (pointResolution * metersPerUnit) / Units_METERS_PER_UNIT[opt_units];
- }
- }
- }
- else {
- var units = projection.getUnits();
- if ((units == proj_Units.DEGREES && !opt_units) || opt_units == proj_Units.DEGREES) {
- pointResolution = resolution;
- }
- else {
- // Estimate point resolution by transforming the center pixel to EPSG:4326,
- // measuring its width and height on the normal sphere, and taking the
- // average of the width and height.
- var toEPSG4326_1 = getTransformFromProjections(projection, proj_get('EPSG:4326'));
- if (toEPSG4326_1 === identityTransform && units !== proj_Units.DEGREES) {
- // no transform is available
- pointResolution = resolution * projection.getMetersPerUnit();
- }
- else {
- var vertices = [
- point[0] - resolution / 2,
- point[1],
- point[0] + resolution / 2,
- point[1],
- point[0],
- point[1] - resolution / 2,
- point[0],
- point[1] + resolution / 2,
- ];
- vertices = toEPSG4326_1(vertices, vertices, 2);
- var width = getDistance(vertices.slice(0, 2), vertices.slice(2, 4));
- var height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8));
- pointResolution = (width + height) / 2;
- }
- var metersPerUnit = opt_units
- ? Units_METERS_PER_UNIT[opt_units]
- : projection.getMetersPerUnit();
- if (metersPerUnit !== undefined) {
- pointResolution /= metersPerUnit;
- }
- }
- }
- return pointResolution;
- }
- /**
- * Registers transformation functions that don't alter coordinates. Those allow
- * to transform between projections with equal meaning.
- *
- * @param {Array<Projection>} projections Projections.
- * @api
- */
- function addEquivalentProjections(projections) {
- addProjections(projections);
- projections.forEach(function (source) {
- projections.forEach(function (destination) {
- if (source !== destination) {
- transforms_add(source, destination, cloneTransform);
- }
- });
- });
- }
- /**
- * Registers transformation functions to convert coordinates in any projection
- * in projection1 to any projection in projection2.
- *
- * @param {Array<Projection>} projections1 Projections with equal
- * meaning.
- * @param {Array<Projection>} projections2 Projections with equal
- * meaning.
- * @param {TransformFunction} forwardTransform Transformation from any
- * projection in projection1 to any projection in projection2.
- * @param {TransformFunction} inverseTransform Transform from any projection
- * in projection2 to any projection in projection1..
- */
- function addEquivalentTransforms(projections1, projections2, forwardTransform, inverseTransform) {
- projections1.forEach(function (projection1) {
- projections2.forEach(function (projection2) {
- transforms_add(projection1, projection2, forwardTransform);
- transforms_add(projection2, projection1, inverseTransform);
- });
- });
- }
- /**
- * Clear all cached projections and transforms.
- */
- function clearAllProjections() {
- clearProj();
- clearTransformFuncs();
- }
- /**
- * @param {Projection|string|undefined} projection Projection.
- * @param {string} defaultCode Default code.
- * @return {Projection} Projection.
- */
- function createProjection(projection, defaultCode) {
- if (!projection) {
- return proj_get(defaultCode);
- }
- else if (typeof projection === 'string') {
- return proj_get(projection);
- }
- else {
- return /** @type {Projection} */ (projection);
- }
- }
- /**
- * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform
- * function.
- * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} coordTransform Coordinate
- * transform.
- * @return {TransformFunction} Transform function.
- */
- function createTransformFromCoordinateTransform(coordTransform) {
- return (
- /**
- * @param {Array<number>} input Input.
- * @param {Array<number>} [opt_output] Output.
- * @param {number} [opt_dimension] Dimension.
- * @return {Array<number>} Output.
- */
- function (input, opt_output, opt_dimension) {
- var length = input.length;
- var dimension = opt_dimension !== undefined ? opt_dimension : 2;
- var output = opt_output !== undefined ? opt_output : new Array(length);
- for (var i = 0; i < length; i += dimension) {
- var point = coordTransform(input.slice(i, i + dimension));
- var pointLength = point.length;
- for (var j = 0, jj = dimension; j < jj; ++j) {
- output[i + j] = j >= pointLength ? input[i + j] : point[j];
- }
- }
- return output;
- });
- }
- /**
- * Registers coordinate transform functions to convert coordinates between the
- * source projection and the destination projection.
- * The forward and inverse functions convert coordinate pairs; this function
- * converts these into the functions used internally which also handle
- * extents and coordinate arrays.
- *
- * @param {ProjectionLike} source Source projection.
- * @param {ProjectionLike} destination Destination projection.
- * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} forward The forward transform
- * function (that is, from the source projection to the destination
- * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns
- * the transformed {@link module:ol/coordinate~Coordinate}.
- * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} inverse The inverse transform
- * function (that is, from the destination projection to the source
- * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns
- * the transformed {@link module:ol/coordinate~Coordinate}. If the transform function can only
- * transform less dimensions than the input coordinate, it is supposeed to return a coordinate
- * with only the length it can transform. The other dimensions will be taken unchanged from the
- * source.
- * @api
- */
- function addCoordinateTransforms(source, destination, forward, inverse) {
- var sourceProj = proj_get(source);
- var destProj = proj_get(destination);
- addTransformFunc(sourceProj, destProj, createTransformFromCoordinateTransform(forward));
- addTransformFunc(destProj, sourceProj, createTransformFromCoordinateTransform(inverse));
- }
- /**
- * Transforms a coordinate from longitude/latitude to a different projection.
- * @param {import("./coordinate.js").Coordinate} coordinate Coordinate as longitude and latitude, i.e.
- * an array with longitude as 1st and latitude as 2nd element.
- * @param {ProjectionLike} [opt_projection] Target projection. The
- * default is Web Mercator, i.e. 'EPSG:3857'.
- * @return {import("./coordinate.js").Coordinate} Coordinate projected to the target projection.
- * @api
- */
- function fromLonLat(coordinate, opt_projection) {
- disableCoordinateWarning();
- return transform(coordinate, 'EPSG:4326', opt_projection !== undefined ? opt_projection : 'EPSG:3857');
- }
- /**
- * Transforms a coordinate to longitude/latitude.
- * @param {import("./coordinate.js").Coordinate} coordinate Projected coordinate.
- * @param {ProjectionLike} [opt_projection] Projection of the coordinate.
- * The default is Web Mercator, i.e. 'EPSG:3857'.
- * @return {import("./coordinate.js").Coordinate} Coordinate as longitude and latitude, i.e. an array
- * with longitude as 1st and latitude as 2nd element.
- * @api
- */
- function toLonLat(coordinate, opt_projection) {
- var lonLat = transform(coordinate, opt_projection !== undefined ? opt_projection : 'EPSG:3857', 'EPSG:4326');
- var lon = lonLat[0];
- if (lon < -180 || lon > 180) {
- lonLat[0] = modulo(lon + 180, 360) - 180;
- }
- return lonLat;
- }
- /**
- * Checks if two projections are the same, that is every coordinate in one
- * projection does represent the same geographic point as the same coordinate in
- * the other projection.
- *
- * @param {Projection} projection1 Projection 1.
- * @param {Projection} projection2 Projection 2.
- * @return {boolean} Equivalent.
- * @api
- */
- function equivalent(projection1, projection2) {
- if (projection1 === projection2) {
- return true;
- }
- var equalUnits = projection1.getUnits() === projection2.getUnits();
- if (projection1.getCode() === projection2.getCode()) {
- return equalUnits;
- }
- else {
- var transformFunc = getTransformFromProjections(projection1, projection2);
- return transformFunc === cloneTransform && equalUnits;
- }
- }
- /**
- * Searches in the list of transform functions for the function for converting
- * coordinates from the source projection to the destination projection.
- *
- * @param {Projection} sourceProjection Source Projection object.
- * @param {Projection} destinationProjection Destination Projection
- * object.
- * @return {TransformFunction} Transform function.
- */
- function getTransformFromProjections(sourceProjection, destinationProjection) {
- var sourceCode = sourceProjection.getCode();
- var destinationCode = destinationProjection.getCode();
- var transformFunc = transforms_get(sourceCode, destinationCode);
- if (!transformFunc) {
- transformFunc = identityTransform;
- }
- return transformFunc;
- }
- /**
- * Given the projection-like objects, searches for a transformation
- * function to convert a coordinates array from the source projection to the
- * destination projection.
- *
- * @param {ProjectionLike} source Source.
- * @param {ProjectionLike} destination Destination.
- * @return {TransformFunction} Transform function.
- * @api
- */
- function getTransform(source, destination) {
- var sourceProjection = proj_get(source);
- var destinationProjection = proj_get(destination);
- return getTransformFromProjections(sourceProjection, destinationProjection);
- }
- /**
- * Transforms a coordinate from source projection to destination projection.
- * This returns a new coordinate (and does not modify the original).
- *
- * See {@link module:ol/proj.transformExtent} for extent transformation.
- * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its
- * subclasses for geometry transforms.
- *
- * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
- * @param {ProjectionLike} source Source projection-like.
- * @param {ProjectionLike} destination Destination projection-like.
- * @return {import("./coordinate.js").Coordinate} Coordinate.
- * @api
- */
- function transform(coordinate, source, destination) {
- var transformFunc = getTransform(source, destination);
- return transformFunc(coordinate, undefined, coordinate.length);
- }
- /**
- * Transforms an extent from source projection to destination projection. This
- * returns a new extent (and does not modify the original).
- *
- * @param {import("./extent.js").Extent} extent The extent to transform.
- * @param {ProjectionLike} source Source projection-like.
- * @param {ProjectionLike} destination Destination projection-like.
- * @param {number} [opt_stops] Number of stops per side used for the transform.
- * By default only the corners are used.
- * @return {import("./extent.js").Extent} The transformed extent.
- * @api
- */
- function transformExtent(extent, source, destination, opt_stops) {
- var transformFunc = getTransform(source, destination);
- return applyTransform(extent, transformFunc, undefined, opt_stops);
- }
- /**
- * Transforms the given point to the destination projection.
- *
- * @param {import("./coordinate.js").Coordinate} point Point.
- * @param {Projection} sourceProjection Source projection.
- * @param {Projection} destinationProjection Destination projection.
- * @return {import("./coordinate.js").Coordinate} Point.
- */
- function transformWithProjections(point, sourceProjection, destinationProjection) {
- var transformFunc = getTransformFromProjections(sourceProjection, destinationProjection);
- return transformFunc(point);
- }
- /**
- * @type {Projection|null}
- */
- var userProjection = null;
- /**
- * Set the projection for coordinates supplied from and returned by API methods.
- * This includes all API methods except for those interacting with tile grids.
- * @param {ProjectionLike} projection The user projection.
- * @api
- */
- function setUserProjection(projection) {
- userProjection = proj_get(projection);
- }
- /**
- * Clear the user projection if set.
- * @api
- */
- function clearUserProjection() {
- userProjection = null;
- }
- /**
- * Get the projection for coordinates supplied from and returned by API methods.
- * Note that this method is not yet a part of the stable API. Support for user
- * projections is not yet complete and should be considered experimental.
- * @return {Projection|null} The user projection (or null if not set).
- * @api
- */
- function getUserProjection() {
- return userProjection;
- }
- /**
- * Use geographic coordinates (WGS-84 datum) in API methods. This includes all API
- * methods except for those interacting with tile grids.
- * @api
- */
- function useGeographic() {
- setUserProjection('EPSG:4326');
- }
- /**
- * Return a coordinate transformed into the user projection. If no user projection
- * is set, the original coordinate is returned.
- * @param {Array<number>} coordinate Input coordinate.
- * @param {ProjectionLike} sourceProjection The input coordinate projection.
- * @return {Array<number>} The input coordinate in the user projection.
- */
- function toUserCoordinate(coordinate, sourceProjection) {
- if (!userProjection) {
- return coordinate;
- }
- return transform(coordinate, sourceProjection, userProjection);
- }
- /**
- * Return a coordinate transformed from the user projection. If no user projection
- * is set, the original coordinate is returned.
- * @param {Array<number>} coordinate Input coordinate.
- * @param {ProjectionLike} destProjection The destination projection.
- * @return {Array<number>} The input coordinate transformed.
- */
- function fromUserCoordinate(coordinate, destProjection) {
- if (!userProjection) {
- if (showCoordinateWarning &&
- !coordinate_equals(coordinate, [0, 0]) &&
- coordinate[0] >= -180 &&
- coordinate[0] <= 180 &&
- coordinate[1] >= -90 &&
- coordinate[1] <= 90) {
- showCoordinateWarning = false;
- // eslint-disable-next-line no-console
- console.warn('Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.');
- }
- return coordinate;
- }
- return transform(coordinate, userProjection, destProjection);
- }
- /**
- * Return an extent transformed into the user projection. If no user projection
- * is set, the original extent is returned.
- * @param {import("./extent.js").Extent} extent Input extent.
- * @param {ProjectionLike} sourceProjection The input extent projection.
- * @return {import("./extent.js").Extent} The input extent in the user projection.
- */
- function proj_toUserExtent(extent, sourceProjection) {
- if (!userProjection) {
- return extent;
- }
- return transformExtent(extent, sourceProjection, userProjection);
- }
- /**
- * Return an extent transformed from the user projection. If no user projection
- * is set, the original extent is returned.
- * @param {import("./extent.js").Extent} extent Input extent.
- * @param {ProjectionLike} destProjection The destination projection.
- * @return {import("./extent.js").Extent} The input extent transformed.
- */
- function proj_fromUserExtent(extent, destProjection) {
- if (!userProjection) {
- return extent;
- }
- return transformExtent(extent, userProjection, destProjection);
- }
- /**
- * Return the resolution in user projection units per pixel. If no user projection
- * is set, or source or user projection are missing units, the original resolution
- * is returned.
- * @param {number} resolution Resolution in input projection units per pixel.
- * @param {ProjectionLike} sourceProjection The input projection.
- * @return {number} Resolution in user projection units per pixel.
- */
- function toUserResolution(resolution, sourceProjection) {
- if (!userProjection) {
- return resolution;
- }
- var sourceUnits = proj_get(sourceProjection).getUnits();
- var userUnits = userProjection.getUnits();
- return sourceUnits && userUnits
- ? (resolution * Units_METERS_PER_UNIT[sourceUnits]) / Units_METERS_PER_UNIT[userUnits]
- : resolution;
- }
- /**
- * Return the resolution in user projection units per pixel. If no user projection
- * is set, or source or user projection are missing units, the original resolution
- * is returned.
- * @param {number} resolution Resolution in user projection units per pixel.
- * @param {ProjectionLike} destProjection The destination projection.
- * @return {number} Resolution in destination projection units per pixel.
- */
- function proj_fromUserResolution(resolution, destProjection) {
- if (!userProjection) {
- return resolution;
- }
- var sourceUnits = proj_get(destProjection).getUnits();
- var userUnits = userProjection.getUnits();
- return sourceUnits && userUnits
- ? (resolution * METERS_PER_UNIT[userUnits]) / METERS_PER_UNIT[sourceUnits]
- : resolution;
- }
- /**
- * Creates a safe coordinate transform function from a coordinate transform function.
- * "Safe" means that it can handle wrapping of x-coordinates for global projections,
- * and that coordinates exceeding the source projection validity extent's range will be
- * clamped to the validity range.
- * @param {Projection} sourceProj Source projection.
- * @param {Projection} destProj Destination projection.
- * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} transform Transform function (source to destiation).
- * @return {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} Safe transform function (source to destiation).
- */
- function createSafeCoordinateTransform(sourceProj, destProj, transform) {
- return function (coord) {
- var transformed, worldsAway;
- if (sourceProj.canWrapX()) {
- var sourceExtent = sourceProj.getExtent();
- var sourceExtentWidth = getWidth(sourceExtent);
- coord = coord.slice(0);
- worldsAway = getWorldsAway(coord, sourceProj, sourceExtentWidth);
- if (worldsAway) {
- // Move x to the real world
- coord[0] = coord[0] - worldsAway * sourceExtentWidth;
- }
- coord[0] = clamp(coord[0], sourceExtent[0], sourceExtent[2]);
- coord[1] = clamp(coord[1], sourceExtent[1], sourceExtent[3]);
- transformed = transform(coord);
- }
- else {
- transformed = transform(coord);
- }
- if (worldsAway && destProj.canWrapX()) {
- // Move transformed coordinate back to the offset world
- transformed[0] += worldsAway * getWidth(destProj.getExtent());
- }
- return transformed;
- };
- }
- /**
- * Add transforms to and from EPSG:4326 and EPSG:3857. This function is called
- * by when this module is executed and should only need to be called again after
- * `clearAllProjections()` is called (e.g. in tests).
- */
- function addCommon() {
- // Add transformations that don't alter coordinates to convert within set of
- // projections with equal meaning.
- addEquivalentProjections(PROJECTIONS);
- addEquivalentProjections(epsg4326_PROJECTIONS);
- // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like
- // coordinates and back.
- addEquivalentTransforms(epsg4326_PROJECTIONS, PROJECTIONS, fromEPSG4326, toEPSG4326);
- }
- addCommon();
- //# sourceMappingURL=proj.js.map
- ;// ./node_modules/ol/control/MousePosition.js
- /**
- * @module ol/control/MousePosition
- */
- var MousePosition_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @type {string}
- */
- var PROJECTION = 'projection';
- /**
- * @type {string}
- */
- var COORDINATE_FORMAT = 'coordinateFormat';
- /***
- * @template Return
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
- * import("../Observable").OnSignature<import("../ObjectEventType").Types|
- * 'change:coordinateFormat'|'change:projection', import("../Object").ObjectEvent, Return> &
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
- * 'change:coordinateFormat'|'change:projection', Return>} MousePositionOnSignature
- */
- /**
- * @typedef {Object} Options
- * @property {string} [className='ol-mouse-position'] CSS class name.
- * @property {import("../coordinate.js").CoordinateFormat} [coordinateFormat] Coordinate format.
- * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
- * @property {function(import("../MapEvent.js").default):void} [render] Function called when the
- * control should be re-rendered. This is called in a `requestAnimationFrame`
- * callback.
- * @property {HTMLElement|string} [target] Specify a target if you want the
- * control to be rendered outside of the map's viewport.
- * @property {string|boolean} [placeholder] Markup to show when the mouse position is not
- * available (e.g. when the pointer leaves the map viewport). By default, a non-breaking space
- * is rendered when the mouse leaves the viewport. To render something else, provide a string
- * to be used as the text content (e.g. 'no position' or '' for an empty string). Set the placeholder
- * to `false` to retain the last position when the mouse leaves the viewport. In a future release, this
- * will be the default behavior.
- * @property {string} [undefinedHTML=' '] This option is deprecated. Use the `placeholder` option instead.
- */
- /**
- * @classdesc
- * A control to show the 2D coordinates of the mouse cursor. By default, these
- * are in the view projection, but can be in any supported projection.
- * By default the control is shown in the top right corner of the map, but this
- * can be changed by using the css selector `.ol-mouse-position`.
- *
- * On touch devices, which usually do not have a mouse cursor, the coordinates
- * of the currently touched position are shown.
- *
- * @api
- */
- var MousePosition = /** @class */ (function (_super) {
- MousePosition_extends(MousePosition, _super);
- /**
- * @param {Options} [opt_options] Mouse position options.
- */
- function MousePosition(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- var element = document.createElement('div');
- element.className =
- options.className !== undefined ? options.className : 'ol-mouse-position';
- _this = _super.call(this, {
- element: element,
- render: options.render,
- target: options.target,
- }) || this;
- /***
- * @type {MousePositionOnSignature<import("../events").EventsKey>}
- */
- _this.on;
- /***
- * @type {MousePositionOnSignature<import("../events").EventsKey>}
- */
- _this.once;
- /***
- * @type {MousePositionOnSignature<void>}
- */
- _this.un;
- _this.addChangeListener(PROJECTION, _this.handleProjectionChanged_);
- if (options.coordinateFormat) {
- _this.setCoordinateFormat(options.coordinateFormat);
- }
- if (options.projection) {
- _this.setProjection(options.projection);
- }
- /**
- * Change this to `false` when removing the deprecated `undefinedHTML` option.
- * @type {boolean}
- */
- var renderOnMouseOut = true;
- /**
- * @type {string}
- */
- var placeholder = ' ';
- if ('undefinedHTML' in options) {
- // deprecated behavior
- if (options.undefinedHTML !== undefined) {
- placeholder = options.undefinedHTML;
- }
- renderOnMouseOut = !!placeholder;
- }
- else if ('placeholder' in options) {
- if (options.placeholder === false) {
- renderOnMouseOut = false;
- }
- else {
- placeholder = String(options.placeholder);
- }
- }
- /**
- * @private
- * @type {string}
- */
- _this.placeholder_ = placeholder;
- /**
- * @private
- * @type {boolean}
- */
- _this.renderOnMouseOut_ = renderOnMouseOut;
- /**
- * @private
- * @type {string}
- */
- _this.renderedHTML_ = element.innerHTML;
- /**
- * @private
- * @type {?import("../proj/Projection.js").default}
- */
- _this.mapProjection_ = null;
- /**
- * @private
- * @type {?import("../proj.js").TransformFunction}
- */
- _this.transform_ = null;
- return _this;
- }
- /**
- * @private
- */
- MousePosition.prototype.handleProjectionChanged_ = function () {
- this.transform_ = null;
- };
- /**
- * Return the coordinate format type used to render the current position or
- * undefined.
- * @return {import("../coordinate.js").CoordinateFormat|undefined} The format to render the current
- * position in.
- * @observable
- * @api
- */
- MousePosition.prototype.getCoordinateFormat = function () {
- return /** @type {import("../coordinate.js").CoordinateFormat|undefined} */ (this.get(COORDINATE_FORMAT));
- };
- /**
- * Return the projection that is used to report the mouse position.
- * @return {import("../proj/Projection.js").default|undefined} The projection to report mouse
- * position in.
- * @observable
- * @api
- */
- MousePosition.prototype.getProjection = function () {
- return /** @type {import("../proj/Projection.js").default|undefined} */ (this.get(PROJECTION));
- };
- /**
- * @param {MouseEvent} event Browser event.
- * @protected
- */
- MousePosition.prototype.handleMouseMove = function (event) {
- var map = this.getMap();
- this.updateHTML_(map.getEventPixel(event));
- };
- /**
- * @param {Event} event Browser event.
- * @protected
- */
- MousePosition.prototype.handleMouseOut = function (event) {
- this.updateHTML_(null);
- };
- /**
- * Remove the control from its current map and attach it to the new map.
- * Pass `null` to just remove the control from the current map.
- * Subclasses may set up event handlers to get notified about changes to
- * the map here.
- * @param {import("../PluggableMap.js").default|null} map Map.
- * @api
- */
- MousePosition.prototype.setMap = function (map) {
- _super.prototype.setMap.call(this, map);
- if (map) {
- var viewport = map.getViewport();
- this.listenerKeys.push(listen(viewport, pointer_EventType.POINTERMOVE, this.handleMouseMove, this));
- if (this.renderOnMouseOut_) {
- this.listenerKeys.push(listen(viewport, pointer_EventType.POINTEROUT, this.handleMouseOut, this));
- }
- this.updateHTML_(null);
- }
- };
- /**
- * Set the coordinate format type used to render the current position.
- * @param {import("../coordinate.js").CoordinateFormat} format The format to render the current
- * position in.
- * @observable
- * @api
- */
- MousePosition.prototype.setCoordinateFormat = function (format) {
- this.set(COORDINATE_FORMAT, format);
- };
- /**
- * Set the projection that is used to report the mouse position.
- * @param {import("../proj.js").ProjectionLike} projection The projection to report mouse
- * position in.
- * @observable
- * @api
- */
- MousePosition.prototype.setProjection = function (projection) {
- this.set(PROJECTION, proj_get(projection));
- };
- /**
- * @param {?import("../pixel.js").Pixel} pixel Pixel.
- * @private
- */
- MousePosition.prototype.updateHTML_ = function (pixel) {
- var html = this.placeholder_;
- if (pixel && this.mapProjection_) {
- if (!this.transform_) {
- var projection = this.getProjection();
- if (projection) {
- this.transform_ = getTransformFromProjections(this.mapProjection_, projection);
- }
- else {
- this.transform_ = identityTransform;
- }
- }
- var map = this.getMap();
- var coordinate = map.getCoordinateFromPixelInternal(pixel);
- if (coordinate) {
- var userProjection = getUserProjection();
- if (userProjection) {
- this.transform_ = getTransformFromProjections(this.mapProjection_, userProjection);
- }
- this.transform_(coordinate, coordinate);
- var coordinateFormat = this.getCoordinateFormat();
- if (coordinateFormat) {
- html = coordinateFormat(coordinate);
- }
- else {
- html = coordinate.toString();
- }
- }
- }
- if (!this.renderedHTML_ || html !== this.renderedHTML_) {
- this.element.innerHTML = html;
- this.renderedHTML_ = html;
- }
- };
- /**
- * Update the projection. Rendering of the coordinates is done in
- * `handleMouseMove` and `handleMouseUp`.
- * @param {import("../MapEvent.js").default} mapEvent Map event.
- * @override
- */
- MousePosition.prototype.render = function (mapEvent) {
- var frameState = mapEvent.frameState;
- if (!frameState) {
- this.mapProjection_ = null;
- }
- else {
- if (this.mapProjection_ != frameState.viewState.projection) {
- this.mapProjection_ = frameState.viewState.projection;
- this.transform_ = null;
- }
- }
- };
- return MousePosition;
- }(control_Control));
- /* harmony default export */ var control_MousePosition = (MousePosition);
- //# sourceMappingURL=MousePosition.js.map
- ;// ./node_modules/ol/easing.js
- /**
- * @module ol/easing
- */
- /**
- * Start slow and speed up.
- * @param {number} t Input between 0 and 1.
- * @return {number} Output between 0 and 1.
- * @api
- */
- function easeIn(t) {
- return Math.pow(t, 3);
- }
- /**
- * Start fast and slow down.
- * @param {number} t Input between 0 and 1.
- * @return {number} Output between 0 and 1.
- * @api
- */
- function easeOut(t) {
- return 1 - easeIn(1 - t);
- }
- /**
- * Start slow, speed up, and then slow down again.
- * @param {number} t Input between 0 and 1.
- * @return {number} Output between 0 and 1.
- * @api
- */
- function inAndOut(t) {
- return 3 * t * t - 2 * t * t * t;
- }
- /**
- * Maintain a constant speed over time.
- * @param {number} t Input between 0 and 1.
- * @return {number} Output between 0 and 1.
- * @api
- */
- function linear(t) {
- return t;
- }
- /**
- * Start slow, speed up, and at the very end slow down again. This has the
- * same general behavior as {@link module:ol/easing.inAndOut}, but the final
- * slowdown is delayed.
- * @param {number} t Input between 0 and 1.
- * @return {number} Output between 0 and 1.
- * @api
- */
- function upAndDown(t) {
- if (t < 0.5) {
- return inAndOut(2 * t);
- }
- else {
- return 1 - inAndOut(2 * (t - 0.5));
- }
- }
- //# sourceMappingURL=easing.js.map
- ;// ./node_modules/ol/control/Zoom.js
- var Zoom_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/control/Zoom
- */
- /**
- * @typedef {Object} Options
- * @property {number} [duration=250] Animation duration in milliseconds.
- * @property {string} [className='ol-zoom'] CSS class name.
- * @property {string} [zoomInClassName=className + '-in'] CSS class name for the zoom-in button.
- * @property {string} [zoomOutClassName=className + '-out'] CSS class name for the zoom-out button.
- * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in
- * button. Instead of text, also an element (e.g. a `span` element) can be used.
- * @property {string|HTMLElement} [zoomOutLabel='–'] Text label to use for the zoom-out button.
- * Instead of text, also an element (e.g. a `span` element) can be used.
- * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.
- * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.
- * @property {number} [delta=1] The zoom delta applied on each click.
- * @property {HTMLElement|string} [target] Specify a target if you want the control to be
- * rendered outside of the map's viewport.
- */
- /**
- * @classdesc
- * A control with 2 buttons, one for zoom in and one for zoom out.
- * This control is one of the default controls of a map. To style this control
- * use css selectors `.ol-zoom-in` and `.ol-zoom-out`.
- *
- * @api
- */
- var Zoom = /** @class */ (function (_super) {
- Zoom_extends(Zoom, _super);
- /**
- * @param {Options} [opt_options] Zoom options.
- */
- function Zoom(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- _this = _super.call(this, {
- element: document.createElement('div'),
- target: options.target,
- }) || this;
- var className = options.className !== undefined ? options.className : 'ol-zoom';
- var delta = options.delta !== undefined ? options.delta : 1;
- var zoomInClassName = options.zoomInClassName !== undefined
- ? options.zoomInClassName
- : className + '-in';
- var zoomOutClassName = options.zoomOutClassName !== undefined
- ? options.zoomOutClassName
- : className + '-out';
- var zoomInLabel = options.zoomInLabel !== undefined ? options.zoomInLabel : '+';
- var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2013';
- var zoomInTipLabel = options.zoomInTipLabel !== undefined ? options.zoomInTipLabel : 'Zoom in';
- var zoomOutTipLabel = options.zoomOutTipLabel !== undefined
- ? options.zoomOutTipLabel
- : 'Zoom out';
- var inElement = document.createElement('button');
- inElement.className = zoomInClassName;
- inElement.setAttribute('type', 'button');
- inElement.title = zoomInTipLabel;
- inElement.appendChild(typeof zoomInLabel === 'string'
- ? document.createTextNode(zoomInLabel)
- : zoomInLabel);
- inElement.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this, delta), false);
- var outElement = document.createElement('button');
- outElement.className = zoomOutClassName;
- outElement.setAttribute('type', 'button');
- outElement.title = zoomOutTipLabel;
- outElement.appendChild(typeof zoomOutLabel === 'string'
- ? document.createTextNode(zoomOutLabel)
- : zoomOutLabel);
- outElement.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this, -delta), false);
- var cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
- var element = _this.element;
- element.className = cssClasses;
- element.appendChild(inElement);
- element.appendChild(outElement);
- /**
- * @type {number}
- * @private
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 250;
- return _this;
- }
- /**
- * @param {number} delta Zoom delta.
- * @param {MouseEvent} event The event to handle
- * @private
- */
- Zoom.prototype.handleClick_ = function (delta, event) {
- event.preventDefault();
- this.zoomByDelta_(delta);
- };
- /**
- * @param {number} delta Zoom delta.
- * @private
- */
- Zoom.prototype.zoomByDelta_ = function (delta) {
- var map = this.getMap();
- var view = map.getView();
- if (!view) {
- // the map does not have a view, so we can't act
- // upon it
- return;
- }
- var currentZoom = view.getZoom();
- if (currentZoom !== undefined) {
- var newZoom = view.getConstrainedZoom(currentZoom + delta);
- if (this.duration_ > 0) {
- if (view.getAnimating()) {
- view.cancelAnimations();
- }
- view.animate({
- zoom: newZoom,
- duration: this.duration_,
- easing: easeOut,
- });
- }
- else {
- view.setZoom(newZoom);
- }
- }
- };
- return Zoom;
- }(control_Control));
- /* harmony default export */ var control_Zoom = (Zoom);
- //# sourceMappingURL=Zoom.js.map
- ;// ./node_modules/ol/geom/GeometryLayout.js
- /**
- * @module ol/geom/GeometryLayout
- */
- /**
- * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')
- * or measure ('M') coordinate is available. Supported values are `'XY'`,
- * `'XYZ'`, `'XYM'`, `'XYZM'`.
- * @enum {string}
- */
- /* harmony default export */ var geom_GeometryLayout = ({
- XY: 'XY',
- XYZ: 'XYZ',
- XYM: 'XYM',
- XYZM: 'XYZM',
- });
- //# sourceMappingURL=GeometryLayout.js.map
- ;// ./node_modules/ol/transform.js
- /**
- * @module ol/transform
- */
- /**
- * An array representing an affine 2d transformation for use with
- * {@link module:ol/transform} functions. The array has 6 elements.
- * @typedef {!Array<number>} Transform
- * @api
- */
- /**
- * Collection of affine 2d transformation functions. The functions work on an
- * array of 6 elements. The element order is compatible with the [SVGMatrix
- * interface](https://developer.mozilla.org/en-US/docs/Web/API/SVGMatrix) and is
- * a subset (elements a to f) of a 3×3 matrix:
- * ```
- * [ a c e ]
- * [ b d f ]
- * [ 0 0 1 ]
- * ```
- */
- /**
- * @private
- * @type {Transform}
- */
- var tmp_ = new Array(6);
- /**
- * Create an identity transform.
- * @return {!Transform} Identity transform.
- */
- function create() {
- return [1, 0, 0, 1, 0, 0];
- }
- /**
- * Resets the given transform to an identity transform.
- * @param {!Transform} transform Transform.
- * @return {!Transform} Transform.
- */
- function transform_reset(transform) {
- return set(transform, 1, 0, 0, 1, 0, 0);
- }
- /**
- * Multiply the underlying matrices of two transforms and return the result in
- * the first transform.
- * @param {!Transform} transform1 Transform parameters of matrix 1.
- * @param {!Transform} transform2 Transform parameters of matrix 2.
- * @return {!Transform} transform1 multiplied with transform2.
- */
- function multiply(transform1, transform2) {
- var a1 = transform1[0];
- var b1 = transform1[1];
- var c1 = transform1[2];
- var d1 = transform1[3];
- var e1 = transform1[4];
- var f1 = transform1[5];
- var a2 = transform2[0];
- var b2 = transform2[1];
- var c2 = transform2[2];
- var d2 = transform2[3];
- var e2 = transform2[4];
- var f2 = transform2[5];
- transform1[0] = a1 * a2 + c1 * b2;
- transform1[1] = b1 * a2 + d1 * b2;
- transform1[2] = a1 * c2 + c1 * d2;
- transform1[3] = b1 * c2 + d1 * d2;
- transform1[4] = a1 * e2 + c1 * f2 + e1;
- transform1[5] = b1 * e2 + d1 * f2 + f1;
- return transform1;
- }
- /**
- * Set the transform components a-f on a given transform.
- * @param {!Transform} transform Transform.
- * @param {number} a The a component of the transform.
- * @param {number} b The b component of the transform.
- * @param {number} c The c component of the transform.
- * @param {number} d The d component of the transform.
- * @param {number} e The e component of the transform.
- * @param {number} f The f component of the transform.
- * @return {!Transform} Matrix with transform applied.
- */
- function set(transform, a, b, c, d, e, f) {
- transform[0] = a;
- transform[1] = b;
- transform[2] = c;
- transform[3] = d;
- transform[4] = e;
- transform[5] = f;
- return transform;
- }
- /**
- * Set transform on one matrix from another matrix.
- * @param {!Transform} transform1 Matrix to set transform to.
- * @param {!Transform} transform2 Matrix to set transform from.
- * @return {!Transform} transform1 with transform from transform2 applied.
- */
- function setFromArray(transform1, transform2) {
- transform1[0] = transform2[0];
- transform1[1] = transform2[1];
- transform1[2] = transform2[2];
- transform1[3] = transform2[3];
- transform1[4] = transform2[4];
- transform1[5] = transform2[5];
- return transform1;
- }
- /**
- * Transforms the given coordinate with the given transform returning the
- * resulting, transformed coordinate. The coordinate will be modified in-place.
- *
- * @param {Transform} transform The transformation.
- * @param {import("./coordinate.js").Coordinate|import("./pixel.js").Pixel} coordinate The coordinate to transform.
- * @return {import("./coordinate.js").Coordinate|import("./pixel.js").Pixel} return coordinate so that operations can be
- * chained together.
- */
- function apply(transform, coordinate) {
- var x = coordinate[0];
- var y = coordinate[1];
- coordinate[0] = transform[0] * x + transform[2] * y + transform[4];
- coordinate[1] = transform[1] * x + transform[3] * y + transform[5];
- return coordinate;
- }
- /**
- * Applies rotation to the given transform.
- * @param {!Transform} transform Transform.
- * @param {number} angle Angle in radians.
- * @return {!Transform} The rotated transform.
- */
- function transform_rotate(transform, angle) {
- var cos = Math.cos(angle);
- var sin = Math.sin(angle);
- return multiply(transform, set(tmp_, cos, sin, -sin, cos, 0, 0));
- }
- /**
- * Applies scale to a given transform.
- * @param {!Transform} transform Transform.
- * @param {number} x Scale factor x.
- * @param {number} y Scale factor y.
- * @return {!Transform} The scaled transform.
- */
- function transform_scale(transform, x, y) {
- return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0));
- }
- /**
- * Creates a scale transform.
- * @param {!Transform} target Transform to overwrite.
- * @param {number} x Scale factor x.
- * @param {number} y Scale factor y.
- * @return {!Transform} The scale transform.
- */
- function makeScale(target, x, y) {
- return set(target, x, 0, 0, y, 0, 0);
- }
- /**
- * Applies translation to the given transform.
- * @param {!Transform} transform Transform.
- * @param {number} dx Translation x.
- * @param {number} dy Translation y.
- * @return {!Transform} The translated transform.
- */
- function translate(transform, dx, dy) {
- return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy));
- }
- /**
- * Creates a composite transform given an initial translation, scale, rotation, and
- * final translation (in that order only, not commutative).
- * @param {!Transform} transform The transform (will be modified in place).
- * @param {number} dx1 Initial translation x.
- * @param {number} dy1 Initial translation y.
- * @param {number} sx Scale factor x.
- * @param {number} sy Scale factor y.
- * @param {number} angle Rotation (in counter-clockwise radians).
- * @param {number} dx2 Final translation x.
- * @param {number} dy2 Final translation y.
- * @return {!Transform} The composite transform.
- */
- function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) {
- var sin = Math.sin(angle);
- var cos = Math.cos(angle);
- transform[0] = sx * cos;
- transform[1] = sy * sin;
- transform[2] = -sx * sin;
- transform[3] = sy * cos;
- transform[4] = dx2 * sx * cos - dy2 * sx * sin + dx1;
- transform[5] = dx2 * sy * sin + dy2 * sy * cos + dy1;
- return transform;
- }
- /**
- * Creates a composite transform given an initial translation, scale, rotation, and
- * final translation (in that order only, not commutative). The resulting transform
- * string can be applied as `transform` property of an HTMLElement's style.
- * @param {number} dx1 Initial translation x.
- * @param {number} dy1 Initial translation y.
- * @param {number} sx Scale factor x.
- * @param {number} sy Scale factor y.
- * @param {number} angle Rotation (in counter-clockwise radians).
- * @param {number} dx2 Final translation x.
- * @param {number} dy2 Final translation y.
- * @return {string} The composite css transform.
- * @api
- */
- function composeCssTransform(dx1, dy1, sx, sy, angle, dx2, dy2) {
- return transform_toString(compose(create(), dx1, dy1, sx, sy, angle, dx2, dy2));
- }
- /**
- * Invert the given transform.
- * @param {!Transform} source The source transform to invert.
- * @return {!Transform} The inverted (source) transform.
- */
- function invert(source) {
- return makeInverse(source, source);
- }
- /**
- * Invert the given transform.
- * @param {!Transform} target Transform to be set as the inverse of
- * the source transform.
- * @param {!Transform} source The source transform to invert.
- * @return {!Transform} The inverted (target) transform.
- */
- function makeInverse(target, source) {
- var det = determinant(source);
- asserts_assert(det !== 0, 32); // Transformation matrix cannot be inverted
- var a = source[0];
- var b = source[1];
- var c = source[2];
- var d = source[3];
- var e = source[4];
- var f = source[5];
- target[0] = d / det;
- target[1] = -b / det;
- target[2] = -c / det;
- target[3] = a / det;
- target[4] = (c * f - d * e) / det;
- target[5] = -(a * f - b * e) / det;
- return target;
- }
- /**
- * Returns the determinant of the given matrix.
- * @param {!Transform} mat Matrix.
- * @return {number} Determinant.
- */
- function determinant(mat) {
- return mat[0] * mat[3] - mat[1] * mat[2];
- }
- /**
- * @type {HTMLElement}
- * @private
- */
- var transformStringDiv;
- /**
- * A rounded string version of the transform. This can be used
- * for CSS transforms.
- * @param {!Transform} mat Matrix.
- * @return {string} The transform as a string.
- */
- function transform_toString(mat) {
- var transformString = 'matrix(' + mat.join(', ') + ')';
- if (WORKER_OFFSCREEN_CANVAS) {
- return transformString;
- }
- var node = transformStringDiv || (transformStringDiv = document.createElement('div'));
- node.style.transform = transformString;
- return node.style.transform;
- }
- //# sourceMappingURL=transform.js.map
- ;// ./node_modules/ol/geom/flat/transform.js
- /**
- * @module ol/geom/flat/transform
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {import("../../transform.js").Transform} transform Transform.
- * @param {Array<number>} [opt_dest] Destination.
- * @return {Array<number>} Transformed coordinates.
- */
- function transform2D(flatCoordinates, offset, end, stride, transform, opt_dest) {
- var dest = opt_dest ? opt_dest : [];
- var i = 0;
- for (var j = offset; j < end; j += stride) {
- var x = flatCoordinates[j];
- var y = flatCoordinates[j + 1];
- dest[i++] = transform[0] * x + transform[2] * y + transform[4];
- dest[i++] = transform[1] * x + transform[3] * y + transform[5];
- }
- if (opt_dest && dest.length != i) {
- dest.length = i;
- }
- return dest;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} angle Angle.
- * @param {Array<number>} anchor Rotation anchor point.
- * @param {Array<number>} [opt_dest] Destination.
- * @return {Array<number>} Transformed coordinates.
- */
- function flat_transform_rotate(flatCoordinates, offset, end, stride, angle, anchor, opt_dest) {
- var dest = opt_dest ? opt_dest : [];
- var cos = Math.cos(angle);
- var sin = Math.sin(angle);
- var anchorX = anchor[0];
- var anchorY = anchor[1];
- var i = 0;
- for (var j = offset; j < end; j += stride) {
- var deltaX = flatCoordinates[j] - anchorX;
- var deltaY = flatCoordinates[j + 1] - anchorY;
- dest[i++] = anchorX + deltaX * cos - deltaY * sin;
- dest[i++] = anchorY + deltaX * sin + deltaY * cos;
- for (var k = j + 2; k < j + stride; ++k) {
- dest[i++] = flatCoordinates[k];
- }
- }
- if (opt_dest && dest.length != i) {
- dest.length = i;
- }
- return dest;
- }
- /**
- * Scale the coordinates.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} sx Scale factor in the x-direction.
- * @param {number} sy Scale factor in the y-direction.
- * @param {Array<number>} anchor Scale anchor point.
- * @param {Array<number>} [opt_dest] Destination.
- * @return {Array<number>} Transformed coordinates.
- */
- function flat_transform_scale(flatCoordinates, offset, end, stride, sx, sy, anchor, opt_dest) {
- var dest = opt_dest ? opt_dest : [];
- var anchorX = anchor[0];
- var anchorY = anchor[1];
- var i = 0;
- for (var j = offset; j < end; j += stride) {
- var deltaX = flatCoordinates[j] - anchorX;
- var deltaY = flatCoordinates[j + 1] - anchorY;
- dest[i++] = anchorX + sx * deltaX;
- dest[i++] = anchorY + sy * deltaY;
- for (var k = j + 2; k < j + stride; ++k) {
- dest[i++] = flatCoordinates[k];
- }
- }
- if (opt_dest && dest.length != i) {
- dest.length = i;
- }
- return dest;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} deltaX Delta X.
- * @param {number} deltaY Delta Y.
- * @param {Array<number>} [opt_dest] Destination.
- * @return {Array<number>} Transformed coordinates.
- */
- function transform_translate(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {
- var dest = opt_dest ? opt_dest : [];
- var i = 0;
- for (var j = offset; j < end; j += stride) {
- dest[i++] = flatCoordinates[j] + deltaX;
- dest[i++] = flatCoordinates[j + 1] + deltaY;
- for (var k = j + 2; k < j + stride; ++k) {
- dest[i++] = flatCoordinates[k];
- }
- }
- if (opt_dest && dest.length != i) {
- dest.length = i;
- }
- return dest;
- }
- //# sourceMappingURL=transform.js.map
- ;// ./node_modules/ol/geom/Geometry.js
- var Geometry_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/geom/Geometry
- */
- /**
- * @typedef {'Point' | 'LineString' | 'LinearRing' | 'Polygon' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon' | 'GeometryCollection' | 'Circle'} Type
- * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,
- * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,
- * `'GeometryCollection'`, or `'Circle'`.
- */
- /**
- * @type {import("../transform.js").Transform}
- */
- var tmpTransform = create();
- /**
- * @classdesc
- * Abstract base class; normally only used for creating subclasses and not
- * instantiated in apps.
- * Base class for vector geometries.
- *
- * To get notified of changes to the geometry, register a listener for the
- * generic `change` event on your geometry instance.
- *
- * @abstract
- * @api
- */
- var Geometry = /** @class */ (function (_super) {
- Geometry_extends(Geometry, _super);
- function Geometry() {
- var _this = _super.call(this) || this;
- /**
- * @private
- * @type {import("../extent.js").Extent}
- */
- _this.extent_ = createEmpty();
- /**
- * @private
- * @type {number}
- */
- _this.extentRevision_ = -1;
- /**
- * @protected
- * @type {number}
- */
- _this.simplifiedGeometryMaxMinSquaredTolerance = 0;
- /**
- * @protected
- * @type {number}
- */
- _this.simplifiedGeometryRevision = 0;
- /**
- * Get a transformed and simplified version of the geometry.
- * @abstract
- * @param {number} revision The geometry revision.
- * @param {number} squaredTolerance Squared tolerance.
- * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
- * @return {Geometry} Simplified geometry.
- */
- _this.simplifyTransformedInternal = memoizeOne(function (revision, squaredTolerance, opt_transform) {
- if (!opt_transform) {
- return this.getSimplifiedGeometry(squaredTolerance);
- }
- var clone = this.clone();
- clone.applyTransform(opt_transform);
- return clone.getSimplifiedGeometry(squaredTolerance);
- });
- return _this;
- }
- /**
- * Get a transformed and simplified version of the geometry.
- * @abstract
- * @param {number} squaredTolerance Squared tolerance.
- * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
- * @return {Geometry} Simplified geometry.
- */
- Geometry.prototype.simplifyTransformed = function (squaredTolerance, opt_transform) {
- return this.simplifyTransformedInternal(this.getRevision(), squaredTolerance, opt_transform);
- };
- /**
- * Make a complete copy of the geometry.
- * @abstract
- * @return {!Geometry} Clone.
- */
- Geometry.prototype.clone = function () {
- return util_abstract();
- };
- /**
- * @abstract
- * @param {number} x X.
- * @param {number} y Y.
- * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @return {number} Minimum squared distance.
- */
- Geometry.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
- return util_abstract();
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @return {boolean} Contains (x, y).
- */
- Geometry.prototype.containsXY = function (x, y) {
- var coord = this.getClosestPoint([x, y]);
- return coord[0] === x && coord[1] === y;
- };
- /**
- * Return the closest point of the geometry to the passed point as
- * {@link module:ol/coordinate~Coordinate coordinate}.
- * @param {import("../coordinate.js").Coordinate} point Point.
- * @param {import("../coordinate.js").Coordinate} [opt_closestPoint] Closest point.
- * @return {import("../coordinate.js").Coordinate} Closest point.
- * @api
- */
- Geometry.prototype.getClosestPoint = function (point, opt_closestPoint) {
- var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN];
- this.closestPointXY(point[0], point[1], closestPoint, Infinity);
- return closestPoint;
- };
- /**
- * Returns true if this geometry includes the specified coordinate. If the
- * coordinate is on the boundary of the geometry, returns false.
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @return {boolean} Contains coordinate.
- * @api
- */
- Geometry.prototype.intersectsCoordinate = function (coordinate) {
- return this.containsXY(coordinate[0], coordinate[1]);
- };
- /**
- * @abstract
- * @param {import("../extent.js").Extent} extent Extent.
- * @protected
- * @return {import("../extent.js").Extent} extent Extent.
- */
- Geometry.prototype.computeExtent = function (extent) {
- return util_abstract();
- };
- /**
- * Get the extent of the geometry.
- * @param {import("../extent.js").Extent} [opt_extent] Extent.
- * @return {import("../extent.js").Extent} extent Extent.
- * @api
- */
- Geometry.prototype.getExtent = function (opt_extent) {
- if (this.extentRevision_ != this.getRevision()) {
- var extent = this.computeExtent(this.extent_);
- if (isNaN(extent[0]) || isNaN(extent[1])) {
- createOrUpdateEmpty(extent);
- }
- this.extentRevision_ = this.getRevision();
- }
- return returnOrUpdate(this.extent_, opt_extent);
- };
- /**
- * Rotate the geometry around a given coordinate. This modifies the geometry
- * coordinates in place.
- * @abstract
- * @param {number} angle Rotation angle in radians.
- * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
- * @api
- */
- Geometry.prototype.rotate = function (angle, anchor) {
- util_abstract();
- };
- /**
- * Scale the geometry (with an optional origin). This modifies the geometry
- * coordinates in place.
- * @abstract
- * @param {number} sx The scaling factor in the x-direction.
- * @param {number} [opt_sy] The scaling factor in the y-direction (defaults to sx).
- * @param {import("../coordinate.js").Coordinate} [opt_anchor] The scale origin (defaults to the center
- * of the geometry extent).
- * @api
- */
- Geometry.prototype.scale = function (sx, opt_sy, opt_anchor) {
- util_abstract();
- };
- /**
- * Create a simplified version of this geometry. For linestrings, this uses
- * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)
- * algorithm. For polygons, a quantization-based
- * simplification is used to preserve topology.
- * @param {number} tolerance The tolerance distance for simplification.
- * @return {Geometry} A new, simplified version of the original geometry.
- * @api
- */
- Geometry.prototype.simplify = function (tolerance) {
- return this.getSimplifiedGeometry(tolerance * tolerance);
- };
- /**
- * Create a simplified version of this geometry using the Douglas Peucker
- * algorithm.
- * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.
- * @abstract
- * @param {number} squaredTolerance Squared tolerance.
- * @return {Geometry} Simplified geometry.
- */
- Geometry.prototype.getSimplifiedGeometry = function (squaredTolerance) {
- return util_abstract();
- };
- /**
- * Get the type of this geometry.
- * @abstract
- * @return {Type} Geometry type.
- */
- Geometry.prototype.getType = function () {
- return util_abstract();
- };
- /**
- * Apply a transform function to the coordinates of the geometry.
- * The geometry is modified in place.
- * If you do not want the geometry modified in place, first `clone()` it and
- * then use this function on the clone.
- * @abstract
- * @param {import("../proj.js").TransformFunction} transformFn Transform function.
- * Called with a flat array of geometry coordinates.
- */
- Geometry.prototype.applyTransform = function (transformFn) {
- util_abstract();
- };
- /**
- * Test if the geometry and the passed extent intersect.
- * @abstract
- * @param {import("../extent.js").Extent} extent Extent.
- * @return {boolean} `true` if the geometry and the extent intersect.
- */
- Geometry.prototype.intersectsExtent = function (extent) {
- return util_abstract();
- };
- /**
- * Translate the geometry. This modifies the geometry coordinates in place. If
- * instead you want a new geometry, first `clone()` this geometry.
- * @abstract
- * @param {number} deltaX Delta X.
- * @param {number} deltaY Delta Y.
- * @api
- */
- Geometry.prototype.translate = function (deltaX, deltaY) {
- util_abstract();
- };
- /**
- * Transform each coordinate of the geometry from one coordinate reference
- * system to another. The geometry is modified in place.
- * For example, a line will be transformed to a line and a circle to a circle.
- * If you do not want the geometry modified in place, first `clone()` it and
- * then use this function on the clone.
- *
- * @param {import("../proj.js").ProjectionLike} source The current projection. Can be a
- * string identifier or a {@link module:ol/proj/Projection~Projection} object.
- * @param {import("../proj.js").ProjectionLike} destination The desired projection. Can be a
- * string identifier or a {@link module:ol/proj/Projection~Projection} object.
- * @return {Geometry} This geometry. Note that original geometry is
- * modified in place.
- * @api
- */
- Geometry.prototype.transform = function (source, destination) {
- /** @type {import("../proj/Projection.js").default} */
- var sourceProj = proj_get(source);
- var transformFn = sourceProj.getUnits() == proj_Units.TILE_PIXELS
- ? function (inCoordinates, outCoordinates, stride) {
- var pixelExtent = sourceProj.getExtent();
- var projectedExtent = sourceProj.getWorldExtent();
- var scale = getHeight(projectedExtent) / getHeight(pixelExtent);
- compose(tmpTransform, projectedExtent[0], projectedExtent[3], scale, -scale, 0, 0, 0);
- transform2D(inCoordinates, 0, inCoordinates.length, stride, tmpTransform, outCoordinates);
- return getTransform(sourceProj, destination)(inCoordinates, outCoordinates, stride);
- }
- : getTransform(sourceProj, destination);
- this.applyTransform(transformFn);
- return this;
- };
- return Geometry;
- }(ol_Object));
- /* harmony default export */ var geom_Geometry = (Geometry);
- //# sourceMappingURL=Geometry.js.map
- ;// ./node_modules/ol/geom/SimpleGeometry.js
- var SimpleGeometry_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/geom/SimpleGeometry
- */
- /**
- * @classdesc
- * Abstract base class; only used for creating subclasses; do not instantiate
- * in apps, as cannot be rendered.
- *
- * @abstract
- * @api
- */
- var SimpleGeometry = /** @class */ (function (_super) {
- SimpleGeometry_extends(SimpleGeometry, _super);
- function SimpleGeometry() {
- var _this = _super.call(this) || this;
- /**
- * @protected
- * @type {import("./GeometryLayout.js").default}
- */
- _this.layout = geom_GeometryLayout.XY;
- /**
- * @protected
- * @type {number}
- */
- _this.stride = 2;
- /**
- * @protected
- * @type {Array<number>}
- */
- _this.flatCoordinates = null;
- return _this;
- }
- /**
- * @param {import("../extent.js").Extent} extent Extent.
- * @protected
- * @return {import("../extent.js").Extent} extent Extent.
- */
- SimpleGeometry.prototype.computeExtent = function (extent) {
- return createOrUpdateFromFlatCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, extent);
- };
- /**
- * @abstract
- * @return {Array<*> | null} Coordinates.
- */
- SimpleGeometry.prototype.getCoordinates = function () {
- return util_abstract();
- };
- /**
- * Return the first coordinate of the geometry.
- * @return {import("../coordinate.js").Coordinate} First coordinate.
- * @api
- */
- SimpleGeometry.prototype.getFirstCoordinate = function () {
- return this.flatCoordinates.slice(0, this.stride);
- };
- /**
- * @return {Array<number>} Flat coordinates.
- */
- SimpleGeometry.prototype.getFlatCoordinates = function () {
- return this.flatCoordinates;
- };
- /**
- * Return the last coordinate of the geometry.
- * @return {import("../coordinate.js").Coordinate} Last point.
- * @api
- */
- SimpleGeometry.prototype.getLastCoordinate = function () {
- return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride);
- };
- /**
- * Return the {@link module:ol/geom/GeometryLayout layout} of the geometry.
- * @return {import("./GeometryLayout.js").default} Layout.
- * @api
- */
- SimpleGeometry.prototype.getLayout = function () {
- return this.layout;
- };
- /**
- * Create a simplified version of this geometry using the Douglas Peucker algorithm.
- * @param {number} squaredTolerance Squared tolerance.
- * @return {SimpleGeometry} Simplified geometry.
- */
- SimpleGeometry.prototype.getSimplifiedGeometry = function (squaredTolerance) {
- if (this.simplifiedGeometryRevision !== this.getRevision()) {
- this.simplifiedGeometryMaxMinSquaredTolerance = 0;
- this.simplifiedGeometryRevision = this.getRevision();
- }
- // If squaredTolerance is negative or if we know that simplification will not
- // have any effect then just return this.
- if (squaredTolerance < 0 ||
- (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&
- squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance)) {
- return this;
- }
- var simplifiedGeometry = this.getSimplifiedGeometryInternal(squaredTolerance);
- var simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates();
- if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) {
- return simplifiedGeometry;
- }
- else {
- // Simplification did not actually remove any coordinates. We now know
- // that any calls to getSimplifiedGeometry with a squaredTolerance less
- // than or equal to the current squaredTolerance will also not have any
- // effect. This allows us to short circuit simplification (saving CPU
- // cycles) and prevents the cache of simplified geometries from filling
- // up with useless identical copies of this geometry (saving memory).
- this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;
- return this;
- }
- };
- /**
- * @param {number} squaredTolerance Squared tolerance.
- * @return {SimpleGeometry} Simplified geometry.
- * @protected
- */
- SimpleGeometry.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
- return this;
- };
- /**
- * @return {number} Stride.
- */
- SimpleGeometry.prototype.getStride = function () {
- return this.stride;
- };
- /**
- * @param {import("./GeometryLayout.js").default} layout Layout.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- */
- SimpleGeometry.prototype.setFlatCoordinates = function (layout, flatCoordinates) {
- this.stride = getStrideForLayout(layout);
- this.layout = layout;
- this.flatCoordinates = flatCoordinates;
- };
- /**
- * @abstract
- * @param {!Array<*>} coordinates Coordinates.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- */
- SimpleGeometry.prototype.setCoordinates = function (coordinates, opt_layout) {
- util_abstract();
- };
- /**
- * @param {import("./GeometryLayout.js").default|undefined} layout Layout.
- * @param {Array<*>} coordinates Coordinates.
- * @param {number} nesting Nesting.
- * @protected
- */
- SimpleGeometry.prototype.setLayout = function (layout, coordinates, nesting) {
- /** @type {number} */
- var stride;
- if (layout) {
- stride = getStrideForLayout(layout);
- }
- else {
- for (var i = 0; i < nesting; ++i) {
- if (coordinates.length === 0) {
- this.layout = geom_GeometryLayout.XY;
- this.stride = 2;
- return;
- }
- else {
- coordinates = /** @type {Array} */ (coordinates[0]);
- }
- }
- stride = coordinates.length;
- layout = getLayoutForStride(stride);
- }
- this.layout = layout;
- this.stride = stride;
- };
- /**
- * Apply a transform function to the coordinates of the geometry.
- * The geometry is modified in place.
- * If you do not want the geometry modified in place, first `clone()` it and
- * then use this function on the clone.
- * @param {import("../proj.js").TransformFunction} transformFn Transform function.
- * Called with a flat array of geometry coordinates.
- * @api
- */
- SimpleGeometry.prototype.applyTransform = function (transformFn) {
- if (this.flatCoordinates) {
- transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);
- this.changed();
- }
- };
- /**
- * Rotate the geometry around a given coordinate. This modifies the geometry
- * coordinates in place.
- * @param {number} angle Rotation angle in counter-clockwise radians.
- * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
- * @api
- */
- SimpleGeometry.prototype.rotate = function (angle, anchor) {
- var flatCoordinates = this.getFlatCoordinates();
- if (flatCoordinates) {
- var stride = this.getStride();
- flat_transform_rotate(flatCoordinates, 0, flatCoordinates.length, stride, angle, anchor, flatCoordinates);
- this.changed();
- }
- };
- /**
- * Scale the geometry (with an optional origin). This modifies the geometry
- * coordinates in place.
- * @param {number} sx The scaling factor in the x-direction.
- * @param {number} [opt_sy] The scaling factor in the y-direction (defaults to sx).
- * @param {import("../coordinate.js").Coordinate} [opt_anchor] The scale origin (defaults to the center
- * of the geometry extent).
- * @api
- */
- SimpleGeometry.prototype.scale = function (sx, opt_sy, opt_anchor) {
- var sy = opt_sy;
- if (sy === undefined) {
- sy = sx;
- }
- var anchor = opt_anchor;
- if (!anchor) {
- anchor = getCenter(this.getExtent());
- }
- var flatCoordinates = this.getFlatCoordinates();
- if (flatCoordinates) {
- var stride = this.getStride();
- flat_transform_scale(flatCoordinates, 0, flatCoordinates.length, stride, sx, sy, anchor, flatCoordinates);
- this.changed();
- }
- };
- /**
- * Translate the geometry. This modifies the geometry coordinates in place. If
- * instead you want a new geometry, first `clone()` this geometry.
- * @param {number} deltaX Delta X.
- * @param {number} deltaY Delta Y.
- * @api
- */
- SimpleGeometry.prototype.translate = function (deltaX, deltaY) {
- var flatCoordinates = this.getFlatCoordinates();
- if (flatCoordinates) {
- var stride = this.getStride();
- transform_translate(flatCoordinates, 0, flatCoordinates.length, stride, deltaX, deltaY, flatCoordinates);
- this.changed();
- }
- };
- return SimpleGeometry;
- }(geom_Geometry));
- /**
- * @param {number} stride Stride.
- * @return {import("./GeometryLayout.js").default} layout Layout.
- */
- function getLayoutForStride(stride) {
- var layout;
- if (stride == 2) {
- layout = geom_GeometryLayout.XY;
- }
- else if (stride == 3) {
- layout = geom_GeometryLayout.XYZ;
- }
- else if (stride == 4) {
- layout = geom_GeometryLayout.XYZM;
- }
- return /** @type {import("./GeometryLayout.js").default} */ (layout);
- }
- /**
- * @param {import("./GeometryLayout.js").default} layout Layout.
- * @return {number} Stride.
- */
- function getStrideForLayout(layout) {
- var stride;
- if (layout == geom_GeometryLayout.XY) {
- stride = 2;
- }
- else if (layout == geom_GeometryLayout.XYZ || layout == geom_GeometryLayout.XYM) {
- stride = 3;
- }
- else if (layout == geom_GeometryLayout.XYZM) {
- stride = 4;
- }
- return /** @type {number} */ (stride);
- }
- /**
- * @param {SimpleGeometry} simpleGeometry Simple geometry.
- * @param {import("../transform.js").Transform} transform Transform.
- * @param {Array<number>} [opt_dest] Destination.
- * @return {Array<number>} Transformed flat coordinates.
- */
- function transformGeom2D(simpleGeometry, transform, opt_dest) {
- var flatCoordinates = simpleGeometry.getFlatCoordinates();
- if (!flatCoordinates) {
- return null;
- }
- else {
- var stride = simpleGeometry.getStride();
- return transform2D(flatCoordinates, 0, flatCoordinates.length, stride, transform, opt_dest);
- }
- }
- /* harmony default export */ var geom_SimpleGeometry = (SimpleGeometry);
- //# sourceMappingURL=SimpleGeometry.js.map
- ;// ./node_modules/ol/geom/flat/closest.js
- /**
- * @module ol/geom/flat/closest
- */
- /**
- * Returns the point on the 2D line segment flatCoordinates[offset1] to
- * flatCoordinates[offset2] that is closest to the point (x, y). Extra
- * dimensions are linearly interpolated.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset1 Offset 1.
- * @param {number} offset2 Offset 2.
- * @param {number} stride Stride.
- * @param {number} x X.
- * @param {number} y Y.
- * @param {Array<number>} closestPoint Closest point.
- */
- function assignClosest(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) {
- var x1 = flatCoordinates[offset1];
- var y1 = flatCoordinates[offset1 + 1];
- var dx = flatCoordinates[offset2] - x1;
- var dy = flatCoordinates[offset2 + 1] - y1;
- var offset;
- if (dx === 0 && dy === 0) {
- offset = offset1;
- }
- else {
- var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);
- if (t > 1) {
- offset = offset2;
- }
- else if (t > 0) {
- for (var i = 0; i < stride; ++i) {
- closestPoint[i] = lerp(flatCoordinates[offset1 + i], flatCoordinates[offset2 + i], t);
- }
- closestPoint.length = stride;
- return;
- }
- else {
- offset = offset1;
- }
- }
- for (var i = 0; i < stride; ++i) {
- closestPoint[i] = flatCoordinates[offset + i];
- }
- closestPoint.length = stride;
- }
- /**
- * Return the squared of the largest distance between any pair of consecutive
- * coordinates.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} max Max squared delta.
- * @return {number} Max squared delta.
- */
- function maxSquaredDelta(flatCoordinates, offset, end, stride, max) {
- var x1 = flatCoordinates[offset];
- var y1 = flatCoordinates[offset + 1];
- for (offset += stride; offset < end; offset += stride) {
- var x2 = flatCoordinates[offset];
- var y2 = flatCoordinates[offset + 1];
- var squaredDelta = math_squaredDistance(x1, y1, x2, y2);
- if (squaredDelta > max) {
- max = squaredDelta;
- }
- x1 = x2;
- y1 = y2;
- }
- return max;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {number} max Max squared delta.
- * @return {number} Max squared delta.
- */
- function arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max) {
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- max = maxSquaredDelta(flatCoordinates, offset, end, stride, max);
- offset = end;
- }
- return max;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @param {number} max Max squared delta.
- * @return {number} Max squared delta.
- */
- function multiArrayMaxSquaredDelta(flatCoordinates, offset, endss, stride, max) {
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- max = arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max);
- offset = ends[ends.length - 1];
- }
- return max;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} maxDelta Max delta.
- * @param {boolean} isRing Is ring.
- * @param {number} x X.
- * @param {number} y Y.
- * @param {Array<number>} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @param {Array<number>} [opt_tmpPoint] Temporary point object.
- * @return {number} Minimum squared distance.
- */
- function assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) {
- if (offset == end) {
- return minSquaredDistance;
- }
- var i, squaredDistance;
- if (maxDelta === 0) {
- // All points are identical, so just test the first point.
- squaredDistance = math_squaredDistance(x, y, flatCoordinates[offset], flatCoordinates[offset + 1]);
- if (squaredDistance < minSquaredDistance) {
- for (i = 0; i < stride; ++i) {
- closestPoint[i] = flatCoordinates[offset + i];
- }
- closestPoint.length = stride;
- return squaredDistance;
- }
- else {
- return minSquaredDistance;
- }
- }
- var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
- var index = offset + stride;
- while (index < end) {
- assignClosest(flatCoordinates, index - stride, index, stride, x, y, tmpPoint);
- squaredDistance = math_squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
- if (squaredDistance < minSquaredDistance) {
- minSquaredDistance = squaredDistance;
- for (i = 0; i < stride; ++i) {
- closestPoint[i] = tmpPoint[i];
- }
- closestPoint.length = stride;
- index += stride;
- }
- else {
- // Skip ahead multiple points, because we know that all the skipped
- // points cannot be any closer than the closest point we have found so
- // far. We know this because we know how close the current point is, how
- // close the closest point we have found so far is, and the maximum
- // distance between consecutive points. For example, if we're currently
- // at distance 10, the best we've found so far is 3, and that the maximum
- // distance between consecutive points is 2, then we'll need to skip at
- // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of
- // finding a closer point. We use Math.max(..., 1) to ensure that we
- // always advance at least one point, to avoid an infinite loop.
- index +=
- stride *
- Math.max(((Math.sqrt(squaredDistance) - Math.sqrt(minSquaredDistance)) /
- maxDelta) |
- 0, 1);
- }
- }
- if (isRing) {
- // Check the closing segment.
- assignClosest(flatCoordinates, end - stride, offset, stride, x, y, tmpPoint);
- squaredDistance = math_squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
- if (squaredDistance < minSquaredDistance) {
- minSquaredDistance = squaredDistance;
- for (i = 0; i < stride; ++i) {
- closestPoint[i] = tmpPoint[i];
- }
- closestPoint.length = stride;
- }
- }
- return minSquaredDistance;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {number} maxDelta Max delta.
- * @param {boolean} isRing Is ring.
- * @param {number} x X.
- * @param {number} y Y.
- * @param {Array<number>} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @param {Array<number>} [opt_tmpPoint] Temporary point object.
- * @return {number} Minimum squared distance.
- */
- function assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) {
- var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- minSquaredDistance = assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);
- offset = end;
- }
- return minSquaredDistance;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @param {number} maxDelta Max delta.
- * @param {boolean} isRing Is ring.
- * @param {number} x X.
- * @param {number} y Y.
- * @param {Array<number>} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @param {Array<number>} [opt_tmpPoint] Temporary point object.
- * @return {number} Minimum squared distance.
- */
- function assignClosestMultiArrayPoint(flatCoordinates, offset, endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) {
- var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- minSquaredDistance = assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);
- offset = ends[ends.length - 1];
- }
- return minSquaredDistance;
- }
- //# sourceMappingURL=closest.js.map
- ;// ./node_modules/ol/geom/flat/deflate.js
- /**
- * @module ol/geom/flat/deflate
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {number} stride Stride.
- * @return {number} offset Offset.
- */
- function deflateCoordinate(flatCoordinates, offset, coordinate, stride) {
- for (var i = 0, ii = coordinate.length; i < ii; ++i) {
- flatCoordinates[offset++] = coordinate[i];
- }
- return offset;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<import("../../coordinate.js").Coordinate>} coordinates Coordinates.
- * @param {number} stride Stride.
- * @return {number} offset Offset.
- */
- function deflateCoordinates(flatCoordinates, offset, coordinates, stride) {
- for (var i = 0, ii = coordinates.length; i < ii; ++i) {
- var coordinate = coordinates[i];
- for (var j = 0; j < stride; ++j) {
- flatCoordinates[offset++] = coordinate[j];
- }
- }
- return offset;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<import("../../coordinate.js").Coordinate>>} coordinatess Coordinatess.
- * @param {number} stride Stride.
- * @param {Array<number>} [opt_ends] Ends.
- * @return {Array<number>} Ends.
- */
- function deflateCoordinatesArray(flatCoordinates, offset, coordinatess, stride, opt_ends) {
- var ends = opt_ends ? opt_ends : [];
- var i = 0;
- for (var j = 0, jj = coordinatess.length; j < jj; ++j) {
- var end = deflateCoordinates(flatCoordinates, offset, coordinatess[j], stride);
- ends[i++] = end;
- offset = end;
- }
- ends.length = i;
- return ends;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<Array<import("../../coordinate.js").Coordinate>>>} coordinatesss Coordinatesss.
- * @param {number} stride Stride.
- * @param {Array<Array<number>>} [opt_endss] Endss.
- * @return {Array<Array<number>>} Endss.
- */
- function deflateMultiCoordinatesArray(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
- var endss = opt_endss ? opt_endss : [];
- var i = 0;
- for (var j = 0, jj = coordinatesss.length; j < jj; ++j) {
- var ends = deflateCoordinatesArray(flatCoordinates, offset, coordinatesss[j], stride, endss[i]);
- endss[i++] = ends;
- offset = ends[ends.length - 1];
- }
- endss.length = i;
- return endss;
- }
- //# sourceMappingURL=deflate.js.map
- ;// ./node_modules/ol/geom/flat/simplify.js
- /**
- * @module ol/geom/flat/simplify
- */
- // Based on simplify-js https://github.com/mourner/simplify-js
- // Copyright (c) 2012, Vladimir Agafonkin
- // All rights reserved.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions are met:
- //
- // 1. Redistributions of source code must retain the above copyright notice,
- // this list of conditions and the following disclaimer.
- //
- // 2. Redistributions in binary form must reproduce the above copyright
- // notice, this list of conditions and the following disclaimer in the
- // documentation and/or other materials provided with the distribution.
- //
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- // POSSIBILITY OF SUCH DAMAGE.
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} squaredTolerance Squared tolerance.
- * @param {boolean} highQuality Highest quality.
- * @param {Array<number>} [opt_simplifiedFlatCoordinates] Simplified flat
- * coordinates.
- * @return {Array<number>} Simplified line string.
- */
- function simplifyLineString(flatCoordinates, offset, end, stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {
- var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined
- ? opt_simplifiedFlatCoordinates
- : [];
- if (!highQuality) {
- end = radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0);
- flatCoordinates = simplifiedFlatCoordinates;
- offset = 0;
- stride = 2;
- }
- simplifiedFlatCoordinates.length = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0);
- return simplifiedFlatCoordinates;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} squaredTolerance Squared tolerance.
- * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
- * coordinates.
- * @param {number} simplifiedOffset Simplified offset.
- * @return {number} Simplified offset.
- */
- function douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {
- var n = (end - offset) / stride;
- if (n < 3) {
- for (; offset < end; offset += stride) {
- simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];
- simplifiedFlatCoordinates[simplifiedOffset++] =
- flatCoordinates[offset + 1];
- }
- return simplifiedOffset;
- }
- /** @type {Array<number>} */
- var markers = new Array(n);
- markers[0] = 1;
- markers[n - 1] = 1;
- /** @type {Array<number>} */
- var stack = [offset, end - stride];
- var index = 0;
- while (stack.length > 0) {
- var last = stack.pop();
- var first = stack.pop();
- var maxSquaredDistance = 0;
- var x1 = flatCoordinates[first];
- var y1 = flatCoordinates[first + 1];
- var x2 = flatCoordinates[last];
- var y2 = flatCoordinates[last + 1];
- for (var i = first + stride; i < last; i += stride) {
- var x = flatCoordinates[i];
- var y = flatCoordinates[i + 1];
- var squaredDistance_1 = squaredSegmentDistance(x, y, x1, y1, x2, y2);
- if (squaredDistance_1 > maxSquaredDistance) {
- index = i;
- maxSquaredDistance = squaredDistance_1;
- }
- }
- if (maxSquaredDistance > squaredTolerance) {
- markers[(index - offset) / stride] = 1;
- if (first + stride < index) {
- stack.push(first, index);
- }
- if (index + stride < last) {
- stack.push(index, last);
- }
- }
- }
- for (var i = 0; i < n; ++i) {
- if (markers[i]) {
- simplifiedFlatCoordinates[simplifiedOffset++] =
- flatCoordinates[offset + i * stride];
- simplifiedFlatCoordinates[simplifiedOffset++] =
- flatCoordinates[offset + i * stride + 1];
- }
- }
- return simplifiedOffset;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {number} squaredTolerance Squared tolerance.
- * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
- * coordinates.
- * @param {number} simplifiedOffset Simplified offset.
- * @param {Array<number>} simplifiedEnds Simplified ends.
- * @return {number} Simplified offset.
- */
- function douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) {
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- simplifiedOffset = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset);
- simplifiedEnds.push(simplifiedOffset);
- offset = end;
- }
- return simplifiedOffset;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @param {number} squaredTolerance Squared tolerance.
- * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
- * coordinates.
- * @param {number} simplifiedOffset Simplified offset.
- * @param {Array<Array<number>>} simplifiedEndss Simplified endss.
- * @return {number} Simplified offset.
- */
- function douglasPeuckerMultiArray(flatCoordinates, offset, endss, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- var simplifiedEnds = [];
- simplifiedOffset = douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);
- simplifiedEndss.push(simplifiedEnds);
- offset = ends[ends.length - 1];
- }
- return simplifiedOffset;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} squaredTolerance Squared tolerance.
- * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
- * coordinates.
- * @param {number} simplifiedOffset Simplified offset.
- * @return {number} Simplified offset.
- */
- function radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {
- if (end <= offset + stride) {
- // zero or one point, no simplification possible, so copy and return
- for (; offset < end; offset += stride) {
- simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];
- simplifiedFlatCoordinates[simplifiedOffset++] =
- flatCoordinates[offset + 1];
- }
- return simplifiedOffset;
- }
- var x1 = flatCoordinates[offset];
- var y1 = flatCoordinates[offset + 1];
- // copy first point
- simplifiedFlatCoordinates[simplifiedOffset++] = x1;
- simplifiedFlatCoordinates[simplifiedOffset++] = y1;
- var x2 = x1;
- var y2 = y1;
- for (offset += stride; offset < end; offset += stride) {
- x2 = flatCoordinates[offset];
- y2 = flatCoordinates[offset + 1];
- if (squaredDistance(x1, y1, x2, y2) > squaredTolerance) {
- // copy point at offset
- simplifiedFlatCoordinates[simplifiedOffset++] = x2;
- simplifiedFlatCoordinates[simplifiedOffset++] = y2;
- x1 = x2;
- y1 = y2;
- }
- }
- if (x2 != x1 || y2 != y1) {
- // copy last point
- simplifiedFlatCoordinates[simplifiedOffset++] = x2;
- simplifiedFlatCoordinates[simplifiedOffset++] = y2;
- }
- return simplifiedOffset;
- }
- /**
- * @param {number} value Value.
- * @param {number} tolerance Tolerance.
- * @return {number} Rounded value.
- */
- function snap(value, tolerance) {
- return tolerance * Math.round(value / tolerance);
- }
- /**
- * Simplifies a line string using an algorithm designed by Tim Schaub.
- * Coordinates are snapped to the nearest value in a virtual grid and
- * consecutive duplicate coordinates are discarded. This effectively preserves
- * topology as the simplification of any subsection of a line string is
- * independent of the rest of the line string. This means that, for examples,
- * the common edge between two polygons will be simplified to the same line
- * string independently in both polygons. This implementation uses a single
- * pass over the coordinates and eliminates intermediate collinear points.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} tolerance Tolerance.
- * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
- * coordinates.
- * @param {number} simplifiedOffset Simplified offset.
- * @return {number} Simplified offset.
- */
- function quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset) {
- // do nothing if the line is empty
- if (offset == end) {
- return simplifiedOffset;
- }
- // snap the first coordinate (P1)
- var x1 = snap(flatCoordinates[offset], tolerance);
- var y1 = snap(flatCoordinates[offset + 1], tolerance);
- offset += stride;
- // add the first coordinate to the output
- simplifiedFlatCoordinates[simplifiedOffset++] = x1;
- simplifiedFlatCoordinates[simplifiedOffset++] = y1;
- // find the next coordinate that does not snap to the same value as the first
- // coordinate (P2)
- var x2, y2;
- do {
- x2 = snap(flatCoordinates[offset], tolerance);
- y2 = snap(flatCoordinates[offset + 1], tolerance);
- offset += stride;
- if (offset == end) {
- // all coordinates snap to the same value, the line collapses to a point
- // push the last snapped value anyway to ensure that the output contains
- // at least two points
- // FIXME should we really return at least two points anyway?
- simplifiedFlatCoordinates[simplifiedOffset++] = x2;
- simplifiedFlatCoordinates[simplifiedOffset++] = y2;
- return simplifiedOffset;
- }
- } while (x2 == x1 && y2 == y1);
- while (offset < end) {
- // snap the next coordinate (P3)
- var x3 = snap(flatCoordinates[offset], tolerance);
- var y3 = snap(flatCoordinates[offset + 1], tolerance);
- offset += stride;
- // skip P3 if it is equal to P2
- if (x3 == x2 && y3 == y2) {
- continue;
- }
- // calculate the delta between P1 and P2
- var dx1 = x2 - x1;
- var dy1 = y2 - y1;
- // calculate the delta between P3 and P1
- var dx2 = x3 - x1;
- var dy2 = y3 - y1;
- // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from
- // P1 in the same direction then P2 is on the straight line between P1 and
- // P3
- if (dx1 * dy2 == dy1 * dx2 &&
- ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) &&
- ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))) {
- // discard P2 and set P2 = P3
- x2 = x3;
- y2 = y3;
- continue;
- }
- // either P1, P2, and P3 are not colinear, or they are colinear but P3 is
- // between P3 and P1 or on the opposite half of the line to P2. add P2,
- // and continue with P1 = P2 and P2 = P3
- simplifiedFlatCoordinates[simplifiedOffset++] = x2;
- simplifiedFlatCoordinates[simplifiedOffset++] = y2;
- x1 = x2;
- y1 = y2;
- x2 = x3;
- y2 = y3;
- }
- // add the last point (P2)
- simplifiedFlatCoordinates[simplifiedOffset++] = x2;
- simplifiedFlatCoordinates[simplifiedOffset++] = y2;
- return simplifiedOffset;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {number} tolerance Tolerance.
- * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
- * coordinates.
- * @param {number} simplifiedOffset Simplified offset.
- * @param {Array<number>} simplifiedEnds Simplified ends.
- * @return {number} Simplified offset.
- */
- function quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) {
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- simplifiedOffset = quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset);
- simplifiedEnds.push(simplifiedOffset);
- offset = end;
- }
- return simplifiedOffset;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @param {number} tolerance Tolerance.
- * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
- * coordinates.
- * @param {number} simplifiedOffset Simplified offset.
- * @param {Array<Array<number>>} simplifiedEndss Simplified endss.
- * @return {number} Simplified offset.
- */
- function quantizeMultiArray(flatCoordinates, offset, endss, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- var simplifiedEnds = [];
- simplifiedOffset = quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);
- simplifiedEndss.push(simplifiedEnds);
- offset = ends[ends.length - 1];
- }
- return simplifiedOffset;
- }
- //# sourceMappingURL=simplify.js.map
- ;// ./node_modules/ol/geom/flat/segments.js
- /**
- * @module ol/geom/flat/segments
- */
- /**
- * This function calls `callback` for each segment of the flat coordinates
- * array. If the callback returns a truthy value the function returns that
- * value immediately. Otherwise the function returns `false`.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {function(import("../../coordinate.js").Coordinate, import("../../coordinate.js").Coordinate): T} callback Function
- * called for each segment.
- * @return {T|boolean} Value.
- * @template T
- */
- function forEach(flatCoordinates, offset, end, stride, callback) {
- var ret;
- offset += stride;
- for (; offset < end; offset += stride) {
- ret = callback(flatCoordinates.slice(offset - stride, offset), flatCoordinates.slice(offset, offset + stride));
- if (ret) {
- return ret;
- }
- }
- return false;
- }
- //# sourceMappingURL=segments.js.map
- ;// ./node_modules/ol/geom/flat/inflate.js
- /**
- * @module ol/geom/flat/inflate
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {Array<import("../../coordinate.js").Coordinate>} [opt_coordinates] Coordinates.
- * @return {Array<import("../../coordinate.js").Coordinate>} Coordinates.
- */
- function inflateCoordinates(flatCoordinates, offset, end, stride, opt_coordinates) {
- var coordinates = opt_coordinates !== undefined ? opt_coordinates : [];
- var i = 0;
- for (var j = offset; j < end; j += stride) {
- coordinates[i++] = flatCoordinates.slice(j, j + stride);
- }
- coordinates.length = i;
- return coordinates;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {Array<Array<import("../../coordinate.js").Coordinate>>} [opt_coordinatess] Coordinatess.
- * @return {Array<Array<import("../../coordinate.js").Coordinate>>} Coordinatess.
- */
- function inflateCoordinatesArray(flatCoordinates, offset, ends, stride, opt_coordinatess) {
- var coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : [];
- var i = 0;
- for (var j = 0, jj = ends.length; j < jj; ++j) {
- var end = ends[j];
- coordinatess[i++] = inflateCoordinates(flatCoordinates, offset, end, stride, coordinatess[i]);
- offset = end;
- }
- coordinatess.length = i;
- return coordinatess;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @param {Array<Array<Array<import("../../coordinate.js").Coordinate>>>} [opt_coordinatesss]
- * Coordinatesss.
- * @return {Array<Array<Array<import("../../coordinate.js").Coordinate>>>} Coordinatesss.
- */
- function inflateMultiCoordinatesArray(flatCoordinates, offset, endss, stride, opt_coordinatesss) {
- var coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : [];
- var i = 0;
- for (var j = 0, jj = endss.length; j < jj; ++j) {
- var ends = endss[j];
- coordinatesss[i++] = inflateCoordinatesArray(flatCoordinates, offset, ends, stride, coordinatesss[i]);
- offset = ends[ends.length - 1];
- }
- coordinatesss.length = i;
- return coordinatesss;
- }
- //# sourceMappingURL=inflate.js.map
- ;// ./node_modules/ol/geom/flat/interpolate.js
- /**
- * @module ol/geom/flat/interpolate
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} fraction Fraction.
- * @param {Array<number>} [opt_dest] Destination.
- * @param {number} [opt_dimension] Destination dimension (default is `2`)
- * @return {Array<number>} Destination.
- */
- function interpolatePoint(flatCoordinates, offset, end, stride, fraction, opt_dest, opt_dimension) {
- var o, t;
- var n = (end - offset) / stride;
- if (n === 1) {
- o = offset;
- }
- else if (n === 2) {
- o = offset;
- t = fraction;
- }
- else if (n !== 0) {
- var x1 = flatCoordinates[offset];
- var y1 = flatCoordinates[offset + 1];
- var length_1 = 0;
- var cumulativeLengths = [0];
- for (var i = offset + stride; i < end; i += stride) {
- var x2 = flatCoordinates[i];
- var y2 = flatCoordinates[i + 1];
- length_1 += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
- cumulativeLengths.push(length_1);
- x1 = x2;
- y1 = y2;
- }
- var target = fraction * length_1;
- var index = binarySearch(cumulativeLengths, target);
- if (index < 0) {
- t =
- (target - cumulativeLengths[-index - 2]) /
- (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);
- o = offset + (-index - 2) * stride;
- }
- else {
- o = offset + index * stride;
- }
- }
- var dimension = opt_dimension > 1 ? opt_dimension : 2;
- var dest = opt_dest ? opt_dest : new Array(dimension);
- for (var i = 0; i < dimension; ++i) {
- dest[i] =
- o === undefined
- ? NaN
- : t === undefined
- ? flatCoordinates[o + i]
- : lerp(flatCoordinates[o + i], flatCoordinates[o + stride + i], t);
- }
- return dest;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} m M.
- * @param {boolean} extrapolate Extrapolate.
- * @return {import("../../coordinate.js").Coordinate|null} Coordinate.
- */
- function lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, extrapolate) {
- if (end == offset) {
- return null;
- }
- var coordinate;
- if (m < flatCoordinates[offset + stride - 1]) {
- if (extrapolate) {
- coordinate = flatCoordinates.slice(offset, offset + stride);
- coordinate[stride - 1] = m;
- return coordinate;
- }
- else {
- return null;
- }
- }
- else if (flatCoordinates[end - 1] < m) {
- if (extrapolate) {
- coordinate = flatCoordinates.slice(end - stride, end);
- coordinate[stride - 1] = m;
- return coordinate;
- }
- else {
- return null;
- }
- }
- // FIXME use O(1) search
- if (m == flatCoordinates[offset + stride - 1]) {
- return flatCoordinates.slice(offset, offset + stride);
- }
- var lo = offset / stride;
- var hi = end / stride;
- while (lo < hi) {
- var mid = (lo + hi) >> 1;
- if (m < flatCoordinates[(mid + 1) * stride - 1]) {
- hi = mid;
- }
- else {
- lo = mid + 1;
- }
- }
- var m0 = flatCoordinates[lo * stride - 1];
- if (m == m0) {
- return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride);
- }
- var m1 = flatCoordinates[(lo + 1) * stride - 1];
- var t = (m - m0) / (m1 - m0);
- coordinate = [];
- for (var i = 0; i < stride - 1; ++i) {
- coordinate.push(lerp(flatCoordinates[(lo - 1) * stride + i], flatCoordinates[lo * stride + i], t));
- }
- coordinate.push(m);
- return coordinate;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {number} m M.
- * @param {boolean} extrapolate Extrapolate.
- * @param {boolean} interpolate Interpolate.
- * @return {import("../../coordinate.js").Coordinate|null} Coordinate.
- */
- function lineStringsCoordinateAtM(flatCoordinates, offset, ends, stride, m, extrapolate, interpolate) {
- if (interpolate) {
- return lineStringCoordinateAtM(flatCoordinates, offset, ends[ends.length - 1], stride, m, extrapolate);
- }
- var coordinate;
- if (m < flatCoordinates[stride - 1]) {
- if (extrapolate) {
- coordinate = flatCoordinates.slice(0, stride);
- coordinate[stride - 1] = m;
- return coordinate;
- }
- else {
- return null;
- }
- }
- if (flatCoordinates[flatCoordinates.length - 1] < m) {
- if (extrapolate) {
- coordinate = flatCoordinates.slice(flatCoordinates.length - stride);
- coordinate[stride - 1] = m;
- return coordinate;
- }
- else {
- return null;
- }
- }
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- if (offset == end) {
- continue;
- }
- if (m < flatCoordinates[offset + stride - 1]) {
- return null;
- }
- else if (m <= flatCoordinates[end - 1]) {
- return lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, false);
- }
- offset = end;
- }
- return null;
- }
- //# sourceMappingURL=interpolate.js.map
- ;// ./node_modules/ol/geom/flat/contains.js
- /**
- * @module ol/geom/flat/contains
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {import("../../extent.js").Extent} extent Extent.
- * @return {boolean} Contains extent.
- */
- function linearRingContainsExtent(flatCoordinates, offset, end, stride, extent) {
- var outside = forEachCorner(extent,
- /**
- * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
- * @return {boolean} Contains (x, y).
- */
- function (coordinate) {
- return !linearRingContainsXY(flatCoordinates, offset, end, stride, coordinate[0], coordinate[1]);
- });
- return !outside;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {number} x X.
- * @param {number} y Y.
- * @return {boolean} Contains (x, y).
- */
- function linearRingContainsXY(flatCoordinates, offset, end, stride, x, y) {
- // https://geomalgorithms.com/a03-_inclusion.html
- // Copyright 2000 softSurfer, 2012 Dan Sunday
- // This code may be freely used and modified for any purpose
- // providing that this copyright notice is included with it.
- // SoftSurfer makes no warranty for this code, and cannot be held
- // liable for any real or imagined damage resulting from its use.
- // Users of this code must verify correctness for their application.
- var wn = 0;
- var x1 = flatCoordinates[end - stride];
- var y1 = flatCoordinates[end - stride + 1];
- for (; offset < end; offset += stride) {
- var x2 = flatCoordinates[offset];
- var y2 = flatCoordinates[offset + 1];
- if (y1 <= y) {
- if (y2 > y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) > 0) {
- wn++;
- }
- }
- else if (y2 <= y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) < 0) {
- wn--;
- }
- x1 = x2;
- y1 = y2;
- }
- return wn !== 0;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {number} x X.
- * @param {number} y Y.
- * @return {boolean} Contains (x, y).
- */
- function linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y) {
- if (ends.length === 0) {
- return false;
- }
- if (!linearRingContainsXY(flatCoordinates, offset, ends[0], stride, x, y)) {
- return false;
- }
- for (var i = 1, ii = ends.length; i < ii; ++i) {
- if (linearRingContainsXY(flatCoordinates, ends[i - 1], ends[i], stride, x, y)) {
- return false;
- }
- }
- return true;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @param {number} x X.
- * @param {number} y Y.
- * @return {boolean} Contains (x, y).
- */
- function linearRingssContainsXY(flatCoordinates, offset, endss, stride, x, y) {
- if (endss.length === 0) {
- return false;
- }
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {
- return true;
- }
- offset = ends[ends.length - 1];
- }
- return false;
- }
- //# sourceMappingURL=contains.js.map
- ;// ./node_modules/ol/geom/flat/intersectsextent.js
- /**
- * @module ol/geom/flat/intersectsextent
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {import("../../extent.js").Extent} extent Extent.
- * @return {boolean} True if the geometry and the extent intersect.
- */
- function intersectsLineString(flatCoordinates, offset, end, stride, extent) {
- var coordinatesExtent = extendFlatCoordinates(createEmpty(), flatCoordinates, offset, end, stride);
- if (!intersects(extent, coordinatesExtent)) {
- return false;
- }
- if (containsExtent(extent, coordinatesExtent)) {
- return true;
- }
- if (coordinatesExtent[0] >= extent[0] && coordinatesExtent[2] <= extent[2]) {
- return true;
- }
- if (coordinatesExtent[1] >= extent[1] && coordinatesExtent[3] <= extent[3]) {
- return true;
- }
- return forEach(flatCoordinates, offset, end, stride,
- /**
- * @param {import("../../coordinate.js").Coordinate} point1 Start point.
- * @param {import("../../coordinate.js").Coordinate} point2 End point.
- * @return {boolean} `true` if the segment and the extent intersect,
- * `false` otherwise.
- */
- function (point1, point2) {
- return intersectsSegment(extent, point1, point2);
- });
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {import("../../extent.js").Extent} extent Extent.
- * @return {boolean} True if the geometry and the extent intersect.
- */
- function intersectsLineStringArray(flatCoordinates, offset, ends, stride, extent) {
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- if (intersectsLineString(flatCoordinates, offset, ends[i], stride, extent)) {
- return true;
- }
- offset = ends[i];
- }
- return false;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {import("../../extent.js").Extent} extent Extent.
- * @return {boolean} True if the geometry and the extent intersect.
- */
- function intersectsLinearRing(flatCoordinates, offset, end, stride, extent) {
- if (intersectsLineString(flatCoordinates, offset, end, stride, extent)) {
- return true;
- }
- if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[0], extent[1])) {
- return true;
- }
- if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[0], extent[3])) {
- return true;
- }
- if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[2], extent[1])) {
- return true;
- }
- if (linearRingContainsXY(flatCoordinates, offset, end, stride, extent[2], extent[3])) {
- return true;
- }
- return false;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {import("../../extent.js").Extent} extent Extent.
- * @return {boolean} True if the geometry and the extent intersect.
- */
- function intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent) {
- if (!intersectsLinearRing(flatCoordinates, offset, ends[0], stride, extent)) {
- return false;
- }
- if (ends.length === 1) {
- return true;
- }
- for (var i = 1, ii = ends.length; i < ii; ++i) {
- if (linearRingContainsExtent(flatCoordinates, ends[i - 1], ends[i], stride, extent)) {
- if (!intersectsLineString(flatCoordinates, ends[i - 1], ends[i], stride, extent)) {
- return false;
- }
- }
- }
- return true;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @param {import("../../extent.js").Extent} extent Extent.
- * @return {boolean} True if the geometry and the extent intersect.
- */
- function intersectsLinearRingMultiArray(flatCoordinates, offset, endss, stride, extent) {
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- if (intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent)) {
- return true;
- }
- offset = ends[ends.length - 1];
- }
- return false;
- }
- //# sourceMappingURL=intersectsextent.js.map
- ;// ./node_modules/ol/geom/flat/length.js
- /**
- * @module ol/geom/flat/length
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @return {number} Length.
- */
- function lineStringLength(flatCoordinates, offset, end, stride) {
- var x1 = flatCoordinates[offset];
- var y1 = flatCoordinates[offset + 1];
- var length = 0;
- for (var i = offset + stride; i < end; i += stride) {
- var x2 = flatCoordinates[i];
- var y2 = flatCoordinates[i + 1];
- length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
- x1 = x2;
- y1 = y2;
- }
- return length;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @return {number} Perimeter.
- */
- function linearRingLength(flatCoordinates, offset, end, stride) {
- var perimeter = lineStringLength(flatCoordinates, offset, end, stride);
- var dx = flatCoordinates[end - stride] - flatCoordinates[offset];
- var dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];
- perimeter += Math.sqrt(dx * dx + dy * dy);
- return perimeter;
- }
- //# sourceMappingURL=length.js.map
- ;// ./node_modules/ol/geom/LineString.js
- var LineString_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/geom/LineString
- */
- /**
- * @classdesc
- * Linestring geometry.
- *
- * @api
- */
- var LineString = /** @class */ (function (_super) {
- LineString_extends(LineString, _super);
- /**
- * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
- * For internal use, flat coordinates in combination with `opt_layout` are also accepted.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- */
- function LineString(coordinates, opt_layout) {
- var _this = _super.call(this) || this;
- /**
- * @private
- * @type {import("../coordinate.js").Coordinate}
- */
- _this.flatMidpoint_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.flatMidpointRevision_ = -1;
- /**
- * @private
- * @type {number}
- */
- _this.maxDelta_ = -1;
- /**
- * @private
- * @type {number}
- */
- _this.maxDeltaRevision_ = -1;
- if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {
- _this.setFlatCoordinates(opt_layout,
- /** @type {Array<number>} */ (coordinates));
- }
- else {
- _this.setCoordinates(
- /** @type {Array<import("../coordinate.js").Coordinate>} */ (coordinates), opt_layout);
- }
- return _this;
- }
- /**
- * Append the passed coordinate to the coordinates of the linestring.
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @api
- */
- LineString.prototype.appendCoordinate = function (coordinate) {
- if (!this.flatCoordinates) {
- this.flatCoordinates = coordinate.slice();
- }
- else {
- array_extend(this.flatCoordinates, coordinate);
- }
- this.changed();
- };
- /**
- * Make a complete copy of the geometry.
- * @return {!LineString} Clone.
- * @api
- */
- LineString.prototype.clone = function () {
- var lineString = new LineString(this.flatCoordinates.slice(), this.layout);
- lineString.applyProperties(this);
- return lineString;
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @return {number} Minimum squared distance.
- */
- LineString.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
- if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
- return minSquaredDistance;
- }
- if (this.maxDeltaRevision_ != this.getRevision()) {
- this.maxDelta_ = Math.sqrt(maxSquaredDelta(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0));
- this.maxDeltaRevision_ = this.getRevision();
- }
- return assignClosestPoint(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, false, x, y, closestPoint, minSquaredDistance);
- };
- /**
- * Iterate over each segment, calling the provided callback.
- * If the callback returns a truthy value the function returns that
- * value immediately. Otherwise the function returns `false`.
- *
- * @param {function(this: S, import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): T} callback Function
- * called for each segment. The function will receive two arguments, the start and end coordinates of the segment.
- * @return {T|boolean} Value.
- * @template T,S
- * @api
- */
- LineString.prototype.forEachSegment = function (callback) {
- return forEach(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, callback);
- };
- /**
- * Returns the coordinate at `m` using linear interpolation, or `null` if no
- * such coordinate exists.
- *
- * `opt_extrapolate` controls extrapolation beyond the range of Ms in the
- * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first
- * M will return the first coordinate and Ms greater than the last M will
- * return the last coordinate.
- *
- * @param {number} m M.
- * @param {boolean} [opt_extrapolate] Extrapolate. Default is `false`.
- * @return {import("../coordinate.js").Coordinate|null} Coordinate.
- * @api
- */
- LineString.prototype.getCoordinateAtM = function (m, opt_extrapolate) {
- if (this.layout != geom_GeometryLayout.XYM &&
- this.layout != geom_GeometryLayout.XYZM) {
- return null;
- }
- var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;
- return lineStringCoordinateAtM(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, m, extrapolate);
- };
- /**
- * Return the coordinates of the linestring.
- * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
- * @api
- */
- LineString.prototype.getCoordinates = function () {
- return inflateCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
- };
- /**
- * Return the coordinate at the provided fraction along the linestring.
- * The `fraction` is a number between 0 and 1, where 0 is the start of the
- * linestring and 1 is the end.
- * @param {number} fraction Fraction.
- * @param {import("../coordinate.js").Coordinate} [opt_dest] Optional coordinate whose values will
- * be modified. If not provided, a new coordinate will be returned.
- * @return {import("../coordinate.js").Coordinate} Coordinate of the interpolated point.
- * @api
- */
- LineString.prototype.getCoordinateAt = function (fraction, opt_dest) {
- return interpolatePoint(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, fraction, opt_dest, this.stride);
- };
- /**
- * Return the length of the linestring on projected plane.
- * @return {number} Length (on projected plane).
- * @api
- */
- LineString.prototype.getLength = function () {
- return lineStringLength(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
- };
- /**
- * @return {Array<number>} Flat midpoint.
- */
- LineString.prototype.getFlatMidpoint = function () {
- if (this.flatMidpointRevision_ != this.getRevision()) {
- this.flatMidpoint_ = this.getCoordinateAt(0.5, this.flatMidpoint_);
- this.flatMidpointRevision_ = this.getRevision();
- }
- return this.flatMidpoint_;
- };
- /**
- * @param {number} squaredTolerance Squared tolerance.
- * @return {LineString} Simplified LineString.
- * @protected
- */
- LineString.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
- var simplifiedFlatCoordinates = [];
- simplifiedFlatCoordinates.length = douglasPeucker(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0);
- return new LineString(simplifiedFlatCoordinates, geom_GeometryLayout.XY);
- };
- /**
- * Get the type of this geometry.
- * @return {import("./Geometry.js").Type} Geometry type.
- * @api
- */
- LineString.prototype.getType = function () {
- return 'LineString';
- };
- /**
- * Test if the geometry and the passed extent intersect.
- * @param {import("../extent.js").Extent} extent Extent.
- * @return {boolean} `true` if the geometry and the extent intersect.
- * @api
- */
- LineString.prototype.intersectsExtent = function (extent) {
- return intersectsLineString(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, extent);
- };
- /**
- * Set the coordinates of the linestring.
- * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- * @api
- */
- LineString.prototype.setCoordinates = function (coordinates, opt_layout) {
- this.setLayout(opt_layout, coordinates, 1);
- if (!this.flatCoordinates) {
- this.flatCoordinates = [];
- }
- this.flatCoordinates.length = deflateCoordinates(this.flatCoordinates, 0, coordinates, this.stride);
- this.changed();
- };
- return LineString;
- }(geom_SimpleGeometry));
- /* harmony default export */ var geom_LineString = (LineString);
- //# sourceMappingURL=LineString.js.map
- ;// ./node_modules/ol/geom/flat/area.js
- /**
- * @module ol/geom/flat/area
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @return {number} Area.
- */
- function linearRing(flatCoordinates, offset, end, stride) {
- var twiceArea = 0;
- var x1 = flatCoordinates[end - stride];
- var y1 = flatCoordinates[end - stride + 1];
- for (; offset < end; offset += stride) {
- var x2 = flatCoordinates[offset];
- var y2 = flatCoordinates[offset + 1];
- twiceArea += y1 * x2 - x1 * y2;
- x1 = x2;
- y1 = y2;
- }
- return twiceArea / 2;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @return {number} Area.
- */
- function linearRings(flatCoordinates, offset, ends, stride) {
- var area = 0;
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- area += linearRing(flatCoordinates, offset, end, stride);
- offset = end;
- }
- return area;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @return {number} Area.
- */
- function linearRingss(flatCoordinates, offset, endss, stride) {
- var area = 0;
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- area += linearRings(flatCoordinates, offset, ends, stride);
- offset = ends[ends.length - 1];
- }
- return area;
- }
- //# sourceMappingURL=area.js.map
- ;// ./node_modules/ol/geom/LinearRing.js
- var LinearRing_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/geom/LinearRing
- */
- /**
- * @classdesc
- * Linear ring geometry. Only used as part of polygon; cannot be rendered
- * on its own.
- *
- * @api
- */
- var LinearRing = /** @class */ (function (_super) {
- LinearRing_extends(LinearRing, _super);
- /**
- * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
- * For internal use, flat coordinates in combination with `opt_layout` are also accepted.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- */
- function LinearRing(coordinates, opt_layout) {
- var _this = _super.call(this) || this;
- /**
- * @private
- * @type {number}
- */
- _this.maxDelta_ = -1;
- /**
- * @private
- * @type {number}
- */
- _this.maxDeltaRevision_ = -1;
- if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {
- _this.setFlatCoordinates(opt_layout,
- /** @type {Array<number>} */ (coordinates));
- }
- else {
- _this.setCoordinates(
- /** @type {Array<import("../coordinate.js").Coordinate>} */ (coordinates), opt_layout);
- }
- return _this;
- }
- /**
- * Make a complete copy of the geometry.
- * @return {!LinearRing} Clone.
- * @api
- */
- LinearRing.prototype.clone = function () {
- return new LinearRing(this.flatCoordinates.slice(), this.layout);
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @return {number} Minimum squared distance.
- */
- LinearRing.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
- if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
- return minSquaredDistance;
- }
- if (this.maxDeltaRevision_ != this.getRevision()) {
- this.maxDelta_ = Math.sqrt(maxSquaredDelta(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0));
- this.maxDeltaRevision_ = this.getRevision();
- }
- return assignClosestPoint(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);
- };
- /**
- * Return the area of the linear ring on projected plane.
- * @return {number} Area (on projected plane).
- * @api
- */
- LinearRing.prototype.getArea = function () {
- return linearRing(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
- };
- /**
- * Return the coordinates of the linear ring.
- * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
- * @api
- */
- LinearRing.prototype.getCoordinates = function () {
- return inflateCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
- };
- /**
- * @param {number} squaredTolerance Squared tolerance.
- * @return {LinearRing} Simplified LinearRing.
- * @protected
- */
- LinearRing.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
- var simplifiedFlatCoordinates = [];
- simplifiedFlatCoordinates.length = douglasPeucker(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0);
- return new LinearRing(simplifiedFlatCoordinates, geom_GeometryLayout.XY);
- };
- /**
- * Get the type of this geometry.
- * @return {import("./Geometry.js").Type} Geometry type.
- * @api
- */
- LinearRing.prototype.getType = function () {
- return 'LinearRing';
- };
- /**
- * Test if the geometry and the passed extent intersect.
- * @param {import("../extent.js").Extent} extent Extent.
- * @return {boolean} `true` if the geometry and the extent intersect.
- * @api
- */
- LinearRing.prototype.intersectsExtent = function (extent) {
- return false;
- };
- /**
- * Set the coordinates of the linear ring.
- * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- * @api
- */
- LinearRing.prototype.setCoordinates = function (coordinates, opt_layout) {
- this.setLayout(opt_layout, coordinates, 1);
- if (!this.flatCoordinates) {
- this.flatCoordinates = [];
- }
- this.flatCoordinates.length = deflateCoordinates(this.flatCoordinates, 0, coordinates, this.stride);
- this.changed();
- };
- return LinearRing;
- }(geom_SimpleGeometry));
- /* harmony default export */ var geom_LinearRing = (LinearRing);
- //# sourceMappingURL=LinearRing.js.map
- ;// ./node_modules/ol/geom/MultiLineString.js
- var MultiLineString_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/geom/MultiLineString
- */
- /**
- * @classdesc
- * Multi-linestring geometry.
- *
- * @api
- */
- var MultiLineString = /** @class */ (function (_super) {
- MultiLineString_extends(MultiLineString, _super);
- /**
- * @param {Array<Array<import("../coordinate.js").Coordinate>|LineString>|Array<number>} coordinates
- * Coordinates or LineString geometries. (For internal use, flat coordinates in
- * combination with `opt_layout` and `opt_ends` are also accepted.)
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- * @param {Array<number>} [opt_ends] Flat coordinate ends for internal use.
- */
- function MultiLineString(coordinates, opt_layout, opt_ends) {
- var _this = _super.call(this) || this;
- /**
- * @type {Array<number>}
- * @private
- */
- _this.ends_ = [];
- /**
- * @private
- * @type {number}
- */
- _this.maxDelta_ = -1;
- /**
- * @private
- * @type {number}
- */
- _this.maxDeltaRevision_ = -1;
- if (Array.isArray(coordinates[0])) {
- _this.setCoordinates(
- /** @type {Array<Array<import("../coordinate.js").Coordinate>>} */ (coordinates), opt_layout);
- }
- else if (opt_layout !== undefined && opt_ends) {
- _this.setFlatCoordinates(opt_layout,
- /** @type {Array<number>} */ (coordinates));
- _this.ends_ = opt_ends;
- }
- else {
- var layout = _this.getLayout();
- var lineStrings = /** @type {Array<LineString>} */ (coordinates);
- var flatCoordinates = [];
- var ends = [];
- for (var i = 0, ii = lineStrings.length; i < ii; ++i) {
- var lineString = lineStrings[i];
- if (i === 0) {
- layout = lineString.getLayout();
- }
- array_extend(flatCoordinates, lineString.getFlatCoordinates());
- ends.push(flatCoordinates.length);
- }
- _this.setFlatCoordinates(layout, flatCoordinates);
- _this.ends_ = ends;
- }
- return _this;
- }
- /**
- * Append the passed linestring to the multilinestring.
- * @param {LineString} lineString LineString.
- * @api
- */
- MultiLineString.prototype.appendLineString = function (lineString) {
- if (!this.flatCoordinates) {
- this.flatCoordinates = lineString.getFlatCoordinates().slice();
- }
- else {
- array_extend(this.flatCoordinates, lineString.getFlatCoordinates().slice());
- }
- this.ends_.push(this.flatCoordinates.length);
- this.changed();
- };
- /**
- * Make a complete copy of the geometry.
- * @return {!MultiLineString} Clone.
- * @api
- */
- MultiLineString.prototype.clone = function () {
- var multiLineString = new MultiLineString(this.flatCoordinates.slice(), this.layout, this.ends_.slice());
- multiLineString.applyProperties(this);
- return multiLineString;
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @return {number} Minimum squared distance.
- */
- MultiLineString.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
- if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
- return minSquaredDistance;
- }
- if (this.maxDeltaRevision_ != this.getRevision()) {
- this.maxDelta_ = Math.sqrt(arrayMaxSquaredDelta(this.flatCoordinates, 0, this.ends_, this.stride, 0));
- this.maxDeltaRevision_ = this.getRevision();
- }
- return assignClosestArrayPoint(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, false, x, y, closestPoint, minSquaredDistance);
- };
- /**
- * Returns the coordinate at `m` using linear interpolation, or `null` if no
- * such coordinate exists.
- *
- * `opt_extrapolate` controls extrapolation beyond the range of Ms in the
- * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first
- * M will return the first coordinate and Ms greater than the last M will
- * return the last coordinate.
- *
- * `opt_interpolate` controls interpolation between consecutive LineStrings
- * within the MultiLineString. If `opt_interpolate` is `true` the coordinates
- * will be linearly interpolated between the last coordinate of one LineString
- * and the first coordinate of the next LineString. If `opt_interpolate` is
- * `false` then the function will return `null` for Ms falling between
- * LineStrings.
- *
- * @param {number} m M.
- * @param {boolean} [opt_extrapolate] Extrapolate. Default is `false`.
- * @param {boolean} [opt_interpolate] Interpolate. Default is `false`.
- * @return {import("../coordinate.js").Coordinate|null} Coordinate.
- * @api
- */
- MultiLineString.prototype.getCoordinateAtM = function (m, opt_extrapolate, opt_interpolate) {
- if ((this.layout != geom_GeometryLayout.XYM &&
- this.layout != geom_GeometryLayout.XYZM) ||
- this.flatCoordinates.length === 0) {
- return null;
- }
- var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;
- var interpolate = opt_interpolate !== undefined ? opt_interpolate : false;
- return lineStringsCoordinateAtM(this.flatCoordinates, 0, this.ends_, this.stride, m, extrapolate, interpolate);
- };
- /**
- * Return the coordinates of the multilinestring.
- * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
- * @api
- */
- MultiLineString.prototype.getCoordinates = function () {
- return inflateCoordinatesArray(this.flatCoordinates, 0, this.ends_, this.stride);
- };
- /**
- * @return {Array<number>} Ends.
- */
- MultiLineString.prototype.getEnds = function () {
- return this.ends_;
- };
- /**
- * Return the linestring at the specified index.
- * @param {number} index Index.
- * @return {LineString} LineString.
- * @api
- */
- MultiLineString.prototype.getLineString = function (index) {
- if (index < 0 || this.ends_.length <= index) {
- return null;
- }
- return new geom_LineString(this.flatCoordinates.slice(index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]), this.layout);
- };
- /**
- * Return the linestrings of this multilinestring.
- * @return {Array<LineString>} LineStrings.
- * @api
- */
- MultiLineString.prototype.getLineStrings = function () {
- var flatCoordinates = this.flatCoordinates;
- var ends = this.ends_;
- var layout = this.layout;
- /** @type {Array<LineString>} */
- var lineStrings = [];
- var offset = 0;
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- var lineString = new geom_LineString(flatCoordinates.slice(offset, end), layout);
- lineStrings.push(lineString);
- offset = end;
- }
- return lineStrings;
- };
- /**
- * @return {Array<number>} Flat midpoints.
- */
- MultiLineString.prototype.getFlatMidpoints = function () {
- var midpoints = [];
- var flatCoordinates = this.flatCoordinates;
- var offset = 0;
- var ends = this.ends_;
- var stride = this.stride;
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- var midpoint = interpolatePoint(flatCoordinates, offset, end, stride, 0.5);
- array_extend(midpoints, midpoint);
- offset = end;
- }
- return midpoints;
- };
- /**
- * @param {number} squaredTolerance Squared tolerance.
- * @return {MultiLineString} Simplified MultiLineString.
- * @protected
- */
- MultiLineString.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
- var simplifiedFlatCoordinates = [];
- var simplifiedEnds = [];
- simplifiedFlatCoordinates.length = douglasPeuckerArray(this.flatCoordinates, 0, this.ends_, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0, simplifiedEnds);
- return new MultiLineString(simplifiedFlatCoordinates, geom_GeometryLayout.XY, simplifiedEnds);
- };
- /**
- * Get the type of this geometry.
- * @return {import("./Geometry.js").Type} Geometry type.
- * @api
- */
- MultiLineString.prototype.getType = function () {
- return 'MultiLineString';
- };
- /**
- * Test if the geometry and the passed extent intersect.
- * @param {import("../extent.js").Extent} extent Extent.
- * @return {boolean} `true` if the geometry and the extent intersect.
- * @api
- */
- MultiLineString.prototype.intersectsExtent = function (extent) {
- return intersectsLineStringArray(this.flatCoordinates, 0, this.ends_, this.stride, extent);
- };
- /**
- * Set the coordinates of the multilinestring.
- * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
- * @param {GeometryLayout} [opt_layout] Layout.
- * @api
- */
- MultiLineString.prototype.setCoordinates = function (coordinates, opt_layout) {
- this.setLayout(opt_layout, coordinates, 2);
- if (!this.flatCoordinates) {
- this.flatCoordinates = [];
- }
- var ends = deflateCoordinatesArray(this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
- this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
- this.changed();
- };
- return MultiLineString;
- }(geom_SimpleGeometry));
- /* harmony default export */ var geom_MultiLineString = (MultiLineString);
- //# sourceMappingURL=MultiLineString.js.map
- ;// ./node_modules/ol/geom/Point.js
- var Point_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/geom/Point
- */
- /**
- * @classdesc
- * Point geometry.
- *
- * @api
- */
- var Point = /** @class */ (function (_super) {
- Point_extends(Point, _super);
- /**
- * @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- */
- function Point(coordinates, opt_layout) {
- var _this = _super.call(this) || this;
- _this.setCoordinates(coordinates, opt_layout);
- return _this;
- }
- /**
- * Make a complete copy of the geometry.
- * @return {!Point} Clone.
- * @api
- */
- Point.prototype.clone = function () {
- var point = new Point(this.flatCoordinates.slice(), this.layout);
- point.applyProperties(this);
- return point;
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @return {number} Minimum squared distance.
- */
- Point.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
- var flatCoordinates = this.flatCoordinates;
- var squaredDistance = math_squaredDistance(x, y, flatCoordinates[0], flatCoordinates[1]);
- if (squaredDistance < minSquaredDistance) {
- var stride = this.stride;
- for (var i = 0; i < stride; ++i) {
- closestPoint[i] = flatCoordinates[i];
- }
- closestPoint.length = stride;
- return squaredDistance;
- }
- else {
- return minSquaredDistance;
- }
- };
- /**
- * Return the coordinate of the point.
- * @return {import("../coordinate.js").Coordinate} Coordinates.
- * @api
- */
- Point.prototype.getCoordinates = function () {
- return !this.flatCoordinates ? [] : this.flatCoordinates.slice();
- };
- /**
- * @param {import("../extent.js").Extent} extent Extent.
- * @protected
- * @return {import("../extent.js").Extent} extent Extent.
- */
- Point.prototype.computeExtent = function (extent) {
- return createOrUpdateFromCoordinate(this.flatCoordinates, extent);
- };
- /**
- * Get the type of this geometry.
- * @return {import("./Geometry.js").Type} Geometry type.
- * @api
- */
- Point.prototype.getType = function () {
- return 'Point';
- };
- /**
- * Test if the geometry and the passed extent intersect.
- * @param {import("../extent.js").Extent} extent Extent.
- * @return {boolean} `true` if the geometry and the extent intersect.
- * @api
- */
- Point.prototype.intersectsExtent = function (extent) {
- return containsXY(extent, this.flatCoordinates[0], this.flatCoordinates[1]);
- };
- /**
- * @param {!Array<*>} coordinates Coordinates.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- * @api
- */
- Point.prototype.setCoordinates = function (coordinates, opt_layout) {
- this.setLayout(opt_layout, coordinates, 0);
- if (!this.flatCoordinates) {
- this.flatCoordinates = [];
- }
- this.flatCoordinates.length = deflateCoordinate(this.flatCoordinates, 0, coordinates, this.stride);
- this.changed();
- };
- return Point;
- }(geom_SimpleGeometry));
- /* harmony default export */ var geom_Point = (Point);
- //# sourceMappingURL=Point.js.map
- ;// ./node_modules/ol/geom/MultiPoint.js
- var MultiPoint_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/geom/MultiPoint
- */
- /**
- * @classdesc
- * Multi-point geometry.
- *
- * @api
- */
- var MultiPoint = /** @class */ (function (_super) {
- MultiPoint_extends(MultiPoint, _super);
- /**
- * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
- * For internal use, flat coordinates in combination with `opt_layout` are also accepted.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- */
- function MultiPoint(coordinates, opt_layout) {
- var _this = _super.call(this) || this;
- if (opt_layout && !Array.isArray(coordinates[0])) {
- _this.setFlatCoordinates(opt_layout,
- /** @type {Array<number>} */ (coordinates));
- }
- else {
- _this.setCoordinates(
- /** @type {Array<import("../coordinate.js").Coordinate>} */ (coordinates), opt_layout);
- }
- return _this;
- }
- /**
- * Append the passed point to this multipoint.
- * @param {Point} point Point.
- * @api
- */
- MultiPoint.prototype.appendPoint = function (point) {
- if (!this.flatCoordinates) {
- this.flatCoordinates = point.getFlatCoordinates().slice();
- }
- else {
- array_extend(this.flatCoordinates, point.getFlatCoordinates());
- }
- this.changed();
- };
- /**
- * Make a complete copy of the geometry.
- * @return {!MultiPoint} Clone.
- * @api
- */
- MultiPoint.prototype.clone = function () {
- var multiPoint = new MultiPoint(this.flatCoordinates.slice(), this.layout);
- multiPoint.applyProperties(this);
- return multiPoint;
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @return {number} Minimum squared distance.
- */
- MultiPoint.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
- if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
- return minSquaredDistance;
- }
- var flatCoordinates = this.flatCoordinates;
- var stride = this.stride;
- for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
- var squaredDistance = math_squaredDistance(x, y, flatCoordinates[i], flatCoordinates[i + 1]);
- if (squaredDistance < minSquaredDistance) {
- minSquaredDistance = squaredDistance;
- for (var j = 0; j < stride; ++j) {
- closestPoint[j] = flatCoordinates[i + j];
- }
- closestPoint.length = stride;
- }
- }
- return minSquaredDistance;
- };
- /**
- * Return the coordinates of the multipoint.
- * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
- * @api
- */
- MultiPoint.prototype.getCoordinates = function () {
- return inflateCoordinates(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
- };
- /**
- * Return the point at the specified index.
- * @param {number} index Index.
- * @return {Point} Point.
- * @api
- */
- MultiPoint.prototype.getPoint = function (index) {
- var n = !this.flatCoordinates
- ? 0
- : this.flatCoordinates.length / this.stride;
- if (index < 0 || n <= index) {
- return null;
- }
- return new geom_Point(this.flatCoordinates.slice(index * this.stride, (index + 1) * this.stride), this.layout);
- };
- /**
- * Return the points of this multipoint.
- * @return {Array<Point>} Points.
- * @api
- */
- MultiPoint.prototype.getPoints = function () {
- var flatCoordinates = this.flatCoordinates;
- var layout = this.layout;
- var stride = this.stride;
- /** @type {Array<Point>} */
- var points = [];
- for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
- var point = new geom_Point(flatCoordinates.slice(i, i + stride), layout);
- points.push(point);
- }
- return points;
- };
- /**
- * Get the type of this geometry.
- * @return {import("./Geometry.js").Type} Geometry type.
- * @api
- */
- MultiPoint.prototype.getType = function () {
- return 'MultiPoint';
- };
- /**
- * Test if the geometry and the passed extent intersect.
- * @param {import("../extent.js").Extent} extent Extent.
- * @return {boolean} `true` if the geometry and the extent intersect.
- * @api
- */
- MultiPoint.prototype.intersectsExtent = function (extent) {
- var flatCoordinates = this.flatCoordinates;
- var stride = this.stride;
- for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
- var x = flatCoordinates[i];
- var y = flatCoordinates[i + 1];
- if (containsXY(extent, x, y)) {
- return true;
- }
- }
- return false;
- };
- /**
- * Set the coordinates of the multipoint.
- * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- * @api
- */
- MultiPoint.prototype.setCoordinates = function (coordinates, opt_layout) {
- this.setLayout(opt_layout, coordinates, 1);
- if (!this.flatCoordinates) {
- this.flatCoordinates = [];
- }
- this.flatCoordinates.length = deflateCoordinates(this.flatCoordinates, 0, coordinates, this.stride);
- this.changed();
- };
- return MultiPoint;
- }(geom_SimpleGeometry));
- /* harmony default export */ var geom_MultiPoint = (MultiPoint);
- //# sourceMappingURL=MultiPoint.js.map
- ;// ./node_modules/ol/geom/flat/interiorpoint.js
- /**
- * @module ol/geom/flat/interiorpoint
- */
- /**
- * Calculates a point that is likely to lie in the interior of the linear rings.
- * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {Array<number>} flatCenters Flat centers.
- * @param {number} flatCentersOffset Flat center offset.
- * @param {Array<number>} [opt_dest] Destination.
- * @return {Array<number>} Destination point as XYM coordinate, where M is the
- * length of the horizontal intersection that the point belongs to.
- */
- function getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, flatCentersOffset, opt_dest) {
- var i, ii, x, x1, x2, y1, y2;
- var y = flatCenters[flatCentersOffset + 1];
- /** @type {Array<number>} */
- var intersections = [];
- // Calculate intersections with the horizontal line
- for (var r = 0, rr = ends.length; r < rr; ++r) {
- var end = ends[r];
- x1 = flatCoordinates[end - stride];
- y1 = flatCoordinates[end - stride + 1];
- for (i = offset; i < end; i += stride) {
- x2 = flatCoordinates[i];
- y2 = flatCoordinates[i + 1];
- if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) {
- x = ((y - y1) / (y2 - y1)) * (x2 - x1) + x1;
- intersections.push(x);
- }
- x1 = x2;
- y1 = y2;
- }
- }
- // Find the longest segment of the horizontal line that has its center point
- // inside the linear ring.
- var pointX = NaN;
- var maxSegmentLength = -Infinity;
- intersections.sort(numberSafeCompareFunction);
- x1 = intersections[0];
- for (i = 1, ii = intersections.length; i < ii; ++i) {
- x2 = intersections[i];
- var segmentLength = Math.abs(x2 - x1);
- if (segmentLength > maxSegmentLength) {
- x = (x1 + x2) / 2;
- if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {
- pointX = x;
- maxSegmentLength = segmentLength;
- }
- }
- x1 = x2;
- }
- if (isNaN(pointX)) {
- // There is no horizontal line that has its center point inside the linear
- // ring. Use the center of the the linear ring's extent.
- pointX = flatCenters[flatCentersOffset];
- }
- if (opt_dest) {
- opt_dest.push(pointX, y, maxSegmentLength);
- return opt_dest;
- }
- else {
- return [pointX, y, maxSegmentLength];
- }
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @param {Array<number>} flatCenters Flat centers.
- * @return {Array<number>} Interior points as XYM coordinates, where M is the
- * length of the horizontal intersection that the point belongs to.
- */
- function getInteriorPointsOfMultiArray(flatCoordinates, offset, endss, stride, flatCenters) {
- var interiorPoints = [];
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- interiorPoints = getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, 2 * i, interiorPoints);
- offset = ends[ends.length - 1];
- }
- return interiorPoints;
- }
- //# sourceMappingURL=interiorpoint.js.map
- ;// ./node_modules/ol/geom/flat/reverse.js
- /**
- * @module ol/geom/flat/reverse
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- */
- function coordinates(flatCoordinates, offset, end, stride) {
- while (offset < end - stride) {
- for (var i = 0; i < stride; ++i) {
- var tmp = flatCoordinates[offset + i];
- flatCoordinates[offset + i] = flatCoordinates[end - stride + i];
- flatCoordinates[end - stride + i] = tmp;
- }
- offset += stride;
- end -= stride;
- }
- }
- //# sourceMappingURL=reverse.js.map
- ;// ./node_modules/ol/geom/flat/orient.js
- /**
- * @module ol/geom/flat/orient
- */
- /**
- * Is the linear ring oriented clockwise in a coordinate system with a bottom-left
- * coordinate origin? For a coordinate system with a top-left coordinate origin,
- * the ring's orientation is clockwise when this function returns false.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @return {boolean} Is clockwise.
- */
- function linearRingIsClockwise(flatCoordinates, offset, end, stride) {
- // https://stackoverflow.com/q/1165647/clockwise-method#1165943
- // https://github.com/OSGeo/gdal/blob/master/gdal/ogr/ogrlinearring.cpp
- var edge = 0;
- var x1 = flatCoordinates[end - stride];
- var y1 = flatCoordinates[end - stride + 1];
- for (; offset < end; offset += stride) {
- var x2 = flatCoordinates[offset];
- var y2 = flatCoordinates[offset + 1];
- edge += (x2 - x1) * (y2 + y1);
- x1 = x2;
- y1 = y2;
- }
- return edge === 0 ? undefined : edge > 0;
- }
- /**
- * Determines if linear rings are oriented. By default, left-hand orientation
- * is tested (first ring must be clockwise, remaining rings counter-clockwise).
- * To test for right-hand orientation, use the `opt_right` argument.
- *
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Array of end indexes.
- * @param {number} stride Stride.
- * @param {boolean} [opt_right] Test for right-hand orientation
- * (counter-clockwise exterior ring and clockwise interior rings).
- * @return {boolean} Rings are correctly oriented.
- */
- function linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right) {
- var right = opt_right !== undefined ? opt_right : false;
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride);
- if (i === 0) {
- if ((right && isClockwise) || (!right && !isClockwise)) {
- return false;
- }
- }
- else {
- if ((right && !isClockwise) || (!right && isClockwise)) {
- return false;
- }
- }
- offset = end;
- }
- return true;
- }
- /**
- * Determines if linear rings are oriented. By default, left-hand orientation
- * is tested (first ring must be clockwise, remaining rings counter-clockwise).
- * To test for right-hand orientation, use the `opt_right` argument.
- *
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Array of array of end indexes.
- * @param {number} stride Stride.
- * @param {boolean} [opt_right] Test for right-hand orientation
- * (counter-clockwise exterior ring and clockwise interior rings).
- * @return {boolean} Rings are correctly oriented.
- */
- function linearRingssAreOriented(flatCoordinates, offset, endss, stride, opt_right) {
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- if (!linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right)) {
- return false;
- }
- if (ends.length) {
- offset = ends[ends.length - 1];
- }
- }
- return true;
- }
- /**
- * Orient coordinates in a flat array of linear rings. By default, rings
- * are oriented following the left-hand rule (clockwise for exterior and
- * counter-clockwise for interior rings). To orient according to the
- * right-hand rule, use the `opt_right` argument.
- *
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {boolean} [opt_right] Follow the right-hand rule for orientation.
- * @return {number} End.
- */
- function orientLinearRings(flatCoordinates, offset, ends, stride, opt_right) {
- var right = opt_right !== undefined ? opt_right : false;
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride);
- var reverse = i === 0
- ? (right && isClockwise) || (!right && !isClockwise)
- : (right && !isClockwise) || (!right && isClockwise);
- if (reverse) {
- coordinates(flatCoordinates, offset, end, stride);
- }
- offset = end;
- }
- return offset;
- }
- /**
- * Orient coordinates in a flat array of linear rings. By default, rings
- * are oriented following the left-hand rule (clockwise for exterior and
- * counter-clockwise for interior rings). To orient according to the
- * right-hand rule, use the `opt_right` argument.
- *
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Array of array of end indexes.
- * @param {number} stride Stride.
- * @param {boolean} [opt_right] Follow the right-hand rule for orientation.
- * @return {number} End.
- */
- function orientLinearRingsArray(flatCoordinates, offset, endss, stride, opt_right) {
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- offset = orientLinearRings(flatCoordinates, offset, endss[i], stride, opt_right);
- }
- return offset;
- }
- /**
- * Return a two-dimensional endss
- * @param {Array<number>} flatCoordinates Flat coordinates
- * @param {Array<number>} ends Linear ring end indexes
- * @return {Array<Array<number>>} Two dimensional endss array that can
- * be used to contruct a MultiPolygon
- */
- function inflateEnds(flatCoordinates, ends) {
- var endss = [];
- var offset = 0;
- var prevEndIndex = 0;
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- // classifies an array of rings into polygons with outer rings and holes
- if (!linearRingIsClockwise(flatCoordinates, offset, end, 2)) {
- endss.push(ends.slice(prevEndIndex, i + 1));
- }
- else {
- if (endss.length === 0) {
- continue;
- }
- endss[endss.length - 1].push(ends[prevEndIndex]);
- }
- prevEndIndex = i + 1;
- offset = end;
- }
- return endss;
- }
- //# sourceMappingURL=orient.js.map
- ;// ./node_modules/ol/geom/Polygon.js
- var Polygon_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/geom/Polygon
- */
- /**
- * @classdesc
- * Polygon geometry.
- *
- * @api
- */
- var Polygon = /** @class */ (function (_super) {
- Polygon_extends(Polygon, _super);
- /**
- * @param {!Array<Array<import("../coordinate.js").Coordinate>>|!Array<number>} coordinates
- * Array of linear rings that define the polygon. The first linear ring of the
- * array defines the outer-boundary or surface of the polygon. Each subsequent
- * linear ring defines a hole in the surface of the polygon. A linear ring is
- * an array of vertices' coordinates where the first coordinate and the last are
- * equivalent. (For internal use, flat coordinates in combination with
- * `opt_layout` and `opt_ends` are also accepted.)
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- * @param {Array<number>} [opt_ends] Ends (for internal use with flat coordinates).
- */
- function Polygon(coordinates, opt_layout, opt_ends) {
- var _this = _super.call(this) || this;
- /**
- * @type {Array<number>}
- * @private
- */
- _this.ends_ = [];
- /**
- * @private
- * @type {number}
- */
- _this.flatInteriorPointRevision_ = -1;
- /**
- * @private
- * @type {import("../coordinate.js").Coordinate}
- */
- _this.flatInteriorPoint_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.maxDelta_ = -1;
- /**
- * @private
- * @type {number}
- */
- _this.maxDeltaRevision_ = -1;
- /**
- * @private
- * @type {number}
- */
- _this.orientedRevision_ = -1;
- /**
- * @private
- * @type {Array<number>}
- */
- _this.orientedFlatCoordinates_ = null;
- if (opt_layout !== undefined && opt_ends) {
- _this.setFlatCoordinates(opt_layout,
- /** @type {Array<number>} */ (coordinates));
- _this.ends_ = opt_ends;
- }
- else {
- _this.setCoordinates(
- /** @type {Array<Array<import("../coordinate.js").Coordinate>>} */ (coordinates), opt_layout);
- }
- return _this;
- }
- /**
- * Append the passed linear ring to this polygon.
- * @param {LinearRing} linearRing Linear ring.
- * @api
- */
- Polygon.prototype.appendLinearRing = function (linearRing) {
- if (!this.flatCoordinates) {
- this.flatCoordinates = linearRing.getFlatCoordinates().slice();
- }
- else {
- array_extend(this.flatCoordinates, linearRing.getFlatCoordinates());
- }
- this.ends_.push(this.flatCoordinates.length);
- this.changed();
- };
- /**
- * Make a complete copy of the geometry.
- * @return {!Polygon} Clone.
- * @api
- */
- Polygon.prototype.clone = function () {
- var polygon = new Polygon(this.flatCoordinates.slice(), this.layout, this.ends_.slice());
- polygon.applyProperties(this);
- return polygon;
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @return {number} Minimum squared distance.
- */
- Polygon.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
- if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
- return minSquaredDistance;
- }
- if (this.maxDeltaRevision_ != this.getRevision()) {
- this.maxDelta_ = Math.sqrt(arrayMaxSquaredDelta(this.flatCoordinates, 0, this.ends_, this.stride, 0));
- this.maxDeltaRevision_ = this.getRevision();
- }
- return assignClosestArrayPoint(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @return {boolean} Contains (x, y).
- */
- Polygon.prototype.containsXY = function (x, y) {
- return linearRingsContainsXY(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y);
- };
- /**
- * Return the area of the polygon on projected plane.
- * @return {number} Area (on projected plane).
- * @api
- */
- Polygon.prototype.getArea = function () {
- return linearRings(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride);
- };
- /**
- * Get the coordinate array for this geometry. This array has the structure
- * of a GeoJSON coordinate array for polygons.
- *
- * @param {boolean} [opt_right] Orient coordinates according to the right-hand
- * rule (counter-clockwise for exterior and clockwise for interior rings).
- * If `false`, coordinates will be oriented according to the left-hand rule
- * (clockwise for exterior and counter-clockwise for interior rings).
- * By default, coordinate orientation will depend on how the geometry was
- * constructed.
- * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
- * @api
- */
- Polygon.prototype.getCoordinates = function (opt_right) {
- var flatCoordinates;
- if (opt_right !== undefined) {
- flatCoordinates = this.getOrientedFlatCoordinates().slice();
- orientLinearRings(flatCoordinates, 0, this.ends_, this.stride, opt_right);
- }
- else {
- flatCoordinates = this.flatCoordinates;
- }
- return inflateCoordinatesArray(flatCoordinates, 0, this.ends_, this.stride);
- };
- /**
- * @return {Array<number>} Ends.
- */
- Polygon.prototype.getEnds = function () {
- return this.ends_;
- };
- /**
- * @return {Array<number>} Interior point.
- */
- Polygon.prototype.getFlatInteriorPoint = function () {
- if (this.flatInteriorPointRevision_ != this.getRevision()) {
- var flatCenter = getCenter(this.getExtent());
- this.flatInteriorPoint_ = getInteriorPointOfArray(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, flatCenter, 0);
- this.flatInteriorPointRevision_ = this.getRevision();
- }
- return this.flatInteriorPoint_;
- };
- /**
- * Return an interior point of the polygon.
- * @return {Point} Interior point as XYM coordinate, where M is the
- * length of the horizontal intersection that the point belongs to.
- * @api
- */
- Polygon.prototype.getInteriorPoint = function () {
- return new geom_Point(this.getFlatInteriorPoint(), geom_GeometryLayout.XYM);
- };
- /**
- * Return the number of rings of the polygon, this includes the exterior
- * ring and any interior rings.
- *
- * @return {number} Number of rings.
- * @api
- */
- Polygon.prototype.getLinearRingCount = function () {
- return this.ends_.length;
- };
- /**
- * Return the Nth linear ring of the polygon geometry. Return `null` if the
- * given index is out of range.
- * The exterior linear ring is available at index `0` and the interior rings
- * at index `1` and beyond.
- *
- * @param {number} index Index.
- * @return {LinearRing|null} Linear ring.
- * @api
- */
- Polygon.prototype.getLinearRing = function (index) {
- if (index < 0 || this.ends_.length <= index) {
- return null;
- }
- return new geom_LinearRing(this.flatCoordinates.slice(index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]), this.layout);
- };
- /**
- * Return the linear rings of the polygon.
- * @return {Array<LinearRing>} Linear rings.
- * @api
- */
- Polygon.prototype.getLinearRings = function () {
- var layout = this.layout;
- var flatCoordinates = this.flatCoordinates;
- var ends = this.ends_;
- var linearRings = [];
- var offset = 0;
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- var linearRing = new geom_LinearRing(flatCoordinates.slice(offset, end), layout);
- linearRings.push(linearRing);
- offset = end;
- }
- return linearRings;
- };
- /**
- * @return {Array<number>} Oriented flat coordinates.
- */
- Polygon.prototype.getOrientedFlatCoordinates = function () {
- if (this.orientedRevision_ != this.getRevision()) {
- var flatCoordinates = this.flatCoordinates;
- if (linearRingsAreOriented(flatCoordinates, 0, this.ends_, this.stride)) {
- this.orientedFlatCoordinates_ = flatCoordinates;
- }
- else {
- this.orientedFlatCoordinates_ = flatCoordinates.slice();
- this.orientedFlatCoordinates_.length = orientLinearRings(this.orientedFlatCoordinates_, 0, this.ends_, this.stride);
- }
- this.orientedRevision_ = this.getRevision();
- }
- return this.orientedFlatCoordinates_;
- };
- /**
- * @param {number} squaredTolerance Squared tolerance.
- * @return {Polygon} Simplified Polygon.
- * @protected
- */
- Polygon.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
- var simplifiedFlatCoordinates = [];
- var simplifiedEnds = [];
- simplifiedFlatCoordinates.length = quantizeArray(this.flatCoordinates, 0, this.ends_, this.stride, Math.sqrt(squaredTolerance), simplifiedFlatCoordinates, 0, simplifiedEnds);
- return new Polygon(simplifiedFlatCoordinates, geom_GeometryLayout.XY, simplifiedEnds);
- };
- /**
- * Get the type of this geometry.
- * @return {import("./Geometry.js").Type} Geometry type.
- * @api
- */
- Polygon.prototype.getType = function () {
- return 'Polygon';
- };
- /**
- * Test if the geometry and the passed extent intersect.
- * @param {import("../extent.js").Extent} extent Extent.
- * @return {boolean} `true` if the geometry and the extent intersect.
- * @api
- */
- Polygon.prototype.intersectsExtent = function (extent) {
- return intersectsLinearRingArray(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent);
- };
- /**
- * Set the coordinates of the polygon.
- * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- * @api
- */
- Polygon.prototype.setCoordinates = function (coordinates, opt_layout) {
- this.setLayout(opt_layout, coordinates, 2);
- if (!this.flatCoordinates) {
- this.flatCoordinates = [];
- }
- var ends = deflateCoordinatesArray(this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
- this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
- this.changed();
- };
- return Polygon;
- }(geom_SimpleGeometry));
- /* harmony default export */ var geom_Polygon = (Polygon);
- /**
- * Create an approximation of a circle on the surface of a sphere.
- * @param {import("../coordinate.js").Coordinate} center Center (`[lon, lat]` in degrees).
- * @param {number} radius The great-circle distance from the center to
- * the polygon vertices in meters.
- * @param {number} [opt_n] Optional number of vertices for the resulting
- * polygon. Default is `32`.
- * @param {number} [opt_sphereRadius] Optional radius for the sphere (defaults to
- * the Earth's mean radius using the WGS84 ellipsoid).
- * @return {Polygon} The "circular" polygon.
- * @api
- */
- function circular(center, radius, opt_n, opt_sphereRadius) {
- var n = opt_n ? opt_n : 32;
- /** @type {Array<number>} */
- var flatCoordinates = [];
- for (var i = 0; i < n; ++i) {
- extend(flatCoordinates, sphereOffset(center, radius, (2 * Math.PI * i) / n, opt_sphereRadius));
- }
- flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
- return new Polygon(flatCoordinates, GeometryLayout.XY, [
- flatCoordinates.length,
- ]);
- }
- /**
- * Create a polygon from an extent. The layout used is `XY`.
- * @param {import("../extent.js").Extent} extent The extent.
- * @return {Polygon} The polygon.
- * @api
- */
- function fromExtent(extent) {
- var minX = extent[0];
- var minY = extent[1];
- var maxX = extent[2];
- var maxY = extent[3];
- var flatCoordinates = [
- minX,
- minY,
- minX,
- maxY,
- maxX,
- maxY,
- maxX,
- minY,
- minX,
- minY,
- ];
- return new Polygon(flatCoordinates, geom_GeometryLayout.XY, [
- flatCoordinates.length,
- ]);
- }
- /**
- * Create a regular polygon from a circle.
- * @param {import("./Circle.js").default} circle Circle geometry.
- * @param {number} [opt_sides] Number of sides of the polygon. Default is 32.
- * @param {number} [opt_angle] Start angle for the first vertex of the polygon in
- * counter-clockwise radians. 0 means East. Default is 0.
- * @return {Polygon} Polygon geometry.
- * @api
- */
- function fromCircle(circle, opt_sides, opt_angle) {
- var sides = opt_sides ? opt_sides : 32;
- var stride = circle.getStride();
- var layout = circle.getLayout();
- var center = circle.getCenter();
- var arrayLength = stride * (sides + 1);
- var flatCoordinates = new Array(arrayLength);
- for (var i = 0; i < arrayLength; i += stride) {
- flatCoordinates[i] = 0;
- flatCoordinates[i + 1] = 0;
- for (var j = 2; j < stride; j++) {
- flatCoordinates[i + j] = center[j];
- }
- }
- var ends = [flatCoordinates.length];
- var polygon = new Polygon(flatCoordinates, layout, ends);
- makeRegular(polygon, center, circle.getRadius(), opt_angle);
- return polygon;
- }
- /**
- * Modify the coordinates of a polygon to make it a regular polygon.
- * @param {Polygon} polygon Polygon geometry.
- * @param {import("../coordinate.js").Coordinate} center Center of the regular polygon.
- * @param {number} radius Radius of the regular polygon.
- * @param {number} [opt_angle] Start angle for the first vertex of the polygon in
- * counter-clockwise radians. 0 means East. Default is 0.
- */
- function makeRegular(polygon, center, radius, opt_angle) {
- var flatCoordinates = polygon.getFlatCoordinates();
- var stride = polygon.getStride();
- var sides = flatCoordinates.length / stride - 1;
- var startAngle = opt_angle ? opt_angle : 0;
- for (var i = 0; i <= sides; ++i) {
- var offset = i * stride;
- var angle = startAngle + (modulo(i, sides) * 2 * Math.PI) / sides;
- flatCoordinates[offset] = center[0] + radius * Math.cos(angle);
- flatCoordinates[offset + 1] = center[1] + radius * Math.sin(angle);
- }
- polygon.changed();
- }
- //# sourceMappingURL=Polygon.js.map
- ;// ./node_modules/ol/geom/flat/center.js
- /**
- * @module ol/geom/flat/center
- */
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<Array<number>>} endss Endss.
- * @param {number} stride Stride.
- * @return {Array<number>} Flat centers.
- */
- function center_linearRingss(flatCoordinates, offset, endss, stride) {
- var flatCenters = [];
- var extent = createEmpty();
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- extent = createOrUpdateFromFlatCoordinates(flatCoordinates, offset, ends[0], stride);
- flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2);
- offset = ends[ends.length - 1];
- }
- return flatCenters;
- }
- //# sourceMappingURL=center.js.map
- ;// ./node_modules/ol/geom/MultiPolygon.js
- var MultiPolygon_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/geom/MultiPolygon
- */
- /**
- * @classdesc
- * Multi-polygon geometry.
- *
- * @api
- */
- var MultiPolygon = /** @class */ (function (_super) {
- MultiPolygon_extends(MultiPolygon, _super);
- /**
- * @param {Array<Array<Array<import("../coordinate.js").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.
- * For internal use, flat coordinates in combination with `opt_layout` and `opt_endss` are also accepted.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- * @param {Array<Array<number>>} [opt_endss] Array of ends for internal use with flat coordinates.
- */
- function MultiPolygon(coordinates, opt_layout, opt_endss) {
- var _this = _super.call(this) || this;
- /**
- * @type {Array<Array<number>>}
- * @private
- */
- _this.endss_ = [];
- /**
- * @private
- * @type {number}
- */
- _this.flatInteriorPointsRevision_ = -1;
- /**
- * @private
- * @type {Array<number>}
- */
- _this.flatInteriorPoints_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.maxDelta_ = -1;
- /**
- * @private
- * @type {number}
- */
- _this.maxDeltaRevision_ = -1;
- /**
- * @private
- * @type {number}
- */
- _this.orientedRevision_ = -1;
- /**
- * @private
- * @type {Array<number>}
- */
- _this.orientedFlatCoordinates_ = null;
- if (!opt_endss && !Array.isArray(coordinates[0])) {
- var layout = _this.getLayout();
- var polygons = /** @type {Array<Polygon>} */ (coordinates);
- var flatCoordinates = [];
- var endss = [];
- for (var i = 0, ii = polygons.length; i < ii; ++i) {
- var polygon = polygons[i];
- if (i === 0) {
- layout = polygon.getLayout();
- }
- var offset = flatCoordinates.length;
- var ends = polygon.getEnds();
- for (var j = 0, jj = ends.length; j < jj; ++j) {
- ends[j] += offset;
- }
- array_extend(flatCoordinates, polygon.getFlatCoordinates());
- endss.push(ends);
- }
- opt_layout = layout;
- coordinates = flatCoordinates;
- opt_endss = endss;
- }
- if (opt_layout !== undefined && opt_endss) {
- _this.setFlatCoordinates(opt_layout,
- /** @type {Array<number>} */ (coordinates));
- _this.endss_ = opt_endss;
- }
- else {
- _this.setCoordinates(
- /** @type {Array<Array<Array<import("../coordinate.js").Coordinate>>>} */ (coordinates), opt_layout);
- }
- return _this;
- }
- /**
- * Append the passed polygon to this multipolygon.
- * @param {Polygon} polygon Polygon.
- * @api
- */
- MultiPolygon.prototype.appendPolygon = function (polygon) {
- /** @type {Array<number>} */
- var ends;
- if (!this.flatCoordinates) {
- this.flatCoordinates = polygon.getFlatCoordinates().slice();
- ends = polygon.getEnds().slice();
- this.endss_.push();
- }
- else {
- var offset = this.flatCoordinates.length;
- array_extend(this.flatCoordinates, polygon.getFlatCoordinates());
- ends = polygon.getEnds().slice();
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- ends[i] += offset;
- }
- }
- this.endss_.push(ends);
- this.changed();
- };
- /**
- * Make a complete copy of the geometry.
- * @return {!MultiPolygon} Clone.
- * @api
- */
- MultiPolygon.prototype.clone = function () {
- var len = this.endss_.length;
- var newEndss = new Array(len);
- for (var i = 0; i < len; ++i) {
- newEndss[i] = this.endss_[i].slice();
- }
- var multiPolygon = new MultiPolygon(this.flatCoordinates.slice(), this.layout, newEndss);
- multiPolygon.applyProperties(this);
- return multiPolygon;
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
- * @param {number} minSquaredDistance Minimum squared distance.
- * @return {number} Minimum squared distance.
- */
- MultiPolygon.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
- if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
- return minSquaredDistance;
- }
- if (this.maxDeltaRevision_ != this.getRevision()) {
- this.maxDelta_ = Math.sqrt(multiArrayMaxSquaredDelta(this.flatCoordinates, 0, this.endss_, this.stride, 0));
- this.maxDeltaRevision_ = this.getRevision();
- }
- return assignClosestMultiArrayPoint(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- * @return {boolean} Contains (x, y).
- */
- MultiPolygon.prototype.containsXY = function (x, y) {
- return linearRingssContainsXY(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, x, y);
- };
- /**
- * Return the area of the multipolygon on projected plane.
- * @return {number} Area (on projected plane).
- * @api
- */
- MultiPolygon.prototype.getArea = function () {
- return linearRingss(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride);
- };
- /**
- * Get the coordinate array for this geometry. This array has the structure
- * of a GeoJSON coordinate array for multi-polygons.
- *
- * @param {boolean} [opt_right] Orient coordinates according to the right-hand
- * rule (counter-clockwise for exterior and clockwise for interior rings).
- * If `false`, coordinates will be oriented according to the left-hand rule
- * (clockwise for exterior and counter-clockwise for interior rings).
- * By default, coordinate orientation will depend on how the geometry was
- * constructed.
- * @return {Array<Array<Array<import("../coordinate.js").Coordinate>>>} Coordinates.
- * @api
- */
- MultiPolygon.prototype.getCoordinates = function (opt_right) {
- var flatCoordinates;
- if (opt_right !== undefined) {
- flatCoordinates = this.getOrientedFlatCoordinates().slice();
- orientLinearRingsArray(flatCoordinates, 0, this.endss_, this.stride, opt_right);
- }
- else {
- flatCoordinates = this.flatCoordinates;
- }
- return inflateMultiCoordinatesArray(flatCoordinates, 0, this.endss_, this.stride);
- };
- /**
- * @return {Array<Array<number>>} Endss.
- */
- MultiPolygon.prototype.getEndss = function () {
- return this.endss_;
- };
- /**
- * @return {Array<number>} Flat interior points.
- */
- MultiPolygon.prototype.getFlatInteriorPoints = function () {
- if (this.flatInteriorPointsRevision_ != this.getRevision()) {
- var flatCenters = center_linearRingss(this.flatCoordinates, 0, this.endss_, this.stride);
- this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, flatCenters);
- this.flatInteriorPointsRevision_ = this.getRevision();
- }
- return this.flatInteriorPoints_;
- };
- /**
- * Return the interior points as {@link module:ol/geom/MultiPoint~MultiPoint multipoint}.
- * @return {MultiPoint} Interior points as XYM coordinates, where M is
- * the length of the horizontal intersection that the point belongs to.
- * @api
- */
- MultiPolygon.prototype.getInteriorPoints = function () {
- return new geom_MultiPoint(this.getFlatInteriorPoints().slice(), geom_GeometryLayout.XYM);
- };
- /**
- * @return {Array<number>} Oriented flat coordinates.
- */
- MultiPolygon.prototype.getOrientedFlatCoordinates = function () {
- if (this.orientedRevision_ != this.getRevision()) {
- var flatCoordinates = this.flatCoordinates;
- if (linearRingssAreOriented(flatCoordinates, 0, this.endss_, this.stride)) {
- this.orientedFlatCoordinates_ = flatCoordinates;
- }
- else {
- this.orientedFlatCoordinates_ = flatCoordinates.slice();
- this.orientedFlatCoordinates_.length = orientLinearRingsArray(this.orientedFlatCoordinates_, 0, this.endss_, this.stride);
- }
- this.orientedRevision_ = this.getRevision();
- }
- return this.orientedFlatCoordinates_;
- };
- /**
- * @param {number} squaredTolerance Squared tolerance.
- * @return {MultiPolygon} Simplified MultiPolygon.
- * @protected
- */
- MultiPolygon.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
- var simplifiedFlatCoordinates = [];
- var simplifiedEndss = [];
- simplifiedFlatCoordinates.length = quantizeMultiArray(this.flatCoordinates, 0, this.endss_, this.stride, Math.sqrt(squaredTolerance), simplifiedFlatCoordinates, 0, simplifiedEndss);
- return new MultiPolygon(simplifiedFlatCoordinates, geom_GeometryLayout.XY, simplifiedEndss);
- };
- /**
- * Return the polygon at the specified index.
- * @param {number} index Index.
- * @return {Polygon} Polygon.
- * @api
- */
- MultiPolygon.prototype.getPolygon = function (index) {
- if (index < 0 || this.endss_.length <= index) {
- return null;
- }
- var offset;
- if (index === 0) {
- offset = 0;
- }
- else {
- var prevEnds = this.endss_[index - 1];
- offset = prevEnds[prevEnds.length - 1];
- }
- var ends = this.endss_[index].slice();
- var end = ends[ends.length - 1];
- if (offset !== 0) {
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- ends[i] -= offset;
- }
- }
- return new geom_Polygon(this.flatCoordinates.slice(offset, end), this.layout, ends);
- };
- /**
- * Return the polygons of this multipolygon.
- * @return {Array<Polygon>} Polygons.
- * @api
- */
- MultiPolygon.prototype.getPolygons = function () {
- var layout = this.layout;
- var flatCoordinates = this.flatCoordinates;
- var endss = this.endss_;
- var polygons = [];
- var offset = 0;
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i].slice();
- var end = ends[ends.length - 1];
- if (offset !== 0) {
- for (var j = 0, jj = ends.length; j < jj; ++j) {
- ends[j] -= offset;
- }
- }
- var polygon = new geom_Polygon(flatCoordinates.slice(offset, end), layout, ends);
- polygons.push(polygon);
- offset = end;
- }
- return polygons;
- };
- /**
- * Get the type of this geometry.
- * @return {import("./Geometry.js").Type} Geometry type.
- * @api
- */
- MultiPolygon.prototype.getType = function () {
- return 'MultiPolygon';
- };
- /**
- * Test if the geometry and the passed extent intersect.
- * @param {import("../extent.js").Extent} extent Extent.
- * @return {boolean} `true` if the geometry and the extent intersect.
- * @api
- */
- MultiPolygon.prototype.intersectsExtent = function (extent) {
- return intersectsLinearRingMultiArray(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, extent);
- };
- /**
- * Set the coordinates of the multipolygon.
- * @param {!Array<Array<Array<import("../coordinate.js").Coordinate>>>} coordinates Coordinates.
- * @param {import("./GeometryLayout.js").default} [opt_layout] Layout.
- * @api
- */
- MultiPolygon.prototype.setCoordinates = function (coordinates, opt_layout) {
- this.setLayout(opt_layout, coordinates, 3);
- if (!this.flatCoordinates) {
- this.flatCoordinates = [];
- }
- var endss = deflateMultiCoordinatesArray(this.flatCoordinates, 0, coordinates, this.stride, this.endss_);
- if (endss.length === 0) {
- this.flatCoordinates.length = 0;
- }
- else {
- var lastEnds = endss[endss.length - 1];
- this.flatCoordinates.length =
- lastEnds.length === 0 ? 0 : lastEnds[lastEnds.length - 1];
- }
- this.changed();
- };
- return MultiPolygon;
- }(geom_SimpleGeometry));
- /* harmony default export */ var geom_MultiPolygon = (MultiPolygon);
- //# sourceMappingURL=MultiPolygon.js.map
- ;// ./node_modules/ol/layer/TileProperty.js
- /**
- * @module ol/layer/TileProperty
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var TileProperty = ({
- PRELOAD: 'preload',
- USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError',
- });
- //# sourceMappingURL=TileProperty.js.map
- ;// ./node_modules/ol/layer/BaseTile.js
- var BaseTile_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/layer/BaseTile
- */
- /***
- * @template Return
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
- * import("../Observable").OnSignature<import("./Base").BaseLayerObjectEventTypes|
- * 'change:source'|'change:preload'|'change:useInterimTilesOnError', import("../Object").ObjectEvent, Return> &
- * import("../Observable").OnSignature<import("../render/EventType").LayerRenderEventTypes, import("../render/Event").default, Return> &
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("./Base").BaseLayerObjectEventTypes|
- * 'change:source'|'change:preload'|'change:useInterimTilesOnError'|import("../render/EventType").LayerRenderEventTypes, Return>} BaseTileLayerOnSignature
- */
- /**
- * @template {import("../source/Tile.js").default} TileSourceType
- * @typedef {Object} Options
- * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
- * @property {number} [opacity=1] Opacity (0, 1).
- * @property {boolean} [visible=true] Visibility.
- * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
- * rendered outside of this extent.
- * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
- * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
- * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
- * method was used.
- * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
- * visible.
- * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
- * be visible.
- * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
- * visible.
- * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
- * be visible.
- * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`
- * means no preloading.
- * @property {TileSourceType} [source] Source for this layer.
- * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage
- * this layer in its layers collection, and the layer will be rendered on top. This is useful for
- * temporary layers. The standard way to add a layer to a map and have it managed by the map is to
- * use {@link import("../PluggableMap.js").default#addLayer map.addLayer()}.
- * @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error.
- * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
- */
- /**
- * @classdesc
- * For layer sources that provide pre-rendered, tiled images in grids that are
- * organized by zoom levels for specific resolutions.
- * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
- * property on the layer object; for example, setting `title: 'My Title'` in the
- * options means that `title` is observable, and has get/set accessors.
- *
- * @template {import("../source/Tile.js").default} TileSourceType
- * @template {import("../renderer/Layer.js").default} RendererType
- * @extends {Layer<TileSourceType, RendererType>}
- * @api
- */
- var BaseTileLayer = /** @class */ (function (_super) {
- BaseTile_extends(BaseTileLayer, _super);
- /**
- * @param {Options<TileSourceType>} [opt_options] Tile layer options.
- */
- function BaseTileLayer(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- var baseOptions = obj_assign({}, options);
- delete baseOptions.preload;
- delete baseOptions.useInterimTilesOnError;
- _this = _super.call(this, baseOptions) || this;
- /***
- * @type {BaseTileLayerOnSignature<import("../events").EventsKey>}
- */
- _this.on;
- /***
- * @type {BaseTileLayerOnSignature<import("../events").EventsKey>}
- */
- _this.once;
- /***
- * @type {BaseTileLayerOnSignature<void>}
- */
- _this.un;
- _this.setPreload(options.preload !== undefined ? options.preload : 0);
- _this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined
- ? options.useInterimTilesOnError
- : true);
- return _this;
- }
- /**
- * Return the level as number to which we will preload tiles up to.
- * @return {number} The level to preload tiles up to.
- * @observable
- * @api
- */
- BaseTileLayer.prototype.getPreload = function () {
- return /** @type {number} */ (this.get(TileProperty.PRELOAD));
- };
- /**
- * Set the level as number to which we will preload tiles up to.
- * @param {number} preload The level to preload tiles up to.
- * @observable
- * @api
- */
- BaseTileLayer.prototype.setPreload = function (preload) {
- this.set(TileProperty.PRELOAD, preload);
- };
- /**
- * Whether we use interim tiles on error.
- * @return {boolean} Use interim tiles on error.
- * @observable
- * @api
- */
- BaseTileLayer.prototype.getUseInterimTilesOnError = function () {
- return /** @type {boolean} */ (this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR));
- };
- /**
- * Set whether we use interim tiles on error.
- * @param {boolean} useInterimTilesOnError Use interim tiles on error.
- * @observable
- * @api
- */
- BaseTileLayer.prototype.setUseInterimTilesOnError = function (useInterimTilesOnError) {
- this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
- };
- /**
- * Get data for a pixel location. The return type depends on the source data. For image tiles,
- * a four element RGBA array will be returned. For data tiles, the array length will match the
- * number of bands in the dataset. For requests outside the layer extent, `null` will be returned.
- * Data for a image tiles can only be retrieved if the source's `crossOrigin` property is set.
- *
- * ```js
- * // display layer data on every pointer move
- * map.on('pointermove', (event) => {
- * console.log(layer.getData(event.pixel));
- * });
- * ```
- * @param {import("../pixel").Pixel} pixel Pixel.
- * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
- * @api
- */
- BaseTileLayer.prototype.getData = function (pixel) {
- return _super.prototype.getData.call(this, pixel);
- };
- return BaseTileLayer;
- }(layer_Layer));
- /* harmony default export */ var BaseTile = (BaseTileLayer);
- //# sourceMappingURL=BaseTile.js.map
- ;// ./node_modules/ol/ImageState.js
- /**
- * @module ol/ImageState
- */
- /**
- * @enum {number}
- */
- /* harmony default export */ var ImageState = ({
- IDLE: 0,
- LOADING: 1,
- LOADED: 2,
- ERROR: 3,
- EMPTY: 4,
- });
- //# sourceMappingURL=ImageState.js.map
- ;// ./node_modules/ol/renderer/Layer.js
- var renderer_Layer_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/renderer/Layer
- */
- /**
- * @template {import("../layer/Layer.js").default} LayerType
- */
- var LayerRenderer = /** @class */ (function (_super) {
- renderer_Layer_extends(LayerRenderer, _super);
- /**
- * @param {LayerType} layer Layer.
- */
- function LayerRenderer(layer) {
- var _this = _super.call(this) || this;
- /**
- * The renderer is initialized and ready to render.
- * @type {boolean}
- */
- _this.ready = true;
- /** @private */
- _this.boundHandleImageChange_ = _this.handleImageChange_.bind(_this);
- /**
- * @protected
- * @type {LayerType}
- */
- _this.layer_ = layer;
- /**
- * @type {import("../render/canvas/ExecutorGroup").default}
- */
- _this.declutterExecutorGroup = null;
- return _this;
- }
- /**
- * Asynchronous layer level hit detection.
- * @param {import("../pixel.js").Pixel} pixel Pixel.
- * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with
- * an array of features.
- */
- LayerRenderer.prototype.getFeatures = function (pixel) {
- return util_abstract();
- };
- /**
- * @param {import("../pixel.js").Pixel} pixel Pixel.
- * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
- */
- LayerRenderer.prototype.getData = function (pixel) {
- return null;
- };
- /**
- * Determine whether render should be called.
- * @abstract
- * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
- * @return {boolean} Layer is ready to be rendered.
- */
- LayerRenderer.prototype.prepareFrame = function (frameState) {
- return util_abstract();
- };
- /**
- * Render the layer.
- * @abstract
- * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
- * @param {HTMLElement} target Target that may be used to render content to.
- * @return {HTMLElement} The rendered element.
- */
- LayerRenderer.prototype.renderFrame = function (frameState, target) {
- return util_abstract();
- };
- /**
- * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
- * @param {number} zoom Zoom level.
- * @param {import("../Tile.js").default} tile Tile.
- * @return {boolean|void} If `false`, the tile will not be considered loaded.
- */
- LayerRenderer.prototype.loadedTileCallback = function (tiles, zoom, tile) {
- if (!tiles[zoom]) {
- tiles[zoom] = {};
- }
- tiles[zoom][tile.tileCoord.toString()] = tile;
- return undefined;
- };
- /**
- * Create a function that adds loaded tiles to the tile lookup.
- * @param {import("../source/Tile.js").default} source Tile source.
- * @param {import("../proj/Projection.js").default} projection Projection of the tiles.
- * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
- * @return {function(number, import("../TileRange.js").default):boolean} A function that can be
- * called with a zoom level and a tile range to add loaded tiles to the lookup.
- * @protected
- */
- LayerRenderer.prototype.createLoadedTileFinder = function (source, projection, tiles) {
- return (
- /**
- * @param {number} zoom Zoom level.
- * @param {import("../TileRange.js").default} tileRange Tile range.
- * @return {boolean} The tile range is fully loaded.
- * @this {LayerRenderer}
- */
- function (zoom, tileRange) {
- var callback = this.loadedTileCallback.bind(this, tiles, zoom);
- return source.forEachLoadedTile(projection, zoom, tileRange, callback);
- }.bind(this));
- };
- /**
- * @abstract
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
- * @param {number} hitTolerance Hit tolerance in pixels.
- * @param {import("./vector.js").FeatureCallback<T>} callback Feature callback.
- * @param {Array<import("./Map.js").HitMatch<T>>} matches The hit detected matches with tolerance.
- * @return {T|undefined} Callback result.
- * @template T
- */
- LayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, matches) {
- return undefined;
- };
- /**
- * @abstract
- * @param {import("../pixel.js").Pixel} pixel Pixel.
- * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
- * @param {number} hitTolerance Hit tolerance in pixels.
- * @return {Uint8ClampedArray|Uint8Array} The result. If there is no data at the pixel
- * location, null will be returned. If there is data, but pixel values cannot be
- * returned, and empty array will be returned.
- */
- LayerRenderer.prototype.getDataAtPixel = function (pixel, frameState, hitTolerance) {
- return null;
- };
- /**
- * @return {LayerType} Layer.
- */
- LayerRenderer.prototype.getLayer = function () {
- return this.layer_;
- };
- /**
- * Perform action necessary to get the layer rendered after new fonts have loaded
- * @abstract
- */
- LayerRenderer.prototype.handleFontsChanged = function () { };
- /**
- * Handle changes in image state.
- * @param {import("../events/Event.js").default} event Image change event.
- * @private
- */
- LayerRenderer.prototype.handleImageChange_ = function (event) {
- var image = /** @type {import("../Image.js").default} */ (event.target);
- if (image.getState() === ImageState.LOADED) {
- this.renderIfReadyAndVisible();
- }
- };
- /**
- * Load the image if not already loaded, and register the image change
- * listener if needed.
- * @param {import("../ImageBase.js").default} image Image.
- * @return {boolean} `true` if the image is already loaded, `false` otherwise.
- * @protected
- */
- LayerRenderer.prototype.loadImage = function (image) {
- var imageState = image.getState();
- if (imageState != ImageState.LOADED && imageState != ImageState.ERROR) {
- image.addEventListener(EventType.CHANGE, this.boundHandleImageChange_);
- }
- if (imageState == ImageState.IDLE) {
- image.load();
- imageState = image.getState();
- }
- return imageState == ImageState.LOADED;
- };
- /**
- * @protected
- */
- LayerRenderer.prototype.renderIfReadyAndVisible = function () {
- var layer = this.getLayer();
- if (layer && layer.getVisible() && layer.getSourceState() === 'ready') {
- layer.changed();
- }
- };
- /**
- * Clean up.
- */
- LayerRenderer.prototype.disposeInternal = function () {
- delete this.layer_;
- _super.prototype.disposeInternal.call(this);
- };
- return LayerRenderer;
- }(ol_Observable));
- /* harmony default export */ var renderer_Layer = (LayerRenderer);
- //# sourceMappingURL=Layer.js.map
- ;// ./node_modules/ol/render/Event.js
- /**
- * @module ol/render/Event
- */
- var Event_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var RenderEvent = /** @class */ (function (_super) {
- Event_extends(RenderEvent, _super);
- /**
- * @param {import("./EventType.js").default} type Type.
- * @param {import("../transform.js").Transform} [opt_inversePixelTransform] Transform for
- * CSS pixels to rendered pixels.
- * @param {import("../PluggableMap.js").FrameState} [opt_frameState] Frame state.
- * @param {?(CanvasRenderingContext2D|WebGLRenderingContext)} [opt_context] Context.
- */
- function RenderEvent(type, opt_inversePixelTransform, opt_frameState, opt_context) {
- var _this = _super.call(this, type) || this;
- /**
- * Transform from CSS pixels (relative to the top-left corner of the map viewport)
- * to rendered pixels on this event's `context`. Only available when a Canvas renderer is used, null otherwise.
- * @type {import("../transform.js").Transform|undefined}
- * @api
- */
- _this.inversePixelTransform = opt_inversePixelTransform;
- /**
- * An object representing the current render frame state.
- * @type {import("../PluggableMap.js").FrameState|undefined}
- * @api
- */
- _this.frameState = opt_frameState;
- /**
- * Canvas context. Not available when the event is dispatched by the map. For Canvas 2D layers,
- * the context will be the 2D rendering context. For WebGL layers, the context will be the WebGL
- * context.
- * @type {CanvasRenderingContext2D|WebGLRenderingContext|undefined}
- * @api
- */
- _this.context = opt_context;
- return _this;
- }
- return RenderEvent;
- }(Event));
- /* harmony default export */ var render_Event = (RenderEvent);
- //# sourceMappingURL=Event.js.map
- ;// ./node_modules/ol/color.js
- /**
- * @module ol/color
- */
- /**
- * A color represented as a short array [red, green, blue, alpha].
- * red, green, and blue should be integers in the range 0..255 inclusive.
- * alpha should be a float in the range 0..1 inclusive. If no alpha value is
- * given then `1` will be used.
- * @typedef {Array<number>} Color
- * @api
- */
- /**
- * This RegExp matches # followed by 3, 4, 6, or 8 hex digits.
- * @const
- * @type {RegExp}
- * @private
- */
- var HEX_COLOR_RE_ = /^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i;
- /**
- * Regular expression for matching potential named color style strings.
- * @const
- * @type {RegExp}
- * @private
- */
- var NAMED_COLOR_RE_ = /^([a-z]*)$|^hsla?\(.*\)$/i;
- /**
- * Return the color as an rgba string.
- * @param {Color|string} color Color.
- * @return {string} Rgba string.
- * @api
- */
- function asString(color) {
- if (typeof color === 'string') {
- return color;
- }
- else {
- return color_toString(color);
- }
- }
- /**
- * Return named color as an rgba string.
- * @param {string} color Named color.
- * @return {string} Rgb string.
- */
- function fromNamed(color) {
- var el = document.createElement('div');
- el.style.color = color;
- if (el.style.color !== '') {
- document.body.appendChild(el);
- var rgb = getComputedStyle(el).color;
- document.body.removeChild(el);
- return rgb;
- }
- else {
- return '';
- }
- }
- /**
- * @param {string} s String.
- * @return {Color} Color.
- */
- var fromString = (function () {
- // We maintain a small cache of parsed strings. To provide cheap LRU-like
- // semantics, whenever the cache grows too large we simply delete an
- // arbitrary 25% of the entries.
- /**
- * @const
- * @type {number}
- */
- var MAX_CACHE_SIZE = 1024;
- /**
- * @type {Object<string, Color>}
- */
- var cache = {};
- /**
- * @type {number}
- */
- var cacheSize = 0;
- return (
- /**
- * @param {string} s String.
- * @return {Color} Color.
- */
- function (s) {
- var color;
- if (cache.hasOwnProperty(s)) {
- color = cache[s];
- }
- else {
- if (cacheSize >= MAX_CACHE_SIZE) {
- var i = 0;
- for (var key in cache) {
- if ((i++ & 3) === 0) {
- delete cache[key];
- --cacheSize;
- }
- }
- }
- color = fromStringInternal_(s);
- cache[s] = color;
- ++cacheSize;
- }
- return color;
- });
- })();
- /**
- * Return the color as an array. This function maintains a cache of calculated
- * arrays which means the result should not be modified.
- * @param {Color|string} color Color.
- * @return {Color} Color.
- * @api
- */
- function asArray(color) {
- if (Array.isArray(color)) {
- return color;
- }
- else {
- return fromString(color);
- }
- }
- /**
- * @param {string} s String.
- * @private
- * @return {Color} Color.
- */
- function fromStringInternal_(s) {
- var r, g, b, a, color;
- if (NAMED_COLOR_RE_.exec(s)) {
- s = fromNamed(s);
- }
- if (HEX_COLOR_RE_.exec(s)) {
- // hex
- var n = s.length - 1; // number of hex digits
- var d = // number of digits per channel
- void 0; // number of digits per channel
- if (n <= 4) {
- d = 1;
- }
- else {
- d = 2;
- }
- var hasAlpha = n === 4 || n === 8;
- r = parseInt(s.substr(1 + 0 * d, d), 16);
- g = parseInt(s.substr(1 + 1 * d, d), 16);
- b = parseInt(s.substr(1 + 2 * d, d), 16);
- if (hasAlpha) {
- a = parseInt(s.substr(1 + 3 * d, d), 16);
- }
- else {
- a = 255;
- }
- if (d == 1) {
- r = (r << 4) + r;
- g = (g << 4) + g;
- b = (b << 4) + b;
- if (hasAlpha) {
- a = (a << 4) + a;
- }
- }
- color = [r, g, b, a / 255];
- }
- else if (s.indexOf('rgba(') == 0) {
- // rgba()
- color = s.slice(5, -1).split(',').map(Number);
- normalize(color);
- }
- else if (s.indexOf('rgb(') == 0) {
- // rgb()
- color = s.slice(4, -1).split(',').map(Number);
- color.push(1);
- normalize(color);
- }
- else {
- asserts_assert(false, 14); // Invalid color
- }
- return color;
- }
- /**
- * TODO this function is only used in the test, we probably shouldn't export it
- * @param {Color} color Color.
- * @return {Color} Clamped color.
- */
- function normalize(color) {
- color[0] = math_clamp((color[0] + 0.5) | 0, 0, 255);
- color[1] = math_clamp((color[1] + 0.5) | 0, 0, 255);
- color[2] = math_clamp((color[2] + 0.5) | 0, 0, 255);
- color[3] = math_clamp(color[3], 0, 1);
- return color;
- }
- /**
- * @param {Color} color Color.
- * @return {string} String.
- */
- function color_toString(color) {
- var r = color[0];
- if (r != (r | 0)) {
- r = (r + 0.5) | 0;
- }
- var g = color[1];
- if (g != (g | 0)) {
- g = (g + 0.5) | 0;
- }
- var b = color[2];
- if (b != (b | 0)) {
- b = (b + 0.5) | 0;
- }
- var a = color[3] === undefined ? 1 : Math.round(color[3] * 100) / 100;
- return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
- }
- /**
- * @param {string} s String.
- * @return {boolean} Whether the string is actually a valid color
- */
- function isStringColor(s) {
- if (NAMED_COLOR_RE_.test(s)) {
- s = fromNamed(s);
- }
- return (HEX_COLOR_RE_.test(s) || s.indexOf('rgba(') === 0 || s.indexOf('rgb(') === 0);
- }
- //# sourceMappingURL=color.js.map
- ;// ./node_modules/ol/renderer/canvas/Layer.js
- var canvas_Layer_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/renderer/canvas/Layer
- */
- /**
- * @type {Array<HTMLCanvasElement>}
- */
- var canvasPool = [];
- /**
- * @type {CanvasRenderingContext2D}
- */
- var pixelContext = null;
- function createPixelContext() {
- var canvas = document.createElement('canvas');
- canvas.width = 1;
- canvas.height = 1;
- pixelContext = canvas.getContext('2d');
- }
- /**
- * @abstract
- * @template {import("../../layer/Layer.js").default} LayerType
- * @extends {LayerRenderer<LayerType>}
- */
- var CanvasLayerRenderer = /** @class */ (function (_super) {
- canvas_Layer_extends(CanvasLayerRenderer, _super);
- /**
- * @param {LayerType} layer Layer.
- */
- function CanvasLayerRenderer(layer) {
- var _this = _super.call(this, layer) || this;
- /**
- * @protected
- * @type {HTMLElement}
- */
- _this.container = null;
- /**
- * @protected
- * @type {number}
- */
- _this.renderedResolution;
- /**
- * A temporary transform. The values in this transform should only be used in a
- * function that sets the values.
- * @protected
- * @type {import("../../transform.js").Transform}
- */
- _this.tempTransform = create();
- /**
- * The transform for rendered pixels to viewport CSS pixels. This transform must
- * be set when rendering a frame and may be used by other functions after rendering.
- * @protected
- * @type {import("../../transform.js").Transform}
- */
- _this.pixelTransform = create();
- /**
- * The transform for viewport CSS pixels to rendered pixels. This transform must
- * be set when rendering a frame and may be used by other functions after rendering.
- * @protected
- * @type {import("../../transform.js").Transform}
- */
- _this.inversePixelTransform = create();
- /**
- * @type {CanvasRenderingContext2D}
- */
- _this.context = null;
- /**
- * @type {boolean}
- */
- _this.containerReused = false;
- /**
- * @private
- * @type {CanvasRenderingContext2D}
- */
- _this.pixelContext_ = null;
- /**
- * @protected
- * @type {import("../../PluggableMap.js").FrameState|null}
- */
- _this.frameState = null;
- return _this;
- }
- /**
- * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.
- * @param {number} col The column index.
- * @param {number} row The row index.
- * @return {Uint8ClampedArray|null} The image data.
- */
- CanvasLayerRenderer.prototype.getImageData = function (image, col, row) {
- if (!pixelContext) {
- createPixelContext();
- }
- pixelContext.clearRect(0, 0, 1, 1);
- var data;
- try {
- pixelContext.drawImage(image, col, row, 1, 1, 0, 0, 1, 1);
- data = pixelContext.getImageData(0, 0, 1, 1).data;
- }
- catch (err) {
- pixelContext = null;
- return null;
- }
- return data;
- };
- /**
- * @param {import('../../PluggableMap.js').FrameState} frameState Frame state.
- * @return {string} Background color.
- */
- CanvasLayerRenderer.prototype.getBackground = function (frameState) {
- var layer = this.getLayer();
- var background = layer.getBackground();
- if (typeof background === 'function') {
- background = background(frameState.viewState.resolution);
- }
- return background || undefined;
- };
- /**
- * Get a rendering container from an existing target, if compatible.
- * @param {HTMLElement} target Potential render target.
- * @param {string} transform CSS Transform.
- * @param {string} [opt_backgroundColor] Background color.
- */
- CanvasLayerRenderer.prototype.useContainer = function (target, transform, opt_backgroundColor) {
- var layerClassName = this.getLayer().getClassName();
- var container, context;
- if (target &&
- target.className === layerClassName &&
- (!opt_backgroundColor ||
- (target &&
- target.style.backgroundColor &&
- equals(asArray(target.style.backgroundColor), asArray(opt_backgroundColor))))) {
- var canvas = target.firstElementChild;
- if (canvas instanceof HTMLCanvasElement) {
- context = canvas.getContext('2d');
- }
- }
- if (context && context.canvas.style.transform === transform) {
- // Container of the previous layer renderer can be used.
- this.container = target;
- this.context = context;
- this.containerReused = true;
- }
- else if (this.containerReused) {
- // Previously reused container cannot be used any more.
- this.container = null;
- this.context = null;
- this.containerReused = false;
- }
- if (!this.container) {
- container = document.createElement('div');
- container.className = layerClassName;
- var style = container.style;
- style.position = 'absolute';
- style.width = '100%';
- style.height = '100%';
- context = createCanvasContext2D();
- var canvas = context.canvas;
- container.appendChild(canvas);
- style = canvas.style;
- style.position = 'absolute';
- style.left = '0';
- style.transformOrigin = 'top left';
- this.container = container;
- this.context = context;
- }
- if (!this.containerReused &&
- opt_backgroundColor &&
- !this.container.style.backgroundColor) {
- this.container.style.backgroundColor = opt_backgroundColor;
- }
- };
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @param {import("../../extent.js").Extent} extent Clip extent.
- * @protected
- */
- CanvasLayerRenderer.prototype.clipUnrotated = function (context, frameState, extent) {
- var topLeft = getTopLeft(extent);
- var topRight = getTopRight(extent);
- var bottomRight = getBottomRight(extent);
- var bottomLeft = getBottomLeft(extent);
- apply(frameState.coordinateToPixelTransform, topLeft);
- apply(frameState.coordinateToPixelTransform, topRight);
- apply(frameState.coordinateToPixelTransform, bottomRight);
- apply(frameState.coordinateToPixelTransform, bottomLeft);
- var inverted = this.inversePixelTransform;
- apply(inverted, topLeft);
- apply(inverted, topRight);
- apply(inverted, bottomRight);
- apply(inverted, bottomLeft);
- context.save();
- context.beginPath();
- context.moveTo(Math.round(topLeft[0]), Math.round(topLeft[1]));
- context.lineTo(Math.round(topRight[0]), Math.round(topRight[1]));
- context.lineTo(Math.round(bottomRight[0]), Math.round(bottomRight[1]));
- context.lineTo(Math.round(bottomLeft[0]), Math.round(bottomLeft[1]));
- context.clip();
- };
- /**
- * @param {import("../../render/EventType.js").default} type Event type.
- * @param {CanvasRenderingContext2D} context Context.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @private
- */
- CanvasLayerRenderer.prototype.dispatchRenderEvent_ = function (type, context, frameState) {
- var layer = this.getLayer();
- if (layer.hasListener(type)) {
- var event_1 = new render_Event(type, this.inversePixelTransform, frameState, context);
- layer.dispatchEvent(event_1);
- }
- };
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @protected
- */
- CanvasLayerRenderer.prototype.preRender = function (context, frameState) {
- this.frameState = frameState;
- this.dispatchRenderEvent_(render_EventType.PRERENDER, context, frameState);
- };
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @protected
- */
- CanvasLayerRenderer.prototype.postRender = function (context, frameState) {
- this.dispatchRenderEvent_(render_EventType.POSTRENDER, context, frameState);
- };
- /**
- * Creates a transform for rendering to an element that will be rotated after rendering.
- * @param {import("../../coordinate.js").Coordinate} center Center.
- * @param {number} resolution Resolution.
- * @param {number} rotation Rotation.
- * @param {number} pixelRatio Pixel ratio.
- * @param {number} width Width of the rendered element (in pixels).
- * @param {number} height Height of the rendered element (in pixels).
- * @param {number} offsetX Offset on the x-axis in view coordinates.
- * @protected
- * @return {!import("../../transform.js").Transform} Transform.
- */
- CanvasLayerRenderer.prototype.getRenderTransform = function (center, resolution, rotation, pixelRatio, width, height, offsetX) {
- var dx1 = width / 2;
- var dy1 = height / 2;
- var sx = pixelRatio / resolution;
- var sy = -sx;
- var dx2 = -center[0] + offsetX;
- var dy2 = -center[1];
- return compose(this.tempTransform, dx1, dy1, sx, sy, -rotation, dx2, dy2);
- };
- /**
- * @param {import("../../pixel.js").Pixel} pixel Pixel.
- * @param {import("../../PluggableMap.js").FrameState} frameState FrameState.
- * @param {number} hitTolerance Hit tolerance in pixels.
- * @return {Uint8ClampedArray|Uint8Array} The result. If there is no data at the pixel
- * location, null will be returned. If there is data, but pixel values cannot be
- * returned, and empty array will be returned.
- */
- CanvasLayerRenderer.prototype.getDataAtPixel = function (pixel, frameState, hitTolerance) {
- var renderPixel = apply(this.inversePixelTransform, pixel.slice());
- var context = this.context;
- var layer = this.getLayer();
- var layerExtent = layer.getExtent();
- if (layerExtent) {
- var renderCoordinate = apply(frameState.pixelToCoordinateTransform, pixel.slice());
- /** get only data inside of the layer extent */
- if (!containsCoordinate(layerExtent, renderCoordinate)) {
- return null;
- }
- }
- var x = Math.round(renderPixel[0]);
- var y = Math.round(renderPixel[1]);
- var pixelContext = this.pixelContext_;
- if (!pixelContext) {
- var pixelCanvas = document.createElement('canvas');
- pixelCanvas.width = 1;
- pixelCanvas.height = 1;
- pixelContext = pixelCanvas.getContext('2d');
- this.pixelContext_ = pixelContext;
- }
- pixelContext.clearRect(0, 0, 1, 1);
- var data;
- try {
- pixelContext.drawImage(context.canvas, x, y, 1, 1, 0, 0, 1, 1);
- data = pixelContext.getImageData(0, 0, 1, 1).data;
- }
- catch (err) {
- if (err.name === 'SecurityError') {
- // tainted canvas, we assume there is data at the given pixel (although there might not be)
- this.pixelContext_ = null;
- return new Uint8Array();
- }
- return data;
- }
- if (data[3] === 0) {
- return null;
- }
- return data;
- };
- /**
- * Clean up.
- */
- CanvasLayerRenderer.prototype.disposeInternal = function () {
- delete this.frameState;
- _super.prototype.disposeInternal.call(this);
- };
- return CanvasLayerRenderer;
- }(renderer_Layer));
- /* harmony default export */ var canvas_Layer = (CanvasLayerRenderer);
- //# sourceMappingURL=Layer.js.map
- ;// ./node_modules/ol/TileState.js
- /**
- * @module ol/TileState
- */
- /**
- * @enum {number}
- */
- /* harmony default export */ var TileState = ({
- IDLE: 0,
- LOADING: 1,
- LOADED: 2,
- /**
- * Indicates that tile loading failed
- * @type {number}
- */
- ERROR: 3,
- EMPTY: 4,
- });
- //# sourceMappingURL=TileState.js.map
- ;// ./node_modules/ol/Tile.js
- var Tile_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/Tile
- */
- /**
- * A function that takes an {@link module:ol/Tile~Tile} for the tile and a
- * `{string}` for the url as arguments. The default is
- * ```js
- * source.setTileLoadFunction(function(tile, src) {
- * tile.getImage().src = src;
- * });
- * ```
- * For more fine grained control, the load function can use fetch or XMLHttpRequest and involve
- * error handling:
- *
- * ```js
- * import TileState from 'ol/TileState';
- *
- * source.setTileLoadFunction(function(tile, src) {
- * var xhr = new XMLHttpRequest();
- * xhr.responseType = 'blob';
- * xhr.addEventListener('loadend', function (evt) {
- * var data = this.response;
- * if (data !== undefined) {
- * tile.getImage().src = URL.createObjectURL(data);
- * } else {
- * tile.setState(TileState.ERROR);
- * }
- * });
- * xhr.addEventListener('error', function () {
- * tile.setState(TileState.ERROR);
- * });
- * xhr.open('GET', src);
- * xhr.send();
- * });
- * ```
- *
- * @typedef {function(Tile, string): void} LoadFunction
- * @api
- */
- /**
- * {@link module:ol/source/Tile~TileSource} sources use a function of this type to get
- * the url that provides a tile for a given tile coordinate.
- *
- * This function takes an {@link module:ol/tilecoord~TileCoord} for the tile
- * coordinate, a `{number}` representing the pixel ratio and a
- * {@link module:ol/proj/Projection~Projection} for the projection as arguments
- * and returns a `{string}` representing the tile URL, or undefined if no tile
- * should be requested for the passed tile coordinate.
- *
- * @typedef {function(import("./tilecoord.js").TileCoord, number,
- * import("./proj/Projection.js").default): (string|undefined)} UrlFunction
- * @api
- */
- /**
- * @typedef {Object} Options
- * @property {number} [transition=250] A duration for tile opacity
- * transitions in milliseconds. A duration of 0 disables the opacity transition.
- * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,
- * the nearest neighbor is used when resampling.
- * @api
- */
- /**
- * @classdesc
- * Base class for tiles.
- *
- * @abstract
- */
- var Tile = /** @class */ (function (_super) {
- Tile_extends(Tile, _super);
- /**
- * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {import("./TileState.js").default} state State.
- * @param {Options} [opt_options] Tile options.
- */
- function Tile(tileCoord, state, opt_options) {
- var _this = _super.call(this) || this;
- var options = opt_options ? opt_options : {};
- /**
- * @type {import("./tilecoord.js").TileCoord}
- */
- _this.tileCoord = tileCoord;
- /**
- * @protected
- * @type {import("./TileState.js").default}
- */
- _this.state = state;
- /**
- * An "interim" tile for this tile. The interim tile may be used while this
- * one is loading, for "smooth" transitions when changing params/dimensions
- * on the source.
- * @type {Tile}
- */
- _this.interimTile = null;
- /**
- * A key assigned to the tile. This is used by the tile source to determine
- * if this tile can effectively be used, or if a new tile should be created
- * and this one be used as an interim tile for this new tile.
- * @type {string}
- */
- _this.key = '';
- /**
- * The duration for the opacity transition.
- * @type {number}
- */
- _this.transition_ =
- options.transition === undefined ? 250 : options.transition;
- /**
- * Lookup of start times for rendering transitions. If the start time is
- * equal to -1, the transition is complete.
- * @type {Object<string, number>}
- */
- _this.transitionStarts_ = {};
- /**
- * @type {boolean}
- */
- _this.interpolate = !!options.interpolate;
- return _this;
- }
- /**
- * @protected
- */
- Tile.prototype.changed = function () {
- this.dispatchEvent(EventType.CHANGE);
- };
- /**
- * Called by the tile cache when the tile is removed from the cache due to expiry
- */
- Tile.prototype.release = function () { };
- /**
- * @return {string} Key.
- */
- Tile.prototype.getKey = function () {
- return this.key + '/' + this.tileCoord;
- };
- /**
- * Get the interim tile most suitable for rendering using the chain of interim
- * tiles. This corresponds to the most recent tile that has been loaded, if no
- * such tile exists, the original tile is returned.
- * @return {!Tile} Best tile for rendering.
- */
- Tile.prototype.getInterimTile = function () {
- if (!this.interimTile) {
- //empty chain
- return this;
- }
- var tile = this.interimTile;
- // find the first loaded tile and return it. Since the chain is sorted in
- // decreasing order of creation time, there is no need to search the remainder
- // of the list (all those tiles correspond to older requests and will be
- // cleaned up by refreshInterimChain)
- do {
- if (tile.getState() == TileState.LOADED) {
- // Show tile immediately instead of fading it in after loading, because
- // the interim tile is in place already
- this.transition_ = 0;
- return tile;
- }
- tile = tile.interimTile;
- } while (tile);
- // we can not find a better tile
- return this;
- };
- /**
- * Goes through the chain of interim tiles and discards sections of the chain
- * that are no longer relevant.
- */
- Tile.prototype.refreshInterimChain = function () {
- if (!this.interimTile) {
- return;
- }
- var tile = this.interimTile;
- /**
- * @type {Tile}
- */
- var prev = this;
- do {
- if (tile.getState() == TileState.LOADED) {
- //we have a loaded tile, we can discard the rest of the list
- //we would could abort any LOADING tile request
- //older than this tile (i.e. any LOADING tile following this entry in the chain)
- tile.interimTile = null;
- break;
- }
- else if (tile.getState() == TileState.LOADING) {
- //keep this LOADING tile any loaded tiles later in the chain are
- //older than this tile, so we're still interested in the request
- prev = tile;
- }
- else if (tile.getState() == TileState.IDLE) {
- //the head of the list is the most current tile, we don't need
- //to start any other requests for this chain
- prev.interimTile = tile.interimTile;
- }
- else {
- prev = tile;
- }
- tile = prev.interimTile;
- } while (tile);
- };
- /**
- * Get the tile coordinate for this tile.
- * @return {import("./tilecoord.js").TileCoord} The tile coordinate.
- * @api
- */
- Tile.prototype.getTileCoord = function () {
- return this.tileCoord;
- };
- /**
- * @return {import("./TileState.js").default} State.
- */
- Tile.prototype.getState = function () {
- return this.state;
- };
- /**
- * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} ,
- * it is important to set the state correctly to {@link module:ol/TileState~ERROR}
- * when the tile cannot be loaded. Otherwise the tile cannot be removed from
- * the tile queue and will block other requests.
- * @param {import("./TileState.js").default} state State.
- * @api
- */
- Tile.prototype.setState = function (state) {
- if (this.state !== TileState.ERROR && this.state > state) {
- throw new Error('Tile load sequence violation');
- }
- this.state = state;
- this.changed();
- };
- /**
- * Load the image or retry if loading previously failed.
- * Loading is taken care of by the tile queue, and calling this method is
- * only needed for preloading or for reloading in case of an error.
- * @abstract
- * @api
- */
- Tile.prototype.load = function () {
- util_abstract();
- };
- /**
- * Get the alpha value for rendering.
- * @param {string} id An id for the renderer.
- * @param {number} time The render frame time.
- * @return {number} A number between 0 and 1.
- */
- Tile.prototype.getAlpha = function (id, time) {
- if (!this.transition_) {
- return 1;
- }
- var start = this.transitionStarts_[id];
- if (!start) {
- start = time;
- this.transitionStarts_[id] = start;
- }
- else if (start === -1) {
- return 1;
- }
- var delta = time - start + 1000 / 60; // avoid rendering at 0
- if (delta >= this.transition_) {
- return 1;
- }
- return easeIn(delta / this.transition_);
- };
- /**
- * Determine if a tile is in an alpha transition. A tile is considered in
- * transition if tile.getAlpha() has not yet been called or has been called
- * and returned 1.
- * @param {string} id An id for the renderer.
- * @return {boolean} The tile is in transition.
- */
- Tile.prototype.inTransition = function (id) {
- if (!this.transition_) {
- return false;
- }
- return this.transitionStarts_[id] !== -1;
- };
- /**
- * Mark a transition as complete.
- * @param {string} id An id for the renderer.
- */
- Tile.prototype.endTransition = function (id) {
- if (this.transition_) {
- this.transitionStarts_[id] = -1;
- }
- };
- return Tile;
- }(events_Target));
- /* harmony default export */ var ol_Tile = (Tile);
- //# sourceMappingURL=Tile.js.map
- ;// ./node_modules/ol/ImageBase.js
- var ImageBase_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/ImageBase
- */
- /**
- * @abstract
- */
- var ImageBase = /** @class */ (function (_super) {
- ImageBase_extends(ImageBase, _super);
- /**
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {number|undefined} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("./ImageState.js").default} state State.
- */
- function ImageBase(extent, resolution, pixelRatio, state) {
- var _this = _super.call(this) || this;
- /**
- * @protected
- * @type {import("./extent.js").Extent}
- */
- _this.extent = extent;
- /**
- * @private
- * @type {number}
- */
- _this.pixelRatio_ = pixelRatio;
- /**
- * @protected
- * @type {number|undefined}
- */
- _this.resolution = resolution;
- /**
- * @protected
- * @type {import("./ImageState.js").default}
- */
- _this.state = state;
- return _this;
- }
- /**
- * @protected
- */
- ImageBase.prototype.changed = function () {
- this.dispatchEvent(EventType.CHANGE);
- };
- /**
- * @return {import("./extent.js").Extent} Extent.
- */
- ImageBase.prototype.getExtent = function () {
- return this.extent;
- };
- /**
- * @abstract
- * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
- */
- ImageBase.prototype.getImage = function () {
- return util_abstract();
- };
- /**
- * @return {number} PixelRatio.
- */
- ImageBase.prototype.getPixelRatio = function () {
- return this.pixelRatio_;
- };
- /**
- * @return {number} Resolution.
- */
- ImageBase.prototype.getResolution = function () {
- return /** @type {number} */ (this.resolution);
- };
- /**
- * @return {import("./ImageState.js").default} State.
- */
- ImageBase.prototype.getState = function () {
- return this.state;
- };
- /**
- * Load not yet loaded URI.
- * @abstract
- */
- ImageBase.prototype.load = function () {
- util_abstract();
- };
- return ImageBase;
- }(events_Target));
- /* harmony default export */ var ol_ImageBase = (ImageBase);
- //# sourceMappingURL=ImageBase.js.map
- ;// ./node_modules/ol/Image.js
- var Image_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/Image
- */
- /**
- * A function that takes an {@link module:ol/Image~ImageWrapper} for the image and a
- * `{string}` for the src as arguments. It is supposed to make it so the
- * underlying image {@link module:ol/Image~ImageWrapper#getImage} is assigned the
- * content specified by the src. If not specified, the default is
- *
- * function(image, src) {
- * image.getImage().src = src;
- * }
- *
- * Providing a custom `imageLoadFunction` can be useful to load images with
- * post requests or - in general - through XHR requests, where the src of the
- * image element would be set to a data URI when the content is loaded.
- *
- * @typedef {function(ImageWrapper, string): void} LoadFunction
- * @api
- */
- var ImageWrapper = /** @class */ (function (_super) {
- Image_extends(ImageWrapper, _super);
- /**
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {number|undefined} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- * @param {string} src Image source URI.
- * @param {?string} crossOrigin Cross origin.
- * @param {LoadFunction} imageLoadFunction Image load function.
- */
- function ImageWrapper(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
- var _this = _super.call(this, extent, resolution, pixelRatio, ImageState.IDLE) || this;
- /**
- * @private
- * @type {string}
- */
- _this.src_ = src;
- /**
- * @private
- * @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement}
- */
- _this.image_ = new Image();
- if (crossOrigin !== null) {
- _this.image_.crossOrigin = crossOrigin;
- }
- /**
- * @private
- * @type {?function():void}
- */
- _this.unlisten_ = null;
- /**
- * @protected
- * @type {import("./ImageState.js").default}
- */
- _this.state = ImageState.IDLE;
- /**
- * @private
- * @type {LoadFunction}
- */
- _this.imageLoadFunction_ = imageLoadFunction;
- return _this;
- }
- /**
- * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
- * @api
- */
- ImageWrapper.prototype.getImage = function () {
- return this.image_;
- };
- /**
- * Tracks loading or read errors.
- *
- * @private
- */
- ImageWrapper.prototype.handleImageError_ = function () {
- this.state = ImageState.ERROR;
- this.unlistenImage_();
- this.changed();
- };
- /**
- * Tracks successful image load.
- *
- * @private
- */
- ImageWrapper.prototype.handleImageLoad_ = function () {
- if (this.resolution === undefined) {
- this.resolution = getHeight(this.extent) / this.image_.height;
- }
- this.state = ImageState.LOADED;
- this.unlistenImage_();
- this.changed();
- };
- /**
- * Load the image or retry if loading previously failed.
- * Loading is taken care of by the tile queue, and calling this method is
- * only needed for preloading or for reloading in case of an error.
- * @api
- */
- ImageWrapper.prototype.load = function () {
- if (this.state == ImageState.IDLE || this.state == ImageState.ERROR) {
- this.state = ImageState.LOADING;
- this.changed();
- this.imageLoadFunction_(this, this.src_);
- this.unlisten_ = listenImage(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this));
- }
- };
- /**
- * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.
- */
- ImageWrapper.prototype.setImage = function (image) {
- this.image_ = image;
- this.resolution = getHeight(this.extent) / this.image_.height;
- };
- /**
- * Discards event handlers which listen for load completion or errors.
- *
- * @private
- */
- ImageWrapper.prototype.unlistenImage_ = function () {
- if (this.unlisten_) {
- this.unlisten_();
- this.unlisten_ = null;
- }
- };
- return ImageWrapper;
- }(ol_ImageBase));
- /**
- * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image element.
- * @param {function():any} loadHandler Load callback function.
- * @param {function():any} errorHandler Error callback function.
- * @return {function():void} Callback to stop listening.
- */
- function listenImage(image, loadHandler, errorHandler) {
- var img = /** @type {HTMLImageElement} */ (image);
- var listening = true;
- var decoding = false;
- var loaded = false;
- var listenerKeys = [
- listenOnce(img, EventType.LOAD, function () {
- loaded = true;
- if (!decoding) {
- loadHandler();
- }
- }),
- ];
- if (img.src && IMAGE_DECODE) {
- decoding = true;
- img
- .decode()
- .then(function () {
- if (listening) {
- loadHandler();
- }
- })
- .catch(function (error) {
- if (listening) {
- if (loaded) {
- loadHandler();
- }
- else {
- errorHandler();
- }
- }
- });
- }
- else {
- listenerKeys.push(listenOnce(img, EventType.ERROR, errorHandler));
- }
- return function unlisten() {
- listening = false;
- listenerKeys.forEach(unlistenByKey);
- };
- }
- /* harmony default export */ var ol_Image = ((/* unused pure expression or super */ null && (ImageWrapper)));
- //# sourceMappingURL=Image.js.map
- ;// ./node_modules/ol/ImageTile.js
- var ImageTile_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/ImageTile
- */
- var ImageTile = /** @class */ (function (_super) {
- ImageTile_extends(ImageTile, _super);
- /**
- * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {import("./TileState.js").default} state State.
- * @param {string} src Image source URI.
- * @param {?string} crossOrigin Cross origin.
- * @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function.
- * @param {import("./Tile.js").Options} [opt_options] Tile options.
- */
- function ImageTile(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
- var _this = _super.call(this, tileCoord, state, opt_options) || this;
- /**
- * @private
- * @type {?string}
- */
- _this.crossOrigin_ = crossOrigin;
- /**
- * Image URI
- *
- * @private
- * @type {string}
- */
- _this.src_ = src;
- _this.key = src;
- /**
- * @private
- * @type {HTMLImageElement|HTMLCanvasElement}
- */
- _this.image_ = new Image();
- if (crossOrigin !== null) {
- _this.image_.crossOrigin = crossOrigin;
- }
- /**
- * @private
- * @type {?function():void}
- */
- _this.unlisten_ = null;
- /**
- * @private
- * @type {import("./Tile.js").LoadFunction}
- */
- _this.tileLoadFunction_ = tileLoadFunction;
- return _this;
- }
- /**
- * Get the HTML image element for this tile (may be a Canvas, Image, or Video).
- * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
- * @api
- */
- ImageTile.prototype.getImage = function () {
- return this.image_;
- };
- /**
- * Sets an HTML image element for this tile (may be a Canvas or preloaded Image).
- * @param {HTMLCanvasElement|HTMLImageElement} element Element.
- */
- ImageTile.prototype.setImage = function (element) {
- this.image_ = element;
- this.state = TileState.LOADED;
- this.unlistenImage_();
- this.changed();
- };
- /**
- * Tracks loading or read errors.
- *
- * @private
- */
- ImageTile.prototype.handleImageError_ = function () {
- this.state = TileState.ERROR;
- this.unlistenImage_();
- this.image_ = getBlankImage();
- this.changed();
- };
- /**
- * Tracks successful image load.
- *
- * @private
- */
- ImageTile.prototype.handleImageLoad_ = function () {
- var image = /** @type {HTMLImageElement} */ (this.image_);
- if (image.naturalWidth && image.naturalHeight) {
- this.state = TileState.LOADED;
- }
- else {
- this.state = TileState.EMPTY;
- }
- this.unlistenImage_();
- this.changed();
- };
- /**
- * Load not yet loaded URI.
- * @api
- */
- ImageTile.prototype.load = function () {
- if (this.state == TileState.ERROR) {
- this.state = TileState.IDLE;
- this.image_ = new Image();
- if (this.crossOrigin_ !== null) {
- this.image_.crossOrigin = this.crossOrigin_;
- }
- }
- if (this.state == TileState.IDLE) {
- this.state = TileState.LOADING;
- this.changed();
- this.tileLoadFunction_(this, this.src_);
- this.unlisten_ = listenImage(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this));
- }
- };
- /**
- * Discards event handlers which listen for load completion or errors.
- *
- * @private
- */
- ImageTile.prototype.unlistenImage_ = function () {
- if (this.unlisten_) {
- this.unlisten_();
- this.unlisten_ = null;
- }
- };
- return ImageTile;
- }(ol_Tile));
- /**
- * Get a 1-pixel blank image.
- * @return {HTMLCanvasElement} Blank image.
- */
- function getBlankImage() {
- var ctx = createCanvasContext2D(1, 1);
- ctx.fillStyle = 'rgba(0,0,0,0)';
- ctx.fillRect(0, 0, 1, 1);
- return ctx.canvas;
- }
- /* harmony default export */ var ol_ImageTile = (ImageTile);
- //# sourceMappingURL=ImageTile.js.map
- ;// ./node_modules/ol/reproj/common.js
- /**
- * @module ol/reproj/common
- */
- /**
- * Default maximum allowed threshold (in pixels) for reprojection
- * triangulation.
- * @type {number}
- */
- var ERROR_THRESHOLD = 0.5;
- /**
- * Enable automatic reprojection of raster sources. Default is `true`.
- * TODO: decide if we want to expose this as a build flag or remove it
- * @type {boolean}
- */
- var ENABLE_RASTER_REPROJECTION = true;
- //# sourceMappingURL=common.js.map
- ;// ./node_modules/ol/reproj/Triangulation.js
- /**
- * @module ol/reproj/Triangulation
- */
- /**
- * Single triangle; consists of 3 source points and 3 target points.
- * @typedef {Object} Triangle
- * @property {Array<import("../coordinate.js").Coordinate>} source Source.
- * @property {Array<import("../coordinate.js").Coordinate>} target Target.
- */
- /**
- * Maximum number of subdivision steps during raster reprojection triangulation.
- * Prevents high memory usage and large number of proj4 calls (for certain
- * transformations and areas). At most `2*(2^this)` triangles are created for
- * each triangulated extent (tile/image).
- * @type {number}
- */
- var MAX_SUBDIVISION = 10;
- /**
- * Maximum allowed size of triangle relative to world width. When transforming
- * corners of world extent between certain projections, the resulting
- * triangulation seems to have zero error and no subdivision is performed. If
- * the triangle width is more than this (relative to world width; 0-1),
- * subdivison is forced (up to `MAX_SUBDIVISION`). Default is `0.25`.
- * @type {number}
- */
- var MAX_TRIANGLE_WIDTH = 0.25;
- /**
- * @classdesc
- * Class containing triangulation of the given target extent.
- * Used for determining source data and the reprojection itself.
- */
- var Triangulation = /** @class */ (function () {
- /**
- * @param {import("../proj/Projection.js").default} sourceProj Source projection.
- * @param {import("../proj/Projection.js").default} targetProj Target projection.
- * @param {import("../extent.js").Extent} targetExtent Target extent to triangulate.
- * @param {import("../extent.js").Extent} maxSourceExtent Maximal source extent that can be used.
- * @param {number} errorThreshold Acceptable error (in source units).
- * @param {?number} opt_destinationResolution The (optional) resolution of the destination.
- */
- function Triangulation(sourceProj, targetProj, targetExtent, maxSourceExtent, errorThreshold, opt_destinationResolution) {
- /**
- * @type {import("../proj/Projection.js").default}
- * @private
- */
- this.sourceProj_ = sourceProj;
- /**
- * @type {import("../proj/Projection.js").default}
- * @private
- */
- this.targetProj_ = targetProj;
- /** @type {!Object<string, import("../coordinate.js").Coordinate>} */
- var transformInvCache = {};
- var transformInv = getTransform(this.targetProj_, this.sourceProj_);
- /**
- * @param {import("../coordinate.js").Coordinate} c A coordinate.
- * @return {import("../coordinate.js").Coordinate} Transformed coordinate.
- * @private
- */
- this.transformInv_ = function (c) {
- var key = c[0] + '/' + c[1];
- if (!transformInvCache[key]) {
- transformInvCache[key] = transformInv(c);
- }
- return transformInvCache[key];
- };
- /**
- * @type {import("../extent.js").Extent}
- * @private
- */
- this.maxSourceExtent_ = maxSourceExtent;
- /**
- * @type {number}
- * @private
- */
- this.errorThresholdSquared_ = errorThreshold * errorThreshold;
- /**
- * @type {Array<Triangle>}
- * @private
- */
- this.triangles_ = [];
- /**
- * Indicates that the triangulation crosses edge of the source projection.
- * @type {boolean}
- * @private
- */
- this.wrapsXInSource_ = false;
- /**
- * @type {boolean}
- * @private
- */
- this.canWrapXInSource_ =
- this.sourceProj_.canWrapX() &&
- !!maxSourceExtent &&
- !!this.sourceProj_.getExtent() &&
- extent_getWidth(maxSourceExtent) == extent_getWidth(this.sourceProj_.getExtent());
- /**
- * @type {?number}
- * @private
- */
- this.sourceWorldWidth_ = this.sourceProj_.getExtent()
- ? extent_getWidth(this.sourceProj_.getExtent())
- : null;
- /**
- * @type {?number}
- * @private
- */
- this.targetWorldWidth_ = this.targetProj_.getExtent()
- ? extent_getWidth(this.targetProj_.getExtent())
- : null;
- var destinationTopLeft = getTopLeft(targetExtent);
- var destinationTopRight = getTopRight(targetExtent);
- var destinationBottomRight = getBottomRight(targetExtent);
- var destinationBottomLeft = getBottomLeft(targetExtent);
- var sourceTopLeft = this.transformInv_(destinationTopLeft);
- var sourceTopRight = this.transformInv_(destinationTopRight);
- var sourceBottomRight = this.transformInv_(destinationBottomRight);
- var sourceBottomLeft = this.transformInv_(destinationBottomLeft);
- /*
- * The maxSubdivision controls how many splittings of the target area can
- * be done. The idea here is to do a linear mapping of the target areas
- * but the actual overal reprojection (can be) extremely non-linear. The
- * default value of MAX_SUBDIVISION was chosen based on mapping a 256x256
- * tile size. However this function is also called to remap canvas rendered
- * layers which can be much larger. This calculation increases the maxSubdivision
- * value by the right factor so that each 256x256 pixel area has
- * MAX_SUBDIVISION divisions.
- */
- var maxSubdivision = MAX_SUBDIVISION +
- (opt_destinationResolution
- ? Math.max(0, Math.ceil(log2(getArea(targetExtent) /
- (opt_destinationResolution *
- opt_destinationResolution *
- 256 *
- 256))))
- : 0);
- this.addQuad_(destinationTopLeft, destinationTopRight, destinationBottomRight, destinationBottomLeft, sourceTopLeft, sourceTopRight, sourceBottomRight, sourceBottomLeft, maxSubdivision);
- if (this.wrapsXInSource_) {
- var leftBound_1 = Infinity;
- this.triangles_.forEach(function (triangle, i, arr) {
- leftBound_1 = Math.min(leftBound_1, triangle.source[0][0], triangle.source[1][0], triangle.source[2][0]);
- });
- // Shift triangles to be as close to `leftBound` as possible
- // (if the distance is more than `worldWidth / 2` it can be closer.
- this.triangles_.forEach(function (triangle) {
- if (Math.max(triangle.source[0][0], triangle.source[1][0], triangle.source[2][0]) -
- leftBound_1 >
- this.sourceWorldWidth_ / 2) {
- var newTriangle = [
- [triangle.source[0][0], triangle.source[0][1]],
- [triangle.source[1][0], triangle.source[1][1]],
- [triangle.source[2][0], triangle.source[2][1]],
- ];
- if (newTriangle[0][0] - leftBound_1 > this.sourceWorldWidth_ / 2) {
- newTriangle[0][0] -= this.sourceWorldWidth_;
- }
- if (newTriangle[1][0] - leftBound_1 > this.sourceWorldWidth_ / 2) {
- newTriangle[1][0] -= this.sourceWorldWidth_;
- }
- if (newTriangle[2][0] - leftBound_1 > this.sourceWorldWidth_ / 2) {
- newTriangle[2][0] -= this.sourceWorldWidth_;
- }
- // Rarely (if the extent contains both the dateline and prime meridian)
- // the shift can in turn break some triangles.
- // Detect this here and don't shift in such cases.
- var minX = Math.min(newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]);
- var maxX = Math.max(newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]);
- if (maxX - minX < this.sourceWorldWidth_ / 2) {
- triangle.source = newTriangle;
- }
- }
- }.bind(this));
- }
- transformInvCache = {};
- }
- /**
- * Adds triangle to the triangulation.
- * @param {import("../coordinate.js").Coordinate} a The target a coordinate.
- * @param {import("../coordinate.js").Coordinate} b The target b coordinate.
- * @param {import("../coordinate.js").Coordinate} c The target c coordinate.
- * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate.
- * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate.
- * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate.
- * @private
- */
- Triangulation.prototype.addTriangle_ = function (a, b, c, aSrc, bSrc, cSrc) {
- this.triangles_.push({
- source: [aSrc, bSrc, cSrc],
- target: [a, b, c],
- });
- };
- /**
- * Adds quad (points in clock-wise order) to the triangulation
- * (and reprojects the vertices) if valid.
- * Performs quad subdivision if needed to increase precision.
- *
- * @param {import("../coordinate.js").Coordinate} a The target a coordinate.
- * @param {import("../coordinate.js").Coordinate} b The target b coordinate.
- * @param {import("../coordinate.js").Coordinate} c The target c coordinate.
- * @param {import("../coordinate.js").Coordinate} d The target d coordinate.
- * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate.
- * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate.
- * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate.
- * @param {import("../coordinate.js").Coordinate} dSrc The source d coordinate.
- * @param {number} maxSubdivision Maximal allowed subdivision of the quad.
- * @private
- */
- Triangulation.prototype.addQuad_ = function (a, b, c, d, aSrc, bSrc, cSrc, dSrc, maxSubdivision) {
- var sourceQuadExtent = boundingExtent([aSrc, bSrc, cSrc, dSrc]);
- var sourceCoverageX = this.sourceWorldWidth_
- ? extent_getWidth(sourceQuadExtent) / this.sourceWorldWidth_
- : null;
- var sourceWorldWidth = /** @type {number} */ (this.sourceWorldWidth_);
- // when the quad is wrapped in the source projection
- // it covers most of the projection extent, but not fully
- var wrapsX = this.sourceProj_.canWrapX() &&
- sourceCoverageX > 0.5 &&
- sourceCoverageX < 1;
- var needsSubdivision = false;
- if (maxSubdivision > 0) {
- if (this.targetProj_.isGlobal() && this.targetWorldWidth_) {
- var targetQuadExtent = boundingExtent([a, b, c, d]);
- var targetCoverageX = extent_getWidth(targetQuadExtent) / this.targetWorldWidth_;
- needsSubdivision =
- targetCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision;
- }
- if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) {
- needsSubdivision =
- sourceCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision;
- }
- }
- if (!needsSubdivision && this.maxSourceExtent_) {
- if (isFinite(sourceQuadExtent[0]) &&
- isFinite(sourceQuadExtent[1]) &&
- isFinite(sourceQuadExtent[2]) &&
- isFinite(sourceQuadExtent[3])) {
- if (!intersects(sourceQuadExtent, this.maxSourceExtent_)) {
- // whole quad outside source projection extent -> ignore
- return;
- }
- }
- }
- var isNotFinite = 0;
- if (!needsSubdivision) {
- if (!isFinite(aSrc[0]) ||
- !isFinite(aSrc[1]) ||
- !isFinite(bSrc[0]) ||
- !isFinite(bSrc[1]) ||
- !isFinite(cSrc[0]) ||
- !isFinite(cSrc[1]) ||
- !isFinite(dSrc[0]) ||
- !isFinite(dSrc[1])) {
- if (maxSubdivision > 0) {
- needsSubdivision = true;
- }
- else {
- // It might be the case that only 1 of the points is infinite. In this case
- // we can draw a single triangle with the other three points
- isNotFinite =
- (!isFinite(aSrc[0]) || !isFinite(aSrc[1]) ? 8 : 0) +
- (!isFinite(bSrc[0]) || !isFinite(bSrc[1]) ? 4 : 0) +
- (!isFinite(cSrc[0]) || !isFinite(cSrc[1]) ? 2 : 0) +
- (!isFinite(dSrc[0]) || !isFinite(dSrc[1]) ? 1 : 0);
- if (isNotFinite != 1 &&
- isNotFinite != 2 &&
- isNotFinite != 4 &&
- isNotFinite != 8) {
- return;
- }
- }
- }
- }
- if (maxSubdivision > 0) {
- if (!needsSubdivision) {
- var center = [(a[0] + c[0]) / 2, (a[1] + c[1]) / 2];
- var centerSrc = this.transformInv_(center);
- var dx = void 0;
- if (wrapsX) {
- var centerSrcEstimX = (math_modulo(aSrc[0], sourceWorldWidth) +
- math_modulo(cSrc[0], sourceWorldWidth)) /
- 2;
- dx = centerSrcEstimX - math_modulo(centerSrc[0], sourceWorldWidth);
- }
- else {
- dx = (aSrc[0] + cSrc[0]) / 2 - centerSrc[0];
- }
- var dy = (aSrc[1] + cSrc[1]) / 2 - centerSrc[1];
- var centerSrcErrorSquared = dx * dx + dy * dy;
- needsSubdivision = centerSrcErrorSquared > this.errorThresholdSquared_;
- }
- if (needsSubdivision) {
- if (Math.abs(a[0] - c[0]) <= Math.abs(a[1] - c[1])) {
- // split horizontally (top & bottom)
- var bc = [(b[0] + c[0]) / 2, (b[1] + c[1]) / 2];
- var bcSrc = this.transformInv_(bc);
- var da = [(d[0] + a[0]) / 2, (d[1] + a[1]) / 2];
- var daSrc = this.transformInv_(da);
- this.addQuad_(a, b, bc, da, aSrc, bSrc, bcSrc, daSrc, maxSubdivision - 1);
- this.addQuad_(da, bc, c, d, daSrc, bcSrc, cSrc, dSrc, maxSubdivision - 1);
- }
- else {
- // split vertically (left & right)
- var ab = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];
- var abSrc = this.transformInv_(ab);
- var cd = [(c[0] + d[0]) / 2, (c[1] + d[1]) / 2];
- var cdSrc = this.transformInv_(cd);
- this.addQuad_(a, ab, cd, d, aSrc, abSrc, cdSrc, dSrc, maxSubdivision - 1);
- this.addQuad_(ab, b, c, cd, abSrc, bSrc, cSrc, cdSrc, maxSubdivision - 1);
- }
- return;
- }
- }
- if (wrapsX) {
- if (!this.canWrapXInSource_) {
- return;
- }
- this.wrapsXInSource_ = true;
- }
- // Exactly zero or one of *Src is not finite
- // The triangles must have the diagonal line as the first side
- // This is to allow easy code in reproj.s to make it straight for broken
- // browsers that can't handle diagonal clipping
- if ((isNotFinite & 0xb) == 0) {
- this.addTriangle_(a, c, d, aSrc, cSrc, dSrc);
- }
- if ((isNotFinite & 0xe) == 0) {
- this.addTriangle_(a, c, b, aSrc, cSrc, bSrc);
- }
- if (isNotFinite) {
- // Try the other two triangles
- if ((isNotFinite & 0xd) == 0) {
- this.addTriangle_(b, d, a, bSrc, dSrc, aSrc);
- }
- if ((isNotFinite & 0x7) == 0) {
- this.addTriangle_(b, d, c, bSrc, dSrc, cSrc);
- }
- }
- };
- /**
- * Calculates extent of the `source` coordinates from all the triangles.
- *
- * @return {import("../extent.js").Extent} Calculated extent.
- */
- Triangulation.prototype.calculateSourceExtent = function () {
- var extent = createEmpty();
- this.triangles_.forEach(function (triangle, i, arr) {
- var src = triangle.source;
- extendCoordinate(extent, src[0]);
- extendCoordinate(extent, src[1]);
- extendCoordinate(extent, src[2]);
- });
- return extent;
- };
- /**
- * @return {Array<Triangle>} Array of the calculated triangles.
- */
- Triangulation.prototype.getTriangles = function () {
- return this.triangles_;
- };
- return Triangulation;
- }());
- /* harmony default export */ var reproj_Triangulation = (Triangulation);
- //# sourceMappingURL=Triangulation.js.map
- ;// ./node_modules/ol/renderer/canvas/common.js
- /**
- * @module ol/renderer/canvas/common
- */
- /**
- * Context options to disable image smoothing.
- * @type {Object}
- */
- var IMAGE_SMOOTHING_DISABLED = {
- imageSmoothingEnabled: false,
- msImageSmoothingEnabled: false,
- };
- /**
- * Context options to enable image smoothing.
- * @type {Object}
- */
- var IMAGE_SMOOTHING_ENABLED = {
- imageSmoothingEnabled: true,
- msImageSmoothingEnabled: true,
- };
- //# sourceMappingURL=common.js.map
- ;// ./node_modules/ol/reproj.js
- /**
- * @module ol/reproj
- */
- var brokenDiagonalRendering_;
- /**
- * @type {Array<HTMLCanvasElement>}
- */
- var reproj_canvasPool = [];
- /**
- * This draws a small triangle into a canvas by setting the triangle as the clip region
- * and then drawing a (too large) rectangle
- *
- * @param {CanvasRenderingContext2D} ctx The context in which to draw the triangle
- * @param {number} u1 The x-coordinate of the second point. The first point is 0,0.
- * @param {number} v1 The y-coordinate of the second point.
- * @param {number} u2 The x-coordinate of the third point.
- * @param {number} v2 The y-coordinate of the third point.
- */
- function drawTestTriangle(ctx, u1, v1, u2, v2) {
- ctx.beginPath();
- ctx.moveTo(0, 0);
- ctx.lineTo(u1, v1);
- ctx.lineTo(u2, v2);
- ctx.closePath();
- ctx.save();
- ctx.clip();
- ctx.fillRect(0, 0, Math.max(u1, u2) + 1, Math.max(v1, v2));
- ctx.restore();
- }
- /**
- * Given the data from getImageData, see if the right values appear at the provided offset.
- * Returns true if either the color or transparency is off
- *
- * @param {Uint8ClampedArray} data The data returned from getImageData
- * @param {number} offset The pixel offset from the start of data.
- * @return {boolean} true if the diagonal rendering is broken
- */
- function verifyBrokenDiagonalRendering(data, offset) {
- // the values ought to be close to the rgba(210, 0, 0, 0.75)
- return (Math.abs(data[offset * 4] - 210) > 2 ||
- Math.abs(data[offset * 4 + 3] - 0.75 * 255) > 2);
- }
- /**
- * Determines if the current browser configuration can render triangular clip regions correctly.
- * This value is cached so the function is only expensive the first time called.
- * Firefox on Windows (as of now) does not if HWA is enabled. See https://bugzilla.mozilla.org/show_bug.cgi?id=1606976
- * IE also doesn't. Chrome works, and everything seems to work on OSX and Android. This function caches the
- * result. I suppose that it is conceivably possible that a browser might flip modes while the app is
- * running, but lets hope not.
- *
- * @return {boolean} true if the Diagonal Rendering is broken.
- */
- function isBrokenDiagonalRendering() {
- if (brokenDiagonalRendering_ === undefined) {
- var ctx = document.createElement('canvas').getContext('2d');
- ctx.globalCompositeOperation = 'lighter';
- ctx.fillStyle = 'rgba(210, 0, 0, 0.75)';
- drawTestTriangle(ctx, 4, 5, 4, 0);
- drawTestTriangle(ctx, 4, 5, 0, 5);
- var data = ctx.getImageData(0, 0, 3, 3).data;
- brokenDiagonalRendering_ =
- verifyBrokenDiagonalRendering(data, 0) ||
- verifyBrokenDiagonalRendering(data, 4) ||
- verifyBrokenDiagonalRendering(data, 8);
- }
- return brokenDiagonalRendering_;
- }
- /**
- * Calculates ideal resolution to use from the source in order to achieve
- * pixel mapping as close as possible to 1:1 during reprojection.
- * The resolution is calculated regardless of what resolutions
- * are actually available in the dataset (TileGrid, Image, ...).
- *
- * @param {import("./proj/Projection.js").default} sourceProj Source projection.
- * @param {import("./proj/Projection.js").default} targetProj Target projection.
- * @param {import("./coordinate.js").Coordinate} targetCenter Target center.
- * @param {number} targetResolution Target resolution.
- * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0.
- */
- function calculateSourceResolution(sourceProj, targetProj, targetCenter, targetResolution) {
- var sourceCenter = transform(targetCenter, targetProj, sourceProj);
- // calculate the ideal resolution of the source data
- var sourceResolution = getPointResolution(targetProj, targetResolution, targetCenter);
- var targetMetersPerUnit = targetProj.getMetersPerUnit();
- if (targetMetersPerUnit !== undefined) {
- sourceResolution *= targetMetersPerUnit;
- }
- var sourceMetersPerUnit = sourceProj.getMetersPerUnit();
- if (sourceMetersPerUnit !== undefined) {
- sourceResolution /= sourceMetersPerUnit;
- }
- // Based on the projection properties, the point resolution at the specified
- // coordinates may be slightly different. We need to reverse-compensate this
- // in order to achieve optimal results.
- var sourceExtent = sourceProj.getExtent();
- if (!sourceExtent || containsCoordinate(sourceExtent, sourceCenter)) {
- var compensationFactor = getPointResolution(sourceProj, sourceResolution, sourceCenter) /
- sourceResolution;
- if (isFinite(compensationFactor) && compensationFactor > 0) {
- sourceResolution /= compensationFactor;
- }
- }
- return sourceResolution;
- }
- /**
- * Calculates ideal resolution to use from the source in order to achieve
- * pixel mapping as close as possible to 1:1 during reprojection.
- * The resolution is calculated regardless of what resolutions
- * are actually available in the dataset (TileGrid, Image, ...).
- *
- * @param {import("./proj/Projection.js").default} sourceProj Source projection.
- * @param {import("./proj/Projection.js").default} targetProj Target projection.
- * @param {import("./extent.js").Extent} targetExtent Target extent
- * @param {number} targetResolution Target resolution.
- * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0.
- */
- function calculateSourceExtentResolution(sourceProj, targetProj, targetExtent, targetResolution) {
- var targetCenter = getCenter(targetExtent);
- var sourceResolution = calculateSourceResolution(sourceProj, targetProj, targetCenter, targetResolution);
- if (!isFinite(sourceResolution) || sourceResolution <= 0) {
- forEachCorner(targetExtent, function (corner) {
- sourceResolution = calculateSourceResolution(sourceProj, targetProj, corner, targetResolution);
- return isFinite(sourceResolution) && sourceResolution > 0;
- });
- }
- return sourceResolution;
- }
- /**
- * @typedef {Object} ImageExtent
- * @property {import("./extent.js").Extent} extent Extent.
- * @property {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.
- */
- /**
- * Renders the source data into new canvas based on the triangulation.
- *
- * @param {number} width Width of the canvas.
- * @param {number} height Height of the canvas.
- * @param {number} pixelRatio Pixel ratio.
- * @param {number} sourceResolution Source resolution.
- * @param {import("./extent.js").Extent} sourceExtent Extent of the data source.
- * @param {number} targetResolution Target resolution.
- * @param {import("./extent.js").Extent} targetExtent Target extent.
- * @param {import("./reproj/Triangulation.js").default} triangulation Calculated triangulation.
- * @param {Array<ImageExtent>} sources Array of sources.
- * @param {number} gutter Gutter of the sources.
- * @param {boolean} [opt_renderEdges] Render reprojection edges.
- * @param {boolean} [opt_interpolate] Use linear interpolation when resampling.
- * @return {HTMLCanvasElement} Canvas with reprojected data.
- */
- function render(width, height, pixelRatio, sourceResolution, sourceExtent, targetResolution, targetExtent, triangulation, sources, gutter, opt_renderEdges, opt_interpolate) {
- var context = createCanvasContext2D(Math.round(pixelRatio * width), Math.round(pixelRatio * height), reproj_canvasPool);
- if (!opt_interpolate) {
- obj_assign(context, IMAGE_SMOOTHING_DISABLED);
- }
- if (sources.length === 0) {
- return context.canvas;
- }
- context.scale(pixelRatio, pixelRatio);
- function pixelRound(value) {
- return Math.round(value * pixelRatio) / pixelRatio;
- }
- context.globalCompositeOperation = 'lighter';
- var sourceDataExtent = createEmpty();
- sources.forEach(function (src, i, arr) {
- extent_extend(sourceDataExtent, src.extent);
- });
- var canvasWidthInUnits = extent_getWidth(sourceDataExtent);
- var canvasHeightInUnits = getHeight(sourceDataExtent);
- var stitchContext = createCanvasContext2D(Math.round((pixelRatio * canvasWidthInUnits) / sourceResolution), Math.round((pixelRatio * canvasHeightInUnits) / sourceResolution));
- if (!opt_interpolate) {
- obj_assign(stitchContext, IMAGE_SMOOTHING_DISABLED);
- }
- var stitchScale = pixelRatio / sourceResolution;
- sources.forEach(function (src, i, arr) {
- var xPos = src.extent[0] - sourceDataExtent[0];
- var yPos = -(src.extent[3] - sourceDataExtent[3]);
- var srcWidth = extent_getWidth(src.extent);
- var srcHeight = getHeight(src.extent);
- // This test should never fail -- but it does. Need to find a fix the upstream condition
- if (src.image.width > 0 && src.image.height > 0) {
- stitchContext.drawImage(src.image, gutter, gutter, src.image.width - 2 * gutter, src.image.height - 2 * gutter, xPos * stitchScale, yPos * stitchScale, srcWidth * stitchScale, srcHeight * stitchScale);
- }
- });
- var targetTopLeft = getTopLeft(targetExtent);
- triangulation.getTriangles().forEach(function (triangle, i, arr) {
- /* Calculate affine transform (src -> dst)
- * Resulting matrix can be used to transform coordinate
- * from `sourceProjection` to destination pixels.
- *
- * To optimize number of context calls and increase numerical stability,
- * we also do the following operations:
- * trans(-topLeftExtentCorner), scale(1 / targetResolution), scale(1, -1)
- * here before solving the linear system so [ui, vi] are pixel coordinates.
- *
- * Src points: xi, yi
- * Dst points: ui, vi
- * Affine coefficients: aij
- *
- * | x0 y0 1 0 0 0 | |a00| |u0|
- * | x1 y1 1 0 0 0 | |a01| |u1|
- * | x2 y2 1 0 0 0 | x |a02| = |u2|
- * | 0 0 0 x0 y0 1 | |a10| |v0|
- * | 0 0 0 x1 y1 1 | |a11| |v1|
- * | 0 0 0 x2 y2 1 | |a12| |v2|
- */
- var source = triangle.source;
- var target = triangle.target;
- var x0 = source[0][0], y0 = source[0][1];
- var x1 = source[1][0], y1 = source[1][1];
- var x2 = source[2][0], y2 = source[2][1];
- // Make sure that everything is on pixel boundaries
- var u0 = pixelRound((target[0][0] - targetTopLeft[0]) / targetResolution);
- var v0 = pixelRound(-(target[0][1] - targetTopLeft[1]) / targetResolution);
- var u1 = pixelRound((target[1][0] - targetTopLeft[0]) / targetResolution);
- var v1 = pixelRound(-(target[1][1] - targetTopLeft[1]) / targetResolution);
- var u2 = pixelRound((target[2][0] - targetTopLeft[0]) / targetResolution);
- var v2 = pixelRound(-(target[2][1] - targetTopLeft[1]) / targetResolution);
- // Shift all the source points to improve numerical stability
- // of all the subsequent calculations. The [x0, y0] is used here.
- // This is also used to simplify the linear system.
- var sourceNumericalShiftX = x0;
- var sourceNumericalShiftY = y0;
- x0 = 0;
- y0 = 0;
- x1 -= sourceNumericalShiftX;
- y1 -= sourceNumericalShiftY;
- x2 -= sourceNumericalShiftX;
- y2 -= sourceNumericalShiftY;
- var augmentedMatrix = [
- [x1, y1, 0, 0, u1 - u0],
- [x2, y2, 0, 0, u2 - u0],
- [0, 0, x1, y1, v1 - v0],
- [0, 0, x2, y2, v2 - v0],
- ];
- var affineCoefs = solveLinearSystem(augmentedMatrix);
- if (!affineCoefs) {
- return;
- }
- context.save();
- context.beginPath();
- if (isBrokenDiagonalRendering() || !opt_interpolate) {
- // Make sure that all lines are horizontal or vertical
- context.moveTo(u1, v1);
- // This is the diagonal line. Do it in 4 steps
- var steps = 4;
- var ud = u0 - u1;
- var vd = v0 - v1;
- for (var step = 0; step < steps; step++) {
- // Go horizontally
- context.lineTo(u1 + pixelRound(((step + 1) * ud) / steps), v1 + pixelRound((step * vd) / (steps - 1)));
- // Go vertically
- if (step != steps - 1) {
- context.lineTo(u1 + pixelRound(((step + 1) * ud) / steps), v1 + pixelRound(((step + 1) * vd) / (steps - 1)));
- }
- }
- // We are almost at u0r, v0r
- context.lineTo(u2, v2);
- }
- else {
- context.moveTo(u1, v1);
- context.lineTo(u0, v0);
- context.lineTo(u2, v2);
- }
- context.clip();
- context.transform(affineCoefs[0], affineCoefs[2], affineCoefs[1], affineCoefs[3], u0, v0);
- context.translate(sourceDataExtent[0] - sourceNumericalShiftX, sourceDataExtent[3] - sourceNumericalShiftY);
- context.scale(sourceResolution / pixelRatio, -sourceResolution / pixelRatio);
- context.drawImage(stitchContext.canvas, 0, 0);
- context.restore();
- });
- if (opt_renderEdges) {
- context.save();
- context.globalCompositeOperation = 'source-over';
- context.strokeStyle = 'black';
- context.lineWidth = 1;
- triangulation.getTriangles().forEach(function (triangle, i, arr) {
- var target = triangle.target;
- var u0 = (target[0][0] - targetTopLeft[0]) / targetResolution;
- var v0 = -(target[0][1] - targetTopLeft[1]) / targetResolution;
- var u1 = (target[1][0] - targetTopLeft[0]) / targetResolution;
- var v1 = -(target[1][1] - targetTopLeft[1]) / targetResolution;
- var u2 = (target[2][0] - targetTopLeft[0]) / targetResolution;
- var v2 = -(target[2][1] - targetTopLeft[1]) / targetResolution;
- context.beginPath();
- context.moveTo(u1, v1);
- context.lineTo(u0, v0);
- context.lineTo(u2, v2);
- context.closePath();
- context.stroke();
- });
- context.restore();
- }
- return context.canvas;
- }
- //# sourceMappingURL=reproj.js.map
- ;// ./node_modules/ol/reproj/Tile.js
- var reproj_Tile_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/reproj/Tile
- */
- /**
- * @typedef {function(number, number, number, number) : import("../Tile.js").default} FunctionType
- */
- /**
- * @classdesc
- * Class encapsulating single reprojected tile.
- * See {@link module:ol/source/TileImage~TileImage}.
- *
- */
- var ReprojTile = /** @class */ (function (_super) {
- reproj_Tile_extends(ReprojTile, _super);
- /**
- * @param {import("../proj/Projection.js").default} sourceProj Source projection.
- * @param {import("../tilegrid/TileGrid.js").default} sourceTileGrid Source tile grid.
- * @param {import("../proj/Projection.js").default} targetProj Target projection.
- * @param {import("../tilegrid/TileGrid.js").default} targetTileGrid Target tile grid.
- * @param {import("../tilecoord.js").TileCoord} tileCoord Coordinate of the tile.
- * @param {import("../tilecoord.js").TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X.
- * @param {number} pixelRatio Pixel ratio.
- * @param {number} gutter Gutter of the source tiles.
- * @param {FunctionType} getTileFunction
- * Function returning source tiles (z, x, y, pixelRatio).
- * @param {number} [opt_errorThreshold] Acceptable reprojection error (in px).
- * @param {boolean} [opt_renderEdges] Render reprojection edges.
- * @param {boolean} [opt_interpolate] Use linear interpolation when resampling.
- */
- function ReprojTile(sourceProj, sourceTileGrid, targetProj, targetTileGrid, tileCoord, wrappedTileCoord, pixelRatio, gutter, getTileFunction, opt_errorThreshold, opt_renderEdges, opt_interpolate) {
- var _this = _super.call(this, tileCoord, TileState.IDLE, { interpolate: !!opt_interpolate }) || this;
- /**
- * @private
- * @type {boolean}
- */
- _this.renderEdges_ = opt_renderEdges !== undefined ? opt_renderEdges : false;
- /**
- * @private
- * @type {number}
- */
- _this.pixelRatio_ = pixelRatio;
- /**
- * @private
- * @type {number}
- */
- _this.gutter_ = gutter;
- /**
- * @private
- * @type {HTMLCanvasElement}
- */
- _this.canvas_ = null;
- /**
- * @private
- * @type {import("../tilegrid/TileGrid.js").default}
- */
- _this.sourceTileGrid_ = sourceTileGrid;
- /**
- * @private
- * @type {import("../tilegrid/TileGrid.js").default}
- */
- _this.targetTileGrid_ = targetTileGrid;
- /**
- * @private
- * @type {import("../tilecoord.js").TileCoord}
- */
- _this.wrappedTileCoord_ = wrappedTileCoord ? wrappedTileCoord : tileCoord;
- /**
- * @private
- * @type {!Array<import("../Tile.js").default>}
- */
- _this.sourceTiles_ = [];
- /**
- * @private
- * @type {?Array<import("../events.js").EventsKey>}
- */
- _this.sourcesListenerKeys_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.sourceZ_ = 0;
- var targetExtent = targetTileGrid.getTileCoordExtent(_this.wrappedTileCoord_);
- var maxTargetExtent = _this.targetTileGrid_.getExtent();
- var maxSourceExtent = _this.sourceTileGrid_.getExtent();
- var limitedTargetExtent = maxTargetExtent
- ? getIntersection(targetExtent, maxTargetExtent)
- : targetExtent;
- if (getArea(limitedTargetExtent) === 0) {
- // Tile is completely outside range -> EMPTY
- // TODO: is it actually correct that the source even creates the tile ?
- _this.state = TileState.EMPTY;
- return _this;
- }
- var sourceProjExtent = sourceProj.getExtent();
- if (sourceProjExtent) {
- if (!maxSourceExtent) {
- maxSourceExtent = sourceProjExtent;
- }
- else {
- maxSourceExtent = getIntersection(maxSourceExtent, sourceProjExtent);
- }
- }
- var targetResolution = targetTileGrid.getResolution(_this.wrappedTileCoord_[0]);
- var sourceResolution = calculateSourceExtentResolution(sourceProj, targetProj, limitedTargetExtent, targetResolution);
- if (!isFinite(sourceResolution) || sourceResolution <= 0) {
- // invalid sourceResolution -> EMPTY
- // probably edges of the projections when no extent is defined
- _this.state = TileState.EMPTY;
- return _this;
- }
- var errorThresholdInPixels = opt_errorThreshold !== undefined ? opt_errorThreshold : ERROR_THRESHOLD;
- /**
- * @private
- * @type {!import("./Triangulation.js").default}
- */
- _this.triangulation_ = new reproj_Triangulation(sourceProj, targetProj, limitedTargetExtent, maxSourceExtent, sourceResolution * errorThresholdInPixels, targetResolution);
- if (_this.triangulation_.getTriangles().length === 0) {
- // no valid triangles -> EMPTY
- _this.state = TileState.EMPTY;
- return _this;
- }
- _this.sourceZ_ = sourceTileGrid.getZForResolution(sourceResolution);
- var sourceExtent = _this.triangulation_.calculateSourceExtent();
- if (maxSourceExtent) {
- if (sourceProj.canWrapX()) {
- sourceExtent[1] = math_clamp(sourceExtent[1], maxSourceExtent[1], maxSourceExtent[3]);
- sourceExtent[3] = math_clamp(sourceExtent[3], maxSourceExtent[1], maxSourceExtent[3]);
- }
- else {
- sourceExtent = getIntersection(sourceExtent, maxSourceExtent);
- }
- }
- if (!getArea(sourceExtent)) {
- _this.state = TileState.EMPTY;
- }
- else {
- var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(sourceExtent, _this.sourceZ_);
- for (var srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) {
- for (var srcY = sourceRange.minY; srcY <= sourceRange.maxY; srcY++) {
- var tile = getTileFunction(_this.sourceZ_, srcX, srcY, pixelRatio);
- if (tile) {
- _this.sourceTiles_.push(tile);
- }
- }
- }
- if (_this.sourceTiles_.length === 0) {
- _this.state = TileState.EMPTY;
- }
- }
- return _this;
- }
- /**
- * Get the HTML Canvas element for this tile.
- * @return {HTMLCanvasElement} Canvas.
- */
- ReprojTile.prototype.getImage = function () {
- return this.canvas_;
- };
- /**
- * @private
- */
- ReprojTile.prototype.reproject_ = function () {
- var sources = [];
- this.sourceTiles_.forEach(function (tile, i, arr) {
- if (tile && tile.getState() == TileState.LOADED) {
- sources.push({
- extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord),
- image: tile.getImage(),
- });
- }
- }.bind(this));
- this.sourceTiles_.length = 0;
- if (sources.length === 0) {
- this.state = TileState.ERROR;
- }
- else {
- var z = this.wrappedTileCoord_[0];
- var size = this.targetTileGrid_.getTileSize(z);
- var width = typeof size === 'number' ? size : size[0];
- var height = typeof size === 'number' ? size : size[1];
- var targetResolution = this.targetTileGrid_.getResolution(z);
- var sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_);
- var targetExtent = this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);
- this.canvas_ = render(width, height, this.pixelRatio_, sourceResolution, this.sourceTileGrid_.getExtent(), targetResolution, targetExtent, this.triangulation_, sources, this.gutter_, this.renderEdges_, this.interpolate);
- this.state = TileState.LOADED;
- }
- this.changed();
- };
- /**
- * Load not yet loaded URI.
- */
- ReprojTile.prototype.load = function () {
- if (this.state == TileState.IDLE) {
- this.state = TileState.LOADING;
- this.changed();
- var leftToLoad_1 = 0;
- this.sourcesListenerKeys_ = [];
- this.sourceTiles_.forEach(function (tile, i, arr) {
- var state = tile.getState();
- if (state == TileState.IDLE || state == TileState.LOADING) {
- leftToLoad_1++;
- var sourceListenKey_1 = listen(tile, EventType.CHANGE, function (e) {
- var state = tile.getState();
- if (state == TileState.LOADED ||
- state == TileState.ERROR ||
- state == TileState.EMPTY) {
- unlistenByKey(sourceListenKey_1);
- leftToLoad_1--;
- if (leftToLoad_1 === 0) {
- this.unlistenSources_();
- this.reproject_();
- }
- }
- }, this);
- this.sourcesListenerKeys_.push(sourceListenKey_1);
- }
- }.bind(this));
- if (leftToLoad_1 === 0) {
- setTimeout(this.reproject_.bind(this), 0);
- }
- else {
- this.sourceTiles_.forEach(function (tile, i, arr) {
- var state = tile.getState();
- if (state == TileState.IDLE) {
- tile.load();
- }
- });
- }
- }
- };
- /**
- * @private
- */
- ReprojTile.prototype.unlistenSources_ = function () {
- this.sourcesListenerKeys_.forEach(unlistenByKey);
- this.sourcesListenerKeys_ = null;
- };
- /**
- * Remove from the cache due to expiry
- */
- ReprojTile.prototype.release = function () {
- if (this.canvas_) {
- releaseCanvas(this.canvas_.getContext('2d'));
- reproj_canvasPool.push(this.canvas_);
- this.canvas_ = null;
- }
- _super.prototype.release.call(this);
- };
- return ReprojTile;
- }(ol_Tile));
- /* harmony default export */ var reproj_Tile = (ReprojTile);
- //# sourceMappingURL=Tile.js.map
- ;// ./node_modules/ol/TileRange.js
- /**
- * @module ol/TileRange
- */
- /**
- * A representation of a contiguous block of tiles. A tile range is specified
- * by its min/max tile coordinates and is inclusive of coordinates.
- */
- var TileRange = /** @class */ (function () {
- /**
- * @param {number} minX Minimum X.
- * @param {number} maxX Maximum X.
- * @param {number} minY Minimum Y.
- * @param {number} maxY Maximum Y.
- */
- function TileRange(minX, maxX, minY, maxY) {
- /**
- * @type {number}
- */
- this.minX = minX;
- /**
- * @type {number}
- */
- this.maxX = maxX;
- /**
- * @type {number}
- */
- this.minY = minY;
- /**
- * @type {number}
- */
- this.maxY = maxY;
- }
- /**
- * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @return {boolean} Contains tile coordinate.
- */
- TileRange.prototype.contains = function (tileCoord) {
- return this.containsXY(tileCoord[1], tileCoord[2]);
- };
- /**
- * @param {TileRange} tileRange Tile range.
- * @return {boolean} Contains.
- */
- TileRange.prototype.containsTileRange = function (tileRange) {
- return (this.minX <= tileRange.minX &&
- tileRange.maxX <= this.maxX &&
- this.minY <= tileRange.minY &&
- tileRange.maxY <= this.maxY);
- };
- /**
- * @param {number} x Tile coordinate x.
- * @param {number} y Tile coordinate y.
- * @return {boolean} Contains coordinate.
- */
- TileRange.prototype.containsXY = function (x, y) {
- return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY;
- };
- /**
- * @param {TileRange} tileRange Tile range.
- * @return {boolean} Equals.
- */
- TileRange.prototype.equals = function (tileRange) {
- return (this.minX == tileRange.minX &&
- this.minY == tileRange.minY &&
- this.maxX == tileRange.maxX &&
- this.maxY == tileRange.maxY);
- };
- /**
- * @param {TileRange} tileRange Tile range.
- */
- TileRange.prototype.extend = function (tileRange) {
- if (tileRange.minX < this.minX) {
- this.minX = tileRange.minX;
- }
- if (tileRange.maxX > this.maxX) {
- this.maxX = tileRange.maxX;
- }
- if (tileRange.minY < this.minY) {
- this.minY = tileRange.minY;
- }
- if (tileRange.maxY > this.maxY) {
- this.maxY = tileRange.maxY;
- }
- };
- /**
- * @return {number} Height.
- */
- TileRange.prototype.getHeight = function () {
- return this.maxY - this.minY + 1;
- };
- /**
- * @return {import("./size.js").Size} Size.
- */
- TileRange.prototype.getSize = function () {
- return [this.getWidth(), this.getHeight()];
- };
- /**
- * @return {number} Width.
- */
- TileRange.prototype.getWidth = function () {
- return this.maxX - this.minX + 1;
- };
- /**
- * @param {TileRange} tileRange Tile range.
- * @return {boolean} Intersects.
- */
- TileRange.prototype.intersects = function (tileRange) {
- return (this.minX <= tileRange.maxX &&
- this.maxX >= tileRange.minX &&
- this.minY <= tileRange.maxY &&
- this.maxY >= tileRange.minY);
- };
- return TileRange;
- }());
- /**
- * @param {number} minX Minimum X.
- * @param {number} maxX Maximum X.
- * @param {number} minY Minimum Y.
- * @param {number} maxY Maximum Y.
- * @param {TileRange} [tileRange] TileRange.
- * @return {TileRange} Tile range.
- */
- function TileRange_createOrUpdate(minX, maxX, minY, maxY, tileRange) {
- if (tileRange !== undefined) {
- tileRange.minX = minX;
- tileRange.maxX = maxX;
- tileRange.minY = minY;
- tileRange.maxY = maxY;
- return tileRange;
- }
- else {
- return new TileRange(minX, maxX, minY, maxY);
- }
- }
- /* harmony default export */ var ol_TileRange = (TileRange);
- //# sourceMappingURL=TileRange.js.map
- ;// ./node_modules/ol/size.js
- /**
- * @module ol/size
- */
- /**
- * An array of numbers representing a size: `[width, height]`.
- * @typedef {Array<number>} Size
- * @api
- */
- /**
- * Returns a buffered size.
- * @param {Size} size Size.
- * @param {number} num The amount by which to buffer.
- * @param {Size} [opt_size] Optional reusable size array.
- * @return {Size} The buffered size.
- */
- function size_buffer(size, num, opt_size) {
- if (opt_size === undefined) {
- opt_size = [0, 0];
- }
- opt_size[0] = size[0] + 2 * num;
- opt_size[1] = size[1] + 2 * num;
- return opt_size;
- }
- /**
- * Determines if a size has a positive area.
- * @param {Size} size The size to test.
- * @return {boolean} The size has a positive area.
- */
- function hasArea(size) {
- return size[0] > 0 && size[1] > 0;
- }
- /**
- * Returns a size scaled by a ratio. The result will be an array of integers.
- * @param {Size} size Size.
- * @param {number} ratio Ratio.
- * @param {Size} [opt_size] Optional reusable size array.
- * @return {Size} The scaled size.
- */
- function size_scale(size, ratio, opt_size) {
- if (opt_size === undefined) {
- opt_size = [0, 0];
- }
- opt_size[0] = (size[0] * ratio + 0.5) | 0;
- opt_size[1] = (size[1] * ratio + 0.5) | 0;
- return opt_size;
- }
- /**
- * Returns an `Size` array for the passed in number (meaning: square) or
- * `Size` array.
- * (meaning: non-square),
- * @param {number|Size} size Width and height.
- * @param {Size} [opt_size] Optional reusable size array.
- * @return {Size} Size.
- * @api
- */
- function toSize(size, opt_size) {
- if (Array.isArray(size)) {
- return size;
- }
- else {
- if (opt_size === undefined) {
- opt_size = [size, size];
- }
- else {
- opt_size[0] = size;
- opt_size[1] = size;
- }
- return opt_size;
- }
- }
- //# sourceMappingURL=size.js.map
- ;// ./node_modules/ol/renderer/canvas/TileLayer.js
- var TileLayer_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/renderer/canvas/TileLayer
- */
- /**
- * @classdesc
- * Canvas renderer for tile layers.
- * @api
- * @template {import("../../layer/Tile.js").default<import("../../source/Tile.js").default>|import("../../layer/VectorTile.js").default} [LayerType=import("../../layer/Tile.js").default<import("../../source/Tile.js").default>|import("../../layer/VectorTile.js").default]
- * @extends {CanvasLayerRenderer<LayerType>}
- */
- var CanvasTileLayerRenderer = /** @class */ (function (_super) {
- TileLayer_extends(CanvasTileLayerRenderer, _super);
- /**
- * @param {LayerType} tileLayer Tile layer.
- */
- function CanvasTileLayerRenderer(tileLayer) {
- var _this = _super.call(this, tileLayer) || this;
- /**
- * Rendered extent has changed since the previous `renderFrame()` call
- * @type {boolean}
- */
- _this.extentChanged = true;
- /**
- * @private
- * @type {?import("../../extent.js").Extent}
- */
- _this.renderedExtent_ = null;
- /**
- * @protected
- * @type {number}
- */
- _this.renderedPixelRatio;
- /**
- * @protected
- * @type {import("../../proj/Projection.js").default}
- */
- _this.renderedProjection = null;
- /**
- * @protected
- * @type {number}
- */
- _this.renderedRevision;
- /**
- * @protected
- * @type {!Array<import("../../Tile.js").default>}
- */
- _this.renderedTiles = [];
- /**
- * @private
- * @type {boolean}
- */
- _this.newTiles_ = false;
- /**
- * @protected
- * @type {import("../../extent.js").Extent}
- */
- _this.tmpExtent = createEmpty();
- /**
- * @private
- * @type {import("../../TileRange.js").default}
- */
- _this.tmpTileRange_ = new ol_TileRange(0, 0, 0, 0);
- return _this;
- }
- /**
- * @protected
- * @param {import("../../Tile.js").default} tile Tile.
- * @return {boolean} Tile is drawable.
- */
- CanvasTileLayerRenderer.prototype.isDrawableTile = function (tile) {
- var tileLayer = this.getLayer();
- var tileState = tile.getState();
- var useInterimTilesOnError = tileLayer.getUseInterimTilesOnError();
- return (tileState == TileState.LOADED ||
- tileState == TileState.EMPTY ||
- (tileState == TileState.ERROR && !useInterimTilesOnError));
- };
- /**
- * @param {number} z Tile coordinate z.
- * @param {number} x Tile coordinate x.
- * @param {number} y Tile coordinate y.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @return {!import("../../Tile.js").default} Tile.
- */
- CanvasTileLayerRenderer.prototype.getTile = function (z, x, y, frameState) {
- var pixelRatio = frameState.pixelRatio;
- var projection = frameState.viewState.projection;
- var tileLayer = this.getLayer();
- var tileSource = tileLayer.getSource();
- var tile = tileSource.getTile(z, x, y, pixelRatio, projection);
- if (tile.getState() == TileState.ERROR) {
- if (!tileLayer.getUseInterimTilesOnError()) {
- // When useInterimTilesOnError is false, we consider the error tile as loaded.
- tile.setState(TileState.LOADED);
- }
- else if (tileLayer.getPreload() > 0) {
- // Preloaded tiles for lower resolutions might have finished loading.
- this.newTiles_ = true;
- }
- }
- if (!this.isDrawableTile(tile)) {
- tile = tile.getInterimTile();
- }
- return tile;
- };
- /**
- * @param {import("../../pixel.js").Pixel} pixel Pixel.
- * @return {Uint8ClampedArray} Data at the pixel location.
- */
- CanvasTileLayerRenderer.prototype.getData = function (pixel) {
- var frameState = this.frameState;
- if (!frameState) {
- return null;
- }
- var layer = this.getLayer();
- var coordinate = apply(frameState.pixelToCoordinateTransform, pixel.slice());
- var layerExtent = layer.getExtent();
- if (layerExtent) {
- if (!containsCoordinate(layerExtent, coordinate)) {
- return null;
- }
- }
- var pixelRatio = frameState.pixelRatio;
- var projection = frameState.viewState.projection;
- var viewState = frameState.viewState;
- var source = layer.getRenderSource();
- var tileGrid = source.getTileGridForProjection(viewState.projection);
- var tilePixelRatio = source.getTilePixelRatio(frameState.pixelRatio);
- for (var z = tileGrid.getZForResolution(viewState.resolution); z >= tileGrid.getMinZoom(); --z) {
- var tileCoord = tileGrid.getTileCoordForCoordAndZ(coordinate, z);
- var tile = source.getTile(z, tileCoord[1], tileCoord[2], pixelRatio, projection);
- if (!(tile instanceof ol_ImageTile || tile instanceof reproj_Tile)) {
- return null;
- }
- if (tile.getState() !== TileState.LOADED) {
- continue;
- }
- var tileOrigin = tileGrid.getOrigin(z);
- var tileSize = toSize(tileGrid.getTileSize(z));
- var tileResolution = tileGrid.getResolution(z);
- var col = Math.floor(tilePixelRatio *
- ((coordinate[0] - tileOrigin[0]) / tileResolution -
- tileCoord[1] * tileSize[0]));
- var row = Math.floor(tilePixelRatio *
- ((tileOrigin[1] - coordinate[1]) / tileResolution -
- tileCoord[2] * tileSize[1]));
- var gutter = Math.round(tilePixelRatio * source.getGutterForProjection(viewState.projection));
- return this.getImageData(tile.getImage(), col + gutter, row + gutter);
- }
- return null;
- };
- /**
- * @param {Object<number, Object<string, import("../../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
- * @param {number} zoom Zoom level.
- * @param {import("../../Tile.js").default} tile Tile.
- * @return {boolean|void} If `false`, the tile will not be considered loaded.
- */
- CanvasTileLayerRenderer.prototype.loadedTileCallback = function (tiles, zoom, tile) {
- if (this.isDrawableTile(tile)) {
- return _super.prototype.loadedTileCallback.call(this, tiles, zoom, tile);
- }
- return false;
- };
- /**
- * Determine whether render should be called.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @return {boolean} Layer is ready to be rendered.
- */
- CanvasTileLayerRenderer.prototype.prepareFrame = function (frameState) {
- return !!this.getLayer().getSource();
- };
- /**
- * Render the layer.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @param {HTMLElement} target Target that may be used to render content to.
- * @return {HTMLElement} The rendered element.
- */
- CanvasTileLayerRenderer.prototype.renderFrame = function (frameState, target) {
- var layerState = frameState.layerStatesArray[frameState.layerIndex];
- var viewState = frameState.viewState;
- var projection = viewState.projection;
- var viewResolution = viewState.resolution;
- var viewCenter = viewState.center;
- var rotation = viewState.rotation;
- var pixelRatio = frameState.pixelRatio;
- var tileLayer = this.getLayer();
- var tileSource = tileLayer.getSource();
- var sourceRevision = tileSource.getRevision();
- var tileGrid = tileSource.getTileGridForProjection(projection);
- var z = tileGrid.getZForResolution(viewResolution, tileSource.zDirection);
- var tileResolution = tileGrid.getResolution(z);
- var extent = frameState.extent;
- var resolution = frameState.viewState.resolution;
- var tilePixelRatio = tileSource.getTilePixelRatio(pixelRatio);
- // desired dimensions of the canvas in pixels
- var width = Math.round((extent_getWidth(extent) / resolution) * pixelRatio);
- var height = Math.round((getHeight(extent) / resolution) * pixelRatio);
- var layerExtent = layerState.extent && proj_fromUserExtent(layerState.extent, projection);
- if (layerExtent) {
- extent = getIntersection(extent, proj_fromUserExtent(layerState.extent, projection));
- }
- var dx = (tileResolution * width) / 2 / tilePixelRatio;
- var dy = (tileResolution * height) / 2 / tilePixelRatio;
- var canvasExtent = [
- viewCenter[0] - dx,
- viewCenter[1] - dy,
- viewCenter[0] + dx,
- viewCenter[1] + dy,
- ];
- var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);
- /**
- * @type {Object<number, Object<string, import("../../Tile.js").default>>}
- */
- var tilesToDrawByZ = {};
- tilesToDrawByZ[z] = {};
- var findLoadedTiles = this.createLoadedTileFinder(tileSource, projection, tilesToDrawByZ);
- var tmpExtent = this.tmpExtent;
- var tmpTileRange = this.tmpTileRange_;
- this.newTiles_ = false;
- var viewport = rotation
- ? getRotatedViewport(viewState.center, resolution, rotation, frameState.size)
- : undefined;
- for (var x = tileRange.minX; x <= tileRange.maxX; ++x) {
- for (var y = tileRange.minY; y <= tileRange.maxY; ++y) {
- if (rotation &&
- !tileGrid.tileCoordIntersectsViewport([z, x, y], viewport)) {
- continue;
- }
- var tile = this.getTile(z, x, y, frameState);
- if (this.isDrawableTile(tile)) {
- var uid = getUid(this);
- if (tile.getState() == TileState.LOADED) {
- tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
- var inTransition = tile.inTransition(uid);
- if (inTransition && layerState.opacity !== 1) {
- // Skipping transition when layer is not fully opaque avoids visual artifacts.
- tile.endTransition(uid);
- inTransition = false;
- }
- if (!this.newTiles_ &&
- (inTransition || this.renderedTiles.indexOf(tile) === -1)) {
- this.newTiles_ = true;
- }
- }
- if (tile.getAlpha(uid, frameState.time) === 1) {
- // don't look for alt tiles if alpha is 1
- continue;
- }
- }
- var childTileRange = tileGrid.getTileCoordChildTileRange(tile.tileCoord, tmpTileRange, tmpExtent);
- var covered = false;
- if (childTileRange) {
- covered = findLoadedTiles(z + 1, childTileRange);
- }
- if (!covered) {
- tileGrid.forEachTileCoordParentTileRange(tile.tileCoord, findLoadedTiles, tmpTileRange, tmpExtent);
- }
- }
- }
- var canvasScale = ((tileResolution / viewResolution) * pixelRatio) / tilePixelRatio;
- // set forward and inverse pixel transforms
- compose(this.pixelTransform, frameState.size[0] / 2, frameState.size[1] / 2, 1 / pixelRatio, 1 / pixelRatio, rotation, -width / 2, -height / 2);
- var canvasTransform = transform_toString(this.pixelTransform);
- this.useContainer(target, canvasTransform, this.getBackground(frameState));
- var context = this.context;
- var canvas = context.canvas;
- makeInverse(this.inversePixelTransform, this.pixelTransform);
- // set scale transform for calculating tile positions on the canvas
- compose(this.tempTransform, width / 2, height / 2, canvasScale, canvasScale, 0, -width / 2, -height / 2);
- if (canvas.width != width || canvas.height != height) {
- canvas.width = width;
- canvas.height = height;
- }
- else if (!this.containerReused) {
- context.clearRect(0, 0, width, height);
- }
- if (layerExtent) {
- this.clipUnrotated(context, frameState, layerExtent);
- }
- if (!tileSource.getInterpolate()) {
- obj_assign(context, IMAGE_SMOOTHING_DISABLED);
- }
- this.preRender(context, frameState);
- this.renderedTiles.length = 0;
- /** @type {Array<number>} */
- var zs = Object.keys(tilesToDrawByZ).map(Number);
- zs.sort(numberSafeCompareFunction);
- var clips, clipZs, currentClip;
- if (layerState.opacity === 1 &&
- (!this.containerReused ||
- tileSource.getOpaque(frameState.viewState.projection))) {
- zs = zs.reverse();
- }
- else {
- clips = [];
- clipZs = [];
- }
- for (var i = zs.length - 1; i >= 0; --i) {
- var currentZ = zs[i];
- var currentTilePixelSize = tileSource.getTilePixelSize(currentZ, pixelRatio, projection);
- var currentResolution = tileGrid.getResolution(currentZ);
- var currentScale = currentResolution / tileResolution;
- var dx_1 = currentTilePixelSize[0] * currentScale * canvasScale;
- var dy_1 = currentTilePixelSize[1] * currentScale * canvasScale;
- var originTileCoord = tileGrid.getTileCoordForCoordAndZ(getTopLeft(canvasExtent), currentZ);
- var originTileExtent = tileGrid.getTileCoordExtent(originTileCoord);
- var origin_1 = apply(this.tempTransform, [
- (tilePixelRatio * (originTileExtent[0] - canvasExtent[0])) /
- tileResolution,
- (tilePixelRatio * (canvasExtent[3] - originTileExtent[3])) /
- tileResolution,
- ]);
- var tileGutter = tilePixelRatio * tileSource.getGutterForProjection(projection);
- var tilesToDraw = tilesToDrawByZ[currentZ];
- for (var tileCoordKey in tilesToDraw) {
- var tile = /** @type {import("../../ImageTile.js").default} */ (tilesToDraw[tileCoordKey]);
- var tileCoord = tile.tileCoord;
- // Calculate integer positions and sizes so that tiles align
- var xIndex = originTileCoord[1] - tileCoord[1];
- var nextX = Math.round(origin_1[0] - (xIndex - 1) * dx_1);
- var yIndex = originTileCoord[2] - tileCoord[2];
- var nextY = Math.round(origin_1[1] - (yIndex - 1) * dy_1);
- var x = Math.round(origin_1[0] - xIndex * dx_1);
- var y = Math.round(origin_1[1] - yIndex * dy_1);
- var w = nextX - x;
- var h = nextY - y;
- var transition = z === currentZ;
- var inTransition = transition && tile.getAlpha(getUid(this), frameState.time) !== 1;
- var contextSaved = false;
- if (!inTransition) {
- if (clips) {
- // Clip mask for regions in this tile that already filled by a higher z tile
- currentClip = [x, y, x + w, y, x + w, y + h, x, y + h];
- for (var i_1 = 0, ii = clips.length; i_1 < ii; ++i_1) {
- if (z !== currentZ && currentZ < clipZs[i_1]) {
- var clip = clips[i_1];
- if (intersects([x, y, x + w, y + h], [clip[0], clip[3], clip[4], clip[7]])) {
- if (!contextSaved) {
- context.save();
- contextSaved = true;
- }
- context.beginPath();
- // counter-clockwise (outer ring) for current tile
- context.moveTo(currentClip[0], currentClip[1]);
- context.lineTo(currentClip[2], currentClip[3]);
- context.lineTo(currentClip[4], currentClip[5]);
- context.lineTo(currentClip[6], currentClip[7]);
- // clockwise (inner ring) for higher z tile
- context.moveTo(clip[6], clip[7]);
- context.lineTo(clip[4], clip[5]);
- context.lineTo(clip[2], clip[3]);
- context.lineTo(clip[0], clip[1]);
- context.clip();
- }
- }
- }
- clips.push(currentClip);
- clipZs.push(currentZ);
- }
- else {
- context.clearRect(x, y, w, h);
- }
- }
- this.drawTileImage(tile, frameState, x, y, w, h, tileGutter, transition);
- if (clips && !inTransition) {
- if (contextSaved) {
- context.restore();
- }
- this.renderedTiles.unshift(tile);
- }
- else {
- this.renderedTiles.push(tile);
- }
- this.updateUsedTiles(frameState.usedTiles, tileSource, tile);
- }
- }
- this.renderedRevision = sourceRevision;
- this.renderedResolution = tileResolution;
- this.extentChanged =
- !this.renderedExtent_ || !extent_equals(this.renderedExtent_, canvasExtent);
- this.renderedExtent_ = canvasExtent;
- this.renderedPixelRatio = pixelRatio;
- this.renderedProjection = projection;
- this.manageTilePyramid(frameState, tileSource, tileGrid, pixelRatio, projection, extent, z, tileLayer.getPreload());
- this.scheduleExpireCache(frameState, tileSource);
- this.postRender(context, frameState);
- if (layerState.extent) {
- context.restore();
- }
- obj_assign(context, IMAGE_SMOOTHING_ENABLED);
- if (canvasTransform !== canvas.style.transform) {
- canvas.style.transform = canvasTransform;
- }
- return this.container;
- };
- /**
- * @param {import("../../ImageTile.js").default} tile Tile.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @param {number} x Left of the tile.
- * @param {number} y Top of the tile.
- * @param {number} w Width of the tile.
- * @param {number} h Height of the tile.
- * @param {number} gutter Tile gutter.
- * @param {boolean} transition Apply an alpha transition.
- */
- CanvasTileLayerRenderer.prototype.drawTileImage = function (tile, frameState, x, y, w, h, gutter, transition) {
- var image = this.getTileImage(tile);
- if (!image) {
- return;
- }
- var uid = getUid(this);
- var layerState = frameState.layerStatesArray[frameState.layerIndex];
- var alpha = layerState.opacity *
- (transition ? tile.getAlpha(uid, frameState.time) : 1);
- var alphaChanged = alpha !== this.context.globalAlpha;
- if (alphaChanged) {
- this.context.save();
- this.context.globalAlpha = alpha;
- }
- this.context.drawImage(image, gutter, gutter, image.width - 2 * gutter, image.height - 2 * gutter, x, y, w, h);
- if (alphaChanged) {
- this.context.restore();
- }
- if (alpha !== layerState.opacity) {
- frameState.animate = true;
- }
- else if (transition) {
- tile.endTransition(uid);
- }
- };
- /**
- * @return {HTMLCanvasElement} Image
- */
- CanvasTileLayerRenderer.prototype.getImage = function () {
- var context = this.context;
- return context ? context.canvas : null;
- };
- /**
- * Get the image from a tile.
- * @param {import("../../ImageTile.js").default} tile Tile.
- * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
- * @protected
- */
- CanvasTileLayerRenderer.prototype.getTileImage = function (tile) {
- return tile.getImage();
- };
- /**
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @param {import("../../source/Tile.js").default} tileSource Tile source.
- * @protected
- */
- CanvasTileLayerRenderer.prototype.scheduleExpireCache = function (frameState, tileSource) {
- if (tileSource.canExpireCache()) {
- /**
- * @param {import("../../source/Tile.js").default} tileSource Tile source.
- * @param {import("../../PluggableMap.js").default} map Map.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- */
- var postRenderFunction = function (tileSource, map, frameState) {
- var tileSourceKey = getUid(tileSource);
- if (tileSourceKey in frameState.usedTiles) {
- tileSource.expireCache(frameState.viewState.projection, frameState.usedTiles[tileSourceKey]);
- }
- }.bind(null, tileSource);
- frameState.postRenderFunctions.push(
- /** @type {import("../../PluggableMap.js").PostRenderFunction} */ (postRenderFunction));
- }
- };
- /**
- * @param {!Object<string, !Object<string, boolean>>} usedTiles Used tiles.
- * @param {import("../../source/Tile.js").default} tileSource Tile source.
- * @param {import('../../Tile.js').default} tile Tile.
- * @protected
- */
- CanvasTileLayerRenderer.prototype.updateUsedTiles = function (usedTiles, tileSource, tile) {
- // FIXME should we use tilesToDrawByZ instead?
- var tileSourceKey = getUid(tileSource);
- if (!(tileSourceKey in usedTiles)) {
- usedTiles[tileSourceKey] = {};
- }
- usedTiles[tileSourceKey][tile.getKey()] = true;
- };
- /**
- * Manage tile pyramid.
- * This function performs a number of functions related to the tiles at the
- * current zoom and lower zoom levels:
- * - registers idle tiles in frameState.wantedTiles so that they are not
- * discarded by the tile queue
- * - enqueues missing tiles
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @param {import("../../source/Tile.js").default} tileSource Tile source.
- * @param {import("../../tilegrid/TileGrid.js").default} tileGrid Tile grid.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("../../proj/Projection.js").default} projection Projection.
- * @param {import("../../extent.js").Extent} extent Extent.
- * @param {number} currentZ Current Z.
- * @param {number} preload Load low resolution tiles up to `preload` levels.
- * @param {function(import("../../Tile.js").default):void} [opt_tileCallback] Tile callback.
- * @protected
- */
- CanvasTileLayerRenderer.prototype.manageTilePyramid = function (frameState, tileSource, tileGrid, pixelRatio, projection, extent, currentZ, preload, opt_tileCallback) {
- var tileSourceKey = getUid(tileSource);
- if (!(tileSourceKey in frameState.wantedTiles)) {
- frameState.wantedTiles[tileSourceKey] = {};
- }
- var wantedTiles = frameState.wantedTiles[tileSourceKey];
- var tileQueue = frameState.tileQueue;
- var minZoom = tileGrid.getMinZoom();
- var rotation = frameState.viewState.rotation;
- var viewport = rotation
- ? getRotatedViewport(frameState.viewState.center, frameState.viewState.resolution, rotation, frameState.size)
- : undefined;
- var tileCount = 0;
- var tile, tileRange, tileResolution, x, y, z;
- for (z = minZoom; z <= currentZ; ++z) {
- tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z, tileRange);
- tileResolution = tileGrid.getResolution(z);
- for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
- for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
- if (rotation &&
- !tileGrid.tileCoordIntersectsViewport([z, x, y], viewport)) {
- continue;
- }
- if (currentZ - z <= preload) {
- ++tileCount;
- tile = tileSource.getTile(z, x, y, pixelRatio, projection);
- if (tile.getState() == TileState.IDLE) {
- wantedTiles[tile.getKey()] = true;
- if (!tileQueue.isKeyQueued(tile.getKey())) {
- tileQueue.enqueue([
- tile,
- tileSourceKey,
- tileGrid.getTileCoordCenter(tile.tileCoord),
- tileResolution,
- ]);
- }
- }
- if (opt_tileCallback !== undefined) {
- opt_tileCallback(tile);
- }
- }
- else {
- tileSource.useTile(z, x, y, projection);
- }
- }
- }
- }
- tileSource.updateCacheSize(tileCount, projection);
- };
- return CanvasTileLayerRenderer;
- }(canvas_Layer));
- /* harmony default export */ var canvas_TileLayer = (CanvasTileLayerRenderer);
- //# sourceMappingURL=TileLayer.js.map
- ;// ./node_modules/ol/layer/Tile.js
- var layer_Tile_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/layer/Tile
- */
- /**
- * @classdesc
- * For layer sources that provide pre-rendered, tiled images in grids that are
- * organized by zoom levels for specific resolutions.
- * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
- * property on the layer object; for example, setting `title: 'My Title'` in the
- * options means that `title` is observable, and has get/set accessors.
- *
- * @template {import("../source/Tile.js").default} TileSourceType
- * @extends BaseTileLayer<TileSourceType, CanvasTileLayerRenderer>
- * @api
- */
- var TileLayer = /** @class */ (function (_super) {
- layer_Tile_extends(TileLayer, _super);
- /**
- * @param {import("./BaseTile.js").Options<TileSourceType>} [opt_options] Tile layer options.
- */
- function TileLayer(opt_options) {
- return _super.call(this, opt_options) || this;
- }
- TileLayer.prototype.createRenderer = function () {
- return new canvas_TileLayer(this);
- };
- return TileLayer;
- }(BaseTile));
- /* harmony default export */ var layer_Tile = (TileLayer);
- //# sourceMappingURL=Tile.js.map
- // EXTERNAL MODULE: ./node_modules/rbush/rbush.min.js
- var rbush_min = __webpack_require__(341);
- ;// ./node_modules/ol/style/Image.js
- /**
- * @module ol/style/Image
- */
- /**
- * @typedef {Object} Options
- * @property {number} opacity Opacity.
- * @property {boolean} rotateWithView If the image should get rotated with the view.
- * @property {number} rotation Rotation.
- * @property {number|import("../size.js").Size} scale Scale.
- * @property {Array<number>} displacement Displacement.
- * @property {"declutter"|"obstacle"|"none"|undefined} declutterMode Declutter mode: `declutter`, `obstacle`, 'none */
- /**
- * @classdesc
- * A base class used for creating subclasses and not instantiated in
- * apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and
- * {@link module:ol/style/RegularShape~RegularShape}.
- * @abstract
- * @api
- */
- var ImageStyle = /** @class */ (function () {
- /**
- * @param {Options} options Options.
- */
- function ImageStyle(options) {
- /**
- * @private
- * @type {number}
- */
- this.opacity_ = options.opacity;
- /**
- * @private
- * @type {boolean}
- */
- this.rotateWithView_ = options.rotateWithView;
- /**
- * @private
- * @type {number}
- */
- this.rotation_ = options.rotation;
- /**
- * @private
- * @type {number|import("../size.js").Size}
- */
- this.scale_ = options.scale;
- /**
- * @private
- * @type {import("../size.js").Size}
- */
- this.scaleArray_ = toSize(options.scale);
- /**
- * @private
- * @type {Array<number>}
- */
- this.displacement_ = options.displacement;
- /**
- * @private
- * @type {"declutter"|"obstacle"|"none"|undefined}
- */
- this.declutterMode_ = options.declutterMode;
- }
- /**
- * Clones the style.
- * @return {ImageStyle} The cloned style.
- * @api
- */
- ImageStyle.prototype.clone = function () {
- var scale = this.getScale();
- return new ImageStyle({
- opacity: this.getOpacity(),
- scale: Array.isArray(scale) ? scale.slice() : scale,
- rotation: this.getRotation(),
- rotateWithView: this.getRotateWithView(),
- displacement: this.getDisplacement().slice(),
- declutterMode: this.getDeclutterMode(),
- });
- };
- /**
- * Get the symbolizer opacity.
- * @return {number} Opacity.
- * @api
- */
- ImageStyle.prototype.getOpacity = function () {
- return this.opacity_;
- };
- /**
- * Determine whether the symbolizer rotates with the map.
- * @return {boolean} Rotate with map.
- * @api
- */
- ImageStyle.prototype.getRotateWithView = function () {
- return this.rotateWithView_;
- };
- /**
- * Get the symoblizer rotation.
- * @return {number} Rotation.
- * @api
- */
- ImageStyle.prototype.getRotation = function () {
- return this.rotation_;
- };
- /**
- * Get the symbolizer scale.
- * @return {number|import("../size.js").Size} Scale.
- * @api
- */
- ImageStyle.prototype.getScale = function () {
- return this.scale_;
- };
- /**
- * Get the symbolizer scale array.
- * @return {import("../size.js").Size} Scale array.
- */
- ImageStyle.prototype.getScaleArray = function () {
- return this.scaleArray_;
- };
- /**
- * Get the displacement of the shape
- * @return {Array<number>} Shape's center displacement
- * @api
- */
- ImageStyle.prototype.getDisplacement = function () {
- return this.displacement_;
- };
- /**
- * Get the declutter mode of the shape
- * @return {"declutter"|"obstacle"|"none"|undefined} Shape's declutter mode
- * @api
- */
- ImageStyle.prototype.getDeclutterMode = function () {
- return this.declutterMode_;
- };
- /**
- * Get the anchor point in pixels. The anchor determines the center point for the
- * symbolizer.
- * @abstract
- * @return {Array<number>} Anchor.
- */
- ImageStyle.prototype.getAnchor = function () {
- return util_abstract();
- };
- /**
- * Get the image element for the symbolizer.
- * @abstract
- * @param {number} pixelRatio Pixel ratio.
- * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
- */
- ImageStyle.prototype.getImage = function (pixelRatio) {
- return util_abstract();
- };
- /**
- * @abstract
- * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
- */
- ImageStyle.prototype.getHitDetectionImage = function () {
- return util_abstract();
- };
- /**
- * Get the image pixel ratio.
- * @param {number} pixelRatio Pixel ratio.
- * @return {number} Pixel ratio.
- */
- ImageStyle.prototype.getPixelRatio = function (pixelRatio) {
- return 1;
- };
- /**
- * @abstract
- * @return {import("../ImageState.js").default} Image state.
- */
- ImageStyle.prototype.getImageState = function () {
- return util_abstract();
- };
- /**
- * @abstract
- * @return {import("../size.js").Size} Image size.
- */
- ImageStyle.prototype.getImageSize = function () {
- return util_abstract();
- };
- /**
- * Get the origin of the symbolizer.
- * @abstract
- * @return {Array<number>} Origin.
- */
- ImageStyle.prototype.getOrigin = function () {
- return util_abstract();
- };
- /**
- * Get the size of the symbolizer (in pixels).
- * @abstract
- * @return {import("../size.js").Size} Size.
- */
- ImageStyle.prototype.getSize = function () {
- return util_abstract();
- };
- /**
- * Set the displacement.
- *
- * @param {Array<number>} displacement Displacement.
- * @api
- */
- ImageStyle.prototype.setDisplacement = function (displacement) {
- this.displacement_ = displacement;
- };
- /**
- * Set the opacity.
- *
- * @param {number} opacity Opacity.
- * @api
- */
- ImageStyle.prototype.setOpacity = function (opacity) {
- this.opacity_ = opacity;
- };
- /**
- * Set whether to rotate the style with the view.
- *
- * @param {boolean} rotateWithView Rotate with map.
- * @api
- */
- ImageStyle.prototype.setRotateWithView = function (rotateWithView) {
- this.rotateWithView_ = rotateWithView;
- };
- /**
- * Set the rotation.
- *
- * @param {number} rotation Rotation.
- * @api
- */
- ImageStyle.prototype.setRotation = function (rotation) {
- this.rotation_ = rotation;
- };
- /**
- * Set the scale.
- *
- * @param {number|import("../size.js").Size} scale Scale.
- * @api
- */
- ImageStyle.prototype.setScale = function (scale) {
- this.scale_ = scale;
- this.scaleArray_ = toSize(scale);
- };
- /**
- * @abstract
- * @param {function(import("../events/Event.js").default): void} listener Listener function.
- */
- ImageStyle.prototype.listenImageChange = function (listener) {
- util_abstract();
- };
- /**
- * Load not yet loaded URI.
- * @abstract
- */
- ImageStyle.prototype.load = function () {
- util_abstract();
- };
- /**
- * @abstract
- * @param {function(import("../events/Event.js").default): void} listener Listener function.
- */
- ImageStyle.prototype.unlistenImageChange = function (listener) {
- util_abstract();
- };
- return ImageStyle;
- }());
- /* harmony default export */ var style_Image = (ImageStyle);
- //# sourceMappingURL=Image.js.map
- ;// ./node_modules/ol/colorlike.js
- /**
- * @module ol/colorlike
- */
- /**
- * A type accepted by CanvasRenderingContext2D.fillStyle
- * or CanvasRenderingContext2D.strokeStyle.
- * Represents a color, pattern, or gradient. The origin for patterns and
- * gradients as fill style is an increment of 512 css pixels from map coordinate
- * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image
- * must be a factor of two (2, 4, 8, ..., 512).
- *
- * @typedef {string|CanvasPattern|CanvasGradient} ColorLike
- * @api
- */
- /**
- * @param {import("./color.js").Color|ColorLike} color Color.
- * @return {ColorLike} The color as an {@link ol/colorlike~ColorLike}.
- * @api
- */
- function asColorLike(color) {
- if (Array.isArray(color)) {
- return color_toString(color);
- }
- else {
- return color;
- }
- }
- //# sourceMappingURL=colorlike.js.map
- ;// ./node_modules/ol/render/canvas.js
- /**
- * @module ol/render/canvas
- */
- /**
- * @typedef {'Circle' | 'Image' | 'LineString' | 'Polygon' | 'Text' | 'Default'} BuilderType
- */
- /**
- * @typedef {Object} FillState
- * @property {import("../colorlike.js").ColorLike} fillStyle FillStyle.
- */
- /**
- * @typedef Label
- * @property {number} width Width.
- * @property {number} height Height.
- * @property {Array<string|number>} contextInstructions ContextInstructions.
- */
- /**
- * @typedef {Object} FillStrokeState
- * @property {import("../colorlike.js").ColorLike} [currentFillStyle] Current FillStyle.
- * @property {import("../colorlike.js").ColorLike} [currentStrokeStyle] Current StrokeStyle.
- * @property {CanvasLineCap} [currentLineCap] Current LineCap.
- * @property {Array<number>} currentLineDash Current LineDash.
- * @property {number} [currentLineDashOffset] Current LineDashOffset.
- * @property {CanvasLineJoin} [currentLineJoin] Current LineJoin.
- * @property {number} [currentLineWidth] Current LineWidth.
- * @property {number} [currentMiterLimit] Current MiterLimit.
- * @property {number} [lastStroke] Last stroke.
- * @property {import("../colorlike.js").ColorLike} [fillStyle] FillStyle.
- * @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle.
- * @property {CanvasLineCap} [lineCap] LineCap.
- * @property {Array<number>} lineDash LineDash.
- * @property {number} [lineDashOffset] LineDashOffset.
- * @property {CanvasLineJoin} [lineJoin] LineJoin.
- * @property {number} [lineWidth] LineWidth.
- * @property {number} [miterLimit] MiterLimit.
- */
- /**
- * @typedef {Object} StrokeState
- * @property {CanvasLineCap} lineCap LineCap.
- * @property {Array<number>} lineDash LineDash.
- * @property {number} lineDashOffset LineDashOffset.
- * @property {CanvasLineJoin} lineJoin LineJoin.
- * @property {number} lineWidth LineWidth.
- * @property {number} miterLimit MiterLimit.
- * @property {import("../colorlike.js").ColorLike} strokeStyle StrokeStyle.
- */
- /**
- * @typedef {Object} TextState
- * @property {string} font Font.
- * @property {string} [textAlign] TextAlign.
- * @property {string} [justify] Justify.
- * @property {string} textBaseline TextBaseline.
- * @property {string} [placement] Placement.
- * @property {number} [maxAngle] MaxAngle.
- * @property {boolean} [overflow] Overflow.
- * @property {import("../style/Fill.js").default} [backgroundFill] BackgroundFill.
- * @property {import("../style/Stroke.js").default} [backgroundStroke] BackgroundStroke.
- * @property {import("../size.js").Size} [scale] Scale.
- * @property {Array<number>} [padding] Padding.
- */
- /**
- * @typedef {Object} SerializableInstructions
- * @property {Array<*>} instructions The rendering instructions.
- * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions.
- * @property {Array<number>} coordinates The array of all coordinates.
- * @property {!Object<string, TextState>} [textStates] The text states (decluttering).
- * @property {!Object<string, FillState>} [fillStates] The fill states (decluttering).
- * @property {!Object<string, StrokeState>} [strokeStates] The stroke states (decluttering).
- */
- /**
- * @typedef {Object<number, import("./canvas/Executor.js").ReplayImageOrLabelArgs>} DeclutterImageWithText
- */
- /**
- * @const
- * @type {string}
- */
- var defaultFont = '10px sans-serif';
- /**
- * @const
- * @type {import("../colorlike.js").ColorLike}
- */
- var defaultFillStyle = '#000';
- /**
- * @const
- * @type {CanvasLineCap}
- */
- var defaultLineCap = 'round';
- /**
- * @const
- * @type {Array<number>}
- */
- var defaultLineDash = [];
- /**
- * @const
- * @type {number}
- */
- var defaultLineDashOffset = 0;
- /**
- * @const
- * @type {CanvasLineJoin}
- */
- var defaultLineJoin = 'round';
- /**
- * @const
- * @type {number}
- */
- var defaultMiterLimit = 10;
- /**
- * @const
- * @type {import("../colorlike.js").ColorLike}
- */
- var defaultStrokeStyle = '#000';
- /**
- * @const
- * @type {string}
- */
- var defaultTextAlign = 'center';
- /**
- * @const
- * @type {string}
- */
- var defaultTextBaseline = 'middle';
- /**
- * @const
- * @type {Array<number>}
- */
- var defaultPadding = [0, 0, 0, 0];
- /**
- * @const
- * @type {number}
- */
- var defaultLineWidth = 1;
- /**
- * @type {BaseObject}
- */
- var checkedFonts = new ol_Object();
- /**
- * The label cache for text rendering. To change the default cache size of 2048
- * entries, use {@link module:ol/structs/LRUCache~LRUCache#setSize cache.setSize()}.
- * Deprecated - there is no label cache any more.
- * @type {?}
- * @api
- * @deprecated
- */
- var labelCache = new events_Target();
- labelCache.setSize = function () {
- console.warn('labelCache is deprecated.'); //eslint-disable-line
- };
- /**
- * @type {CanvasRenderingContext2D}
- */
- var measureContext = null;
- /**
- * @type {string}
- */
- var measureFont;
- /**
- * @type {!Object<string, number>}
- */
- var textHeights = {};
- /**
- * Clears the label cache when a font becomes available.
- * @param {string} fontSpec CSS font spec.
- */
- var registerFont = (function () {
- var retries = 100;
- var size = '32px ';
- var referenceFonts = ['monospace', 'serif'];
- var len = referenceFonts.length;
- var text = 'wmytzilWMYTZIL@#/&?$%10\uF013';
- var interval, referenceWidth;
- /**
- * @param {string} fontStyle Css font-style
- * @param {string} fontWeight Css font-weight
- * @param {*} fontFamily Css font-family
- * @return {boolean} Font with style and weight is available
- */
- function isAvailable(fontStyle, fontWeight, fontFamily) {
- var available = true;
- for (var i = 0; i < len; ++i) {
- var referenceFont = referenceFonts[i];
- referenceWidth = measureTextWidth(fontStyle + ' ' + fontWeight + ' ' + size + referenceFont, text);
- if (fontFamily != referenceFont) {
- var width = measureTextWidth(fontStyle +
- ' ' +
- fontWeight +
- ' ' +
- size +
- fontFamily +
- ',' +
- referenceFont, text);
- // If width and referenceWidth are the same, then the fallback was used
- // instead of the font we wanted, so the font is not available.
- available = available && width != referenceWidth;
- }
- }
- if (available) {
- return true;
- }
- return false;
- }
- function check() {
- var done = true;
- var fonts = checkedFonts.getKeys();
- for (var i = 0, ii = fonts.length; i < ii; ++i) {
- var font = fonts[i];
- if (checkedFonts.get(font) < retries) {
- if (isAvailable.apply(this, font.split('\n'))) {
- clear(textHeights);
- // Make sure that loaded fonts are picked up by Safari
- measureContext = null;
- measureFont = undefined;
- checkedFonts.set(font, retries);
- }
- else {
- checkedFonts.set(font, checkedFonts.get(font) + 1, true);
- done = false;
- }
- }
- }
- if (done) {
- clearInterval(interval);
- interval = undefined;
- }
- }
- return function (fontSpec) {
- var font = getFontParameters(fontSpec);
- if (!font) {
- return;
- }
- var families = font.families;
- for (var i = 0, ii = families.length; i < ii; ++i) {
- var family = families[i];
- var key = font.style + '\n' + font.weight + '\n' + family;
- if (checkedFonts.get(key) === undefined) {
- checkedFonts.set(key, retries, true);
- if (!isAvailable(font.style, font.weight, family)) {
- checkedFonts.set(key, 0, true);
- if (interval === undefined) {
- interval = setInterval(check, 32);
- }
- }
- }
- }
- };
- })();
- /**
- * @param {string} font Font to use for measuring.
- * @return {import("../size.js").Size} Measurement.
- */
- var measureTextHeight = (function () {
- /**
- * @type {HTMLDivElement}
- */
- var measureElement;
- return function (fontSpec) {
- var height = textHeights[fontSpec];
- if (height == undefined) {
- if (WORKER_OFFSCREEN_CANVAS) {
- var font = getFontParameters(fontSpec);
- var metrics = measureText(fontSpec, 'Žg');
- var lineHeight = isNaN(Number(font.lineHeight))
- ? 1.2
- : Number(font.lineHeight);
- height =
- lineHeight *
- (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
- }
- else {
- if (!measureElement) {
- measureElement = document.createElement('div');
- measureElement.innerHTML = 'M';
- measureElement.style.minHeight = '0';
- measureElement.style.maxHeight = 'none';
- measureElement.style.height = 'auto';
- measureElement.style.padding = '0';
- measureElement.style.border = 'none';
- measureElement.style.position = 'absolute';
- measureElement.style.display = 'block';
- measureElement.style.left = '-99999px';
- }
- measureElement.style.font = fontSpec;
- document.body.appendChild(measureElement);
- height = measureElement.offsetHeight;
- document.body.removeChild(measureElement);
- }
- textHeights[fontSpec] = height;
- }
- return height;
- };
- })();
- /**
- * @param {string} font Font.
- * @param {string} text Text.
- * @return {TextMetrics} Text metrics.
- */
- function measureText(font, text) {
- if (!measureContext) {
- measureContext = createCanvasContext2D(1, 1);
- }
- if (font != measureFont) {
- measureContext.font = font;
- measureFont = measureContext.font;
- }
- return measureContext.measureText(text);
- }
- /**
- * @param {string} font Font.
- * @param {string} text Text.
- * @return {number} Width.
- */
- function measureTextWidth(font, text) {
- return measureText(font, text).width;
- }
- /**
- * Measure text width using a cache.
- * @param {string} font The font.
- * @param {string} text The text to measure.
- * @param {Object<string, number>} cache A lookup of cached widths by text.
- * @return {number} The text width.
- */
- function measureAndCacheTextWidth(font, text, cache) {
- if (text in cache) {
- return cache[text];
- }
- var width = text
- .split('\n')
- .reduce(function (prev, curr) { return Math.max(prev, measureTextWidth(font, curr)); }, 0);
- cache[text] = width;
- return width;
- }
- /**
- * @param {TextState} baseStyle Base style.
- * @param {Array<string>} chunks Text chunks to measure.
- * @return {{width: number, height: number, widths: Array<number>, heights: Array<number>, lineWidths: Array<number>}}} Text metrics.
- */
- function getTextDimensions(baseStyle, chunks) {
- var widths = [];
- var heights = [];
- var lineWidths = [];
- var width = 0;
- var lineWidth = 0;
- var height = 0;
- var lineHeight = 0;
- for (var i = 0, ii = chunks.length; i <= ii; i += 2) {
- var text = chunks[i];
- if (text === '\n' || i === ii) {
- width = Math.max(width, lineWidth);
- lineWidths.push(lineWidth);
- lineWidth = 0;
- height += lineHeight;
- continue;
- }
- var font = chunks[i + 1] || baseStyle.font;
- var currentWidth = measureTextWidth(font, text);
- widths.push(currentWidth);
- lineWidth += currentWidth;
- var currentHeight = measureTextHeight(font);
- heights.push(currentHeight);
- lineHeight = Math.max(lineHeight, currentHeight);
- }
- return { width: width, height: height, widths: widths, heights: heights, lineWidths: lineWidths };
- }
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {number} rotation Rotation.
- * @param {number} offsetX X offset.
- * @param {number} offsetY Y offset.
- */
- function rotateAtOffset(context, rotation, offsetX, offsetY) {
- if (rotation !== 0) {
- context.translate(offsetX, offsetY);
- context.rotate(rotation);
- context.translate(-offsetX, -offsetY);
- }
- }
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {import("../transform.js").Transform|null} transform Transform.
- * @param {number} opacity Opacity.
- * @param {Label|HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} labelOrImage Label.
- * @param {number} originX Origin X.
- * @param {number} originY Origin Y.
- * @param {number} w Width.
- * @param {number} h Height.
- * @param {number} x X.
- * @param {number} y Y.
- * @param {import("../size.js").Size} scale Scale.
- */
- function drawImageOrLabel(context, transform, opacity, labelOrImage, originX, originY, w, h, x, y, scale) {
- context.save();
- if (opacity !== 1) {
- context.globalAlpha *= opacity;
- }
- if (transform) {
- context.setTransform.apply(context, transform);
- }
- if ( /** @type {*} */(labelOrImage).contextInstructions) {
- // label
- context.translate(x, y);
- context.scale(scale[0], scale[1]);
- executeLabelInstructions(/** @type {Label} */ (labelOrImage), context);
- }
- else if (scale[0] < 0 || scale[1] < 0) {
- // flipped image
- context.translate(x, y);
- context.scale(scale[0], scale[1]);
- context.drawImage(
- /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (labelOrImage), originX, originY, w, h, 0, 0, w, h);
- }
- else {
- // if image not flipped translate and scale can be avoided
- context.drawImage(
- /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (labelOrImage), originX, originY, w, h, x, y, w * scale[0], h * scale[1]);
- }
- context.restore();
- }
- /**
- * @param {Label} label Label.
- * @param {CanvasRenderingContext2D} context Context.
- */
- function executeLabelInstructions(label, context) {
- var contextInstructions = label.contextInstructions;
- for (var i = 0, ii = contextInstructions.length; i < ii; i += 2) {
- if (Array.isArray(contextInstructions[i + 1])) {
- context[contextInstructions[i]].apply(context, contextInstructions[i + 1]);
- }
- else {
- context[contextInstructions[i]] = contextInstructions[i + 1];
- }
- }
- }
- //# sourceMappingURL=canvas.js.map
- ;// ./node_modules/ol/style/RegularShape.js
- /**
- * @module ol/style/RegularShape
- */
- var RegularShape_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * Specify radius for regular polygons, or radius1 and radius2 for stars.
- * @typedef {Object} Options
- * @property {import("./Fill.js").default} [fill] Fill style.
- * @property {number} points Number of points for stars and regular polygons. In case of a polygon, the number of points
- * is the number of sides.
- * @property {number} [radius] Radius of a regular polygon.
- * @property {number} [radius1] First radius of a star. Ignored if radius is set.
- * @property {number} [radius2] Second radius of a star.
- * @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up.
- * @property {Array<number>} [displacement=[0,0]] Displacement of the shape
- * @property {import("./Stroke.js").default} [stroke] Stroke style.
- * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
- * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view.
- * @property {number|import("../size.js").Size} [scale=1] Scale. Unless two dimensional scaling is required a better
- * result may be obtained with appropriate settings for `radius`, `radius1` and `radius2`.
- * @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode
- */
- /**
- * @typedef {Object} RenderOptions
- * @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle.
- * @property {number} strokeWidth StrokeWidth.
- * @property {number} size Size.
- * @property {Array<number>} lineDash LineDash.
- * @property {number} lineDashOffset LineDashOffset.
- * @property {CanvasLineJoin} lineJoin LineJoin.
- * @property {number} miterLimit MiterLimit.
- */
- /**
- * @classdesc
- * Set regular shape style for vector features. The resulting shape will be
- * a regular polygon when `radius` is provided, or a star when `radius1` and
- * `radius2` are provided.
- * @api
- */
- var RegularShape = /** @class */ (function (_super) {
- RegularShape_extends(RegularShape, _super);
- /**
- * @param {Options} options Options.
- */
- function RegularShape(options) {
- var _this = this;
- /**
- * @type {boolean}
- */
- var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false;
- _this = _super.call(this, {
- opacity: 1,
- rotateWithView: rotateWithView,
- rotation: options.rotation !== undefined ? options.rotation : 0,
- scale: options.scale !== undefined ? options.scale : 1,
- displacement: options.displacement !== undefined ? options.displacement : [0, 0],
- declutterMode: options.declutterMode,
- }) || this;
- /**
- * @private
- * @type {Object<number, HTMLCanvasElement>}
- */
- _this.canvas_ = undefined;
- /**
- * @private
- * @type {HTMLCanvasElement}
- */
- _this.hitDetectionCanvas_ = null;
- /**
- * @private
- * @type {import("./Fill.js").default}
- */
- _this.fill_ = options.fill !== undefined ? options.fill : null;
- /**
- * @private
- * @type {Array<number>}
- */
- _this.origin_ = [0, 0];
- /**
- * @private
- * @type {number}
- */
- _this.points_ = options.points;
- /**
- * @protected
- * @type {number}
- */
- _this.radius_ =
- options.radius !== undefined ? options.radius : options.radius1;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.radius2_ = options.radius2;
- /**
- * @private
- * @type {number}
- */
- _this.angle_ = options.angle !== undefined ? options.angle : 0;
- /**
- * @private
- * @type {import("./Stroke.js").default}
- */
- _this.stroke_ = options.stroke !== undefined ? options.stroke : null;
- /**
- * @private
- * @type {import("../size.js").Size}
- */
- _this.size_ = null;
- /**
- * @private
- * @type {RenderOptions}
- */
- _this.renderOptions_ = null;
- _this.render();
- return _this;
- }
- /**
- * Clones the style.
- * @return {RegularShape} The cloned style.
- * @api
- */
- RegularShape.prototype.clone = function () {
- var scale = this.getScale();
- var style = new RegularShape({
- fill: this.getFill() ? this.getFill().clone() : undefined,
- points: this.getPoints(),
- radius: this.getRadius(),
- radius2: this.getRadius2(),
- angle: this.getAngle(),
- stroke: this.getStroke() ? this.getStroke().clone() : undefined,
- rotation: this.getRotation(),
- rotateWithView: this.getRotateWithView(),
- scale: Array.isArray(scale) ? scale.slice() : scale,
- displacement: this.getDisplacement().slice(),
- declutterMode: this.getDeclutterMode(),
- });
- style.setOpacity(this.getOpacity());
- return style;
- };
- /**
- * Get the anchor point in pixels. The anchor determines the center point for the
- * symbolizer.
- * @return {Array<number>} Anchor.
- * @api
- */
- RegularShape.prototype.getAnchor = function () {
- var size = this.size_;
- if (!size) {
- return null;
- }
- var displacement = this.getDisplacement();
- return [size[0] / 2 - displacement[0], size[1] / 2 + displacement[1]];
- };
- /**
- * Get the angle used in generating the shape.
- * @return {number} Shape's rotation in radians.
- * @api
- */
- RegularShape.prototype.getAngle = function () {
- return this.angle_;
- };
- /**
- * Get the fill style for the shape.
- * @return {import("./Fill.js").default} Fill style.
- * @api
- */
- RegularShape.prototype.getFill = function () {
- return this.fill_;
- };
- /**
- * Set the fill style.
- * @param {import("./Fill.js").default} fill Fill style.
- * @api
- */
- RegularShape.prototype.setFill = function (fill) {
- this.fill_ = fill;
- this.render();
- };
- /**
- * @return {HTMLCanvasElement} Image element.
- */
- RegularShape.prototype.getHitDetectionImage = function () {
- if (!this.hitDetectionCanvas_) {
- this.createHitDetectionCanvas_(this.renderOptions_);
- }
- return this.hitDetectionCanvas_;
- };
- /**
- * Get the image icon.
- * @param {number} pixelRatio Pixel ratio.
- * @return {HTMLCanvasElement} Image or Canvas element.
- * @api
- */
- RegularShape.prototype.getImage = function (pixelRatio) {
- var image = this.canvas_[pixelRatio];
- if (!image) {
- var renderOptions = this.renderOptions_;
- var context = createCanvasContext2D(renderOptions.size * pixelRatio, renderOptions.size * pixelRatio);
- this.draw_(renderOptions, context, pixelRatio);
- image = context.canvas;
- this.canvas_[pixelRatio] = image;
- }
- return image;
- };
- /**
- * Get the image pixel ratio.
- * @param {number} pixelRatio Pixel ratio.
- * @return {number} Pixel ratio.
- */
- RegularShape.prototype.getPixelRatio = function (pixelRatio) {
- return pixelRatio;
- };
- /**
- * @return {import("../size.js").Size} Image size.
- */
- RegularShape.prototype.getImageSize = function () {
- return this.size_;
- };
- /**
- * @return {import("../ImageState.js").default} Image state.
- */
- RegularShape.prototype.getImageState = function () {
- return ImageState.LOADED;
- };
- /**
- * Get the origin of the symbolizer.
- * @return {Array<number>} Origin.
- * @api
- */
- RegularShape.prototype.getOrigin = function () {
- return this.origin_;
- };
- /**
- * Get the number of points for generating the shape.
- * @return {number} Number of points for stars and regular polygons.
- * @api
- */
- RegularShape.prototype.getPoints = function () {
- return this.points_;
- };
- /**
- * Get the (primary) radius for the shape.
- * @return {number} Radius.
- * @api
- */
- RegularShape.prototype.getRadius = function () {
- return this.radius_;
- };
- /**
- * Get the secondary radius for the shape.
- * @return {number|undefined} Radius2.
- * @api
- */
- RegularShape.prototype.getRadius2 = function () {
- return this.radius2_;
- };
- /**
- * Get the size of the symbolizer (in pixels).
- * @return {import("../size.js").Size} Size.
- * @api
- */
- RegularShape.prototype.getSize = function () {
- return this.size_;
- };
- /**
- * Get the stroke style for the shape.
- * @return {import("./Stroke.js").default} Stroke style.
- * @api
- */
- RegularShape.prototype.getStroke = function () {
- return this.stroke_;
- };
- /**
- * Set the stroke style.
- * @param {import("./Stroke.js").default} stroke Stroke style.
- * @api
- */
- RegularShape.prototype.setStroke = function (stroke) {
- this.stroke_ = stroke;
- this.render();
- };
- /**
- * @param {function(import("../events/Event.js").default): void} listener Listener function.
- */
- RegularShape.prototype.listenImageChange = function (listener) { };
- /**
- * Load not yet loaded URI.
- */
- RegularShape.prototype.load = function () { };
- /**
- * @param {function(import("../events/Event.js").default): void} listener Listener function.
- */
- RegularShape.prototype.unlistenImageChange = function (listener) { };
- /**
- * Calculate additional canvas size needed for the miter.
- * @param {string} lineJoin Line join
- * @param {number} strokeWidth Stroke width
- * @param {number} miterLimit Miter limit
- * @return {number} Additional canvas size needed
- * @private
- */
- RegularShape.prototype.calculateLineJoinSize_ = function (lineJoin, strokeWidth, miterLimit) {
- if (strokeWidth === 0 ||
- this.points_ === Infinity ||
- (lineJoin !== 'bevel' && lineJoin !== 'miter')) {
- return strokeWidth;
- }
- // m | ^
- // i | |\ .
- // t >| #\
- // e | |\ \ .
- // r \s\
- // | \t\ . .
- // \r\ . .
- // | \o\ . . . . .
- // e \k\ . . . .
- // | \e\ . . . . .
- // d \ \ . . . .
- // | _ _a_ _\# . . .
- // r1 / ` . .
- // | . .
- // b / . .
- // | . .
- // / r2 . .
- // | . .
- // / . .
- // |α . .
- // / . .
- // ° center
- var r1 = this.radius_;
- var r2 = this.radius2_ === undefined ? r1 : this.radius2_;
- if (r1 < r2) {
- var tmp = r1;
- r1 = r2;
- r2 = tmp;
- }
- var points = this.radius2_ === undefined ? this.points_ : this.points_ * 2;
- var alpha = (2 * Math.PI) / points;
- var a = r2 * Math.sin(alpha);
- var b = Math.sqrt(r2 * r2 - a * a);
- var d = r1 - b;
- var e = Math.sqrt(a * a + d * d);
- var miterRatio = e / a;
- if (lineJoin === 'miter' && miterRatio <= miterLimit) {
- return miterRatio * strokeWidth;
- }
- // Calculate the distnce from center to the stroke corner where
- // it was cut short because of the miter limit.
- // l
- // ----+---- <= distance from center to here is maxr
- // /####|k ##\
- // /#####^#####\
- // /#### /+\# s #\
- // /### h/+++\# t #\
- // /### t/+++++\# r #\
- // /### a/+++++++\# o #\
- // /### p/++ fill +\# k #\
- ///#### /+++++^+++++\# e #\
- //#####/+++++/+\+++++\#####\
- var k = strokeWidth / 2 / miterRatio;
- var l = (strokeWidth / 2) * (d / e);
- var maxr = Math.sqrt((r1 + k) * (r1 + k) + l * l);
- var bevelAdd = maxr - r1;
- if (this.radius2_ === undefined || lineJoin === 'bevel') {
- return bevelAdd * 2;
- }
- // If outer miter is over the miter limit the inner miter may reach through the
- // center and be longer than the bevel, same calculation as above but swap r1 / r2.
- var aa = r1 * Math.sin(alpha);
- var bb = Math.sqrt(r1 * r1 - aa * aa);
- var dd = r2 - bb;
- var ee = Math.sqrt(aa * aa + dd * dd);
- var innerMiterRatio = ee / aa;
- if (innerMiterRatio <= miterLimit) {
- var innerLength = (innerMiterRatio * strokeWidth) / 2 - r2 - r1;
- return 2 * Math.max(bevelAdd, innerLength);
- }
- return bevelAdd * 2;
- };
- /**
- * @return {RenderOptions} The render options
- * @protected
- */
- RegularShape.prototype.createRenderOptions = function () {
- var lineJoin = defaultLineJoin;
- var miterLimit = 0;
- var lineDash = null;
- var lineDashOffset = 0;
- var strokeStyle;
- var strokeWidth = 0;
- if (this.stroke_) {
- strokeStyle = this.stroke_.getColor();
- if (strokeStyle === null) {
- strokeStyle = defaultStrokeStyle;
- }
- strokeStyle = asColorLike(strokeStyle);
- strokeWidth = this.stroke_.getWidth();
- if (strokeWidth === undefined) {
- strokeWidth = defaultLineWidth;
- }
- lineDash = this.stroke_.getLineDash();
- lineDashOffset = this.stroke_.getLineDashOffset();
- lineJoin = this.stroke_.getLineJoin();
- if (lineJoin === undefined) {
- lineJoin = defaultLineJoin;
- }
- miterLimit = this.stroke_.getMiterLimit();
- if (miterLimit === undefined) {
- miterLimit = defaultMiterLimit;
- }
- }
- var add = this.calculateLineJoinSize_(lineJoin, strokeWidth, miterLimit);
- var maxRadius = Math.max(this.radius_, this.radius2_ || 0);
- var size = Math.ceil(2 * maxRadius + add);
- return {
- strokeStyle: strokeStyle,
- strokeWidth: strokeWidth,
- size: size,
- lineDash: lineDash,
- lineDashOffset: lineDashOffset,
- lineJoin: lineJoin,
- miterLimit: miterLimit,
- };
- };
- /**
- * @protected
- */
- RegularShape.prototype.render = function () {
- this.renderOptions_ = this.createRenderOptions();
- var size = this.renderOptions_.size;
- this.canvas_ = {};
- this.size_ = [size, size];
- };
- /**
- * @private
- * @param {RenderOptions} renderOptions Render options.
- * @param {CanvasRenderingContext2D} context The rendering context.
- * @param {number} pixelRatio The pixel ratio.
- */
- RegularShape.prototype.draw_ = function (renderOptions, context, pixelRatio) {
- context.scale(pixelRatio, pixelRatio);
- // set origin to canvas center
- context.translate(renderOptions.size / 2, renderOptions.size / 2);
- this.createPath_(context);
- if (this.fill_) {
- var color = this.fill_.getColor();
- if (color === null) {
- color = defaultFillStyle;
- }
- context.fillStyle = asColorLike(color);
- context.fill();
- }
- if (this.stroke_) {
- context.strokeStyle = renderOptions.strokeStyle;
- context.lineWidth = renderOptions.strokeWidth;
- if (context.setLineDash && renderOptions.lineDash) {
- context.setLineDash(renderOptions.lineDash);
- context.lineDashOffset = renderOptions.lineDashOffset;
- }
- context.lineJoin = renderOptions.lineJoin;
- context.miterLimit = renderOptions.miterLimit;
- context.stroke();
- }
- };
- /**
- * @private
- * @param {RenderOptions} renderOptions Render options.
- */
- RegularShape.prototype.createHitDetectionCanvas_ = function (renderOptions) {
- if (this.fill_) {
- var color = this.fill_.getColor();
- // determine if fill is transparent (or pattern or gradient)
- var opacity = 0;
- if (typeof color === 'string') {
- color = asArray(color);
- }
- if (color === null) {
- opacity = 1;
- }
- else if (Array.isArray(color)) {
- opacity = color.length === 4 ? color[3] : 1;
- }
- if (opacity === 0) {
- // if a transparent fill style is set, create an extra hit-detection image
- // with a default fill style
- var context = createCanvasContext2D(renderOptions.size, renderOptions.size);
- this.hitDetectionCanvas_ = context.canvas;
- this.drawHitDetectionCanvas_(renderOptions, context);
- }
- }
- if (!this.hitDetectionCanvas_) {
- this.hitDetectionCanvas_ = this.getImage(1);
- }
- };
- /**
- * @private
- * @param {CanvasRenderingContext2D} context The context to draw in.
- */
- RegularShape.prototype.createPath_ = function (context) {
- var points = this.points_;
- var radius = this.radius_;
- if (points === Infinity) {
- context.arc(0, 0, radius, 0, 2 * Math.PI);
- }
- else {
- var radius2 = this.radius2_ === undefined ? radius : this.radius2_;
- if (this.radius2_ !== undefined) {
- points *= 2;
- }
- var startAngle = this.angle_ - Math.PI / 2;
- var step = (2 * Math.PI) / points;
- for (var i = 0; i < points; i++) {
- var angle0 = startAngle + i * step;
- var radiusC = i % 2 === 0 ? radius : radius2;
- context.lineTo(radiusC * Math.cos(angle0), radiusC * Math.sin(angle0));
- }
- context.closePath();
- }
- };
- /**
- * @private
- * @param {RenderOptions} renderOptions Render options.
- * @param {CanvasRenderingContext2D} context The context.
- */
- RegularShape.prototype.drawHitDetectionCanvas_ = function (renderOptions, context) {
- // set origin to canvas center
- context.translate(renderOptions.size / 2, renderOptions.size / 2);
- this.createPath_(context);
- context.fillStyle = defaultFillStyle;
- context.fill();
- if (this.stroke_) {
- context.strokeStyle = renderOptions.strokeStyle;
- context.lineWidth = renderOptions.strokeWidth;
- if (renderOptions.lineDash) {
- context.setLineDash(renderOptions.lineDash);
- context.lineDashOffset = renderOptions.lineDashOffset;
- }
- context.lineJoin = renderOptions.lineJoin;
- context.miterLimit = renderOptions.miterLimit;
- context.stroke();
- }
- };
- return RegularShape;
- }(style_Image));
- /* harmony default export */ var style_RegularShape = (RegularShape);
- //# sourceMappingURL=RegularShape.js.map
- ;// ./node_modules/ol/style/Circle.js
- /**
- * @module ol/style/Circle
- */
- var Circle_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @typedef {Object} Options
- * @property {import("./Fill.js").default} [fill] Fill style.
- * @property {number} radius Circle radius.
- * @property {import("./Stroke.js").default} [stroke] Stroke style.
- * @property {Array<number>} [displacement=[0,0]] displacement
- * @property {number|import("../size.js").Size} [scale=1] Scale. A two dimensional scale will produce an ellipse.
- * Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `radius`.
- * @property {number} [rotation=0] Rotation in radians
- * (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).
- * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view
- * (meaningful only when used in conjunction with a two dimensional scale).
- * @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode
- */
- /**
- * @classdesc
- * Set circle style for vector features.
- * @api
- */
- var Circle_CircleStyle = /** @class */ (function (_super) {
- Circle_extends(CircleStyle, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function CircleStyle(opt_options) {
- var options = opt_options ? opt_options : {};
- return _super.call(this, {
- points: Infinity,
- fill: options.fill,
- radius: options.radius,
- stroke: options.stroke,
- scale: options.scale !== undefined ? options.scale : 1,
- rotation: options.rotation !== undefined ? options.rotation : 0,
- rotateWithView: options.rotateWithView !== undefined ? options.rotateWithView : false,
- displacement: options.displacement !== undefined ? options.displacement : [0, 0],
- declutterMode: options.declutterMode,
- }) || this;
- }
- /**
- * Clones the style.
- * @return {CircleStyle} The cloned style.
- * @api
- */
- CircleStyle.prototype.clone = function () {
- var scale = this.getScale();
- var style = new CircleStyle({
- fill: this.getFill() ? this.getFill().clone() : undefined,
- stroke: this.getStroke() ? this.getStroke().clone() : undefined,
- radius: this.getRadius(),
- scale: Array.isArray(scale) ? scale.slice() : scale,
- rotation: this.getRotation(),
- rotateWithView: this.getRotateWithView(),
- displacement: this.getDisplacement().slice(),
- declutterMode: this.getDeclutterMode(),
- });
- style.setOpacity(this.getOpacity());
- return style;
- };
- /**
- * Set the circle radius.
- *
- * @param {number} radius Circle radius.
- * @api
- */
- CircleStyle.prototype.setRadius = function (radius) {
- this.radius_ = radius;
- this.render();
- };
- return CircleStyle;
- }(style_RegularShape));
- /* harmony default export */ var Circle = (Circle_CircleStyle);
- //# sourceMappingURL=Circle.js.map
- ;// ./node_modules/ol/style/Fill.js
- /**
- * @module ol/style/Fill
- */
- /**
- * @typedef {Object} Options
- * @property {import("../color.js").Color|import("../colorlike.js").ColorLike|null} [color=null] A color, gradient or pattern.
- * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.
- * Default null; if null, the Canvas/renderer default black will be used.
- */
- /**
- * @classdesc
- * Set fill style for vector features.
- * @api
- */
- var Fill_Fill = /** @class */ (function () {
- /**
- * @param {Options} [opt_options] Options.
- */
- function Fill(opt_options) {
- var options = opt_options || {};
- /**
- * @private
- * @type {import("../color.js").Color|import("../colorlike.js").ColorLike|null}
- */
- this.color_ = options.color !== undefined ? options.color : null;
- }
- /**
- * Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}.
- * @return {Fill} The cloned style.
- * @api
- */
- Fill.prototype.clone = function () {
- var color = this.getColor();
- return new Fill({
- color: Array.isArray(color) ? color.slice() : color || undefined,
- });
- };
- /**
- * Get the fill color.
- * @return {import("../color.js").Color|import("../colorlike.js").ColorLike|null} Color.
- * @api
- */
- Fill.prototype.getColor = function () {
- return this.color_;
- };
- /**
- * Set the color.
- *
- * @param {import("../color.js").Color|import("../colorlike.js").ColorLike|null} color Color.
- * @api
- */
- Fill.prototype.setColor = function (color) {
- this.color_ = color;
- };
- return Fill;
- }());
- /* harmony default export */ var style_Fill = (Fill_Fill);
- //# sourceMappingURL=Fill.js.map
- ;// ./node_modules/ol/style/Stroke.js
- /**
- * @module ol/style/Stroke
- */
- /**
- * @typedef {Object} Options
- * @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color] A color, gradient or pattern.
- * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.
- * Default null; if null, the Canvas/renderer default black will be used.
- * @property {CanvasLineCap} [lineCap='round'] Line cap style: `butt`, `round`, or `square`.
- * @property {CanvasLineJoin} [lineJoin='round'] Line join style: `bevel`, `round`, or `miter`.
- * @property {Array<number>} [lineDash] Line dash pattern. Default is `null` (no dash).
- * Please note that Internet Explorer 10 and lower do not support the `setLineDash` method on
- * the `CanvasRenderingContext2D` and therefore this option will have no visual effect in these browsers.
- * @property {number} [lineDashOffset=0] Line dash offset.
- * @property {number} [miterLimit=10] Miter limit.
- * @property {number} [width] Width.
- */
- /**
- * @classdesc
- * Set stroke style for vector features.
- * Note that the defaults given are the Canvas defaults, which will be used if
- * option is not defined. The `get` functions return whatever was entered in
- * the options; they will not return the default.
- * @api
- */
- var Stroke_Stroke = /** @class */ (function () {
- /**
- * @param {Options} [opt_options] Options.
- */
- function Stroke(opt_options) {
- var options = opt_options || {};
- /**
- * @private
- * @type {import("../color.js").Color|import("../colorlike.js").ColorLike}
- */
- this.color_ = options.color !== undefined ? options.color : null;
- /**
- * @private
- * @type {CanvasLineCap|undefined}
- */
- this.lineCap_ = options.lineCap;
- /**
- * @private
- * @type {Array<number>}
- */
- this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null;
- /**
- * @private
- * @type {number|undefined}
- */
- this.lineDashOffset_ = options.lineDashOffset;
- /**
- * @private
- * @type {CanvasLineJoin|undefined}
- */
- this.lineJoin_ = options.lineJoin;
- /**
- * @private
- * @type {number|undefined}
- */
- this.miterLimit_ = options.miterLimit;
- /**
- * @private
- * @type {number|undefined}
- */
- this.width_ = options.width;
- }
- /**
- * Clones the style.
- * @return {Stroke} The cloned style.
- * @api
- */
- Stroke.prototype.clone = function () {
- var color = this.getColor();
- return new Stroke({
- color: Array.isArray(color) ? color.slice() : color || undefined,
- lineCap: this.getLineCap(),
- lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined,
- lineDashOffset: this.getLineDashOffset(),
- lineJoin: this.getLineJoin(),
- miterLimit: this.getMiterLimit(),
- width: this.getWidth(),
- });
- };
- /**
- * Get the stroke color.
- * @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color.
- * @api
- */
- Stroke.prototype.getColor = function () {
- return this.color_;
- };
- /**
- * Get the line cap type for the stroke.
- * @return {CanvasLineCap|undefined} Line cap.
- * @api
- */
- Stroke.prototype.getLineCap = function () {
- return this.lineCap_;
- };
- /**
- * Get the line dash style for the stroke.
- * @return {Array<number>} Line dash.
- * @api
- */
- Stroke.prototype.getLineDash = function () {
- return this.lineDash_;
- };
- /**
- * Get the line dash offset for the stroke.
- * @return {number|undefined} Line dash offset.
- * @api
- */
- Stroke.prototype.getLineDashOffset = function () {
- return this.lineDashOffset_;
- };
- /**
- * Get the line join type for the stroke.
- * @return {CanvasLineJoin|undefined} Line join.
- * @api
- */
- Stroke.prototype.getLineJoin = function () {
- return this.lineJoin_;
- };
- /**
- * Get the miter limit for the stroke.
- * @return {number|undefined} Miter limit.
- * @api
- */
- Stroke.prototype.getMiterLimit = function () {
- return this.miterLimit_;
- };
- /**
- * Get the stroke width.
- * @return {number|undefined} Width.
- * @api
- */
- Stroke.prototype.getWidth = function () {
- return this.width_;
- };
- /**
- * Set the color.
- *
- * @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color.
- * @api
- */
- Stroke.prototype.setColor = function (color) {
- this.color_ = color;
- };
- /**
- * Set the line cap.
- *
- * @param {CanvasLineCap|undefined} lineCap Line cap.
- * @api
- */
- Stroke.prototype.setLineCap = function (lineCap) {
- this.lineCap_ = lineCap;
- };
- /**
- * Set the line dash.
- *
- * Please note that Internet Explorer 10 and lower [do not support][mdn] the
- * `setLineDash` method on the `CanvasRenderingContext2D` and therefore this
- * property will have no visual effect in these browsers.
- *
- * [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility
- *
- * @param {Array<number>} lineDash Line dash.
- * @api
- */
- Stroke.prototype.setLineDash = function (lineDash) {
- this.lineDash_ = lineDash;
- };
- /**
- * Set the line dash offset.
- *
- * @param {number|undefined} lineDashOffset Line dash offset.
- * @api
- */
- Stroke.prototype.setLineDashOffset = function (lineDashOffset) {
- this.lineDashOffset_ = lineDashOffset;
- };
- /**
- * Set the line join.
- *
- * @param {CanvasLineJoin|undefined} lineJoin Line join.
- * @api
- */
- Stroke.prototype.setLineJoin = function (lineJoin) {
- this.lineJoin_ = lineJoin;
- };
- /**
- * Set the miter limit.
- *
- * @param {number|undefined} miterLimit Miter limit.
- * @api
- */
- Stroke.prototype.setMiterLimit = function (miterLimit) {
- this.miterLimit_ = miterLimit;
- };
- /**
- * Set the width.
- *
- * @param {number|undefined} width Width.
- * @api
- */
- Stroke.prototype.setWidth = function (width) {
- this.width_ = width;
- };
- return Stroke;
- }());
- /* harmony default export */ var style_Stroke = (Stroke_Stroke);
- //# sourceMappingURL=Stroke.js.map
- ;// ./node_modules/ol/style/Style.js
- /**
- * @module ol/style/Style
- */
- /**
- * A function that takes an {@link module:ol/Feature~Feature} and a `{number}`
- * representing the view's resolution. The function should return a
- * {@link module:ol/style/Style~Style} or an array of them. This way e.g. a
- * vector layer can be styled. If the function returns `undefined`, the
- * feature will not be rendered.
- *
- * @typedef {function(import("../Feature.js").FeatureLike, number):(Style|Array<Style>|void)} StyleFunction
- */
- /**
- * A {@link Style}, an array of {@link Style}, or a {@link StyleFunction}.
- * @typedef {Style|Array<Style>|StyleFunction} StyleLike
- */
- /**
- * A function that takes an {@link module:ol/Feature~Feature} as argument and returns an
- * {@link module:ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.
- *
- * @typedef {function(import("../Feature.js").FeatureLike):
- * (import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined)} GeometryFunction
- */
- /**
- * Custom renderer function. Takes two arguments:
- *
- * 1. The pixel coordinates of the geometry in GeoJSON notation.
- * 2. The {@link module:ol/render~State} of the layer renderer.
- *
- * @typedef {function((import("../coordinate.js").Coordinate|Array<import("../coordinate.js").Coordinate>|Array<Array<import("../coordinate.js").Coordinate>>),import("../render.js").State): void} RenderFunction
- */
- /**
- * @typedef {Object} Options
- * @property {string|import("../geom/Geometry.js").default|GeometryFunction} [geometry] Feature property or geometry
- * or function returning a geometry to render for this style.
- * @property {import("./Fill.js").default} [fill] Fill style.
- * @property {import("./Image.js").default} [image] Image style.
- * @property {RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be
- * ignored, and the provided function will be called with each render frame for each geometry.
- * @property {RenderFunction} [hitDetectionRenderer] Custom renderer for hit detection. If provided will be used
- * in hit detection rendering.
- * @property {import("./Stroke.js").default} [stroke] Stroke style.
- * @property {import("./Text.js").default} [text] Text style.
- * @property {number} [zIndex] Z index.
- */
- /**
- * @classdesc
- * Container for vector feature rendering styles. Any changes made to the style
- * or its children through `set*()` methods will not take effect until the
- * feature or layer that uses the style is re-rendered.
- *
- * ## Feature styles
- *
- * If no style is defined, the following default style is used:
- * ```js
- * import {Circle, Fill, Stroke, Style} from 'ol/style';
- *
- * const fill = new Fill({
- * color: 'rgba(255,255,255,0.4)',
- * });
- * const stroke = new Stroke({
- * color: '#3399CC',
- * width: 1.25,
- * });
- * const styles = [
- * new Style({
- * image: new Circle({
- * fill: fill,
- * stroke: stroke,
- * radius: 5,
- * }),
- * fill: fill,
- * stroke: stroke,
- * }),
- * ];
- * ```
- *
- * A separate editing style has the following defaults:
- * ```js
- * import {Circle, Fill, Stroke, Style} from 'ol/style';
- *
- * const styles = {};
- * const white = [255, 255, 255, 1];
- * const blue = [0, 153, 255, 1];
- * const width = 3;
- * styles['Polygon'] = [
- * new Style({
- * fill: new Fill({
- * color: [255, 255, 255, 0.5],
- * }),
- * }),
- * ];
- * styles['MultiPolygon'] =
- * styles['Polygon'];
- * styles['LineString'] = [
- * new Style({
- * stroke: new Stroke({
- * color: white,
- * width: width + 2,
- * }),
- * }),
- * new Style({
- * stroke: new Stroke({
- * color: blue,
- * width: width,
- * }),
- * }),
- * ];
- * styles['MultiLineString'] = styles['LineString'];
- *
- * styles['Circle'] = styles['Polygon'].concat(
- * styles['LineString']
- * );
- *
- * styles['Point'] = [
- * new Style({
- * image: new Circle({
- * radius: width * 2,
- * fill: new Fill({
- * color: blue,
- * }),
- * stroke: new Stroke({
- * color: white,
- * width: width / 2,
- * }),
- * }),
- * zIndex: Infinity,
- * }),
- * ];
- * styles['MultiPoint'] =
- * styles['Point'];
- * styles['GeometryCollection'] =
- * styles['Polygon'].concat(
- * styles['LineString'],
- * styles['Point']
- * );
- * ```
- *
- * @api
- */
- var Style = /** @class */ (function () {
- /**
- * @param {Options} [opt_options] Style options.
- */
- function Style(opt_options) {
- var options = opt_options || {};
- /**
- * @private
- * @type {string|import("../geom/Geometry.js").default|GeometryFunction}
- */
- this.geometry_ = null;
- /**
- * @private
- * @type {!GeometryFunction}
- */
- this.geometryFunction_ = defaultGeometryFunction;
- if (options.geometry !== undefined) {
- this.setGeometry(options.geometry);
- }
- /**
- * @private
- * @type {import("./Fill.js").default}
- */
- this.fill_ = options.fill !== undefined ? options.fill : null;
- /**
- * @private
- * @type {import("./Image.js").default}
- */
- this.image_ = options.image !== undefined ? options.image : null;
- /**
- * @private
- * @type {RenderFunction|null}
- */
- this.renderer_ = options.renderer !== undefined ? options.renderer : null;
- /**
- * @private
- * @type {RenderFunction|null}
- */
- this.hitDetectionRenderer_ =
- options.hitDetectionRenderer !== undefined
- ? options.hitDetectionRenderer
- : null;
- /**
- * @private
- * @type {import("./Stroke.js").default}
- */
- this.stroke_ = options.stroke !== undefined ? options.stroke : null;
- /**
- * @private
- * @type {import("./Text.js").default}
- */
- this.text_ = options.text !== undefined ? options.text : null;
- /**
- * @private
- * @type {number|undefined}
- */
- this.zIndex_ = options.zIndex;
- }
- /**
- * Clones the style.
- * @return {Style} The cloned style.
- * @api
- */
- Style.prototype.clone = function () {
- var geometry = this.getGeometry();
- if (geometry && typeof geometry === 'object') {
- geometry = /** @type {import("../geom/Geometry.js").default} */ (geometry).clone();
- }
- return new Style({
- geometry: geometry,
- fill: this.getFill() ? this.getFill().clone() : undefined,
- image: this.getImage() ? this.getImage().clone() : undefined,
- renderer: this.getRenderer(),
- stroke: this.getStroke() ? this.getStroke().clone() : undefined,
- text: this.getText() ? this.getText().clone() : undefined,
- zIndex: this.getZIndex(),
- });
- };
- /**
- * Get the custom renderer function that was configured with
- * {@link #setRenderer} or the `renderer` constructor option.
- * @return {RenderFunction|null} Custom renderer function.
- * @api
- */
- Style.prototype.getRenderer = function () {
- return this.renderer_;
- };
- /**
- * Sets a custom renderer function for this style. When set, `fill`, `stroke`
- * and `image` options of the style will be ignored.
- * @param {RenderFunction|null} renderer Custom renderer function.
- * @api
- */
- Style.prototype.setRenderer = function (renderer) {
- this.renderer_ = renderer;
- };
- /**
- * Sets a custom renderer function for this style used
- * in hit detection.
- * @param {RenderFunction|null} renderer Custom renderer function.
- * @api
- */
- Style.prototype.setHitDetectionRenderer = function (renderer) {
- this.hitDetectionRenderer_ = renderer;
- };
- /**
- * Get the custom renderer function that was configured with
- * {@link #setHitDetectionRenderer} or the `hitDetectionRenderer` constructor option.
- * @return {RenderFunction|null} Custom renderer function.
- * @api
- */
- Style.prototype.getHitDetectionRenderer = function () {
- return this.hitDetectionRenderer_;
- };
- /**
- * Get the geometry to be rendered.
- * @return {string|import("../geom/Geometry.js").default|GeometryFunction}
- * Feature property or geometry or function that returns the geometry that will
- * be rendered with this style.
- * @api
- */
- Style.prototype.getGeometry = function () {
- return this.geometry_;
- };
- /**
- * Get the function used to generate a geometry for rendering.
- * @return {!GeometryFunction} Function that is called with a feature
- * and returns the geometry to render instead of the feature's geometry.
- * @api
- */
- Style.prototype.getGeometryFunction = function () {
- return this.geometryFunction_;
- };
- /**
- * Get the fill style.
- * @return {import("./Fill.js").default} Fill style.
- * @api
- */
- Style.prototype.getFill = function () {
- return this.fill_;
- };
- /**
- * Set the fill style.
- * @param {import("./Fill.js").default} fill Fill style.
- * @api
- */
- Style.prototype.setFill = function (fill) {
- this.fill_ = fill;
- };
- /**
- * Get the image style.
- * @return {import("./Image.js").default} Image style.
- * @api
- */
- Style.prototype.getImage = function () {
- return this.image_;
- };
- /**
- * Set the image style.
- * @param {import("./Image.js").default} image Image style.
- * @api
- */
- Style.prototype.setImage = function (image) {
- this.image_ = image;
- };
- /**
- * Get the stroke style.
- * @return {import("./Stroke.js").default} Stroke style.
- * @api
- */
- Style.prototype.getStroke = function () {
- return this.stroke_;
- };
- /**
- * Set the stroke style.
- * @param {import("./Stroke.js").default} stroke Stroke style.
- * @api
- */
- Style.prototype.setStroke = function (stroke) {
- this.stroke_ = stroke;
- };
- /**
- * Get the text style.
- * @return {import("./Text.js").default} Text style.
- * @api
- */
- Style.prototype.getText = function () {
- return this.text_;
- };
- /**
- * Set the text style.
- * @param {import("./Text.js").default} text Text style.
- * @api
- */
- Style.prototype.setText = function (text) {
- this.text_ = text;
- };
- /**
- * Get the z-index for the style.
- * @return {number|undefined} ZIndex.
- * @api
- */
- Style.prototype.getZIndex = function () {
- return this.zIndex_;
- };
- /**
- * Set a geometry that is rendered instead of the feature's geometry.
- *
- * @param {string|import("../geom/Geometry.js").default|GeometryFunction} geometry
- * Feature property or geometry or function returning a geometry to render
- * for this style.
- * @api
- */
- Style.prototype.setGeometry = function (geometry) {
- if (typeof geometry === 'function') {
- this.geometryFunction_ = geometry;
- }
- else if (typeof geometry === 'string') {
- this.geometryFunction_ = function (feature) {
- return /** @type {import("../geom/Geometry.js").default} */ (feature.get(geometry));
- };
- }
- else if (!geometry) {
- this.geometryFunction_ = defaultGeometryFunction;
- }
- else if (geometry !== undefined) {
- this.geometryFunction_ = function () {
- return /** @type {import("../geom/Geometry.js").default} */ (geometry);
- };
- }
- this.geometry_ = geometry;
- };
- /**
- * Set the z-index.
- *
- * @param {number|undefined} zIndex ZIndex.
- * @api
- */
- Style.prototype.setZIndex = function (zIndex) {
- this.zIndex_ = zIndex;
- };
- return Style;
- }());
- /**
- * Convert the provided object into a style function. Functions passed through
- * unchanged. Arrays of Style or single style objects wrapped in a
- * new style function.
- * @param {StyleFunction|Array<Style>|Style} obj
- * A style function, a single style, or an array of styles.
- * @return {StyleFunction} A style function.
- */
- function toFunction(obj) {
- var styleFunction;
- if (typeof obj === 'function') {
- styleFunction = obj;
- }
- else {
- /**
- * @type {Array<Style>}
- */
- var styles_1;
- if (Array.isArray(obj)) {
- styles_1 = obj;
- }
- else {
- asserts_assert(typeof ( /** @type {?} */(obj).getZIndex) === 'function', 41); // Expected an `Style` or an array of `Style`
- var style = /** @type {Style} */ (obj);
- styles_1 = [style];
- }
- styleFunction = function () {
- return styles_1;
- };
- }
- return styleFunction;
- }
- /**
- * @type {Array<Style>|null}
- */
- var defaultStyles = null;
- /**
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {number} resolution Resolution.
- * @return {Array<Style>} Style.
- */
- function createDefaultStyle(feature, resolution) {
- // We don't use an immediately-invoked function
- // and a closure so we don't get an error at script evaluation time in
- // browsers that do not support Canvas. (import("./Circle.js").CircleStyle does
- // canvas.getContext('2d') at construction time, which will cause an.error
- // in such browsers.)
- if (!defaultStyles) {
- var fill = new style_Fill({
- color: 'rgba(255,255,255,0.4)',
- });
- var stroke = new style_Stroke({
- color: '#3399CC',
- width: 1.25,
- });
- defaultStyles = [
- new Style({
- image: new Circle({
- fill: fill,
- stroke: stroke,
- radius: 5,
- }),
- fill: fill,
- stroke: stroke,
- }),
- ];
- }
- return defaultStyles;
- }
- /**
- * Default styles for editing features.
- * @return {Object<import("../geom/Geometry.js").Type, Array<Style>>} Styles
- */
- function createEditingStyle() {
- /** @type {Object<import("../geom/Geometry.js").Type, Array<Style>>} */
- var styles = {};
- var white = [255, 255, 255, 1];
- var blue = [0, 153, 255, 1];
- var width = 3;
- styles['Polygon'] = [
- new Style({
- fill: new Fill({
- color: [255, 255, 255, 0.5],
- }),
- }),
- ];
- styles['MultiPolygon'] = styles['Polygon'];
- styles['LineString'] = [
- new Style({
- stroke: new Stroke({
- color: white,
- width: width + 2,
- }),
- }),
- new Style({
- stroke: new Stroke({
- color: blue,
- width: width,
- }),
- }),
- ];
- styles['MultiLineString'] = styles['LineString'];
- styles['Circle'] = styles['Polygon'].concat(styles['LineString']);
- styles['Point'] = [
- new Style({
- image: new CircleStyle({
- radius: width * 2,
- fill: new Fill({
- color: blue,
- }),
- stroke: new Stroke({
- color: white,
- width: width / 2,
- }),
- }),
- zIndex: Infinity,
- }),
- ];
- styles['MultiPoint'] = styles['Point'];
- styles['GeometryCollection'] = styles['Polygon'].concat(styles['LineString'], styles['Point']);
- return styles;
- }
- /**
- * Function that is called with a feature and returns its default geometry.
- * @param {import("../Feature.js").FeatureLike} feature Feature to get the geometry for.
- * @return {import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined} Geometry to render.
- */
- function defaultGeometryFunction(feature) {
- return feature.getGeometry();
- }
- /* harmony default export */ var style_Style = (Style);
- //# sourceMappingURL=Style.js.map
- ;// ./node_modules/ol/layer/BaseVector.js
- var BaseVector_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/layer/BaseVector
- */
- /**
- * @template {import("../source/Vector.js").default|import("../source/VectorTile.js").default} VectorSourceType
- * @typedef {Object} Options
- * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
- * @property {number} [opacity=1] Opacity (0, 1).
- * @property {boolean} [visible=true] Visibility.
- * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
- * rendered outside of this extent.
- * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
- * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
- * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
- * method was used.
- * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
- * visible.
- * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
- * be visible.
- * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
- * visible.
- * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
- * be visible.
- * @property {import("../render.js").OrderFunction} [renderOrder] Render order. Function to be used when sorting
- * features before rendering. By default features are drawn in the order that they are created. Use
- * `null` to avoid the sort, but get an undefined draw order.
- * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the
- * renderer when getting features from the vector source for the rendering or hit-detection.
- * Recommended value: the size of the largest symbol, line width or label.
- * @property {VectorSourceType} [source] Source.
- * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage
- * this layer in its layers collection, and the layer will be rendered on top. This is useful for
- * temporary layers. The standard way to add a layer to a map and have it managed by the map is to
- * use {@link import("../PluggableMap.js").default#addLayer map.addLayer()}.
- * @property {boolean} [declutter=false] Declutter images and text. Decluttering is applied to all
- * image and text styles of all Vector and VectorTile layers that have set this to `true`. The priority
- * is defined by the z-index of the layer, the `zIndex` of the style and the render order of features.
- * Higher z-index means higher priority. Within the same z-index, a feature rendered before another has
- * higher priority.
- *
- * As an optimization decluttered features from layers with the same `className` are rendered above
- * the fill and stroke styles of all of those layers regardless of z-index. To opt out of this
- * behavior and place declutterd features with their own layer configure the layer with a `className`
- * other than `ol-layer`.
- * @property {import("../style/Style.js").StyleLike|null} [style] Layer style. When set to `null`, only
- * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style
- * which will be used if this is not set.
- * @property {import("./Base.js").BackgroundColor} [background] Background color for the layer. If not specified, no background
- * will be rendered.
- * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will
- * be recreated during animations. This means that no vectors will be shown clipped, but the
- * setting will have a performance impact for large amounts of vector data. When set to `false`,
- * batches will be recreated when no animation is active.
- * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will
- * be recreated during interactions. See also `updateWhileAnimating`.
- * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
- */
- /**
- * @enum {string}
- * @private
- */
- var BaseVector_Property = {
- RENDER_ORDER: 'renderOrder',
- };
- /**
- * @classdesc
- * Vector data that is rendered client-side.
- * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
- * property on the layer object; for example, setting `title: 'My Title'` in the
- * options means that `title` is observable, and has get/set accessors.
- *
- * @template {import("../source/Vector.js").default|import("../source/VectorTile.js").default} VectorSourceType
- * @template {import("../renderer/canvas/VectorLayer.js").default|import("../renderer/canvas/VectorTileLayer.js").default|import("../renderer/canvas/VectorImageLayer.js").default|import("../renderer/webgl/PointsLayer.js").default} RendererType
- * @extends {Layer<VectorSourceType, RendererType>}
- * @api
- */
- var BaseVectorLayer = /** @class */ (function (_super) {
- BaseVector_extends(BaseVectorLayer, _super);
- /**
- * @param {Options<VectorSourceType>} [opt_options] Options.
- */
- function BaseVectorLayer(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- var baseOptions = obj_assign({}, options);
- delete baseOptions.style;
- delete baseOptions.renderBuffer;
- delete baseOptions.updateWhileAnimating;
- delete baseOptions.updateWhileInteracting;
- _this = _super.call(this, baseOptions) || this;
- /**
- * @private
- * @type {boolean}
- */
- _this.declutter_ =
- options.declutter !== undefined ? options.declutter : false;
- /**
- * @type {number}
- * @private
- */
- _this.renderBuffer_ =
- options.renderBuffer !== undefined ? options.renderBuffer : 100;
- /**
- * User provided style.
- * @type {import("../style/Style.js").StyleLike}
- * @private
- */
- _this.style_ = null;
- /**
- * Style function for use within the library.
- * @type {import("../style/Style.js").StyleFunction|undefined}
- * @private
- */
- _this.styleFunction_ = undefined;
- _this.setStyle(options.style);
- /**
- * @type {boolean}
- * @private
- */
- _this.updateWhileAnimating_ =
- options.updateWhileAnimating !== undefined
- ? options.updateWhileAnimating
- : false;
- /**
- * @type {boolean}
- * @private
- */
- _this.updateWhileInteracting_ =
- options.updateWhileInteracting !== undefined
- ? options.updateWhileInteracting
- : false;
- return _this;
- }
- /**
- * @return {boolean} Declutter.
- */
- BaseVectorLayer.prototype.getDeclutter = function () {
- return this.declutter_;
- };
- /**
- * Get the topmost feature that intersects the given pixel on the viewport. Returns a promise
- * that resolves with an array of features. The array will either contain the topmost feature
- * when a hit was detected, or it will be empty.
- *
- * The hit detection algorithm used for this method is optimized for performance, but is less
- * accurate than the one used in {@link import("../PluggableMap.js").default#getFeaturesAtPixel}: Text
- * is not considered, and icons are only represented by their bounding box instead of the exact
- * image.
- *
- * @param {import("../pixel.js").Pixel} pixel Pixel.
- * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with an array of features.
- * @api
- */
- BaseVectorLayer.prototype.getFeatures = function (pixel) {
- return _super.prototype.getFeatures.call(this, pixel);
- };
- /**
- * @return {number|undefined} Render buffer.
- */
- BaseVectorLayer.prototype.getRenderBuffer = function () {
- return this.renderBuffer_;
- };
- /**
- * @return {function(import("../Feature.js").default, import("../Feature.js").default): number|null|undefined} Render
- * order.
- */
- BaseVectorLayer.prototype.getRenderOrder = function () {
- return /** @type {import("../render.js").OrderFunction|null|undefined} */ (this.get(BaseVector_Property.RENDER_ORDER));
- };
- /**
- * Get the style for features. This returns whatever was passed to the `style`
- * option at construction or to the `setStyle` method.
- * @return {import("../style/Style.js").StyleLike|null|undefined} Layer style.
- * @api
- */
- BaseVectorLayer.prototype.getStyle = function () {
- return this.style_;
- };
- /**
- * Get the style function.
- * @return {import("../style/Style.js").StyleFunction|undefined} Layer style function.
- * @api
- */
- BaseVectorLayer.prototype.getStyleFunction = function () {
- return this.styleFunction_;
- };
- /**
- * @return {boolean} Whether the rendered layer should be updated while
- * animating.
- */
- BaseVectorLayer.prototype.getUpdateWhileAnimating = function () {
- return this.updateWhileAnimating_;
- };
- /**
- * @return {boolean} Whether the rendered layer should be updated while
- * interacting.
- */
- BaseVectorLayer.prototype.getUpdateWhileInteracting = function () {
- return this.updateWhileInteracting_;
- };
- /**
- * Render declutter items for this layer
- * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
- */
- BaseVectorLayer.prototype.renderDeclutter = function (frameState) {
- if (!frameState.declutterTree) {
- frameState.declutterTree = new rbush_min(9);
- }
- /** @type {*} */ (this.getRenderer()).renderDeclutter(frameState);
- };
- /**
- * @param {import("../render.js").OrderFunction|null|undefined} renderOrder
- * Render order.
- */
- BaseVectorLayer.prototype.setRenderOrder = function (renderOrder) {
- this.set(BaseVector_Property.RENDER_ORDER, renderOrder);
- };
- /**
- * Set the style for features. This can be a single style object, an array
- * of styles, or a function that takes a feature and resolution and returns
- * an array of styles. If set to `null`, the layer has no style (a `null` style),
- * so only features that have their own styles will be rendered in the layer. Call
- * `setStyle()` without arguments to reset to the default style. See
- * {@link module:ol/style/Style~Style} for information on the default style.
- * @param {import("../style/Style.js").StyleLike|null} [opt_style] Layer style.
- * @api
- */
- BaseVectorLayer.prototype.setStyle = function (opt_style) {
- this.style_ = opt_style !== undefined ? opt_style : createDefaultStyle;
- this.styleFunction_ =
- opt_style === null ? undefined : toFunction(this.style_);
- this.changed();
- };
- return BaseVectorLayer;
- }(layer_Layer));
- /* harmony default export */ var BaseVector = (BaseVectorLayer);
- //# sourceMappingURL=BaseVector.js.map
- ;// ./node_modules/ol/render/canvas/Instruction.js
- /**
- * @module ol/render/canvas/Instruction
- */
- /**
- * @enum {number}
- */
- var Instruction = {
- BEGIN_GEOMETRY: 0,
- BEGIN_PATH: 1,
- CIRCLE: 2,
- CLOSE_PATH: 3,
- CUSTOM: 4,
- DRAW_CHARS: 5,
- DRAW_IMAGE: 6,
- END_GEOMETRY: 7,
- FILL: 8,
- MOVE_TO_LINE_TO: 9,
- SET_FILL_STYLE: 10,
- SET_STROKE_STYLE: 11,
- STROKE: 12,
- };
- /**
- * @type {Array<Instruction>}
- */
- var fillInstruction = [Instruction.FILL];
- /**
- * @type {Array<Instruction>}
- */
- var strokeInstruction = [Instruction.STROKE];
- /**
- * @type {Array<Instruction>}
- */
- var beginPathInstruction = [Instruction.BEGIN_PATH];
- /**
- * @type {Array<Instruction>}
- */
- var closePathInstruction = [Instruction.CLOSE_PATH];
- /* harmony default export */ var canvas_Instruction = (Instruction);
- //# sourceMappingURL=Instruction.js.map
- ;// ./node_modules/ol/render/VectorContext.js
- /**
- * @module ol/render/VectorContext
- */
- /**
- * @classdesc
- * Context for drawing geometries. A vector context is available on render
- * events and does not need to be constructed directly.
- * @api
- */
- var VectorContext = /** @class */ (function () {
- function VectorContext() {
- }
- /**
- * Render a geometry with a custom renderer.
- *
- * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {Function} renderer Renderer.
- * @param {Function} hitDetectionRenderer Renderer.
- */
- VectorContext.prototype.drawCustom = function (geometry, feature, renderer, hitDetectionRenderer) { };
- /**
- * Render a geometry.
- *
- * @param {import("../geom/Geometry.js").default} geometry The geometry to render.
- */
- VectorContext.prototype.drawGeometry = function (geometry) { };
- /**
- * Set the rendering style.
- *
- * @param {import("../style/Style.js").default} style The rendering style.
- */
- VectorContext.prototype.setStyle = function (style) { };
- /**
- * @param {import("../geom/Circle.js").default} circleGeometry Circle geometry.
- * @param {import("../Feature.js").default} feature Feature.
- */
- VectorContext.prototype.drawCircle = function (circleGeometry, feature) { };
- /**
- * @param {import("../Feature.js").default} feature Feature.
- * @param {import("../style/Style.js").default} style Style.
- */
- VectorContext.prototype.drawFeature = function (feature, style) { };
- /**
- * @param {import("../geom/GeometryCollection.js").default} geometryCollectionGeometry Geometry collection.
- * @param {import("../Feature.js").default} feature Feature.
- */
- VectorContext.prototype.drawGeometryCollection = function (geometryCollectionGeometry, feature) { };
- /**
- * @param {import("../geom/LineString.js").default|import("./Feature.js").default} lineStringGeometry Line string geometry.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- */
- VectorContext.prototype.drawLineString = function (lineStringGeometry, feature) { };
- /**
- * @param {import("../geom/MultiLineString.js").default|import("./Feature.js").default} multiLineStringGeometry MultiLineString geometry.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- */
- VectorContext.prototype.drawMultiLineString = function (multiLineStringGeometry, feature) { };
- /**
- * @param {import("../geom/MultiPoint.js").default|import("./Feature.js").default} multiPointGeometry MultiPoint geometry.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- */
- VectorContext.prototype.drawMultiPoint = function (multiPointGeometry, feature) { };
- /**
- * @param {import("../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- */
- VectorContext.prototype.drawMultiPolygon = function (multiPolygonGeometry, feature) { };
- /**
- * @param {import("../geom/Point.js").default|import("./Feature.js").default} pointGeometry Point geometry.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- */
- VectorContext.prototype.drawPoint = function (pointGeometry, feature) { };
- /**
- * @param {import("../geom/Polygon.js").default|import("./Feature.js").default} polygonGeometry Polygon geometry.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- */
- VectorContext.prototype.drawPolygon = function (polygonGeometry, feature) { };
- /**
- * @param {import("../geom/SimpleGeometry.js").default|import("./Feature.js").default} geometry Geometry.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- */
- VectorContext.prototype.drawText = function (geometry, feature) { };
- /**
- * @param {import("../style/Fill.js").default} fillStyle Fill style.
- * @param {import("../style/Stroke.js").default} strokeStyle Stroke style.
- */
- VectorContext.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) { };
- /**
- * @param {import("../style/Image.js").default} imageStyle Image style.
- * @param {import("../render/canvas.js").DeclutterImageWithText} [opt_declutterImageWithText] Shared data for combined decluttering with a text style.
- */
- VectorContext.prototype.setImageStyle = function (imageStyle, opt_declutterImageWithText) { };
- /**
- * @param {import("../style/Text.js").default} textStyle Text style.
- * @param {import("../render/canvas.js").DeclutterImageWithText} [opt_declutterImageWithText] Shared data for combined decluttering with an image style.
- */
- VectorContext.prototype.setTextStyle = function (textStyle, opt_declutterImageWithText) { };
- return VectorContext;
- }());
- /* harmony default export */ var render_VectorContext = (VectorContext);
- //# sourceMappingURL=VectorContext.js.map
- ;// ./node_modules/ol/render/canvas/Builder.js
- var Builder_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/render/canvas/Builder
- */
- var CanvasBuilder = /** @class */ (function (_super) {
- Builder_extends(CanvasBuilder, _super);
- /**
- * @param {number} tolerance Tolerance.
- * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- */
- function CanvasBuilder(tolerance, maxExtent, resolution, pixelRatio) {
- var _this = _super.call(this) || this;
- /**
- * @protected
- * @type {number}
- */
- _this.tolerance = tolerance;
- /**
- * @protected
- * @const
- * @type {import("../../extent.js").Extent}
- */
- _this.maxExtent = maxExtent;
- /**
- * @protected
- * @type {number}
- */
- _this.pixelRatio = pixelRatio;
- /**
- * @protected
- * @type {number}
- */
- _this.maxLineWidth = 0;
- /**
- * @protected
- * @const
- * @type {number}
- */
- _this.resolution = resolution;
- /**
- * @private
- * @type {Array<*>}
- */
- _this.beginGeometryInstruction1_ = null;
- /**
- * @private
- * @type {Array<*>}
- */
- _this.beginGeometryInstruction2_ = null;
- /**
- * @private
- * @type {import("../../extent.js").Extent}
- */
- _this.bufferedMaxExtent_ = null;
- /**
- * @protected
- * @type {Array<*>}
- */
- _this.instructions = [];
- /**
- * @protected
- * @type {Array<number>}
- */
- _this.coordinates = [];
- /**
- * @private
- * @type {import("../../coordinate.js").Coordinate}
- */
- _this.tmpCoordinate_ = [];
- /**
- * @protected
- * @type {Array<*>}
- */
- _this.hitDetectionInstructions = [];
- /**
- * @protected
- * @type {import("../canvas.js").FillStrokeState}
- */
- _this.state = /** @type {import("../canvas.js").FillStrokeState} */ ({});
- return _this;
- }
- /**
- * @protected
- * @param {Array<number>} dashArray Dash array.
- * @return {Array<number>} Dash array with pixel ratio applied
- */
- CanvasBuilder.prototype.applyPixelRatio = function (dashArray) {
- var pixelRatio = this.pixelRatio;
- return pixelRatio == 1
- ? dashArray
- : dashArray.map(function (dash) {
- return dash * pixelRatio;
- });
- };
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} stride Stride.
- * @protected
- * @return {number} My end
- */
- CanvasBuilder.prototype.appendFlatPointCoordinates = function (flatCoordinates, stride) {
- var extent = this.getBufferedMaxExtent();
- var tmpCoord = this.tmpCoordinate_;
- var coordinates = this.coordinates;
- var myEnd = coordinates.length;
- for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
- tmpCoord[0] = flatCoordinates[i];
- tmpCoord[1] = flatCoordinates[i + 1];
- if (containsCoordinate(extent, tmpCoord)) {
- coordinates[myEnd++] = tmpCoord[0];
- coordinates[myEnd++] = tmpCoord[1];
- }
- }
- return myEnd;
- };
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {boolean} closed Last input coordinate equals first.
- * @param {boolean} skipFirst Skip first coordinate.
- * @protected
- * @return {number} My end.
- */
- CanvasBuilder.prototype.appendFlatLineCoordinates = function (flatCoordinates, offset, end, stride, closed, skipFirst) {
- var coordinates = this.coordinates;
- var myEnd = coordinates.length;
- var extent = this.getBufferedMaxExtent();
- if (skipFirst) {
- offset += stride;
- }
- var lastXCoord = flatCoordinates[offset];
- var lastYCoord = flatCoordinates[offset + 1];
- var nextCoord = this.tmpCoordinate_;
- var skipped = true;
- var i, lastRel, nextRel;
- for (i = offset + stride; i < end; i += stride) {
- nextCoord[0] = flatCoordinates[i];
- nextCoord[1] = flatCoordinates[i + 1];
- nextRel = coordinateRelationship(extent, nextCoord);
- if (nextRel !== lastRel) {
- if (skipped) {
- coordinates[myEnd++] = lastXCoord;
- coordinates[myEnd++] = lastYCoord;
- skipped = false;
- }
- coordinates[myEnd++] = nextCoord[0];
- coordinates[myEnd++] = nextCoord[1];
- }
- else if (nextRel === Relationship.INTERSECTING) {
- coordinates[myEnd++] = nextCoord[0];
- coordinates[myEnd++] = nextCoord[1];
- skipped = false;
- }
- else {
- skipped = true;
- }
- lastXCoord = nextCoord[0];
- lastYCoord = nextCoord[1];
- lastRel = nextRel;
- }
- // Last coordinate equals first or only one point to append:
- if ((closed && skipped) || i === offset + stride) {
- coordinates[myEnd++] = lastXCoord;
- coordinates[myEnd++] = lastYCoord;
- }
- return myEnd;
- };
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @param {Array<number>} builderEnds Builder ends.
- * @return {number} Offset.
- */
- CanvasBuilder.prototype.drawCustomCoordinates_ = function (flatCoordinates, offset, ends, stride, builderEnds) {
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- var end = ends[i];
- var builderEnd = this.appendFlatLineCoordinates(flatCoordinates, offset, end, stride, false, false);
- builderEnds.push(builderEnd);
- offset = end;
- }
- return offset;
- };
- /**
- * @param {import("../../geom/SimpleGeometry.js").default} geometry Geometry.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- * @param {Function} renderer Renderer.
- * @param {Function} hitDetectionRenderer Renderer.
- */
- CanvasBuilder.prototype.drawCustom = function (geometry, feature, renderer, hitDetectionRenderer) {
- this.beginGeometry(geometry, feature);
- var type = geometry.getType();
- var stride = geometry.getStride();
- var builderBegin = this.coordinates.length;
- var flatCoordinates, builderEnd, builderEnds, builderEndss;
- var offset;
- switch (type) {
- case 'MultiPolygon':
- flatCoordinates =
- /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getOrientedFlatCoordinates();
- builderEndss = [];
- var endss =
- /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss();
- offset = 0;
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var myEnds = [];
- offset = this.drawCustomCoordinates_(flatCoordinates, offset, endss[i], stride, myEnds);
- builderEndss.push(myEnds);
- }
- this.instructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEndss,
- geometry,
- renderer,
- inflateMultiCoordinatesArray,
- ]);
- this.hitDetectionInstructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEndss,
- geometry,
- hitDetectionRenderer || renderer,
- inflateMultiCoordinatesArray,
- ]);
- break;
- case 'Polygon':
- case 'MultiLineString':
- builderEnds = [];
- flatCoordinates =
- type == 'Polygon'
- ? /** @type {import("../../geom/Polygon.js").default} */ (geometry).getOrientedFlatCoordinates()
- : geometry.getFlatCoordinates();
- offset = this.drawCustomCoordinates_(flatCoordinates, 0,
- /** @type {import("../../geom/Polygon.js").default|import("../../geom/MultiLineString.js").default} */ (geometry).getEnds(), stride, builderEnds);
- this.instructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEnds,
- geometry,
- renderer,
- inflateCoordinatesArray,
- ]);
- this.hitDetectionInstructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEnds,
- geometry,
- hitDetectionRenderer || renderer,
- inflateCoordinatesArray,
- ]);
- break;
- case 'LineString':
- case 'Circle':
- flatCoordinates = geometry.getFlatCoordinates();
- builderEnd = this.appendFlatLineCoordinates(flatCoordinates, 0, flatCoordinates.length, stride, false, false);
- this.instructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEnd,
- geometry,
- renderer,
- inflateCoordinates,
- ]);
- this.hitDetectionInstructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEnd,
- geometry,
- hitDetectionRenderer || renderer,
- inflateCoordinates,
- ]);
- break;
- case 'MultiPoint':
- flatCoordinates = geometry.getFlatCoordinates();
- builderEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);
- if (builderEnd > builderBegin) {
- this.instructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEnd,
- geometry,
- renderer,
- inflateCoordinates,
- ]);
- this.hitDetectionInstructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEnd,
- geometry,
- hitDetectionRenderer || renderer,
- inflateCoordinates,
- ]);
- }
- break;
- case 'Point':
- flatCoordinates = geometry.getFlatCoordinates();
- this.coordinates.push(flatCoordinates[0], flatCoordinates[1]);
- builderEnd = this.coordinates.length;
- this.instructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEnd,
- geometry,
- renderer,
- ]);
- this.hitDetectionInstructions.push([
- canvas_Instruction.CUSTOM,
- builderBegin,
- builderEnd,
- geometry,
- hitDetectionRenderer || renderer,
- ]);
- break;
- default:
- }
- this.endGeometry(feature);
- };
- /**
- * @protected
- * @param {import("../../geom/Geometry").default|import("../Feature.js").default} geometry The geometry.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- */
- CanvasBuilder.prototype.beginGeometry = function (geometry, feature) {
- this.beginGeometryInstruction1_ = [
- canvas_Instruction.BEGIN_GEOMETRY,
- feature,
- 0,
- geometry,
- ];
- this.instructions.push(this.beginGeometryInstruction1_);
- this.beginGeometryInstruction2_ = [
- canvas_Instruction.BEGIN_GEOMETRY,
- feature,
- 0,
- geometry,
- ];
- this.hitDetectionInstructions.push(this.beginGeometryInstruction2_);
- };
- /**
- * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
- */
- CanvasBuilder.prototype.finish = function () {
- return {
- instructions: this.instructions,
- hitDetectionInstructions: this.hitDetectionInstructions,
- coordinates: this.coordinates,
- };
- };
- /**
- * Reverse the hit detection instructions.
- */
- CanvasBuilder.prototype.reverseHitDetectionInstructions = function () {
- var hitDetectionInstructions = this.hitDetectionInstructions;
- // step 1 - reverse array
- hitDetectionInstructions.reverse();
- // step 2 - reverse instructions within geometry blocks
- var i;
- var n = hitDetectionInstructions.length;
- var instruction;
- var type;
- var begin = -1;
- for (i = 0; i < n; ++i) {
- instruction = hitDetectionInstructions[i];
- type = /** @type {import("./Instruction.js").default} */ (instruction[0]);
- if (type == canvas_Instruction.END_GEOMETRY) {
- begin = i;
- }
- else if (type == canvas_Instruction.BEGIN_GEOMETRY) {
- instruction[2] = i;
- reverseSubArray(this.hitDetectionInstructions, begin, i);
- begin = -1;
- }
- }
- };
- /**
- * @param {import("../../style/Fill.js").default} fillStyle Fill style.
- * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
- */
- CanvasBuilder.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) {
- var state = this.state;
- if (fillStyle) {
- var fillStyleColor = fillStyle.getColor();
- state.fillStyle = asColorLike(fillStyleColor ? fillStyleColor : defaultFillStyle);
- }
- else {
- state.fillStyle = undefined;
- }
- if (strokeStyle) {
- var strokeStyleColor = strokeStyle.getColor();
- state.strokeStyle = asColorLike(strokeStyleColor ? strokeStyleColor : defaultStrokeStyle);
- var strokeStyleLineCap = strokeStyle.getLineCap();
- state.lineCap =
- strokeStyleLineCap !== undefined ? strokeStyleLineCap : defaultLineCap;
- var strokeStyleLineDash = strokeStyle.getLineDash();
- state.lineDash = strokeStyleLineDash
- ? strokeStyleLineDash.slice()
- : defaultLineDash;
- var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
- state.lineDashOffset = strokeStyleLineDashOffset
- ? strokeStyleLineDashOffset
- : defaultLineDashOffset;
- var strokeStyleLineJoin = strokeStyle.getLineJoin();
- state.lineJoin =
- strokeStyleLineJoin !== undefined
- ? strokeStyleLineJoin
- : defaultLineJoin;
- var strokeStyleWidth = strokeStyle.getWidth();
- state.lineWidth =
- strokeStyleWidth !== undefined ? strokeStyleWidth : defaultLineWidth;
- var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
- state.miterLimit =
- strokeStyleMiterLimit !== undefined
- ? strokeStyleMiterLimit
- : defaultMiterLimit;
- if (state.lineWidth > this.maxLineWidth) {
- this.maxLineWidth = state.lineWidth;
- // invalidate the buffered max extent cache
- this.bufferedMaxExtent_ = null;
- }
- }
- else {
- state.strokeStyle = undefined;
- state.lineCap = undefined;
- state.lineDash = null;
- state.lineDashOffset = undefined;
- state.lineJoin = undefined;
- state.lineWidth = undefined;
- state.miterLimit = undefined;
- }
- };
- /**
- * @param {import("../canvas.js").FillStrokeState} state State.
- * @return {Array<*>} Fill instruction.
- */
- CanvasBuilder.prototype.createFill = function (state) {
- var fillStyle = state.fillStyle;
- /** @type {Array<*>} */
- var fillInstruction = [canvas_Instruction.SET_FILL_STYLE, fillStyle];
- if (typeof fillStyle !== 'string') {
- // Fill is a pattern or gradient - align it!
- fillInstruction.push(true);
- }
- return fillInstruction;
- };
- /**
- * @param {import("../canvas.js").FillStrokeState} state State.
- */
- CanvasBuilder.prototype.applyStroke = function (state) {
- this.instructions.push(this.createStroke(state));
- };
- /**
- * @param {import("../canvas.js").FillStrokeState} state State.
- * @return {Array<*>} Stroke instruction.
- */
- CanvasBuilder.prototype.createStroke = function (state) {
- return [
- canvas_Instruction.SET_STROKE_STYLE,
- state.strokeStyle,
- state.lineWidth * this.pixelRatio,
- state.lineCap,
- state.lineJoin,
- state.miterLimit,
- this.applyPixelRatio(state.lineDash),
- state.lineDashOffset * this.pixelRatio,
- ];
- };
- /**
- * @param {import("../canvas.js").FillStrokeState} state State.
- * @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState):Array<*>} createFill Create fill.
- */
- CanvasBuilder.prototype.updateFillStyle = function (state, createFill) {
- var fillStyle = state.fillStyle;
- if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) {
- if (fillStyle !== undefined) {
- this.instructions.push(createFill.call(this, state));
- }
- state.currentFillStyle = fillStyle;
- }
- };
- /**
- * @param {import("../canvas.js").FillStrokeState} state State.
- * @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState): void} applyStroke Apply stroke.
- */
- CanvasBuilder.prototype.updateStrokeStyle = function (state, applyStroke) {
- var strokeStyle = state.strokeStyle;
- var lineCap = state.lineCap;
- var lineDash = state.lineDash;
- var lineDashOffset = state.lineDashOffset;
- var lineJoin = state.lineJoin;
- var lineWidth = state.lineWidth;
- var miterLimit = state.miterLimit;
- if (state.currentStrokeStyle != strokeStyle ||
- state.currentLineCap != lineCap ||
- (lineDash != state.currentLineDash &&
- !equals(state.currentLineDash, lineDash)) ||
- state.currentLineDashOffset != lineDashOffset ||
- state.currentLineJoin != lineJoin ||
- state.currentLineWidth != lineWidth ||
- state.currentMiterLimit != miterLimit) {
- if (strokeStyle !== undefined) {
- applyStroke.call(this, state);
- }
- state.currentStrokeStyle = strokeStyle;
- state.currentLineCap = lineCap;
- state.currentLineDash = lineDash;
- state.currentLineDashOffset = lineDashOffset;
- state.currentLineJoin = lineJoin;
- state.currentLineWidth = lineWidth;
- state.currentMiterLimit = miterLimit;
- }
- };
- /**
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- */
- CanvasBuilder.prototype.endGeometry = function (feature) {
- this.beginGeometryInstruction1_[2] = this.instructions.length;
- this.beginGeometryInstruction1_ = null;
- this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;
- this.beginGeometryInstruction2_ = null;
- var endGeometryInstruction = [canvas_Instruction.END_GEOMETRY, feature];
- this.instructions.push(endGeometryInstruction);
- this.hitDetectionInstructions.push(endGeometryInstruction);
- };
- /**
- * Get the buffered rendering extent. Rendering will be clipped to the extent
- * provided to the constructor. To account for symbolizers that may intersect
- * this extent, we calculate a buffered extent (e.g. based on stroke width).
- * @return {import("../../extent.js").Extent} The buffered rendering extent.
- * @protected
- */
- CanvasBuilder.prototype.getBufferedMaxExtent = function () {
- if (!this.bufferedMaxExtent_) {
- this.bufferedMaxExtent_ = clone(this.maxExtent);
- if (this.maxLineWidth > 0) {
- var width = (this.resolution * (this.maxLineWidth + 1)) / 2;
- buffer(this.bufferedMaxExtent_, width, this.bufferedMaxExtent_);
- }
- }
- return this.bufferedMaxExtent_;
- };
- return CanvasBuilder;
- }(render_VectorContext));
- /* harmony default export */ var Builder = (CanvasBuilder);
- //# sourceMappingURL=Builder.js.map
- ;// ./node_modules/ol/render/canvas/ImageBuilder.js
- var ImageBuilder_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/render/canvas/ImageBuilder
- */
- var CanvasImageBuilder = /** @class */ (function (_super) {
- ImageBuilder_extends(CanvasImageBuilder, _super);
- /**
- * @param {number} tolerance Tolerance.
- * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- */
- function CanvasImageBuilder(tolerance, maxExtent, resolution, pixelRatio) {
- var _this = _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
- /**
- * @private
- * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
- */
- _this.hitDetectionImage_ = null;
- /**
- * @private
- * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
- */
- _this.image_ = null;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.imagePixelRatio_ = undefined;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.anchorX_ = undefined;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.anchorY_ = undefined;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.height_ = undefined;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.opacity_ = undefined;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.originX_ = undefined;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.originY_ = undefined;
- /**
- * @private
- * @type {boolean|undefined}
- */
- _this.rotateWithView_ = undefined;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.rotation_ = undefined;
- /**
- * @private
- * @type {import("../../size.js").Size|undefined}
- */
- _this.scale_ = undefined;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.width_ = undefined;
- /**
- * @private
- * @type {"declutter"|"obstacle"|"none"|undefined}
- */
- _this.declutterMode_ = undefined;
- /**
- * Data shared with a text builder for combined decluttering.
- * @private
- * @type {import("../canvas.js").DeclutterImageWithText}
- */
- _this.declutterImageWithText_ = undefined;
- return _this;
- }
- /**
- * @param {import("../../geom/Point.js").default|import("../Feature.js").default} pointGeometry Point geometry.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- */
- CanvasImageBuilder.prototype.drawPoint = function (pointGeometry, feature) {
- if (!this.image_) {
- return;
- }
- this.beginGeometry(pointGeometry, feature);
- var flatCoordinates = pointGeometry.getFlatCoordinates();
- var stride = pointGeometry.getStride();
- var myBegin = this.coordinates.length;
- var myEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);
- this.instructions.push([
- canvas_Instruction.DRAW_IMAGE,
- myBegin,
- myEnd,
- this.image_,
- // Remaining arguments to DRAW_IMAGE are in alphabetical order
- this.anchorX_ * this.imagePixelRatio_,
- this.anchorY_ * this.imagePixelRatio_,
- Math.ceil(this.height_ * this.imagePixelRatio_),
- this.opacity_,
- this.originX_ * this.imagePixelRatio_,
- this.originY_ * this.imagePixelRatio_,
- this.rotateWithView_,
- this.rotation_,
- [
- (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,
- (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,
- ],
- Math.ceil(this.width_ * this.imagePixelRatio_),
- this.declutterMode_,
- this.declutterImageWithText_,
- ]);
- this.hitDetectionInstructions.push([
- canvas_Instruction.DRAW_IMAGE,
- myBegin,
- myEnd,
- this.hitDetectionImage_,
- // Remaining arguments to DRAW_IMAGE are in alphabetical order
- this.anchorX_,
- this.anchorY_,
- this.height_,
- this.opacity_,
- this.originX_,
- this.originY_,
- this.rotateWithView_,
- this.rotation_,
- this.scale_,
- this.width_,
- this.declutterMode_,
- this.declutterImageWithText_,
- ]);
- this.endGeometry(feature);
- };
- /**
- * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} multiPointGeometry MultiPoint geometry.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- */
- CanvasImageBuilder.prototype.drawMultiPoint = function (multiPointGeometry, feature) {
- if (!this.image_) {
- return;
- }
- this.beginGeometry(multiPointGeometry, feature);
- var flatCoordinates = multiPointGeometry.getFlatCoordinates();
- var stride = multiPointGeometry.getStride();
- var myBegin = this.coordinates.length;
- var myEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);
- this.instructions.push([
- canvas_Instruction.DRAW_IMAGE,
- myBegin,
- myEnd,
- this.image_,
- // Remaining arguments to DRAW_IMAGE are in alphabetical order
- this.anchorX_ * this.imagePixelRatio_,
- this.anchorY_ * this.imagePixelRatio_,
- Math.ceil(this.height_ * this.imagePixelRatio_),
- this.opacity_,
- this.originX_ * this.imagePixelRatio_,
- this.originY_ * this.imagePixelRatio_,
- this.rotateWithView_,
- this.rotation_,
- [
- (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,
- (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,
- ],
- Math.ceil(this.width_ * this.imagePixelRatio_),
- this.declutterMode_,
- this.declutterImageWithText_,
- ]);
- this.hitDetectionInstructions.push([
- canvas_Instruction.DRAW_IMAGE,
- myBegin,
- myEnd,
- this.hitDetectionImage_,
- // Remaining arguments to DRAW_IMAGE are in alphabetical order
- this.anchorX_,
- this.anchorY_,
- this.height_,
- this.opacity_,
- this.originX_,
- this.originY_,
- this.rotateWithView_,
- this.rotation_,
- this.scale_,
- this.width_,
- this.declutterMode_,
- this.declutterImageWithText_,
- ]);
- this.endGeometry(feature);
- };
- /**
- * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
- */
- CanvasImageBuilder.prototype.finish = function () {
- this.reverseHitDetectionInstructions();
- // FIXME this doesn't really protect us against further calls to draw*Geometry
- this.anchorX_ = undefined;
- this.anchorY_ = undefined;
- this.hitDetectionImage_ = null;
- this.image_ = null;
- this.imagePixelRatio_ = undefined;
- this.height_ = undefined;
- this.scale_ = undefined;
- this.opacity_ = undefined;
- this.originX_ = undefined;
- this.originY_ = undefined;
- this.rotateWithView_ = undefined;
- this.rotation_ = undefined;
- this.width_ = undefined;
- return _super.prototype.finish.call(this);
- };
- /**
- * @param {import("../../style/Image.js").default} imageStyle Image style.
- * @param {Object} [opt_sharedData] Shared data.
- */
- CanvasImageBuilder.prototype.setImageStyle = function (imageStyle, opt_sharedData) {
- var anchor = imageStyle.getAnchor();
- var size = imageStyle.getSize();
- var origin = imageStyle.getOrigin();
- this.imagePixelRatio_ = imageStyle.getPixelRatio(this.pixelRatio);
- this.anchorX_ = anchor[0];
- this.anchorY_ = anchor[1];
- this.hitDetectionImage_ = imageStyle.getHitDetectionImage();
- this.image_ = imageStyle.getImage(this.pixelRatio);
- this.height_ = size[1];
- this.opacity_ = imageStyle.getOpacity();
- this.originX_ = origin[0];
- this.originY_ = origin[1];
- this.rotateWithView_ = imageStyle.getRotateWithView();
- this.rotation_ = imageStyle.getRotation();
- this.scale_ = imageStyle.getScaleArray();
- this.width_ = size[0];
- this.declutterMode_ = imageStyle.getDeclutterMode();
- this.declutterImageWithText_ = opt_sharedData;
- };
- return CanvasImageBuilder;
- }(Builder));
- /* harmony default export */ var ImageBuilder = (CanvasImageBuilder);
- //# sourceMappingURL=ImageBuilder.js.map
- ;// ./node_modules/ol/render/canvas/LineStringBuilder.js
- var LineStringBuilder_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/render/canvas/LineStringBuilder
- */
- var CanvasLineStringBuilder = /** @class */ (function (_super) {
- LineStringBuilder_extends(CanvasLineStringBuilder, _super);
- /**
- * @param {number} tolerance Tolerance.
- * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- */
- function CanvasLineStringBuilder(tolerance, maxExtent, resolution, pixelRatio) {
- return _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @private
- * @return {number} end.
- */
- CanvasLineStringBuilder.prototype.drawFlatCoordinates_ = function (flatCoordinates, offset, end, stride) {
- var myBegin = this.coordinates.length;
- var myEnd = this.appendFlatLineCoordinates(flatCoordinates, offset, end, stride, false, false);
- var moveToLineToInstruction = [
- canvas_Instruction.MOVE_TO_LINE_TO,
- myBegin,
- myEnd,
- ];
- this.instructions.push(moveToLineToInstruction);
- this.hitDetectionInstructions.push(moveToLineToInstruction);
- return end;
- };
- /**
- * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} lineStringGeometry Line string geometry.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- */
- CanvasLineStringBuilder.prototype.drawLineString = function (lineStringGeometry, feature) {
- var state = this.state;
- var strokeStyle = state.strokeStyle;
- var lineWidth = state.lineWidth;
- if (strokeStyle === undefined || lineWidth === undefined) {
- return;
- }
- this.updateStrokeStyle(state, this.applyStroke);
- this.beginGeometry(lineStringGeometry, feature);
- this.hitDetectionInstructions.push([
- canvas_Instruction.SET_STROKE_STYLE,
- state.strokeStyle,
- state.lineWidth,
- state.lineCap,
- state.lineJoin,
- state.miterLimit,
- defaultLineDash,
- defaultLineDashOffset,
- ], beginPathInstruction);
- var flatCoordinates = lineStringGeometry.getFlatCoordinates();
- var stride = lineStringGeometry.getStride();
- this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride);
- this.hitDetectionInstructions.push(strokeInstruction);
- this.endGeometry(feature);
- };
- /**
- * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} multiLineStringGeometry MultiLineString geometry.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- */
- CanvasLineStringBuilder.prototype.drawMultiLineString = function (multiLineStringGeometry, feature) {
- var state = this.state;
- var strokeStyle = state.strokeStyle;
- var lineWidth = state.lineWidth;
- if (strokeStyle === undefined || lineWidth === undefined) {
- return;
- }
- this.updateStrokeStyle(state, this.applyStroke);
- this.beginGeometry(multiLineStringGeometry, feature);
- this.hitDetectionInstructions.push([
- canvas_Instruction.SET_STROKE_STYLE,
- state.strokeStyle,
- state.lineWidth,
- state.lineCap,
- state.lineJoin,
- state.miterLimit,
- state.lineDash,
- state.lineDashOffset,
- ], beginPathInstruction);
- var ends = multiLineStringGeometry.getEnds();
- var flatCoordinates = multiLineStringGeometry.getFlatCoordinates();
- var stride = multiLineStringGeometry.getStride();
- var offset = 0;
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- offset = this.drawFlatCoordinates_(flatCoordinates, offset,
- /** @type {number} */ (ends[i]), stride);
- }
- this.hitDetectionInstructions.push(strokeInstruction);
- this.endGeometry(feature);
- };
- /**
- * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
- */
- CanvasLineStringBuilder.prototype.finish = function () {
- var state = this.state;
- if (state.lastStroke != undefined &&
- state.lastStroke != this.coordinates.length) {
- this.instructions.push(strokeInstruction);
- }
- this.reverseHitDetectionInstructions();
- this.state = null;
- return _super.prototype.finish.call(this);
- };
- /**
- * @param {import("../canvas.js").FillStrokeState} state State.
- */
- CanvasLineStringBuilder.prototype.applyStroke = function (state) {
- if (state.lastStroke != undefined &&
- state.lastStroke != this.coordinates.length) {
- this.instructions.push(strokeInstruction);
- state.lastStroke = this.coordinates.length;
- }
- state.lastStroke = 0;
- _super.prototype.applyStroke.call(this, state);
- this.instructions.push(beginPathInstruction);
- };
- return CanvasLineStringBuilder;
- }(Builder));
- /* harmony default export */ var LineStringBuilder = (CanvasLineStringBuilder);
- //# sourceMappingURL=LineStringBuilder.js.map
- ;// ./node_modules/ol/render/canvas/PolygonBuilder.js
- var PolygonBuilder_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/render/canvas/PolygonBuilder
- */
- var CanvasPolygonBuilder = /** @class */ (function (_super) {
- PolygonBuilder_extends(CanvasPolygonBuilder, _super);
- /**
- * @param {number} tolerance Tolerance.
- * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- */
- function CanvasPolygonBuilder(tolerance, maxExtent, resolution, pixelRatio) {
- return _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @private
- * @return {number} End.
- */
- CanvasPolygonBuilder.prototype.drawFlatCoordinatess_ = function (flatCoordinates, offset, ends, stride) {
- var state = this.state;
- var fill = state.fillStyle !== undefined;
- var stroke = state.strokeStyle !== undefined;
- var numEnds = ends.length;
- this.instructions.push(beginPathInstruction);
- this.hitDetectionInstructions.push(beginPathInstruction);
- for (var i = 0; i < numEnds; ++i) {
- var end = ends[i];
- var myBegin = this.coordinates.length;
- var myEnd = this.appendFlatLineCoordinates(flatCoordinates, offset, end, stride, true, !stroke);
- var moveToLineToInstruction = [
- canvas_Instruction.MOVE_TO_LINE_TO,
- myBegin,
- myEnd,
- ];
- this.instructions.push(moveToLineToInstruction);
- this.hitDetectionInstructions.push(moveToLineToInstruction);
- if (stroke) {
- // Performance optimization: only call closePath() when we have a stroke.
- // Otherwise the ring is closed already (see appendFlatLineCoordinates above).
- this.instructions.push(closePathInstruction);
- this.hitDetectionInstructions.push(closePathInstruction);
- }
- offset = end;
- }
- if (fill) {
- this.instructions.push(fillInstruction);
- this.hitDetectionInstructions.push(fillInstruction);
- }
- if (stroke) {
- this.instructions.push(strokeInstruction);
- this.hitDetectionInstructions.push(strokeInstruction);
- }
- return offset;
- };
- /**
- * @param {import("../../geom/Circle.js").default} circleGeometry Circle geometry.
- * @param {import("../../Feature.js").default} feature Feature.
- */
- CanvasPolygonBuilder.prototype.drawCircle = function (circleGeometry, feature) {
- var state = this.state;
- var fillStyle = state.fillStyle;
- var strokeStyle = state.strokeStyle;
- if (fillStyle === undefined && strokeStyle === undefined) {
- return;
- }
- this.setFillStrokeStyles_();
- this.beginGeometry(circleGeometry, feature);
- if (state.fillStyle !== undefined) {
- this.hitDetectionInstructions.push([
- canvas_Instruction.SET_FILL_STYLE,
- defaultFillStyle,
- ]);
- }
- if (state.strokeStyle !== undefined) {
- this.hitDetectionInstructions.push([
- canvas_Instruction.SET_STROKE_STYLE,
- state.strokeStyle,
- state.lineWidth,
- state.lineCap,
- state.lineJoin,
- state.miterLimit,
- state.lineDash,
- state.lineDashOffset,
- ]);
- }
- var flatCoordinates = circleGeometry.getFlatCoordinates();
- var stride = circleGeometry.getStride();
- var myBegin = this.coordinates.length;
- this.appendFlatLineCoordinates(flatCoordinates, 0, flatCoordinates.length, stride, false, false);
- var circleInstruction = [canvas_Instruction.CIRCLE, myBegin];
- this.instructions.push(beginPathInstruction, circleInstruction);
- this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction);
- if (state.fillStyle !== undefined) {
- this.instructions.push(fillInstruction);
- this.hitDetectionInstructions.push(fillInstruction);
- }
- if (state.strokeStyle !== undefined) {
- this.instructions.push(strokeInstruction);
- this.hitDetectionInstructions.push(strokeInstruction);
- }
- this.endGeometry(feature);
- };
- /**
- * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} polygonGeometry Polygon geometry.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- */
- CanvasPolygonBuilder.prototype.drawPolygon = function (polygonGeometry, feature) {
- var state = this.state;
- var fillStyle = state.fillStyle;
- var strokeStyle = state.strokeStyle;
- if (fillStyle === undefined && strokeStyle === undefined) {
- return;
- }
- this.setFillStrokeStyles_();
- this.beginGeometry(polygonGeometry, feature);
- if (state.fillStyle !== undefined) {
- this.hitDetectionInstructions.push([
- canvas_Instruction.SET_FILL_STYLE,
- defaultFillStyle,
- ]);
- }
- if (state.strokeStyle !== undefined) {
- this.hitDetectionInstructions.push([
- canvas_Instruction.SET_STROKE_STYLE,
- state.strokeStyle,
- state.lineWidth,
- state.lineCap,
- state.lineJoin,
- state.miterLimit,
- state.lineDash,
- state.lineDashOffset,
- ]);
- }
- var ends = polygonGeometry.getEnds();
- var flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
- var stride = polygonGeometry.getStride();
- this.drawFlatCoordinatess_(flatCoordinates, 0,
- /** @type {Array<number>} */ (ends), stride);
- this.endGeometry(feature);
- };
- /**
- * @param {import("../../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- */
- CanvasPolygonBuilder.prototype.drawMultiPolygon = function (multiPolygonGeometry, feature) {
- var state = this.state;
- var fillStyle = state.fillStyle;
- var strokeStyle = state.strokeStyle;
- if (fillStyle === undefined && strokeStyle === undefined) {
- return;
- }
- this.setFillStrokeStyles_();
- this.beginGeometry(multiPolygonGeometry, feature);
- if (state.fillStyle !== undefined) {
- this.hitDetectionInstructions.push([
- canvas_Instruction.SET_FILL_STYLE,
- defaultFillStyle,
- ]);
- }
- if (state.strokeStyle !== undefined) {
- this.hitDetectionInstructions.push([
- canvas_Instruction.SET_STROKE_STYLE,
- state.strokeStyle,
- state.lineWidth,
- state.lineCap,
- state.lineJoin,
- state.miterLimit,
- state.lineDash,
- state.lineDashOffset,
- ]);
- }
- var endss = multiPolygonGeometry.getEndss();
- var flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates();
- var stride = multiPolygonGeometry.getStride();
- var offset = 0;
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- offset = this.drawFlatCoordinatess_(flatCoordinates, offset, endss[i], stride);
- }
- this.endGeometry(feature);
- };
- /**
- * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
- */
- CanvasPolygonBuilder.prototype.finish = function () {
- this.reverseHitDetectionInstructions();
- this.state = null;
- // We want to preserve topology when drawing polygons. Polygons are
- // simplified using quantization and point elimination. However, we might
- // have received a mix of quantized and non-quantized geometries, so ensure
- // that all are quantized by quantizing all coordinates in the batch.
- var tolerance = this.tolerance;
- if (tolerance !== 0) {
- var coordinates = this.coordinates;
- for (var i = 0, ii = coordinates.length; i < ii; ++i) {
- coordinates[i] = snap(coordinates[i], tolerance);
- }
- }
- return _super.prototype.finish.call(this);
- };
- /**
- * @private
- */
- CanvasPolygonBuilder.prototype.setFillStrokeStyles_ = function () {
- var state = this.state;
- var fillStyle = state.fillStyle;
- if (fillStyle !== undefined) {
- this.updateFillStyle(state, this.createFill);
- }
- if (state.strokeStyle !== undefined) {
- this.updateStrokeStyle(state, this.applyStroke);
- }
- };
- return CanvasPolygonBuilder;
- }(Builder));
- /* harmony default export */ var PolygonBuilder = (CanvasPolygonBuilder);
- //# sourceMappingURL=PolygonBuilder.js.map
- ;// ./node_modules/ol/style/TextPlacement.js
- /**
- * @module ol/style/TextPlacement
- */
- /**
- * Text placement. One of `'point'`, `'line'`. Default is `'point'`. Note that
- * `'line'` requires the underlying geometry to be a {@link module:ol/geom/LineString~LineString},
- * {@link module:ol/geom/Polygon~Polygon}, {@link module:ol/geom/MultiLineString~MultiLineString} or
- * {@link module:ol/geom/MultiPolygon~MultiPolygon}.
- * @enum {string}
- */
- /* harmony default export */ var TextPlacement = ({
- POINT: 'point',
- LINE: 'line',
- });
- //# sourceMappingURL=TextPlacement.js.map
- ;// ./node_modules/ol/geom/flat/straightchunk.js
- /**
- * @module ol/geom/flat/straightchunk
- */
- /**
- * @param {number} maxAngle Maximum acceptable angle delta between segments.
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @return {Array<number>} Start and end of the first suitable chunk of the
- * given `flatCoordinates`.
- */
- function matchingChunk(maxAngle, flatCoordinates, offset, end, stride) {
- var chunkStart = offset;
- var chunkEnd = offset;
- var chunkM = 0;
- var m = 0;
- var start = offset;
- var acos, i, m12, m23, x1, y1, x12, y12, x23, y23;
- for (i = offset; i < end; i += stride) {
- var x2 = flatCoordinates[i];
- var y2 = flatCoordinates[i + 1];
- if (x1 !== undefined) {
- x23 = x2 - x1;
- y23 = y2 - y1;
- m23 = Math.sqrt(x23 * x23 + y23 * y23);
- if (x12 !== undefined) {
- m += m12;
- acos = Math.acos((x12 * x23 + y12 * y23) / (m12 * m23));
- if (acos > maxAngle) {
- if (m > chunkM) {
- chunkM = m;
- chunkStart = start;
- chunkEnd = i;
- }
- m = 0;
- start = i - stride;
- }
- }
- m12 = m23;
- x12 = x23;
- y12 = y23;
- }
- x1 = x2;
- y1 = y2;
- }
- m += m23;
- return m > chunkM ? [start, i] : [chunkStart, chunkEnd];
- }
- //# sourceMappingURL=straightchunk.js.map
- ;// ./node_modules/ol/render/canvas/TextBuilder.js
- var TextBuilder_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/render/canvas/TextBuilder
- */
- /**
- * @const
- * @enum {number}
- */
- var TEXT_ALIGN = {
- 'left': 0,
- 'end': 0,
- 'center': 0.5,
- 'right': 1,
- 'start': 1,
- 'top': 0,
- 'middle': 0.5,
- 'hanging': 0.2,
- 'alphabetic': 0.8,
- 'ideographic': 0.8,
- 'bottom': 1,
- };
- var CanvasTextBuilder = /** @class */ (function (_super) {
- TextBuilder_extends(CanvasTextBuilder, _super);
- /**
- * @param {number} tolerance Tolerance.
- * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- */
- function CanvasTextBuilder(tolerance, maxExtent, resolution, pixelRatio) {
- var _this = _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
- /**
- * @private
- * @type {Array<HTMLCanvasElement>}
- */
- _this.labels_ = null;
- /**
- * @private
- * @type {string|Array<string>}
- */
- _this.text_ = '';
- /**
- * @private
- * @type {number}
- */
- _this.textOffsetX_ = 0;
- /**
- * @private
- * @type {number}
- */
- _this.textOffsetY_ = 0;
- /**
- * @private
- * @type {boolean|undefined}
- */
- _this.textRotateWithView_ = undefined;
- /**
- * @private
- * @type {number}
- */
- _this.textRotation_ = 0;
- /**
- * @private
- * @type {?import("../canvas.js").FillState}
- */
- _this.textFillState_ = null;
- /**
- * @type {!Object<string, import("../canvas.js").FillState>}
- */
- _this.fillStates = {};
- /**
- * @private
- * @type {?import("../canvas.js").StrokeState}
- */
- _this.textStrokeState_ = null;
- /**
- * @type {!Object<string, import("../canvas.js").StrokeState>}
- */
- _this.strokeStates = {};
- /**
- * @private
- * @type {import("../canvas.js").TextState}
- */
- _this.textState_ = /** @type {import("../canvas.js").TextState} */ ({});
- /**
- * @type {!Object<string, import("../canvas.js").TextState>}
- */
- _this.textStates = {};
- /**
- * @private
- * @type {string}
- */
- _this.textKey_ = '';
- /**
- * @private
- * @type {string}
- */
- _this.fillKey_ = '';
- /**
- * @private
- * @type {string}
- */
- _this.strokeKey_ = '';
- /**
- * Data shared with an image builder for combined decluttering.
- * @private
- * @type {import("../canvas.js").DeclutterImageWithText}
- */
- _this.declutterImageWithText_ = undefined;
- return _this;
- }
- /**
- * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
- */
- CanvasTextBuilder.prototype.finish = function () {
- var instructions = _super.prototype.finish.call(this);
- instructions.textStates = this.textStates;
- instructions.fillStates = this.fillStates;
- instructions.strokeStates = this.strokeStates;
- return instructions;
- };
- /**
- * @param {import("../../geom/SimpleGeometry.js").default|import("../Feature.js").default} geometry Geometry.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- */
- CanvasTextBuilder.prototype.drawText = function (geometry, feature) {
- var fillState = this.textFillState_;
- var strokeState = this.textStrokeState_;
- var textState = this.textState_;
- if (this.text_ === '' || !textState || (!fillState && !strokeState)) {
- return;
- }
- var coordinates = this.coordinates;
- var begin = coordinates.length;
- var geometryType = geometry.getType();
- var flatCoordinates = null;
- var stride = geometry.getStride();
- if (textState.placement === TextPlacement.LINE &&
- (geometryType == 'LineString' ||
- geometryType == 'MultiLineString' ||
- geometryType == 'Polygon' ||
- geometryType == 'MultiPolygon')) {
- if (!intersects(this.getBufferedMaxExtent(), geometry.getExtent())) {
- return;
- }
- var ends = void 0;
- flatCoordinates = geometry.getFlatCoordinates();
- if (geometryType == 'LineString') {
- ends = [flatCoordinates.length];
- }
- else if (geometryType == 'MultiLineString') {
- ends = /** @type {import("../../geom/MultiLineString.js").default} */ (geometry).getEnds();
- }
- else if (geometryType == 'Polygon') {
- ends = /** @type {import("../../geom/Polygon.js").default} */ (geometry)
- .getEnds()
- .slice(0, 1);
- }
- else if (geometryType == 'MultiPolygon') {
- var endss =
- /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss();
- ends = [];
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- ends.push(endss[i][0]);
- }
- }
- this.beginGeometry(geometry, feature);
- var textAlign = textState.textAlign;
- // No `justify` support for line placement.
- var flatOffset = 0;
- var flatEnd = void 0;
- for (var o = 0, oo = ends.length; o < oo; ++o) {
- if (textAlign == undefined) {
- var range = matchingChunk(textState.maxAngle, flatCoordinates, flatOffset, ends[o], stride);
- flatOffset = range[0];
- flatEnd = range[1];
- }
- else {
- flatEnd = ends[o];
- }
- for (var i = flatOffset; i < flatEnd; i += stride) {
- coordinates.push(flatCoordinates[i], flatCoordinates[i + 1]);
- }
- var end = coordinates.length;
- flatOffset = ends[o];
- this.drawChars_(begin, end);
- begin = end;
- }
- this.endGeometry(feature);
- }
- else {
- var geometryWidths = textState.overflow ? null : [];
- switch (geometryType) {
- case 'Point':
- case 'MultiPoint':
- flatCoordinates =
- /** @type {import("../../geom/MultiPoint.js").default} */ (geometry).getFlatCoordinates();
- break;
- case 'LineString':
- flatCoordinates =
- /** @type {import("../../geom/LineString.js").default} */ (geometry).getFlatMidpoint();
- break;
- case 'Circle':
- flatCoordinates =
- /** @type {import("../../geom/Circle.js").default} */ (geometry).getCenter();
- break;
- case 'MultiLineString':
- flatCoordinates =
- /** @type {import("../../geom/MultiLineString.js").default} */ (geometry).getFlatMidpoints();
- stride = 2;
- break;
- case 'Polygon':
- flatCoordinates =
- /** @type {import("../../geom/Polygon.js").default} */ (geometry).getFlatInteriorPoint();
- if (!textState.overflow) {
- geometryWidths.push(flatCoordinates[2] / this.resolution);
- }
- stride = 3;
- break;
- case 'MultiPolygon':
- var interiorPoints =
- /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getFlatInteriorPoints();
- flatCoordinates = [];
- for (var i = 0, ii = interiorPoints.length; i < ii; i += 3) {
- if (!textState.overflow) {
- geometryWidths.push(interiorPoints[i + 2] / this.resolution);
- }
- flatCoordinates.push(interiorPoints[i], interiorPoints[i + 1]);
- }
- if (flatCoordinates.length === 0) {
- return;
- }
- stride = 2;
- break;
- default:
- }
- var end = this.appendFlatPointCoordinates(flatCoordinates, stride);
- if (end === begin) {
- return;
- }
- if (geometryWidths &&
- (end - begin) / 2 !== flatCoordinates.length / stride) {
- var beg_1 = begin / 2;
- geometryWidths = geometryWidths.filter(function (w, i) {
- var keep = coordinates[(beg_1 + i) * 2] === flatCoordinates[i * stride] &&
- coordinates[(beg_1 + i) * 2 + 1] === flatCoordinates[i * stride + 1];
- if (!keep) {
- --beg_1;
- }
- return keep;
- });
- }
- this.saveTextStates_();
- if (textState.backgroundFill || textState.backgroundStroke) {
- this.setFillStrokeStyle(textState.backgroundFill, textState.backgroundStroke);
- if (textState.backgroundFill) {
- this.updateFillStyle(this.state, this.createFill);
- this.hitDetectionInstructions.push(this.createFill(this.state));
- }
- if (textState.backgroundStroke) {
- this.updateStrokeStyle(this.state, this.applyStroke);
- this.hitDetectionInstructions.push(this.createStroke(this.state));
- }
- }
- this.beginGeometry(geometry, feature);
- // adjust padding for negative scale
- var padding = textState.padding;
- if (padding != defaultPadding &&
- (textState.scale[0] < 0 || textState.scale[1] < 0)) {
- var p0 = textState.padding[0];
- var p1 = textState.padding[1];
- var p2 = textState.padding[2];
- var p3 = textState.padding[3];
- if (textState.scale[0] < 0) {
- p1 = -p1;
- p3 = -p3;
- }
- if (textState.scale[1] < 0) {
- p0 = -p0;
- p2 = -p2;
- }
- padding = [p0, p1, p2, p3];
- }
- // The image is unknown at this stage so we pass null; it will be computed at render time.
- // For clarity, we pass NaN for offsetX, offsetY, width and height, which will be computed at
- // render time.
- var pixelRatio_1 = this.pixelRatio;
- this.instructions.push([
- canvas_Instruction.DRAW_IMAGE,
- begin,
- end,
- null,
- NaN,
- NaN,
- NaN,
- 1,
- 0,
- 0,
- this.textRotateWithView_,
- this.textRotation_,
- [1, 1],
- NaN,
- undefined,
- this.declutterImageWithText_,
- padding == defaultPadding
- ? defaultPadding
- : padding.map(function (p) {
- return p * pixelRatio_1;
- }),
- !!textState.backgroundFill,
- !!textState.backgroundStroke,
- this.text_,
- this.textKey_,
- this.strokeKey_,
- this.fillKey_,
- this.textOffsetX_,
- this.textOffsetY_,
- geometryWidths,
- ]);
- var scale = 1 / pixelRatio_1;
- this.hitDetectionInstructions.push([
- canvas_Instruction.DRAW_IMAGE,
- begin,
- end,
- null,
- NaN,
- NaN,
- NaN,
- 1,
- 0,
- 0,
- this.textRotateWithView_,
- this.textRotation_,
- [scale, scale],
- NaN,
- undefined,
- this.declutterImageWithText_,
- padding,
- !!textState.backgroundFill,
- !!textState.backgroundStroke,
- this.text_,
- this.textKey_,
- this.strokeKey_,
- this.fillKey_,
- this.textOffsetX_,
- this.textOffsetY_,
- geometryWidths,
- ]);
- this.endGeometry(feature);
- }
- };
- /**
- * @private
- */
- CanvasTextBuilder.prototype.saveTextStates_ = function () {
- var strokeState = this.textStrokeState_;
- var textState = this.textState_;
- var fillState = this.textFillState_;
- var strokeKey = this.strokeKey_;
- if (strokeState) {
- if (!(strokeKey in this.strokeStates)) {
- this.strokeStates[strokeKey] = {
- strokeStyle: strokeState.strokeStyle,
- lineCap: strokeState.lineCap,
- lineDashOffset: strokeState.lineDashOffset,
- lineWidth: strokeState.lineWidth,
- lineJoin: strokeState.lineJoin,
- miterLimit: strokeState.miterLimit,
- lineDash: strokeState.lineDash,
- };
- }
- }
- var textKey = this.textKey_;
- if (!(textKey in this.textStates)) {
- this.textStates[textKey] = {
- font: textState.font,
- textAlign: textState.textAlign || defaultTextAlign,
- justify: textState.justify,
- textBaseline: textState.textBaseline || defaultTextBaseline,
- scale: textState.scale,
- };
- }
- var fillKey = this.fillKey_;
- if (fillState) {
- if (!(fillKey in this.fillStates)) {
- this.fillStates[fillKey] = {
- fillStyle: fillState.fillStyle,
- };
- }
- }
- };
- /**
- * @private
- * @param {number} begin Begin.
- * @param {number} end End.
- */
- CanvasTextBuilder.prototype.drawChars_ = function (begin, end) {
- var strokeState = this.textStrokeState_;
- var textState = this.textState_;
- var strokeKey = this.strokeKey_;
- var textKey = this.textKey_;
- var fillKey = this.fillKey_;
- this.saveTextStates_();
- var pixelRatio = this.pixelRatio;
- var baseline = TEXT_ALIGN[textState.textBaseline];
- var offsetY = this.textOffsetY_ * pixelRatio;
- var text = this.text_;
- var strokeWidth = strokeState
- ? (strokeState.lineWidth * Math.abs(textState.scale[0])) / 2
- : 0;
- this.instructions.push([
- canvas_Instruction.DRAW_CHARS,
- begin,
- end,
- baseline,
- textState.overflow,
- fillKey,
- textState.maxAngle,
- pixelRatio,
- offsetY,
- strokeKey,
- strokeWidth * pixelRatio,
- text,
- textKey,
- 1,
- ]);
- this.hitDetectionInstructions.push([
- canvas_Instruction.DRAW_CHARS,
- begin,
- end,
- baseline,
- textState.overflow,
- fillKey,
- textState.maxAngle,
- 1,
- offsetY,
- strokeKey,
- strokeWidth,
- text,
- textKey,
- 1 / pixelRatio,
- ]);
- };
- /**
- * @param {import("../../style/Text.js").default} textStyle Text style.
- * @param {Object} [opt_sharedData] Shared data.
- */
- CanvasTextBuilder.prototype.setTextStyle = function (textStyle, opt_sharedData) {
- var textState, fillState, strokeState;
- if (!textStyle) {
- this.text_ = '';
- }
- else {
- var textFillStyle = textStyle.getFill();
- if (!textFillStyle) {
- fillState = null;
- this.textFillState_ = fillState;
- }
- else {
- fillState = this.textFillState_;
- if (!fillState) {
- fillState = /** @type {import("../canvas.js").FillState} */ ({});
- this.textFillState_ = fillState;
- }
- fillState.fillStyle = asColorLike(textFillStyle.getColor() || defaultFillStyle);
- }
- var textStrokeStyle = textStyle.getStroke();
- if (!textStrokeStyle) {
- strokeState = null;
- this.textStrokeState_ = strokeState;
- }
- else {
- strokeState = this.textStrokeState_;
- if (!strokeState) {
- strokeState = /** @type {import("../canvas.js").StrokeState} */ ({});
- this.textStrokeState_ = strokeState;
- }
- var lineDash = textStrokeStyle.getLineDash();
- var lineDashOffset = textStrokeStyle.getLineDashOffset();
- var lineWidth = textStrokeStyle.getWidth();
- var miterLimit = textStrokeStyle.getMiterLimit();
- strokeState.lineCap = textStrokeStyle.getLineCap() || defaultLineCap;
- strokeState.lineDash = lineDash ? lineDash.slice() : defaultLineDash;
- strokeState.lineDashOffset =
- lineDashOffset === undefined ? defaultLineDashOffset : lineDashOffset;
- strokeState.lineJoin = textStrokeStyle.getLineJoin() || defaultLineJoin;
- strokeState.lineWidth =
- lineWidth === undefined ? defaultLineWidth : lineWidth;
- strokeState.miterLimit =
- miterLimit === undefined ? defaultMiterLimit : miterLimit;
- strokeState.strokeStyle = asColorLike(textStrokeStyle.getColor() || defaultStrokeStyle);
- }
- textState = this.textState_;
- var font = textStyle.getFont() || defaultFont;
- registerFont(font);
- var textScale = textStyle.getScaleArray();
- textState.overflow = textStyle.getOverflow();
- textState.font = font;
- textState.maxAngle = textStyle.getMaxAngle();
- textState.placement = textStyle.getPlacement();
- textState.textAlign = textStyle.getTextAlign();
- textState.justify = textStyle.getJustify();
- textState.textBaseline =
- textStyle.getTextBaseline() || defaultTextBaseline;
- textState.backgroundFill = textStyle.getBackgroundFill();
- textState.backgroundStroke = textStyle.getBackgroundStroke();
- textState.padding = textStyle.getPadding() || defaultPadding;
- textState.scale = textScale === undefined ? [1, 1] : textScale;
- var textOffsetX = textStyle.getOffsetX();
- var textOffsetY = textStyle.getOffsetY();
- var textRotateWithView = textStyle.getRotateWithView();
- var textRotation = textStyle.getRotation();
- this.text_ = textStyle.getText() || '';
- this.textOffsetX_ = textOffsetX === undefined ? 0 : textOffsetX;
- this.textOffsetY_ = textOffsetY === undefined ? 0 : textOffsetY;
- this.textRotateWithView_ =
- textRotateWithView === undefined ? false : textRotateWithView;
- this.textRotation_ = textRotation === undefined ? 0 : textRotation;
- this.strokeKey_ = strokeState
- ? (typeof strokeState.strokeStyle == 'string'
- ? strokeState.strokeStyle
- : getUid(strokeState.strokeStyle)) +
- strokeState.lineCap +
- strokeState.lineDashOffset +
- '|' +
- strokeState.lineWidth +
- strokeState.lineJoin +
- strokeState.miterLimit +
- '[' +
- strokeState.lineDash.join() +
- ']'
- : '';
- this.textKey_ =
- textState.font +
- textState.scale +
- (textState.textAlign || '?') +
- (textState.justify || '?') +
- (textState.textBaseline || '?');
- this.fillKey_ = fillState
- ? typeof fillState.fillStyle == 'string'
- ? fillState.fillStyle
- : '|' + getUid(fillState.fillStyle)
- : '';
- }
- this.declutterImageWithText_ = opt_sharedData;
- };
- return CanvasTextBuilder;
- }(Builder));
- /* harmony default export */ var TextBuilder = (CanvasTextBuilder);
- //# sourceMappingURL=TextBuilder.js.map
- ;// ./node_modules/ol/render/canvas/BuilderGroup.js
- /**
- * @module ol/render/canvas/BuilderGroup
- */
- /**
- * @type {Object<import("../canvas.js").BuilderType, typeof Builder>}
- */
- var BATCH_CONSTRUCTORS = {
- 'Circle': PolygonBuilder,
- 'Default': Builder,
- 'Image': ImageBuilder,
- 'LineString': LineStringBuilder,
- 'Polygon': PolygonBuilder,
- 'Text': TextBuilder,
- };
- var BuilderGroup = /** @class */ (function () {
- /**
- * @param {number} tolerance Tolerance.
- * @param {import("../../extent.js").Extent} maxExtent Max extent.
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- */
- function BuilderGroup(tolerance, maxExtent, resolution, pixelRatio) {
- /**
- * @private
- * @type {number}
- */
- this.tolerance_ = tolerance;
- /**
- * @private
- * @type {import("../../extent.js").Extent}
- */
- this.maxExtent_ = maxExtent;
- /**
- * @private
- * @type {number}
- */
- this.pixelRatio_ = pixelRatio;
- /**
- * @private
- * @type {number}
- */
- this.resolution_ = resolution;
- /**
- * @private
- * @type {!Object<string, !Object<import("../canvas.js").BuilderType, Builder>>}
- */
- this.buildersByZIndex_ = {};
- }
- /**
- * @return {!Object<string, !Object<import("../canvas.js").BuilderType, import("./Builder.js").SerializableInstructions>>} The serializable instructions
- */
- BuilderGroup.prototype.finish = function () {
- var builderInstructions = {};
- for (var zKey in this.buildersByZIndex_) {
- builderInstructions[zKey] = builderInstructions[zKey] || {};
- var builders = this.buildersByZIndex_[zKey];
- for (var builderKey in builders) {
- var builderInstruction = builders[builderKey].finish();
- builderInstructions[zKey][builderKey] = builderInstruction;
- }
- }
- return builderInstructions;
- };
- /**
- * @param {number|undefined} zIndex Z index.
- * @param {import("../canvas.js").BuilderType} builderType Replay type.
- * @return {import("../VectorContext.js").default} Replay.
- */
- BuilderGroup.prototype.getBuilder = function (zIndex, builderType) {
- var zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
- var replays = this.buildersByZIndex_[zIndexKey];
- if (replays === undefined) {
- replays = {};
- this.buildersByZIndex_[zIndexKey] = replays;
- }
- var replay = replays[builderType];
- if (replay === undefined) {
- var Constructor = BATCH_CONSTRUCTORS[builderType];
- replay = new Constructor(this.tolerance_, this.maxExtent_, this.resolution_, this.pixelRatio_);
- replays[builderType] = replay;
- }
- return replay;
- };
- return BuilderGroup;
- }());
- /* harmony default export */ var canvas_BuilderGroup = (BuilderGroup);
- //# sourceMappingURL=BuilderGroup.js.map
- ;// ./node_modules/ol/geom/flat/textpath.js
- /**
- * @module ol/geom/flat/textpath
- */
- /**
- * @param {Array<number>} flatCoordinates Path to put text on.
- * @param {number} offset Start offset of the `flatCoordinates`.
- * @param {number} end End offset of the `flatCoordinates`.
- * @param {number} stride Stride.
- * @param {string} text Text to place on the path.
- * @param {number} startM m along the path where the text starts.
- * @param {number} maxAngle Max angle between adjacent chars in radians.
- * @param {number} scale The product of the text scale and the device pixel ratio.
- * @param {function(string, string, Object<string, number>):number} measureAndCacheTextWidth Measure and cache text width.
- * @param {string} font The font.
- * @param {Object<string, number>} cache A cache of measured widths.
- * @param {number} rotation Rotation to apply to the flatCoordinates to determine whether text needs to be reversed.
- * @return {Array<Array<*>>|null} The result array (or null if `maxAngle` was
- * exceeded). Entries of the array are x, y, anchorX, angle, chunk.
- */
- function drawTextOnPath(flatCoordinates, offset, end, stride, text, startM, maxAngle, scale, measureAndCacheTextWidth, font, cache, rotation) {
- var x2 = flatCoordinates[offset];
- var y2 = flatCoordinates[offset + 1];
- var x1 = 0;
- var y1 = 0;
- var segmentLength = 0;
- var segmentM = 0;
- function advance() {
- x1 = x2;
- y1 = y2;
- offset += stride;
- x2 = flatCoordinates[offset];
- y2 = flatCoordinates[offset + 1];
- segmentM += segmentLength;
- segmentLength = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
- }
- do {
- advance();
- } while (offset < end - stride && segmentM + segmentLength < startM);
- var interpolate = segmentLength === 0 ? 0 : (startM - segmentM) / segmentLength;
- var beginX = lerp(x1, x2, interpolate);
- var beginY = lerp(y1, y2, interpolate);
- var startOffset = offset - stride;
- var startLength = segmentM;
- var endM = startM + scale * measureAndCacheTextWidth(font, text, cache);
- while (offset < end - stride && segmentM + segmentLength < endM) {
- advance();
- }
- interpolate = segmentLength === 0 ? 0 : (endM - segmentM) / segmentLength;
- var endX = lerp(x1, x2, interpolate);
- var endY = lerp(y1, y2, interpolate);
- // Keep text upright
- var reverse;
- if (rotation) {
- var flat = [beginX, beginY, endX, endY];
- flat_transform_rotate(flat, 0, 4, 2, rotation, flat, flat);
- reverse = flat[0] > flat[2];
- }
- else {
- reverse = beginX > endX;
- }
- var PI = Math.PI;
- var result = [];
- var singleSegment = startOffset + stride === offset;
- offset = startOffset;
- segmentLength = 0;
- segmentM = startLength;
- x2 = flatCoordinates[offset];
- y2 = flatCoordinates[offset + 1];
- var previousAngle;
- // All on the same segment
- if (singleSegment) {
- advance();
- previousAngle = Math.atan2(y2 - y1, x2 - x1);
- if (reverse) {
- previousAngle += previousAngle > 0 ? -PI : PI;
- }
- var x = (endX + beginX) / 2;
- var y = (endY + beginY) / 2;
- result[0] = [x, y, (endM - startM) / 2, previousAngle, text];
- return result;
- }
- // rendering across line segments
- text = text.replace(/\n/g, ' '); // ensure rendering in single-line as all calculations below don't handle multi-lines
- for (var i = 0, ii = text.length; i < ii;) {
- advance();
- var angle = Math.atan2(y2 - y1, x2 - x1);
- if (reverse) {
- angle += angle > 0 ? -PI : PI;
- }
- if (previousAngle !== undefined) {
- var delta = angle - previousAngle;
- delta += delta > PI ? -2 * PI : delta < -PI ? 2 * PI : 0;
- if (Math.abs(delta) > maxAngle) {
- return null;
- }
- }
- previousAngle = angle;
- var iStart = i;
- var charLength = 0;
- for (; i < ii; ++i) {
- var index = reverse ? ii - i - 1 : i;
- var len = scale * measureAndCacheTextWidth(font, text[index], cache);
- if (offset + stride < end &&
- segmentM + segmentLength < startM + charLength + len / 2) {
- break;
- }
- charLength += len;
- }
- if (i === iStart) {
- continue;
- }
- var chars = reverse
- ? text.substring(ii - iStart, ii - i)
- : text.substring(iStart, i);
- interpolate =
- segmentLength === 0
- ? 0
- : (startM + charLength / 2 - segmentM) / segmentLength;
- var x = lerp(x1, x2, interpolate);
- var y = lerp(y1, y2, interpolate);
- result.push([x, y, charLength / 2, angle, chars]);
- startM += charLength;
- }
- return result;
- }
- //# sourceMappingURL=textpath.js.map
- ;// ./node_modules/ol/render/canvas/Executor.js
- /**
- * @module ol/render/canvas/Executor
- */
- /**
- * @typedef {Object} BBox
- * @property {number} minX Minimal x.
- * @property {number} minY Minimal y.
- * @property {number} maxX Maximal x.
- * @property {number} maxY Maximal y
- * @property {*} value Value.
- */
- /**
- * @typedef {Object} ImageOrLabelDimensions
- * @property {number} drawImageX DrawImageX.
- * @property {number} drawImageY DrawImageY.
- * @property {number} drawImageW DrawImageW.
- * @property {number} drawImageH DrawImageH.
- * @property {number} originX OriginX.
- * @property {number} originY OriginY.
- * @property {Array<number>} scale Scale.
- * @property {BBox} declutterBox DeclutterBox.
- * @property {import("../../transform.js").Transform} canvasTransform CanvasTransform.
- */
- /**
- * @typedef {{0: CanvasRenderingContext2D, 1: number, 2: import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement, 3: ImageOrLabelDimensions, 4: number, 5: Array<*>, 6: Array<*>}} ReplayImageOrLabelArgs
- */
- /**
- * @template T
- * @typedef {function(import("../../Feature.js").FeatureLike, import("../../geom/SimpleGeometry.js").default): T} FeatureCallback
- */
- /**
- * @type {import("../../extent.js").Extent}
- */
- var tmpExtent = createEmpty();
- /** @type {import("../../coordinate.js").Coordinate} */
- var p1 = [];
- /** @type {import("../../coordinate.js").Coordinate} */
- var p2 = [];
- /** @type {import("../../coordinate.js").Coordinate} */
- var p3 = [];
- /** @type {import("../../coordinate.js").Coordinate} */
- var p4 = [];
- /**
- * @param {ReplayImageOrLabelArgs} replayImageOrLabelArgs Arguments to replayImageOrLabel
- * @return {BBox} Declutter bbox.
- */
- function getDeclutterBox(replayImageOrLabelArgs) {
- return replayImageOrLabelArgs[3].declutterBox;
- }
- var rtlRegEx = new RegExp(
- /* eslint-disable prettier/prettier */
- '[' +
- String.fromCharCode(0x00591) + '-' + String.fromCharCode(0x008ff) +
- String.fromCharCode(0x0fb1d) + '-' + String.fromCharCode(0x0fdff) +
- String.fromCharCode(0x0fe70) + '-' + String.fromCharCode(0x0fefc) +
- String.fromCharCode(0x10800) + '-' + String.fromCharCode(0x10fff) +
- String.fromCharCode(0x1e800) + '-' + String.fromCharCode(0x1efff) +
- ']'
- /* eslint-enable prettier/prettier */
- );
- /**
- * @param {string} text Text.
- * @param {string} align Alignment.
- * @return {number} Text alignment.
- */
- function horizontalTextAlign(text, align) {
- if ((align === 'start' || align === 'end') && !rtlRegEx.test(text)) {
- align = align === 'start' ? 'left' : 'right';
- }
- return TEXT_ALIGN[align];
- }
- /**
- * @param {Array<string>} acc Accumulator.
- * @param {string} line Line of text.
- * @param {number} i Index
- * @return {Array<string>} Accumulator.
- */
- function createTextChunks(acc, line, i) {
- if (i > 0) {
- acc.push('\n', '');
- }
- acc.push(line, '');
- return acc;
- }
- var Executor = /** @class */ (function () {
- /**
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- * @param {boolean} overlaps The replay can have overlapping geometries.
- * @param {import("../canvas.js").SerializableInstructions} instructions The serializable instructions
- */
- function Executor(resolution, pixelRatio, overlaps, instructions) {
- /**
- * @protected
- * @type {boolean}
- */
- this.overlaps = overlaps;
- /**
- * @protected
- * @type {number}
- */
- this.pixelRatio = pixelRatio;
- /**
- * @protected
- * @const
- * @type {number}
- */
- this.resolution = resolution;
- /**
- * @private
- * @type {boolean}
- */
- this.alignFill_;
- /**
- * @protected
- * @type {Array<*>}
- */
- this.instructions = instructions.instructions;
- /**
- * @protected
- * @type {Array<number>}
- */
- this.coordinates = instructions.coordinates;
- /**
- * @private
- * @type {!Object<number,import("../../coordinate.js").Coordinate|Array<import("../../coordinate.js").Coordinate>|Array<Array<import("../../coordinate.js").Coordinate>>>}
- */
- this.coordinateCache_ = {};
- /**
- * @private
- * @type {!import("../../transform.js").Transform}
- */
- this.renderedTransform_ = create();
- /**
- * @protected
- * @type {Array<*>}
- */
- this.hitDetectionInstructions = instructions.hitDetectionInstructions;
- /**
- * @private
- * @type {Array<number>}
- */
- this.pixelCoordinates_ = null;
- /**
- * @private
- * @type {number}
- */
- this.viewRotation_ = 0;
- /**
- * @type {!Object<string, import("../canvas.js").FillState>}
- */
- this.fillStates = instructions.fillStates || {};
- /**
- * @type {!Object<string, import("../canvas.js").StrokeState>}
- */
- this.strokeStates = instructions.strokeStates || {};
- /**
- * @type {!Object<string, import("../canvas.js").TextState>}
- */
- this.textStates = instructions.textStates || {};
- /**
- * @private
- * @type {Object<string, Object<string, number>>}
- */
- this.widths_ = {};
- /**
- * @private
- * @type {Object<string, import("../canvas.js").Label>}
- */
- this.labels_ = {};
- }
- /**
- * @param {string|Array<string>} text Text.
- * @param {string} textKey Text style key.
- * @param {string} fillKey Fill style key.
- * @param {string} strokeKey Stroke style key.
- * @return {import("../canvas.js").Label} Label.
- */
- Executor.prototype.createLabel = function (text, textKey, fillKey, strokeKey) {
- var key = text + textKey + fillKey + strokeKey;
- if (this.labels_[key]) {
- return this.labels_[key];
- }
- var strokeState = strokeKey ? this.strokeStates[strokeKey] : null;
- var fillState = fillKey ? this.fillStates[fillKey] : null;
- var textState = this.textStates[textKey];
- var pixelRatio = this.pixelRatio;
- var scale = [
- textState.scale[0] * pixelRatio,
- textState.scale[1] * pixelRatio,
- ];
- var textIsArray = Array.isArray(text);
- var align = textState.justify
- ? TEXT_ALIGN[textState.justify]
- : horizontalTextAlign(Array.isArray(text) ? text[0] : text, textState.textAlign || defaultTextAlign);
- var strokeWidth = strokeKey && strokeState.lineWidth ? strokeState.lineWidth : 0;
- var chunks = textIsArray
- ? text
- : text.split('\n').reduce(createTextChunks, []);
- var _a = getTextDimensions(textState, chunks), width = _a.width, height = _a.height, widths = _a.widths, heights = _a.heights, lineWidths = _a.lineWidths;
- var renderWidth = width + strokeWidth;
- var contextInstructions = [];
- // make canvas 2 pixels wider to account for italic text width measurement errors
- var w = (renderWidth + 2) * scale[0];
- var h = (height + strokeWidth) * scale[1];
- /** @type {import("../canvas.js").Label} */
- var label = {
- width: w < 0 ? Math.floor(w) : Math.ceil(w),
- height: h < 0 ? Math.floor(h) : Math.ceil(h),
- contextInstructions: contextInstructions,
- };
- if (scale[0] != 1 || scale[1] != 1) {
- contextInstructions.push('scale', scale);
- }
- if (strokeKey) {
- contextInstructions.push('strokeStyle', strokeState.strokeStyle);
- contextInstructions.push('lineWidth', strokeWidth);
- contextInstructions.push('lineCap', strokeState.lineCap);
- contextInstructions.push('lineJoin', strokeState.lineJoin);
- contextInstructions.push('miterLimit', strokeState.miterLimit);
- // eslint-disable-next-line
- var Context = WORKER_OFFSCREEN_CANVAS ? OffscreenCanvasRenderingContext2D : CanvasRenderingContext2D;
- if (Context.prototype.setLineDash) {
- contextInstructions.push('setLineDash', [strokeState.lineDash]);
- contextInstructions.push('lineDashOffset', strokeState.lineDashOffset);
- }
- }
- if (fillKey) {
- contextInstructions.push('fillStyle', fillState.fillStyle);
- }
- contextInstructions.push('textBaseline', 'middle');
- contextInstructions.push('textAlign', 'center');
- var leftRight = 0.5 - align;
- var x = align * renderWidth + leftRight * strokeWidth;
- var strokeInstructions = [];
- var fillInstructions = [];
- var lineHeight = 0;
- var lineOffset = 0;
- var widthHeightIndex = 0;
- var lineWidthIndex = 0;
- var previousFont;
- for (var i = 0, ii = chunks.length; i < ii; i += 2) {
- var text_1 = chunks[i];
- if (text_1 === '\n') {
- lineOffset += lineHeight;
- lineHeight = 0;
- x = align * renderWidth + leftRight * strokeWidth;
- ++lineWidthIndex;
- continue;
- }
- var font = chunks[i + 1] || textState.font;
- if (font !== previousFont) {
- if (strokeKey) {
- strokeInstructions.push('font', font);
- }
- if (fillKey) {
- fillInstructions.push('font', font);
- }
- previousFont = font;
- }
- lineHeight = Math.max(lineHeight, heights[widthHeightIndex]);
- var fillStrokeArgs = [
- text_1,
- x +
- leftRight * widths[widthHeightIndex] +
- align * (widths[widthHeightIndex] - lineWidths[lineWidthIndex]),
- 0.5 * (strokeWidth + lineHeight) + lineOffset,
- ];
- x += widths[widthHeightIndex];
- if (strokeKey) {
- strokeInstructions.push('strokeText', fillStrokeArgs);
- }
- if (fillKey) {
- fillInstructions.push('fillText', fillStrokeArgs);
- }
- ++widthHeightIndex;
- }
- Array.prototype.push.apply(contextInstructions, strokeInstructions);
- Array.prototype.push.apply(contextInstructions, fillInstructions);
- this.labels_[key] = label;
- return label;
- };
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {import("../../coordinate.js").Coordinate} p1 1st point of the background box.
- * @param {import("../../coordinate.js").Coordinate} p2 2nd point of the background box.
- * @param {import("../../coordinate.js").Coordinate} p3 3rd point of the background box.
- * @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box.
- * @param {Array<*>} fillInstruction Fill instruction.
- * @param {Array<*>} strokeInstruction Stroke instruction.
- */
- Executor.prototype.replayTextBackground_ = function (context, p1, p2, p3, p4, fillInstruction, strokeInstruction) {
- context.beginPath();
- context.moveTo.apply(context, p1);
- context.lineTo.apply(context, p2);
- context.lineTo.apply(context, p3);
- context.lineTo.apply(context, p4);
- context.lineTo.apply(context, p1);
- if (fillInstruction) {
- this.alignFill_ = /** @type {boolean} */ (fillInstruction[2]);
- this.fill_(context);
- }
- if (strokeInstruction) {
- this.setStrokeStyle_(context,
- /** @type {Array<*>} */ (strokeInstruction));
- context.stroke();
- }
- };
- /**
- * @private
- * @param {number} sheetWidth Width of the sprite sheet.
- * @param {number} sheetHeight Height of the sprite sheet.
- * @param {number} centerX X.
- * @param {number} centerY Y.
- * @param {number} width Width.
- * @param {number} height Height.
- * @param {number} anchorX Anchor X.
- * @param {number} anchorY Anchor Y.
- * @param {number} originX Origin X.
- * @param {number} originY Origin Y.
- * @param {number} rotation Rotation.
- * @param {import("../../size.js").Size} scale Scale.
- * @param {boolean} snapToPixel Snap to pixel.
- * @param {Array<number>} padding Padding.
- * @param {boolean} fillStroke Background fill or stroke.
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- * @return {ImageOrLabelDimensions} Dimensions for positioning and decluttering the image or label.
- */
- Executor.prototype.calculateImageOrLabelDimensions_ = function (sheetWidth, sheetHeight, centerX, centerY, width, height, anchorX, anchorY, originX, originY, rotation, scale, snapToPixel, padding, fillStroke, feature) {
- anchorX *= scale[0];
- anchorY *= scale[1];
- var x = centerX - anchorX;
- var y = centerY - anchorY;
- var w = width + originX > sheetWidth ? sheetWidth - originX : width;
- var h = height + originY > sheetHeight ? sheetHeight - originY : height;
- var boxW = padding[3] + w * scale[0] + padding[1];
- var boxH = padding[0] + h * scale[1] + padding[2];
- var boxX = x - padding[3];
- var boxY = y - padding[0];
- if (fillStroke || rotation !== 0) {
- p1[0] = boxX;
- p4[0] = boxX;
- p1[1] = boxY;
- p2[1] = boxY;
- p2[0] = boxX + boxW;
- p3[0] = p2[0];
- p3[1] = boxY + boxH;
- p4[1] = p3[1];
- }
- var transform;
- if (rotation !== 0) {
- transform = compose(create(), centerX, centerY, 1, 1, rotation, -centerX, -centerY);
- apply(transform, p1);
- apply(transform, p2);
- apply(transform, p3);
- apply(transform, p4);
- createOrUpdate(Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1]), tmpExtent);
- }
- else {
- createOrUpdate(Math.min(boxX, boxX + boxW), Math.min(boxY, boxY + boxH), Math.max(boxX, boxX + boxW), Math.max(boxY, boxY + boxH), tmpExtent);
- }
- if (snapToPixel) {
- x = Math.round(x);
- y = Math.round(y);
- }
- return {
- drawImageX: x,
- drawImageY: y,
- drawImageW: w,
- drawImageH: h,
- originX: originX,
- originY: originY,
- declutterBox: {
- minX: tmpExtent[0],
- minY: tmpExtent[1],
- maxX: tmpExtent[2],
- maxY: tmpExtent[3],
- value: feature,
- },
- canvasTransform: transform,
- scale: scale,
- };
- };
- /**
- * @private
- * @param {CanvasRenderingContext2D} context Context.
- * @param {number} contextScale Scale of the context.
- * @param {import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image.
- * @param {ImageOrLabelDimensions} dimensions Dimensions.
- * @param {number} opacity Opacity.
- * @param {Array<*>} fillInstruction Fill instruction.
- * @param {Array<*>} strokeInstruction Stroke instruction.
- * @return {boolean} The image or label was rendered.
- */
- Executor.prototype.replayImageOrLabel_ = function (context, contextScale, imageOrLabel, dimensions, opacity, fillInstruction, strokeInstruction) {
- var fillStroke = !!(fillInstruction || strokeInstruction);
- var box = dimensions.declutterBox;
- var canvas = context.canvas;
- var strokePadding = strokeInstruction
- ? (strokeInstruction[2] * dimensions.scale[0]) / 2
- : 0;
- var intersects = box.minX - strokePadding <= canvas.width / contextScale &&
- box.maxX + strokePadding >= 0 &&
- box.minY - strokePadding <= canvas.height / contextScale &&
- box.maxY + strokePadding >= 0;
- if (intersects) {
- if (fillStroke) {
- this.replayTextBackground_(context, p1, p2, p3, p4,
- /** @type {Array<*>} */ (fillInstruction),
- /** @type {Array<*>} */ (strokeInstruction));
- }
- drawImageOrLabel(context, dimensions.canvasTransform, opacity, imageOrLabel, dimensions.originX, dimensions.originY, dimensions.drawImageW, dimensions.drawImageH, dimensions.drawImageX, dimensions.drawImageY, dimensions.scale);
- }
- return true;
- };
- /**
- * @private
- * @param {CanvasRenderingContext2D} context Context.
- */
- Executor.prototype.fill_ = function (context) {
- if (this.alignFill_) {
- var origin_1 = apply(this.renderedTransform_, [0, 0]);
- var repeatSize = 512 * this.pixelRatio;
- context.save();
- context.translate(origin_1[0] % repeatSize, origin_1[1] % repeatSize);
- context.rotate(this.viewRotation_);
- }
- context.fill();
- if (this.alignFill_) {
- context.restore();
- }
- };
- /**
- * @private
- * @param {CanvasRenderingContext2D} context Context.
- * @param {Array<*>} instruction Instruction.
- */
- Executor.prototype.setStrokeStyle_ = function (context, instruction) {
- context['strokeStyle'] =
- /** @type {import("../../colorlike.js").ColorLike} */ (instruction[1]);
- context.lineWidth = /** @type {number} */ (instruction[2]);
- context.lineCap = /** @type {CanvasLineCap} */ (instruction[3]);
- context.lineJoin = /** @type {CanvasLineJoin} */ (instruction[4]);
- context.miterLimit = /** @type {number} */ (instruction[5]);
- if (context.setLineDash) {
- context.lineDashOffset = /** @type {number} */ (instruction[7]);
- context.setLineDash(/** @type {Array<number>} */ (instruction[6]));
- }
- };
- /**
- * @private
- * @param {string|Array<string>} text The text to draw.
- * @param {string} textKey The key of the text state.
- * @param {string} strokeKey The key for the stroke state.
- * @param {string} fillKey The key for the fill state.
- * @return {{label: import("../canvas.js").Label, anchorX: number, anchorY: number}} The text image and its anchor.
- */
- Executor.prototype.drawLabelWithPointPlacement_ = function (text, textKey, strokeKey, fillKey) {
- var textState = this.textStates[textKey];
- var label = this.createLabel(text, textKey, fillKey, strokeKey);
- var strokeState = this.strokeStates[strokeKey];
- var pixelRatio = this.pixelRatio;
- var align = horizontalTextAlign(Array.isArray(text) ? text[0] : text, textState.textAlign || defaultTextAlign);
- var baseline = TEXT_ALIGN[textState.textBaseline || defaultTextBaseline];
- var strokeWidth = strokeState && strokeState.lineWidth ? strokeState.lineWidth : 0;
- // Remove the 2 pixels we added in createLabel() for the anchor
- var width = label.width / pixelRatio - 2 * textState.scale[0];
- var anchorX = align * width + 2 * (0.5 - align) * strokeWidth;
- var anchorY = (baseline * label.height) / pixelRatio +
- 2 * (0.5 - baseline) * strokeWidth;
- return {
- label: label,
- anchorX: anchorX,
- anchorY: anchorY,
- };
- };
- /**
- * @private
- * @param {CanvasRenderingContext2D} context Context.
- * @param {number} contextScale Scale of the context.
- * @param {import("../../transform.js").Transform} transform Transform.
- * @param {Array<*>} instructions Instructions array.
- * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
- * @param {FeatureCallback<T>} [opt_featureCallback] Feature callback.
- * @param {import("../../extent.js").Extent} [opt_hitExtent] Only check
- * features that intersect this extent.
- * @param {import("rbush").default} [opt_declutterTree] Declutter tree.
- * @return {T|undefined} Callback result.
- * @template T
- */
- Executor.prototype.execute_ = function (context, contextScale, transform, instructions, snapToPixel, opt_featureCallback, opt_hitExtent, opt_declutterTree) {
- /** @type {Array<number>} */
- var pixelCoordinates;
- if (this.pixelCoordinates_ && equals(transform, this.renderedTransform_)) {
- pixelCoordinates = this.pixelCoordinates_;
- }
- else {
- if (!this.pixelCoordinates_) {
- this.pixelCoordinates_ = [];
- }
- pixelCoordinates = transform2D(this.coordinates, 0, this.coordinates.length, 2, transform, this.pixelCoordinates_);
- setFromArray(this.renderedTransform_, transform);
- }
- var i = 0; // instruction index
- var ii = instructions.length; // end of instructions
- var d = 0; // data index
- var dd; // end of per-instruction data
- var anchorX, anchorY, prevX, prevY, roundX, roundY, image, text, textKey, strokeKey, fillKey;
- var pendingFill = 0;
- var pendingStroke = 0;
- var lastFillInstruction = null;
- var lastStrokeInstruction = null;
- var coordinateCache = this.coordinateCache_;
- var viewRotation = this.viewRotation_;
- var viewRotationFromTransform = Math.round(Math.atan2(-transform[1], transform[0]) * 1e12) / 1e12;
- var state = /** @type {import("../../render.js").State} */ ({
- context: context,
- pixelRatio: this.pixelRatio,
- resolution: this.resolution,
- rotation: viewRotation,
- });
- // When the batch size gets too big, performance decreases. 200 is a good
- // balance between batch size and number of fill/stroke instructions.
- var batchSize = this.instructions != instructions || this.overlaps ? 0 : 200;
- var /** @type {import("../../Feature.js").FeatureLike} */ feature;
- var x, y, currentGeometry;
- while (i < ii) {
- var instruction = instructions[i];
- var type = /** @type {import("./Instruction.js").default} */ (instruction[0]);
- switch (type) {
- case canvas_Instruction.BEGIN_GEOMETRY:
- feature = /** @type {import("../../Feature.js").FeatureLike} */ (instruction[1]);
- currentGeometry = instruction[3];
- if (!feature.getGeometry()) {
- i = /** @type {number} */ (instruction[2]);
- }
- else if (opt_hitExtent !== undefined &&
- !intersects(opt_hitExtent, currentGeometry.getExtent())) {
- i = /** @type {number} */ (instruction[2]) + 1;
- }
- else {
- ++i;
- }
- break;
- case canvas_Instruction.BEGIN_PATH:
- if (pendingFill > batchSize) {
- this.fill_(context);
- pendingFill = 0;
- }
- if (pendingStroke > batchSize) {
- context.stroke();
- pendingStroke = 0;
- }
- if (!pendingFill && !pendingStroke) {
- context.beginPath();
- prevX = NaN;
- prevY = NaN;
- }
- ++i;
- break;
- case canvas_Instruction.CIRCLE:
- d = /** @type {number} */ (instruction[1]);
- var x1 = pixelCoordinates[d];
- var y1 = pixelCoordinates[d + 1];
- var x2 = pixelCoordinates[d + 2];
- var y2 = pixelCoordinates[d + 3];
- var dx = x2 - x1;
- var dy = y2 - y1;
- var r = Math.sqrt(dx * dx + dy * dy);
- context.moveTo(x1 + r, y1);
- context.arc(x1, y1, r, 0, 2 * Math.PI, true);
- ++i;
- break;
- case canvas_Instruction.CLOSE_PATH:
- context.closePath();
- ++i;
- break;
- case canvas_Instruction.CUSTOM:
- d = /** @type {number} */ (instruction[1]);
- dd = instruction[2];
- var geometry =
- /** @type {import("../../geom/SimpleGeometry.js").default} */ (instruction[3]);
- var renderer = instruction[4];
- var fn = instruction.length == 6 ? instruction[5] : undefined;
- state.geometry = geometry;
- state.feature = feature;
- if (!(i in coordinateCache)) {
- coordinateCache[i] = [];
- }
- var coords = coordinateCache[i];
- if (fn) {
- fn(pixelCoordinates, d, dd, 2, coords);
- }
- else {
- coords[0] = pixelCoordinates[d];
- coords[1] = pixelCoordinates[d + 1];
- coords.length = 2;
- }
- renderer(coords, state);
- ++i;
- break;
- case canvas_Instruction.DRAW_IMAGE:
- d = /** @type {number} */ (instruction[1]);
- dd = /** @type {number} */ (instruction[2]);
- image =
- /** @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} */ (instruction[3]);
- // Remaining arguments in DRAW_IMAGE are in alphabetical order
- anchorX = /** @type {number} */ (instruction[4]);
- anchorY = /** @type {number} */ (instruction[5]);
- var height = /** @type {number} */ (instruction[6]);
- var opacity = /** @type {number} */ (instruction[7]);
- var originX = /** @type {number} */ (instruction[8]);
- var originY = /** @type {number} */ (instruction[9]);
- var rotateWithView = /** @type {boolean} */ (instruction[10]);
- var rotation = /** @type {number} */ (instruction[11]);
- var scale = /** @type {import("../../size.js").Size} */ (instruction[12]);
- var width = /** @type {number} */ (instruction[13]);
- var declutterMode =
- /** @type {"declutter"|"obstacle"|"none"|undefined} */ (instruction[14]);
- var declutterImageWithText =
- /** @type {import("../canvas.js").DeclutterImageWithText} */ (instruction[15]);
- if (!image && instruction.length >= 20) {
- // create label images
- text = /** @type {string} */ (instruction[19]);
- textKey = /** @type {string} */ (instruction[20]);
- strokeKey = /** @type {string} */ (instruction[21]);
- fillKey = /** @type {string} */ (instruction[22]);
- var labelWithAnchor = this.drawLabelWithPointPlacement_(text, textKey, strokeKey, fillKey);
- image = labelWithAnchor.label;
- instruction[3] = image;
- var textOffsetX = /** @type {number} */ (instruction[23]);
- anchorX = (labelWithAnchor.anchorX - textOffsetX) * this.pixelRatio;
- instruction[4] = anchorX;
- var textOffsetY = /** @type {number} */ (instruction[24]);
- anchorY = (labelWithAnchor.anchorY - textOffsetY) * this.pixelRatio;
- instruction[5] = anchorY;
- height = image.height;
- instruction[6] = height;
- width = image.width;
- instruction[13] = width;
- }
- var geometryWidths = void 0;
- if (instruction.length > 25) {
- geometryWidths = /** @type {number} */ (instruction[25]);
- }
- var padding = void 0, backgroundFill = void 0, backgroundStroke = void 0;
- if (instruction.length > 17) {
- padding = /** @type {Array<number>} */ (instruction[16]);
- backgroundFill = /** @type {boolean} */ (instruction[17]);
- backgroundStroke = /** @type {boolean} */ (instruction[18]);
- }
- else {
- padding = defaultPadding;
- backgroundFill = false;
- backgroundStroke = false;
- }
- if (rotateWithView && viewRotationFromTransform) {
- // Canvas is expected to be rotated to reverse view rotation.
- rotation += viewRotation;
- }
- else if (!rotateWithView && !viewRotationFromTransform) {
- // Canvas is not rotated, images need to be rotated back to be north-up.
- rotation -= viewRotation;
- }
- var widthIndex = 0;
- for (; d < dd; d += 2) {
- if (geometryWidths &&
- geometryWidths[widthIndex++] < width / this.pixelRatio) {
- continue;
- }
- var dimensions = this.calculateImageOrLabelDimensions_(image.width, image.height, pixelCoordinates[d], pixelCoordinates[d + 1], width, height, anchorX, anchorY, originX, originY, rotation, scale, snapToPixel, padding, backgroundFill || backgroundStroke, feature);
- /** @type {ReplayImageOrLabelArgs} */
- var args = [
- context,
- contextScale,
- image,
- dimensions,
- opacity,
- backgroundFill
- ? /** @type {Array<*>} */ (lastFillInstruction)
- : null,
- backgroundStroke
- ? /** @type {Array<*>} */ (lastStrokeInstruction)
- : null,
- ];
- if (opt_declutterTree) {
- if (declutterMode === 'none') {
- // not rendered in declutter group
- continue;
- }
- else if (declutterMode === 'obstacle') {
- // will always be drawn, thus no collision detection, but insert as obstacle
- opt_declutterTree.insert(dimensions.declutterBox);
- continue;
- }
- else {
- var imageArgs = void 0;
- var imageDeclutterBox = void 0;
- if (declutterImageWithText) {
- var index = dd - d;
- if (!declutterImageWithText[index]) {
- // We now have the image for an image+text combination.
- declutterImageWithText[index] = args;
- // Don't render anything for now, wait for the text.
- continue;
- }
- imageArgs = declutterImageWithText[index];
- delete declutterImageWithText[index];
- imageDeclutterBox = getDeclutterBox(imageArgs);
- if (opt_declutterTree.collides(imageDeclutterBox)) {
- continue;
- }
- }
- if (opt_declutterTree.collides(dimensions.declutterBox)) {
- continue;
- }
- if (imageArgs) {
- // We now have image and text for an image+text combination.
- opt_declutterTree.insert(imageDeclutterBox);
- // Render the image before we render the text.
- this.replayImageOrLabel_.apply(this, imageArgs);
- }
- opt_declutterTree.insert(dimensions.declutterBox);
- }
- }
- this.replayImageOrLabel_.apply(this, args);
- }
- ++i;
- break;
- case canvas_Instruction.DRAW_CHARS:
- var begin = /** @type {number} */ (instruction[1]);
- var end = /** @type {number} */ (instruction[2]);
- var baseline = /** @type {number} */ (instruction[3]);
- var overflow = /** @type {number} */ (instruction[4]);
- fillKey = /** @type {string} */ (instruction[5]);
- var maxAngle = /** @type {number} */ (instruction[6]);
- var measurePixelRatio = /** @type {number} */ (instruction[7]);
- var offsetY = /** @type {number} */ (instruction[8]);
- strokeKey = /** @type {string} */ (instruction[9]);
- var strokeWidth = /** @type {number} */ (instruction[10]);
- text = /** @type {string} */ (instruction[11]);
- textKey = /** @type {string} */ (instruction[12]);
- var pixelRatioScale = [
- /** @type {number} */ (instruction[13]),
- /** @type {number} */ (instruction[13]),
- ];
- var textState = this.textStates[textKey];
- var font = textState.font;
- var textScale = [
- textState.scale[0] * measurePixelRatio,
- textState.scale[1] * measurePixelRatio,
- ];
- var cachedWidths = void 0;
- if (font in this.widths_) {
- cachedWidths = this.widths_[font];
- }
- else {
- cachedWidths = {};
- this.widths_[font] = cachedWidths;
- }
- var pathLength = lineStringLength(pixelCoordinates, begin, end, 2);
- var textLength = Math.abs(textScale[0]) *
- measureAndCacheTextWidth(font, text, cachedWidths);
- if (overflow || textLength <= pathLength) {
- var textAlign = this.textStates[textKey].textAlign;
- var startM = (pathLength - textLength) * TEXT_ALIGN[textAlign];
- var parts = drawTextOnPath(pixelCoordinates, begin, end, 2, text, startM, maxAngle, Math.abs(textScale[0]), measureAndCacheTextWidth, font, cachedWidths, viewRotationFromTransform ? 0 : this.viewRotation_);
- drawChars: if (parts) {
- /** @type {Array<ReplayImageOrLabelArgs>} */
- var replayImageOrLabelArgs = [];
- var c = void 0, cc = void 0, chars = void 0, label = void 0, part = void 0;
- if (strokeKey) {
- for (c = 0, cc = parts.length; c < cc; ++c) {
- part = parts[c]; // x, y, anchorX, rotation, chunk
- chars = /** @type {string} */ (part[4]);
- label = this.createLabel(chars, textKey, '', strokeKey);
- anchorX =
- /** @type {number} */ (part[2]) +
- (textScale[0] < 0 ? -strokeWidth : strokeWidth);
- anchorY =
- baseline * label.height +
- ((0.5 - baseline) * 2 * strokeWidth * textScale[1]) /
- textScale[0] -
- offsetY;
- var dimensions = this.calculateImageOrLabelDimensions_(label.width, label.height, part[0], part[1], label.width, label.height, anchorX, anchorY, 0, 0, part[3], pixelRatioScale, false, defaultPadding, false, feature);
- if (opt_declutterTree &&
- opt_declutterTree.collides(dimensions.declutterBox)) {
- break drawChars;
- }
- replayImageOrLabelArgs.push([
- context,
- contextScale,
- label,
- dimensions,
- 1,
- null,
- null,
- ]);
- }
- }
- if (fillKey) {
- for (c = 0, cc = parts.length; c < cc; ++c) {
- part = parts[c]; // x, y, anchorX, rotation, chunk
- chars = /** @type {string} */ (part[4]);
- label = this.createLabel(chars, textKey, fillKey, '');
- anchorX = /** @type {number} */ (part[2]);
- anchorY = baseline * label.height - offsetY;
- var dimensions = this.calculateImageOrLabelDimensions_(label.width, label.height, part[0], part[1], label.width, label.height, anchorX, anchorY, 0, 0, part[3], pixelRatioScale, false, defaultPadding, false, feature);
- if (opt_declutterTree &&
- opt_declutterTree.collides(dimensions.declutterBox)) {
- break drawChars;
- }
- replayImageOrLabelArgs.push([
- context,
- contextScale,
- label,
- dimensions,
- 1,
- null,
- null,
- ]);
- }
- }
- if (opt_declutterTree) {
- opt_declutterTree.load(replayImageOrLabelArgs.map(getDeclutterBox));
- }
- for (var i_1 = 0, ii_1 = replayImageOrLabelArgs.length; i_1 < ii_1; ++i_1) {
- this.replayImageOrLabel_.apply(this, replayImageOrLabelArgs[i_1]);
- }
- }
- }
- ++i;
- break;
- case canvas_Instruction.END_GEOMETRY:
- if (opt_featureCallback !== undefined) {
- feature = /** @type {import("../../Feature.js").FeatureLike} */ (instruction[1]);
- var result = opt_featureCallback(feature, currentGeometry);
- if (result) {
- return result;
- }
- }
- ++i;
- break;
- case canvas_Instruction.FILL:
- if (batchSize) {
- pendingFill++;
- }
- else {
- this.fill_(context);
- }
- ++i;
- break;
- case canvas_Instruction.MOVE_TO_LINE_TO:
- d = /** @type {number} */ (instruction[1]);
- dd = /** @type {number} */ (instruction[2]);
- x = pixelCoordinates[d];
- y = pixelCoordinates[d + 1];
- roundX = (x + 0.5) | 0;
- roundY = (y + 0.5) | 0;
- if (roundX !== prevX || roundY !== prevY) {
- context.moveTo(x, y);
- prevX = roundX;
- prevY = roundY;
- }
- for (d += 2; d < dd; d += 2) {
- x = pixelCoordinates[d];
- y = pixelCoordinates[d + 1];
- roundX = (x + 0.5) | 0;
- roundY = (y + 0.5) | 0;
- if (d == dd - 2 || roundX !== prevX || roundY !== prevY) {
- context.lineTo(x, y);
- prevX = roundX;
- prevY = roundY;
- }
- }
- ++i;
- break;
- case canvas_Instruction.SET_FILL_STYLE:
- lastFillInstruction = instruction;
- this.alignFill_ = instruction[2];
- if (pendingFill) {
- this.fill_(context);
- pendingFill = 0;
- if (pendingStroke) {
- context.stroke();
- pendingStroke = 0;
- }
- }
- context.fillStyle =
- /** @type {import("../../colorlike.js").ColorLike} */ (instruction[1]);
- ++i;
- break;
- case canvas_Instruction.SET_STROKE_STYLE:
- lastStrokeInstruction = instruction;
- if (pendingStroke) {
- context.stroke();
- pendingStroke = 0;
- }
- this.setStrokeStyle_(context, /** @type {Array<*>} */ (instruction));
- ++i;
- break;
- case canvas_Instruction.STROKE:
- if (batchSize) {
- pendingStroke++;
- }
- else {
- context.stroke();
- }
- ++i;
- break;
- default: // consume the instruction anyway, to avoid an infinite loop
- ++i;
- break;
- }
- }
- if (pendingFill) {
- this.fill_(context);
- }
- if (pendingStroke) {
- context.stroke();
- }
- return undefined;
- };
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {number} contextScale Scale of the context.
- * @param {import("../../transform.js").Transform} transform Transform.
- * @param {number} viewRotation View rotation.
- * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
- * @param {import("rbush").default} [opt_declutterTree] Declutter tree.
- */
- Executor.prototype.execute = function (context, contextScale, transform, viewRotation, snapToPixel, opt_declutterTree) {
- this.viewRotation_ = viewRotation;
- this.execute_(context, contextScale, transform, this.instructions, snapToPixel, undefined, undefined, opt_declutterTree);
- };
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {import("../../transform.js").Transform} transform Transform.
- * @param {number} viewRotation View rotation.
- * @param {FeatureCallback<T>} [opt_featureCallback] Feature callback.
- * @param {import("../../extent.js").Extent} [opt_hitExtent] Only check
- * features that intersect this extent.
- * @return {T|undefined} Callback result.
- * @template T
- */
- Executor.prototype.executeHitDetection = function (context, transform, viewRotation, opt_featureCallback, opt_hitExtent) {
- this.viewRotation_ = viewRotation;
- return this.execute_(context, 1, transform, this.hitDetectionInstructions, true, opt_featureCallback, opt_hitExtent);
- };
- return Executor;
- }());
- /* harmony default export */ var canvas_Executor = (Executor);
- //# sourceMappingURL=Executor.js.map
- ;// ./node_modules/ol/render/canvas/ExecutorGroup.js
- /**
- * @module ol/render/canvas/ExecutorGroup
- */
- /**
- * @const
- * @type {Array<import("../canvas.js").BuilderType>}
- */
- var ORDER = ['Polygon', 'Circle', 'LineString', 'Image', 'Text', 'Default'];
- var ExecutorGroup = /** @class */ (function () {
- /**
- * @param {import("../../extent.js").Extent} maxExtent Max extent for clipping. When a
- * `maxExtent` was set on the Builder for this executor group, the same `maxExtent`
- * should be set here, unless the target context does not exceed that extent (which
- * can be the case when rendering to tiles).
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- * @param {boolean} overlaps The executor group can have overlapping geometries.
- * @param {!Object<string, !Object<import("../canvas.js").BuilderType, import("../canvas.js").SerializableInstructions>>} allInstructions
- * The serializable instructions.
- * @param {number} [opt_renderBuffer] Optional rendering buffer.
- */
- function ExecutorGroup(maxExtent, resolution, pixelRatio, overlaps, allInstructions, opt_renderBuffer) {
- /**
- * @private
- * @type {import("../../extent.js").Extent}
- */
- this.maxExtent_ = maxExtent;
- /**
- * @private
- * @type {boolean}
- */
- this.overlaps_ = overlaps;
- /**
- * @private
- * @type {number}
- */
- this.pixelRatio_ = pixelRatio;
- /**
- * @private
- * @type {number}
- */
- this.resolution_ = resolution;
- /**
- * @private
- * @type {number|undefined}
- */
- this.renderBuffer_ = opt_renderBuffer;
- /**
- * @private
- * @type {!Object<string, !Object<import("../canvas.js").BuilderType, import("./Executor").default>>}
- */
- this.executorsByZIndex_ = {};
- /**
- * @private
- * @type {CanvasRenderingContext2D}
- */
- this.hitDetectionContext_ = null;
- /**
- * @private
- * @type {import("../../transform.js").Transform}
- */
- this.hitDetectionTransform_ = create();
- this.createExecutors_(allInstructions);
- }
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {import("../../transform.js").Transform} transform Transform.
- */
- ExecutorGroup.prototype.clip = function (context, transform) {
- var flatClipCoords = this.getClipCoords(transform);
- context.beginPath();
- context.moveTo(flatClipCoords[0], flatClipCoords[1]);
- context.lineTo(flatClipCoords[2], flatClipCoords[3]);
- context.lineTo(flatClipCoords[4], flatClipCoords[5]);
- context.lineTo(flatClipCoords[6], flatClipCoords[7]);
- context.clip();
- };
- /**
- * Create executors and populate them using the provided instructions.
- * @private
- * @param {!Object<string, !Object<import("../canvas.js").BuilderType, import("../canvas.js").SerializableInstructions>>} allInstructions The serializable instructions
- */
- ExecutorGroup.prototype.createExecutors_ = function (allInstructions) {
- for (var zIndex in allInstructions) {
- var executors = this.executorsByZIndex_[zIndex];
- if (executors === undefined) {
- executors = {};
- this.executorsByZIndex_[zIndex] = executors;
- }
- var instructionByZindex = allInstructions[zIndex];
- for (var builderType in instructionByZindex) {
- var instructions = instructionByZindex[builderType];
- executors[builderType] = new canvas_Executor(this.resolution_, this.pixelRatio_, this.overlaps_, instructions);
- }
- }
- };
- /**
- * @param {Array<import("../canvas.js").BuilderType>} executors Executors.
- * @return {boolean} Has executors of the provided types.
- */
- ExecutorGroup.prototype.hasExecutors = function (executors) {
- for (var zIndex in this.executorsByZIndex_) {
- var candidates = this.executorsByZIndex_[zIndex];
- for (var i = 0, ii = executors.length; i < ii; ++i) {
- if (executors[i] in candidates) {
- return true;
- }
- }
- }
- return false;
- };
- /**
- * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {number} resolution Resolution.
- * @param {number} rotation Rotation.
- * @param {number} hitTolerance Hit tolerance in pixels.
- * @param {function(import("../../Feature.js").FeatureLike, import("../../geom/SimpleGeometry.js").default, number): T} callback Feature callback.
- * @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
- * @return {T|undefined} Callback result.
- * @template T
- */
- ExecutorGroup.prototype.forEachFeatureAtCoordinate = function (coordinate, resolution, rotation, hitTolerance, callback, declutteredFeatures) {
- hitTolerance = Math.round(hitTolerance);
- var contextSize = hitTolerance * 2 + 1;
- var transform = compose(this.hitDetectionTransform_, hitTolerance + 0.5, hitTolerance + 0.5, 1 / resolution, -1 / resolution, -rotation, -coordinate[0], -coordinate[1]);
- var newContext = !this.hitDetectionContext_;
- if (newContext) {
- this.hitDetectionContext_ = createCanvasContext2D(contextSize, contextSize);
- }
- var context = this.hitDetectionContext_;
- if (context.canvas.width !== contextSize ||
- context.canvas.height !== contextSize) {
- context.canvas.width = contextSize;
- context.canvas.height = contextSize;
- }
- else if (!newContext) {
- context.clearRect(0, 0, contextSize, contextSize);
- }
- /**
- * @type {import("../../extent.js").Extent}
- */
- var hitExtent;
- if (this.renderBuffer_ !== undefined) {
- hitExtent = createEmpty();
- extendCoordinate(hitExtent, coordinate);
- buffer(hitExtent, resolution * (this.renderBuffer_ + hitTolerance), hitExtent);
- }
- var indexes = getPixelIndexArray(hitTolerance);
- var builderType;
- /**
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- * @param {import("../../geom/SimpleGeometry.js").default} geometry Geometry.
- * @return {T|undefined} Callback result.
- */
- function featureCallback(feature, geometry) {
- var imageData = context.getImageData(0, 0, contextSize, contextSize).data;
- for (var i_1 = 0, ii = indexes.length; i_1 < ii; i_1++) {
- if (imageData[indexes[i_1]] > 0) {
- if (!declutteredFeatures ||
- (builderType !== 'Image' && builderType !== 'Text') ||
- declutteredFeatures.indexOf(feature) !== -1) {
- var idx = (indexes[i_1] - 3) / 4;
- var x = hitTolerance - (idx % contextSize);
- var y = hitTolerance - ((idx / contextSize) | 0);
- var result_1 = callback(feature, geometry, x * x + y * y);
- if (result_1) {
- return result_1;
- }
- }
- context.clearRect(0, 0, contextSize, contextSize);
- break;
- }
- }
- return undefined;
- }
- /** @type {Array<number>} */
- var zs = Object.keys(this.executorsByZIndex_).map(Number);
- zs.sort(numberSafeCompareFunction);
- var i, j, executors, executor, result;
- for (i = zs.length - 1; i >= 0; --i) {
- var zIndexKey = zs[i].toString();
- executors = this.executorsByZIndex_[zIndexKey];
- for (j = ORDER.length - 1; j >= 0; --j) {
- builderType = ORDER[j];
- executor = executors[builderType];
- if (executor !== undefined) {
- result = executor.executeHitDetection(context, transform, rotation, featureCallback, hitExtent);
- if (result) {
- return result;
- }
- }
- }
- }
- return undefined;
- };
- /**
- * @param {import("../../transform.js").Transform} transform Transform.
- * @return {Array<number>|null} Clip coordinates.
- */
- ExecutorGroup.prototype.getClipCoords = function (transform) {
- var maxExtent = this.maxExtent_;
- if (!maxExtent) {
- return null;
- }
- var minX = maxExtent[0];
- var minY = maxExtent[1];
- var maxX = maxExtent[2];
- var maxY = maxExtent[3];
- var flatClipCoords = [minX, minY, minX, maxY, maxX, maxY, maxX, minY];
- transform2D(flatClipCoords, 0, 8, 2, transform, flatClipCoords);
- return flatClipCoords;
- };
- /**
- * @return {boolean} Is empty.
- */
- ExecutorGroup.prototype.isEmpty = function () {
- return obj_isEmpty(this.executorsByZIndex_);
- };
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {number} contextScale Scale of the context.
- * @param {import("../../transform.js").Transform} transform Transform.
- * @param {number} viewRotation View rotation.
- * @param {boolean} snapToPixel Snap point symbols and test to integer pixel.
- * @param {Array<import("../canvas.js").BuilderType>} [opt_builderTypes] Ordered replay types to replay.
- * Default is {@link module:ol/render/replay~ORDER}
- * @param {import("rbush").default} [opt_declutterTree] Declutter tree.
- */
- ExecutorGroup.prototype.execute = function (context, contextScale, transform, viewRotation, snapToPixel, opt_builderTypes, opt_declutterTree) {
- /** @type {Array<number>} */
- var zs = Object.keys(this.executorsByZIndex_).map(Number);
- zs.sort(numberSafeCompareFunction);
- // setup clipping so that the parts of over-simplified geometries are not
- // visible outside the current extent when panning
- if (this.maxExtent_) {
- context.save();
- this.clip(context, transform);
- }
- var builderTypes = opt_builderTypes ? opt_builderTypes : ORDER;
- var i, ii, j, jj, replays, replay;
- if (opt_declutterTree) {
- zs.reverse();
- }
- for (i = 0, ii = zs.length; i < ii; ++i) {
- var zIndexKey = zs[i].toString();
- replays = this.executorsByZIndex_[zIndexKey];
- for (j = 0, jj = builderTypes.length; j < jj; ++j) {
- var builderType = builderTypes[j];
- replay = replays[builderType];
- if (replay !== undefined) {
- replay.execute(context, contextScale, transform, viewRotation, snapToPixel, opt_declutterTree);
- }
- }
- }
- if (this.maxExtent_) {
- context.restore();
- }
- };
- return ExecutorGroup;
- }());
- /**
- * This cache is used to store arrays of indexes for calculated pixel circles
- * to increase performance.
- * It is a static property to allow each Replaygroup to access it.
- * @type {Object<number, Array<number>>}
- */
- var circlePixelIndexArrayCache = {};
- /**
- * This methods creates an array with indexes of all pixels within a circle,
- * ordered by how close they are to the center.
- * A cache is used to increase performance.
- * @param {number} radius Radius.
- * @return {Array<number>} An array with indexes within a circle.
- */
- function getPixelIndexArray(radius) {
- if (circlePixelIndexArrayCache[radius] !== undefined) {
- return circlePixelIndexArrayCache[radius];
- }
- var size = radius * 2 + 1;
- var maxDistanceSq = radius * radius;
- var distances = new Array(maxDistanceSq + 1);
- for (var i = 0; i <= radius; ++i) {
- for (var j = 0; j <= radius; ++j) {
- var distanceSq = i * i + j * j;
- if (distanceSq > maxDistanceSq) {
- break;
- }
- var distance = distances[distanceSq];
- if (!distance) {
- distance = [];
- distances[distanceSq] = distance;
- }
- distance.push(((radius + i) * size + (radius + j)) * 4 + 3);
- if (i > 0) {
- distance.push(((radius - i) * size + (radius + j)) * 4 + 3);
- }
- if (j > 0) {
- distance.push(((radius + i) * size + (radius - j)) * 4 + 3);
- if (i > 0) {
- distance.push(((radius - i) * size + (radius - j)) * 4 + 3);
- }
- }
- }
- }
- var pixelIndex = [];
- for (var i = 0, ii = distances.length; i < ii; ++i) {
- if (distances[i]) {
- pixelIndex.push.apply(pixelIndex, distances[i]);
- }
- }
- circlePixelIndexArrayCache[radius] = pixelIndex;
- return pixelIndex;
- }
- /* harmony default export */ var canvas_ExecutorGroup = (ExecutorGroup);
- //# sourceMappingURL=ExecutorGroup.js.map
- ;// ./node_modules/ol/ViewHint.js
- /**
- * @module ol/ViewHint
- */
- /**
- * @enum {number}
- */
- /* harmony default export */ var ViewHint = ({
- ANIMATING: 0,
- INTERACTING: 1,
- });
- //# sourceMappingURL=ViewHint.js.map
- ;// ./node_modules/ol/render/canvas/Immediate.js
- /**
- * @module ol/render/canvas/Immediate
- */
- // FIXME test, especially polygons with holes and multipolygons
- // FIXME need to handle large thick features (where pixel size matters)
- // FIXME add offset and end to ol/geom/flat/transform~transform2D?
- var Immediate_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @classdesc
- * A concrete subclass of {@link module:ol/render/VectorContext~VectorContext VectorContext} that implements
- * direct rendering of features and geometries to an HTML5 Canvas context.
- * Instances of this class are created internally by the library and
- * provided to application code as vectorContext member of the
- * {@link module:ol/render/Event~RenderEvent RenderEvent} object associated with postcompose, precompose and
- * render events emitted by layers and maps.
- */
- var CanvasImmediateRenderer = /** @class */ (function (_super) {
- Immediate_extends(CanvasImmediateRenderer, _super);
- /**
- * @param {CanvasRenderingContext2D} context Context.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("../../extent.js").Extent} extent Extent.
- * @param {import("../../transform.js").Transform} transform Transform.
- * @param {number} viewRotation View rotation.
- * @param {number} [opt_squaredTolerance] Optional squared tolerance for simplification.
- * @param {import("../../proj.js").TransformFunction} [opt_userTransform] Transform from user to view projection.
- */
- function CanvasImmediateRenderer(context, pixelRatio, extent, transform, viewRotation, opt_squaredTolerance, opt_userTransform) {
- var _this = _super.call(this) || this;
- /**
- * @private
- * @type {CanvasRenderingContext2D}
- */
- _this.context_ = context;
- /**
- * @private
- * @type {number}
- */
- _this.pixelRatio_ = pixelRatio;
- /**
- * @private
- * @type {import("../../extent.js").Extent}
- */
- _this.extent_ = extent;
- /**
- * @private
- * @type {import("../../transform.js").Transform}
- */
- _this.transform_ = transform;
- /**
- * @private
- * @type {number}
- */
- _this.viewRotation_ = viewRotation;
- /**
- * @private
- * @type {number}
- */
- _this.squaredTolerance_ = opt_squaredTolerance;
- /**
- * @private
- * @type {import("../../proj.js").TransformFunction}
- */
- _this.userTransform_ = opt_userTransform;
- /**
- * @private
- * @type {?import("../canvas.js").FillState}
- */
- _this.contextFillState_ = null;
- /**
- * @private
- * @type {?import("../canvas.js").StrokeState}
- */
- _this.contextStrokeState_ = null;
- /**
- * @private
- * @type {?import("../canvas.js").TextState}
- */
- _this.contextTextState_ = null;
- /**
- * @private
- * @type {?import("../canvas.js").FillState}
- */
- _this.fillState_ = null;
- /**
- * @private
- * @type {?import("../canvas.js").StrokeState}
- */
- _this.strokeState_ = null;
- /**
- * @private
- * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
- */
- _this.image_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.imageAnchorX_ = 0;
- /**
- * @private
- * @type {number}
- */
- _this.imageAnchorY_ = 0;
- /**
- * @private
- * @type {number}
- */
- _this.imageHeight_ = 0;
- /**
- * @private
- * @type {number}
- */
- _this.imageOpacity_ = 0;
- /**
- * @private
- * @type {number}
- */
- _this.imageOriginX_ = 0;
- /**
- * @private
- * @type {number}
- */
- _this.imageOriginY_ = 0;
- /**
- * @private
- * @type {boolean}
- */
- _this.imageRotateWithView_ = false;
- /**
- * @private
- * @type {number}
- */
- _this.imageRotation_ = 0;
- /**
- * @private
- * @type {import("../../size.js").Size}
- */
- _this.imageScale_ = [0, 0];
- /**
- * @private
- * @type {number}
- */
- _this.imageWidth_ = 0;
- /**
- * @private
- * @type {string}
- */
- _this.text_ = '';
- /**
- * @private
- * @type {number}
- */
- _this.textOffsetX_ = 0;
- /**
- * @private
- * @type {number}
- */
- _this.textOffsetY_ = 0;
- /**
- * @private
- * @type {boolean}
- */
- _this.textRotateWithView_ = false;
- /**
- * @private
- * @type {number}
- */
- _this.textRotation_ = 0;
- /**
- * @private
- * @type {import("../../size.js").Size}
- */
- _this.textScale_ = [0, 0];
- /**
- * @private
- * @type {?import("../canvas.js").FillState}
- */
- _this.textFillState_ = null;
- /**
- * @private
- * @type {?import("../canvas.js").StrokeState}
- */
- _this.textStrokeState_ = null;
- /**
- * @private
- * @type {?import("../canvas.js").TextState}
- */
- _this.textState_ = null;
- /**
- * @private
- * @type {Array<number>}
- */
- _this.pixelCoordinates_ = [];
- /**
- * @private
- * @type {import("../../transform.js").Transform}
- */
- _this.tmpLocalTransform_ = create();
- return _this;
- }
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @private
- */
- CanvasImmediateRenderer.prototype.drawImages_ = function (flatCoordinates, offset, end, stride) {
- if (!this.image_) {
- return;
- }
- var pixelCoordinates = transform2D(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_);
- var context = this.context_;
- var localTransform = this.tmpLocalTransform_;
- var alpha = context.globalAlpha;
- if (this.imageOpacity_ != 1) {
- context.globalAlpha = alpha * this.imageOpacity_;
- }
- var rotation = this.imageRotation_;
- if (this.imageRotateWithView_) {
- rotation += this.viewRotation_;
- }
- for (var i = 0, ii = pixelCoordinates.length; i < ii; i += 2) {
- var x = pixelCoordinates[i] - this.imageAnchorX_;
- var y = pixelCoordinates[i + 1] - this.imageAnchorY_;
- if (rotation !== 0 ||
- this.imageScale_[0] != 1 ||
- this.imageScale_[1] != 1) {
- var centerX = x + this.imageAnchorX_;
- var centerY = y + this.imageAnchorY_;
- compose(localTransform, centerX, centerY, 1, 1, rotation, -centerX, -centerY);
- context.setTransform.apply(context, localTransform);
- context.translate(centerX, centerY);
- context.scale(this.imageScale_[0], this.imageScale_[1]);
- context.drawImage(this.image_, this.imageOriginX_, this.imageOriginY_, this.imageWidth_, this.imageHeight_, -this.imageAnchorX_, -this.imageAnchorY_, this.imageWidth_, this.imageHeight_);
- context.setTransform(1, 0, 0, 1, 0, 0);
- }
- else {
- context.drawImage(this.image_, this.imageOriginX_, this.imageOriginY_, this.imageWidth_, this.imageHeight_, x, y, this.imageWidth_, this.imageHeight_);
- }
- }
- if (this.imageOpacity_ != 1) {
- context.globalAlpha = alpha;
- }
- };
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @private
- */
- CanvasImmediateRenderer.prototype.drawText_ = function (flatCoordinates, offset, end, stride) {
- if (!this.textState_ || this.text_ === '') {
- return;
- }
- if (this.textFillState_) {
- this.setContextFillState_(this.textFillState_);
- }
- if (this.textStrokeState_) {
- this.setContextStrokeState_(this.textStrokeState_);
- }
- this.setContextTextState_(this.textState_);
- var pixelCoordinates = transform2D(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_);
- var context = this.context_;
- var rotation = this.textRotation_;
- if (this.textRotateWithView_) {
- rotation += this.viewRotation_;
- }
- for (; offset < end; offset += stride) {
- var x = pixelCoordinates[offset] + this.textOffsetX_;
- var y = pixelCoordinates[offset + 1] + this.textOffsetY_;
- if (rotation !== 0 ||
- this.textScale_[0] != 1 ||
- this.textScale_[1] != 1) {
- var localTransform = compose(this.tmpLocalTransform_, x, y, 1, 1, rotation, -x, -y);
- context.setTransform.apply(context, localTransform);
- context.translate(x, y);
- context.scale(this.textScale_[0], this.textScale_[1]);
- if (this.textStrokeState_) {
- context.strokeText(this.text_, 0, 0);
- }
- if (this.textFillState_) {
- context.fillText(this.text_, 0, 0);
- }
- context.setTransform(1, 0, 0, 1, 0, 0);
- }
- else {
- if (this.textStrokeState_) {
- context.strokeText(this.text_, x, y);
- }
- if (this.textFillState_) {
- context.fillText(this.text_, x, y);
- }
- }
- }
- };
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {number} end End.
- * @param {number} stride Stride.
- * @param {boolean} close Close.
- * @private
- * @return {number} end End.
- */
- CanvasImmediateRenderer.prototype.moveToLineTo_ = function (flatCoordinates, offset, end, stride, close) {
- var context = this.context_;
- var pixelCoordinates = transform2D(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_);
- context.moveTo(pixelCoordinates[0], pixelCoordinates[1]);
- var length = pixelCoordinates.length;
- if (close) {
- length -= 2;
- }
- for (var i = 2; i < length; i += 2) {
- context.lineTo(pixelCoordinates[i], pixelCoordinates[i + 1]);
- }
- if (close) {
- context.closePath();
- }
- return end;
- };
- /**
- * @param {Array<number>} flatCoordinates Flat coordinates.
- * @param {number} offset Offset.
- * @param {Array<number>} ends Ends.
- * @param {number} stride Stride.
- * @private
- * @return {number} End.
- */
- CanvasImmediateRenderer.prototype.drawRings_ = function (flatCoordinates, offset, ends, stride) {
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- offset = this.moveToLineTo_(flatCoordinates, offset, ends[i], stride, true);
- }
- return offset;
- };
- /**
- * Render a circle geometry into the canvas. Rendering is immediate and uses
- * the current fill and stroke styles.
- *
- * @param {import("../../geom/Circle.js").default} geometry Circle geometry.
- * @api
- */
- CanvasImmediateRenderer.prototype.drawCircle = function (geometry) {
- if (!intersects(this.extent_, geometry.getExtent())) {
- return;
- }
- if (this.fillState_ || this.strokeState_) {
- if (this.fillState_) {
- this.setContextFillState_(this.fillState_);
- }
- if (this.strokeState_) {
- this.setContextStrokeState_(this.strokeState_);
- }
- var pixelCoordinates = transformGeom2D(geometry, this.transform_, this.pixelCoordinates_);
- var dx = pixelCoordinates[2] - pixelCoordinates[0];
- var dy = pixelCoordinates[3] - pixelCoordinates[1];
- var radius = Math.sqrt(dx * dx + dy * dy);
- var context = this.context_;
- context.beginPath();
- context.arc(pixelCoordinates[0], pixelCoordinates[1], radius, 0, 2 * Math.PI);
- if (this.fillState_) {
- context.fill();
- }
- if (this.strokeState_) {
- context.stroke();
- }
- }
- if (this.text_ !== '') {
- this.drawText_(geometry.getCenter(), 0, 2, 2);
- }
- };
- /**
- * Set the rendering style. Note that since this is an immediate rendering API,
- * any `zIndex` on the provided style will be ignored.
- *
- * @param {import("../../style/Style.js").default} style The rendering style.
- * @api
- */
- CanvasImmediateRenderer.prototype.setStyle = function (style) {
- this.setFillStrokeStyle(style.getFill(), style.getStroke());
- this.setImageStyle(style.getImage());
- this.setTextStyle(style.getText());
- };
- /**
- * @param {import("../../transform.js").Transform} transform Transform.
- */
- CanvasImmediateRenderer.prototype.setTransform = function (transform) {
- this.transform_ = transform;
- };
- /**
- * Render a geometry into the canvas. Call
- * {@link module:ol/render/canvas/Immediate~CanvasImmediateRenderer#setStyle renderer.setStyle()} first to set the rendering style.
- *
- * @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render.
- * @api
- */
- CanvasImmediateRenderer.prototype.drawGeometry = function (geometry) {
- var type = geometry.getType();
- switch (type) {
- case 'Point':
- this.drawPoint(
- /** @type {import("../../geom/Point.js").default} */ (geometry));
- break;
- case 'LineString':
- this.drawLineString(
- /** @type {import("../../geom/LineString.js").default} */ (geometry));
- break;
- case 'Polygon':
- this.drawPolygon(
- /** @type {import("../../geom/Polygon.js").default} */ (geometry));
- break;
- case 'MultiPoint':
- this.drawMultiPoint(
- /** @type {import("../../geom/MultiPoint.js").default} */ (geometry));
- break;
- case 'MultiLineString':
- this.drawMultiLineString(
- /** @type {import("../../geom/MultiLineString.js").default} */ (geometry));
- break;
- case 'MultiPolygon':
- this.drawMultiPolygon(
- /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry));
- break;
- case 'GeometryCollection':
- this.drawGeometryCollection(
- /** @type {import("../../geom/GeometryCollection.js").default} */ (geometry));
- break;
- case 'Circle':
- this.drawCircle(
- /** @type {import("../../geom/Circle.js").default} */ (geometry));
- break;
- default:
- }
- };
- /**
- * Render a feature into the canvas. Note that any `zIndex` on the provided
- * style will be ignored - features are rendered immediately in the order that
- * this method is called. If you need `zIndex` support, you should be using an
- * {@link module:ol/layer/Vector~VectorLayer VectorLayer} instead.
- *
- * @param {import("../../Feature.js").default} feature Feature.
- * @param {import("../../style/Style.js").default} style Style.
- * @api
- */
- CanvasImmediateRenderer.prototype.drawFeature = function (feature, style) {
- var geometry = style.getGeometryFunction()(feature);
- if (!geometry || !intersects(this.extent_, geometry.getExtent())) {
- return;
- }
- this.setStyle(style);
- this.drawGeometry(geometry);
- };
- /**
- * Render a GeometryCollection to the canvas. Rendering is immediate and
- * uses the current styles appropriate for each geometry in the collection.
- *
- * @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection.
- */
- CanvasImmediateRenderer.prototype.drawGeometryCollection = function (geometry) {
- var geometries = geometry.getGeometriesArray();
- for (var i = 0, ii = geometries.length; i < ii; ++i) {
- this.drawGeometry(geometries[i]);
- }
- };
- /**
- * Render a Point geometry into the canvas. Rendering is immediate and uses
- * the current style.
- *
- * @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry.
- */
- CanvasImmediateRenderer.prototype.drawPoint = function (geometry) {
- if (this.squaredTolerance_) {
- geometry = /** @type {import("../../geom/Point.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
- }
- var flatCoordinates = geometry.getFlatCoordinates();
- var stride = geometry.getStride();
- if (this.image_) {
- this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
- }
- if (this.text_ !== '') {
- this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);
- }
- };
- /**
- * Render a MultiPoint geometry into the canvas. Rendering is immediate and
- * uses the current style.
- *
- * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry.
- */
- CanvasImmediateRenderer.prototype.drawMultiPoint = function (geometry) {
- if (this.squaredTolerance_) {
- geometry = /** @type {import("../../geom/MultiPoint.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
- }
- var flatCoordinates = geometry.getFlatCoordinates();
- var stride = geometry.getStride();
- if (this.image_) {
- this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
- }
- if (this.text_ !== '') {
- this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);
- }
- };
- /**
- * Render a LineString into the canvas. Rendering is immediate and uses
- * the current style.
- *
- * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry.
- */
- CanvasImmediateRenderer.prototype.drawLineString = function (geometry) {
- if (this.squaredTolerance_) {
- geometry = /** @type {import("../../geom/LineString.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
- }
- if (!intersects(this.extent_, geometry.getExtent())) {
- return;
- }
- if (this.strokeState_) {
- this.setContextStrokeState_(this.strokeState_);
- var context = this.context_;
- var flatCoordinates = geometry.getFlatCoordinates();
- context.beginPath();
- this.moveToLineTo_(flatCoordinates, 0, flatCoordinates.length, geometry.getStride(), false);
- context.stroke();
- }
- if (this.text_ !== '') {
- var flatMidpoint = geometry.getFlatMidpoint();
- this.drawText_(flatMidpoint, 0, 2, 2);
- }
- };
- /**
- * Render a MultiLineString geometry into the canvas. Rendering is immediate
- * and uses the current style.
- *
- * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry.
- */
- CanvasImmediateRenderer.prototype.drawMultiLineString = function (geometry) {
- if (this.squaredTolerance_) {
- geometry =
- /** @type {import("../../geom/MultiLineString.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
- }
- var geometryExtent = geometry.getExtent();
- if (!intersects(this.extent_, geometryExtent)) {
- return;
- }
- if (this.strokeState_) {
- this.setContextStrokeState_(this.strokeState_);
- var context = this.context_;
- var flatCoordinates = geometry.getFlatCoordinates();
- var offset = 0;
- var ends = /** @type {Array<number>} */ (geometry.getEnds());
- var stride = geometry.getStride();
- context.beginPath();
- for (var i = 0, ii = ends.length; i < ii; ++i) {
- offset = this.moveToLineTo_(flatCoordinates, offset, ends[i], stride, false);
- }
- context.stroke();
- }
- if (this.text_ !== '') {
- var flatMidpoints = geometry.getFlatMidpoints();
- this.drawText_(flatMidpoints, 0, flatMidpoints.length, 2);
- }
- };
- /**
- * Render a Polygon geometry into the canvas. Rendering is immediate and uses
- * the current style.
- *
- * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry.
- */
- CanvasImmediateRenderer.prototype.drawPolygon = function (geometry) {
- if (this.squaredTolerance_) {
- geometry = /** @type {import("../../geom/Polygon.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
- }
- if (!intersects(this.extent_, geometry.getExtent())) {
- return;
- }
- if (this.strokeState_ || this.fillState_) {
- if (this.fillState_) {
- this.setContextFillState_(this.fillState_);
- }
- if (this.strokeState_) {
- this.setContextStrokeState_(this.strokeState_);
- }
- var context = this.context_;
- context.beginPath();
- this.drawRings_(geometry.getOrientedFlatCoordinates(), 0,
- /** @type {Array<number>} */ (geometry.getEnds()), geometry.getStride());
- if (this.fillState_) {
- context.fill();
- }
- if (this.strokeState_) {
- context.stroke();
- }
- }
- if (this.text_ !== '') {
- var flatInteriorPoint = geometry.getFlatInteriorPoint();
- this.drawText_(flatInteriorPoint, 0, 2, 2);
- }
- };
- /**
- * Render MultiPolygon geometry into the canvas. Rendering is immediate and
- * uses the current style.
- * @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
- */
- CanvasImmediateRenderer.prototype.drawMultiPolygon = function (geometry) {
- if (this.squaredTolerance_) {
- geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
- }
- if (!intersects(this.extent_, geometry.getExtent())) {
- return;
- }
- if (this.strokeState_ || this.fillState_) {
- if (this.fillState_) {
- this.setContextFillState_(this.fillState_);
- }
- if (this.strokeState_) {
- this.setContextStrokeState_(this.strokeState_);
- }
- var context = this.context_;
- var flatCoordinates = geometry.getOrientedFlatCoordinates();
- var offset = 0;
- var endss = geometry.getEndss();
- var stride = geometry.getStride();
- context.beginPath();
- for (var i = 0, ii = endss.length; i < ii; ++i) {
- var ends = endss[i];
- offset = this.drawRings_(flatCoordinates, offset, ends, stride);
- }
- if (this.fillState_) {
- context.fill();
- }
- if (this.strokeState_) {
- context.stroke();
- }
- }
- if (this.text_ !== '') {
- var flatInteriorPoints = geometry.getFlatInteriorPoints();
- this.drawText_(flatInteriorPoints, 0, flatInteriorPoints.length, 2);
- }
- };
- /**
- * @param {import("../canvas.js").FillState} fillState Fill state.
- * @private
- */
- CanvasImmediateRenderer.prototype.setContextFillState_ = function (fillState) {
- var context = this.context_;
- var contextFillState = this.contextFillState_;
- if (!contextFillState) {
- context.fillStyle = fillState.fillStyle;
- this.contextFillState_ = {
- fillStyle: fillState.fillStyle,
- };
- }
- else {
- if (contextFillState.fillStyle != fillState.fillStyle) {
- contextFillState.fillStyle = fillState.fillStyle;
- context.fillStyle = fillState.fillStyle;
- }
- }
- };
- /**
- * @param {import("../canvas.js").StrokeState} strokeState Stroke state.
- * @private
- */
- CanvasImmediateRenderer.prototype.setContextStrokeState_ = function (strokeState) {
- var context = this.context_;
- var contextStrokeState = this.contextStrokeState_;
- if (!contextStrokeState) {
- context.lineCap = strokeState.lineCap;
- if (context.setLineDash) {
- context.setLineDash(strokeState.lineDash);
- context.lineDashOffset = strokeState.lineDashOffset;
- }
- context.lineJoin = strokeState.lineJoin;
- context.lineWidth = strokeState.lineWidth;
- context.miterLimit = strokeState.miterLimit;
- context.strokeStyle = strokeState.strokeStyle;
- this.contextStrokeState_ = {
- lineCap: strokeState.lineCap,
- lineDash: strokeState.lineDash,
- lineDashOffset: strokeState.lineDashOffset,
- lineJoin: strokeState.lineJoin,
- lineWidth: strokeState.lineWidth,
- miterLimit: strokeState.miterLimit,
- strokeStyle: strokeState.strokeStyle,
- };
- }
- else {
- if (contextStrokeState.lineCap != strokeState.lineCap) {
- contextStrokeState.lineCap = strokeState.lineCap;
- context.lineCap = strokeState.lineCap;
- }
- if (context.setLineDash) {
- if (!equals(contextStrokeState.lineDash, strokeState.lineDash)) {
- context.setLineDash((contextStrokeState.lineDash = strokeState.lineDash));
- }
- if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) {
- contextStrokeState.lineDashOffset = strokeState.lineDashOffset;
- context.lineDashOffset = strokeState.lineDashOffset;
- }
- }
- if (contextStrokeState.lineJoin != strokeState.lineJoin) {
- contextStrokeState.lineJoin = strokeState.lineJoin;
- context.lineJoin = strokeState.lineJoin;
- }
- if (contextStrokeState.lineWidth != strokeState.lineWidth) {
- contextStrokeState.lineWidth = strokeState.lineWidth;
- context.lineWidth = strokeState.lineWidth;
- }
- if (contextStrokeState.miterLimit != strokeState.miterLimit) {
- contextStrokeState.miterLimit = strokeState.miterLimit;
- context.miterLimit = strokeState.miterLimit;
- }
- if (contextStrokeState.strokeStyle != strokeState.strokeStyle) {
- contextStrokeState.strokeStyle = strokeState.strokeStyle;
- context.strokeStyle = strokeState.strokeStyle;
- }
- }
- };
- /**
- * @param {import("../canvas.js").TextState} textState Text state.
- * @private
- */
- CanvasImmediateRenderer.prototype.setContextTextState_ = function (textState) {
- var context = this.context_;
- var contextTextState = this.contextTextState_;
- var textAlign = textState.textAlign
- ? textState.textAlign
- : defaultTextAlign;
- if (!contextTextState) {
- context.font = textState.font;
- context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
- context.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
- this.contextTextState_ = {
- font: textState.font,
- textAlign: textAlign,
- textBaseline: textState.textBaseline,
- };
- }
- else {
- if (contextTextState.font != textState.font) {
- contextTextState.font = textState.font;
- context.font = textState.font;
- }
- if (contextTextState.textAlign != textAlign) {
- contextTextState.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
- context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
- }
- if (contextTextState.textBaseline != textState.textBaseline) {
- contextTextState.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
- context.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
- }
- }
- };
- /**
- * Set the fill and stroke style for subsequent draw operations. To clear
- * either fill or stroke styles, pass null for the appropriate parameter.
- *
- * @param {import("../../style/Fill.js").default} fillStyle Fill style.
- * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
- */
- CanvasImmediateRenderer.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) {
- var _this = this;
- if (!fillStyle) {
- this.fillState_ = null;
- }
- else {
- var fillStyleColor = fillStyle.getColor();
- this.fillState_ = {
- fillStyle: asColorLike(fillStyleColor ? fillStyleColor : defaultFillStyle),
- };
- }
- if (!strokeStyle) {
- this.strokeState_ = null;
- }
- else {
- var strokeStyleColor = strokeStyle.getColor();
- var strokeStyleLineCap = strokeStyle.getLineCap();
- var strokeStyleLineDash = strokeStyle.getLineDash();
- var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
- var strokeStyleLineJoin = strokeStyle.getLineJoin();
- var strokeStyleWidth = strokeStyle.getWidth();
- var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
- var lineDash = strokeStyleLineDash
- ? strokeStyleLineDash
- : defaultLineDash;
- this.strokeState_ = {
- lineCap: strokeStyleLineCap !== undefined
- ? strokeStyleLineCap
- : defaultLineCap,
- lineDash: this.pixelRatio_ === 1
- ? lineDash
- : lineDash.map(function (n) { return n * _this.pixelRatio_; }),
- lineDashOffset: (strokeStyleLineDashOffset
- ? strokeStyleLineDashOffset
- : defaultLineDashOffset) * this.pixelRatio_,
- lineJoin: strokeStyleLineJoin !== undefined
- ? strokeStyleLineJoin
- : defaultLineJoin,
- lineWidth: (strokeStyleWidth !== undefined
- ? strokeStyleWidth
- : defaultLineWidth) * this.pixelRatio_,
- miterLimit: strokeStyleMiterLimit !== undefined
- ? strokeStyleMiterLimit
- : defaultMiterLimit,
- strokeStyle: asColorLike(strokeStyleColor ? strokeStyleColor : defaultStrokeStyle),
- };
- }
- };
- /**
- * Set the image style for subsequent draw operations. Pass null to remove
- * the image style.
- *
- * @param {import("../../style/Image.js").default} imageStyle Image style.
- */
- CanvasImmediateRenderer.prototype.setImageStyle = function (imageStyle) {
- var imageSize;
- if (!imageStyle || !(imageSize = imageStyle.getSize())) {
- this.image_ = null;
- return;
- }
- var imageAnchor = imageStyle.getAnchor();
- var imageOrigin = imageStyle.getOrigin();
- this.image_ = imageStyle.getImage(this.pixelRatio_);
- this.imageAnchorX_ = imageAnchor[0] * this.pixelRatio_;
- this.imageAnchorY_ = imageAnchor[1] * this.pixelRatio_;
- this.imageHeight_ = imageSize[1] * this.pixelRatio_;
- this.imageOpacity_ = imageStyle.getOpacity();
- this.imageOriginX_ = imageOrigin[0];
- this.imageOriginY_ = imageOrigin[1];
- this.imageRotateWithView_ = imageStyle.getRotateWithView();
- this.imageRotation_ = imageStyle.getRotation();
- this.imageScale_ = imageStyle.getScaleArray();
- this.imageWidth_ = imageSize[0] * this.pixelRatio_;
- };
- /**
- * Set the text style for subsequent draw operations. Pass null to
- * remove the text style.
- *
- * @param {import("../../style/Text.js").default} textStyle Text style.
- */
- CanvasImmediateRenderer.prototype.setTextStyle = function (textStyle) {
- if (!textStyle) {
- this.text_ = '';
- }
- else {
- var textFillStyle = textStyle.getFill();
- if (!textFillStyle) {
- this.textFillState_ = null;
- }
- else {
- var textFillStyleColor = textFillStyle.getColor();
- this.textFillState_ = {
- fillStyle: asColorLike(textFillStyleColor ? textFillStyleColor : defaultFillStyle),
- };
- }
- var textStrokeStyle = textStyle.getStroke();
- if (!textStrokeStyle) {
- this.textStrokeState_ = null;
- }
- else {
- var textStrokeStyleColor = textStrokeStyle.getColor();
- var textStrokeStyleLineCap = textStrokeStyle.getLineCap();
- var textStrokeStyleLineDash = textStrokeStyle.getLineDash();
- var textStrokeStyleLineDashOffset = textStrokeStyle.getLineDashOffset();
- var textStrokeStyleLineJoin = textStrokeStyle.getLineJoin();
- var textStrokeStyleWidth = textStrokeStyle.getWidth();
- var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();
- this.textStrokeState_ = {
- lineCap: textStrokeStyleLineCap !== undefined
- ? textStrokeStyleLineCap
- : defaultLineCap,
- lineDash: textStrokeStyleLineDash
- ? textStrokeStyleLineDash
- : defaultLineDash,
- lineDashOffset: textStrokeStyleLineDashOffset
- ? textStrokeStyleLineDashOffset
- : defaultLineDashOffset,
- lineJoin: textStrokeStyleLineJoin !== undefined
- ? textStrokeStyleLineJoin
- : defaultLineJoin,
- lineWidth: textStrokeStyleWidth !== undefined
- ? textStrokeStyleWidth
- : defaultLineWidth,
- miterLimit: textStrokeStyleMiterLimit !== undefined
- ? textStrokeStyleMiterLimit
- : defaultMiterLimit,
- strokeStyle: asColorLike(textStrokeStyleColor ? textStrokeStyleColor : defaultStrokeStyle),
- };
- }
- var textFont = textStyle.getFont();
- var textOffsetX = textStyle.getOffsetX();
- var textOffsetY = textStyle.getOffsetY();
- var textRotateWithView = textStyle.getRotateWithView();
- var textRotation = textStyle.getRotation();
- var textScale = textStyle.getScaleArray();
- var textText = textStyle.getText();
- var textTextAlign = textStyle.getTextAlign();
- var textTextBaseline = textStyle.getTextBaseline();
- this.textState_ = {
- font: textFont !== undefined ? textFont : defaultFont,
- textAlign: textTextAlign !== undefined ? textTextAlign : defaultTextAlign,
- textBaseline: textTextBaseline !== undefined
- ? textTextBaseline
- : defaultTextBaseline,
- };
- this.text_ =
- textText !== undefined
- ? Array.isArray(textText)
- ? textText.reduce(function (acc, t, i) { return (acc += i % 2 ? ' ' : t); }, '')
- : textText
- : '';
- this.textOffsetX_ =
- textOffsetX !== undefined ? this.pixelRatio_ * textOffsetX : 0;
- this.textOffsetY_ =
- textOffsetY !== undefined ? this.pixelRatio_ * textOffsetY : 0;
- this.textRotateWithView_ =
- textRotateWithView !== undefined ? textRotateWithView : false;
- this.textRotation_ = textRotation !== undefined ? textRotation : 0;
- this.textScale_ = [
- this.pixelRatio_ * textScale[0],
- this.pixelRatio_ * textScale[1],
- ];
- }
- };
- return CanvasImmediateRenderer;
- }(render_VectorContext));
- /* harmony default export */ var Immediate = (CanvasImmediateRenderer);
- //# sourceMappingURL=Immediate.js.map
- ;// ./node_modules/ol/style/IconAnchorUnits.js
- /**
- * @module ol/style/IconAnchorUnits
- */
- /**
- * Icon anchor units. One of 'fraction', 'pixels'.
- * @enum {string}
- */
- /* harmony default export */ var IconAnchorUnits = ({
- /**
- * Anchor is a fraction
- * @api
- */
- FRACTION: 'fraction',
- /**
- * Anchor is in pixels
- * @api
- */
- PIXELS: 'pixels',
- });
- //# sourceMappingURL=IconAnchorUnits.js.map
- ;// ./node_modules/ol/style/IconOrigin.js
- /**
- * @module ol/style/IconOrigin
- */
- /**
- * Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'.
- * @enum {string}
- */
- /* harmony default export */ var IconOrigin = ({
- /**
- * Origin is at bottom left
- * @api
- */
- BOTTOM_LEFT: 'bottom-left',
- /**
- * Origin is at bottom right
- * @api
- */
- BOTTOM_RIGHT: 'bottom-right',
- /**
- * Origin is at top left
- * @api
- */
- TOP_LEFT: 'top-left',
- /**
- * Origin is at top right
- * @api
- */
- TOP_RIGHT: 'top-right',
- });
- //# sourceMappingURL=IconOrigin.js.map
- ;// ./node_modules/ol/style/IconImageCache.js
- /**
- * @module ol/style/IconImageCache
- */
- /**
- * @classdesc
- * Singleton class. Available through {@link module:ol/style/IconImageCache.shared}.
- */
- var IconImageCache = /** @class */ (function () {
- function IconImageCache() {
- /**
- * @type {!Object<string, import("./IconImage.js").default>}
- * @private
- */
- this.cache_ = {};
- /**
- * @type {number}
- * @private
- */
- this.cacheSize_ = 0;
- /**
- * @type {number}
- * @private
- */
- this.maxCacheSize_ = 32;
- }
- /**
- * FIXME empty description for jsdoc
- */
- IconImageCache.prototype.clear = function () {
- this.cache_ = {};
- this.cacheSize_ = 0;
- };
- /**
- * @return {boolean} Can expire cache.
- */
- IconImageCache.prototype.canExpireCache = function () {
- return this.cacheSize_ > this.maxCacheSize_;
- };
- /**
- * FIXME empty description for jsdoc
- */
- IconImageCache.prototype.expire = function () {
- if (this.canExpireCache()) {
- var i = 0;
- for (var key in this.cache_) {
- var iconImage = this.cache_[key];
- if ((i++ & 3) === 0 && !iconImage.hasListener()) {
- delete this.cache_[key];
- --this.cacheSize_;
- }
- }
- }
- };
- /**
- * @param {string} src Src.
- * @param {?string} crossOrigin Cross origin.
- * @param {import("../color.js").Color} color Color.
- * @return {import("./IconImage.js").default} Icon image.
- */
- IconImageCache.prototype.get = function (src, crossOrigin, color) {
- var key = getKey(src, crossOrigin, color);
- return key in this.cache_ ? this.cache_[key] : null;
- };
- /**
- * @param {string} src Src.
- * @param {?string} crossOrigin Cross origin.
- * @param {import("../color.js").Color} color Color.
- * @param {import("./IconImage.js").default} iconImage Icon image.
- */
- IconImageCache.prototype.set = function (src, crossOrigin, color, iconImage) {
- var key = getKey(src, crossOrigin, color);
- this.cache_[key] = iconImage;
- ++this.cacheSize_;
- };
- /**
- * Set the cache size of the icon cache. Default is `32`. Change this value when
- * your map uses more than 32 different icon images and you are not caching icon
- * styles on the application level.
- * @param {number} maxCacheSize Cache max size.
- * @api
- */
- IconImageCache.prototype.setSize = function (maxCacheSize) {
- this.maxCacheSize_ = maxCacheSize;
- this.expire();
- };
- return IconImageCache;
- }());
- /**
- * @param {string} src Src.
- * @param {?string} crossOrigin Cross origin.
- * @param {import("../color.js").Color} color Color.
- * @return {string} Cache key.
- */
- function getKey(src, crossOrigin, color) {
- var colorString = color ? asString(color) : 'null';
- return crossOrigin + ':' + src + ':' + colorString;
- }
- /* harmony default export */ var style_IconImageCache = ((/* unused pure expression or super */ null && (IconImageCache)));
- /**
- * The {@link module:ol/style/IconImageCache~IconImageCache} for
- * {@link module:ol/style/Icon~Icon} images.
- * @api
- */
- var shared = new IconImageCache();
- //# sourceMappingURL=IconImageCache.js.map
- ;// ./node_modules/ol/style/IconImage.js
- /**
- * @module ol/style/IconImage
- */
- var IconImage_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @type {CanvasRenderingContext2D}
- */
- var taintedTestContext = null;
- var IconImage = /** @class */ (function (_super) {
- IconImage_extends(IconImage, _super);
- /**
- * @param {HTMLImageElement|HTMLCanvasElement} image Image.
- * @param {string|undefined} src Src.
- * @param {import("../size.js").Size} size Size.
- * @param {?string} crossOrigin Cross origin.
- * @param {import("../ImageState.js").default} imageState Image state.
- * @param {import("../color.js").Color} color Color.
- */
- function IconImage(image, src, size, crossOrigin, imageState, color) {
- var _this = _super.call(this) || this;
- /**
- * @private
- * @type {HTMLImageElement|HTMLCanvasElement}
- */
- _this.hitDetectionImage_ = null;
- /**
- * @private
- * @type {HTMLImageElement|HTMLCanvasElement}
- */
- _this.image_ = !image ? new Image() : image;
- if (crossOrigin !== null) {
- /** @type {HTMLImageElement} */ (_this.image_).crossOrigin = crossOrigin;
- }
- /**
- * @private
- * @type {Object<number, HTMLCanvasElement>}
- */
- _this.canvas_ = {};
- /**
- * @private
- * @type {import("../color.js").Color}
- */
- _this.color_ = color;
- /**
- * @private
- * @type {?function():void}
- */
- _this.unlisten_ = null;
- /**
- * @private
- * @type {import("../ImageState.js").default}
- */
- _this.imageState_ = imageState;
- /**
- * @private
- * @type {import("../size.js").Size}
- */
- _this.size_ = size;
- /**
- * @private
- * @type {string|undefined}
- */
- _this.src_ = src;
- /**
- * @private
- */
- _this.tainted_;
- return _this;
- }
- /**
- * @private
- * @return {boolean} The image canvas is tainted.
- */
- IconImage.prototype.isTainted_ = function () {
- if (this.tainted_ === undefined && this.imageState_ === ImageState.LOADED) {
- if (!taintedTestContext) {
- taintedTestContext = createCanvasContext2D(1, 1);
- }
- taintedTestContext.drawImage(this.image_, 0, 0);
- try {
- taintedTestContext.getImageData(0, 0, 1, 1);
- this.tainted_ = false;
- }
- catch (e) {
- taintedTestContext = null;
- this.tainted_ = true;
- }
- }
- return this.tainted_ === true;
- };
- /**
- * @private
- */
- IconImage.prototype.dispatchChangeEvent_ = function () {
- this.dispatchEvent(EventType.CHANGE);
- };
- /**
- * @private
- */
- IconImage.prototype.handleImageError_ = function () {
- this.imageState_ = ImageState.ERROR;
- this.unlistenImage_();
- this.dispatchChangeEvent_();
- };
- /**
- * @private
- */
- IconImage.prototype.handleImageLoad_ = function () {
- this.imageState_ = ImageState.LOADED;
- if (this.size_) {
- this.image_.width = this.size_[0];
- this.image_.height = this.size_[1];
- }
- else {
- this.size_ = [this.image_.width, this.image_.height];
- }
- this.unlistenImage_();
- this.dispatchChangeEvent_();
- };
- /**
- * @param {number} pixelRatio Pixel ratio.
- * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
- */
- IconImage.prototype.getImage = function (pixelRatio) {
- this.replaceColor_(pixelRatio);
- return this.canvas_[pixelRatio] ? this.canvas_[pixelRatio] : this.image_;
- };
- /**
- * @param {number} pixelRatio Pixel ratio.
- * @return {number} Image or Canvas element.
- */
- IconImage.prototype.getPixelRatio = function (pixelRatio) {
- this.replaceColor_(pixelRatio);
- return this.canvas_[pixelRatio] ? pixelRatio : 1;
- };
- /**
- * @return {import("../ImageState.js").default} Image state.
- */
- IconImage.prototype.getImageState = function () {
- return this.imageState_;
- };
- /**
- * @return {HTMLImageElement|HTMLCanvasElement} Image element.
- */
- IconImage.prototype.getHitDetectionImage = function () {
- if (!this.hitDetectionImage_) {
- if (this.isTainted_()) {
- var width = this.size_[0];
- var height = this.size_[1];
- var context = createCanvasContext2D(width, height);
- context.fillRect(0, 0, width, height);
- this.hitDetectionImage_ = context.canvas;
- }
- else {
- this.hitDetectionImage_ = this.image_;
- }
- }
- return this.hitDetectionImage_;
- };
- /**
- * Get the size of the icon (in pixels).
- * @return {import("../size.js").Size} Image size.
- */
- IconImage.prototype.getSize = function () {
- return this.size_;
- };
- /**
- * @return {string|undefined} Image src.
- */
- IconImage.prototype.getSrc = function () {
- return this.src_;
- };
- /**
- * Load not yet loaded URI.
- */
- IconImage.prototype.load = function () {
- if (this.imageState_ == ImageState.IDLE) {
- this.imageState_ = ImageState.LOADING;
- try {
- /** @type {HTMLImageElement} */ (this.image_).src = this.src_;
- }
- catch (e) {
- this.handleImageError_();
- }
- this.unlisten_ = listenImage(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this));
- }
- };
- /**
- * @param {number} pixelRatio Pixel ratio.
- * @private
- */
- IconImage.prototype.replaceColor_ = function (pixelRatio) {
- if (!this.color_ ||
- this.canvas_[pixelRatio] ||
- this.imageState_ !== ImageState.LOADED) {
- return;
- }
- var canvas = document.createElement('canvas');
- this.canvas_[pixelRatio] = canvas;
- canvas.width = Math.ceil(this.image_.width * pixelRatio);
- canvas.height = Math.ceil(this.image_.height * pixelRatio);
- var ctx = canvas.getContext('2d');
- ctx.scale(pixelRatio, pixelRatio);
- ctx.drawImage(this.image_, 0, 0);
- ctx.globalCompositeOperation = 'multiply';
- // Internet Explorer 11 does not support the multiply operation.
- // If the canvas is tainted in Internet Explorer this still produces
- // a solid color image with the shape of the icon.
- if (ctx.globalCompositeOperation === 'multiply' || this.isTainted_()) {
- ctx.fillStyle = asString(this.color_);
- ctx.fillRect(0, 0, canvas.width / pixelRatio, canvas.height / pixelRatio);
- ctx.globalCompositeOperation = 'destination-in';
- ctx.drawImage(this.image_, 0, 0);
- }
- else {
- var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
- var data = imgData.data;
- var r = this.color_[0] / 255.0;
- var g = this.color_[1] / 255.0;
- var b = this.color_[2] / 255.0;
- var a = this.color_[3];
- for (var i = 0, ii = data.length; i < ii; i += 4) {
- data[i] *= r;
- data[i + 1] *= g;
- data[i + 2] *= b;
- data[i + 3] *= a;
- }
- ctx.putImageData(imgData, 0, 0);
- }
- };
- /**
- * Discards event handlers which listen for load completion or errors.
- *
- * @private
- */
- IconImage.prototype.unlistenImage_ = function () {
- if (this.unlisten_) {
- this.unlisten_();
- this.unlisten_ = null;
- }
- };
- return IconImage;
- }(events_Target));
- /**
- * @param {HTMLImageElement|HTMLCanvasElement} image Image.
- * @param {string} src Src.
- * @param {import("../size.js").Size} size Size.
- * @param {?string} crossOrigin Cross origin.
- * @param {import("../ImageState.js").default} imageState Image state.
- * @param {import("../color.js").Color} color Color.
- * @return {IconImage} Icon image.
- */
- function IconImage_get(image, src, size, crossOrigin, imageState, color) {
- var iconImage = shared.get(src, crossOrigin, color);
- if (!iconImage) {
- iconImage = new IconImage(image, src, size, crossOrigin, imageState, color);
- shared.set(src, crossOrigin, color, iconImage);
- }
- return iconImage;
- }
- /* harmony default export */ var style_IconImage = ((/* unused pure expression or super */ null && (IconImage)));
- //# sourceMappingURL=IconImage.js.map
- ;// ./node_modules/ol/style/Icon.js
- var Icon_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/style/Icon
- */
- /**
- * @typedef {Object} Options
- * @property {Array<number>} [anchor=[0.5, 0.5]] Anchor. Default value is the icon center.
- * @property {import("./IconOrigin.js").default} [anchorOrigin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,
- * `top-left` or `top-right`.
- * @property {import("./IconAnchorUnits.js").default} [anchorXUnits='fraction'] Units in which the anchor x value is
- * specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates
- * the x value in pixels.
- * @property {import("./IconAnchorUnits.js").default} [anchorYUnits='fraction'] Units in which the anchor y value is
- * specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates
- * the y value in pixels.
- * @property {import("../color.js").Color|string} [color] Color to tint the icon. If not specified,
- * the icon will be left as is.
- * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that you must provide a
- * `crossOrigin` value if you want to access pixel data with the Canvas renderer.
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
- * @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the
- * provided image must already be loaded. And in that case, it is required
- * to provide the size of the image, with the `imgSize` option.
- * @property {Array<number>} [offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
- * sub-rectangle to use from the original icon image.
- * @property {Array<number>} [displacement=[0,0]] Displacement of the icon.
- * @property {import("./IconOrigin.js").default} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
- * `top-left` or `top-right`.
- * @property {number} [opacity=1] Opacity of the icon.
- * @property {number|import("../size.js").Size} [scale=1] Scale.
- * @property {boolean} [rotateWithView=false] Whether to rotate the icon with the view.
- * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
- * @property {import("../size.js").Size} [size] Icon size in pixel. Can be used together with `offset` to define the
- * sub-rectangle to use from the origin (sprite) icon image.
- * @property {import("../size.js").Size} [imgSize] Image size in pixels. Only required if `img` is set and `src` is not, and
- * for SVG images in Internet Explorer 11. The provided `imgSize` needs to match the actual size of the image.
- * @property {string} [src] Image source URI.
- * @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode
- */
- /**
- * @classdesc
- * Set icon style for vector features.
- * @api
- */
- var Icon = /** @class */ (function (_super) {
- Icon_extends(Icon, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function Icon(opt_options) {
- var _this = this;
- var options = opt_options || {};
- /**
- * @type {number}
- */
- var opacity = options.opacity !== undefined ? options.opacity : 1;
- /**
- * @type {number}
- */
- var rotation = options.rotation !== undefined ? options.rotation : 0;
- /**
- * @type {number|import("../size.js").Size}
- */
- var scale = options.scale !== undefined ? options.scale : 1;
- /**
- * @type {boolean}
- */
- var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false;
- _this = _super.call(this, {
- opacity: opacity,
- rotation: rotation,
- scale: scale,
- displacement: options.displacement !== undefined ? options.displacement : [0, 0],
- rotateWithView: rotateWithView,
- declutterMode: options.declutterMode,
- }) || this;
- /**
- * @private
- * @type {Array<number>}
- */
- _this.anchor_ = options.anchor !== undefined ? options.anchor : [0.5, 0.5];
- /**
- * @private
- * @type {Array<number>}
- */
- _this.normalizedAnchor_ = null;
- /**
- * @private
- * @type {import("./IconOrigin.js").default}
- */
- _this.anchorOrigin_ =
- options.anchorOrigin !== undefined
- ? options.anchorOrigin
- : IconOrigin.TOP_LEFT;
- /**
- * @private
- * @type {import("./IconAnchorUnits.js").default}
- */
- _this.anchorXUnits_ =
- options.anchorXUnits !== undefined
- ? options.anchorXUnits
- : IconAnchorUnits.FRACTION;
- /**
- * @private
- * @type {import("./IconAnchorUnits.js").default}
- */
- _this.anchorYUnits_ =
- options.anchorYUnits !== undefined
- ? options.anchorYUnits
- : IconAnchorUnits.FRACTION;
- /**
- * @private
- * @type {?string}
- */
- _this.crossOrigin_ =
- options.crossOrigin !== undefined ? options.crossOrigin : null;
- /**
- * @type {HTMLImageElement|HTMLCanvasElement}
- */
- var image = options.img !== undefined ? options.img : null;
- /**
- * @private
- * @type {import("../size.js").Size|undefined}
- */
- _this.imgSize_ = options.imgSize;
- /**
- * @type {string|undefined}
- */
- var src = options.src;
- asserts_assert(!(src !== undefined && image), 4); // `image` and `src` cannot be provided at the same time
- asserts_assert(!image || (image && _this.imgSize_), 5); // `imgSize` must be set when `image` is provided
- if ((src === undefined || src.length === 0) && image) {
- src = /** @type {HTMLImageElement} */ (image).src || getUid(image);
- }
- asserts_assert(src !== undefined && src.length > 0, 6); // A defined and non-empty `src` or `image` must be provided
- /**
- * @type {import("../ImageState.js").default}
- */
- var imageState = options.src !== undefined ? ImageState.IDLE : ImageState.LOADED;
- /**
- * @private
- * @type {import("../color.js").Color}
- */
- _this.color_ = options.color !== undefined ? asArray(options.color) : null;
- /**
- * @private
- * @type {import("./IconImage.js").default}
- */
- _this.iconImage_ = IconImage_get(image,
- /** @type {string} */ (src), _this.imgSize_ !== undefined ? _this.imgSize_ : null, _this.crossOrigin_, imageState, _this.color_);
- /**
- * @private
- * @type {Array<number>}
- */
- _this.offset_ = options.offset !== undefined ? options.offset : [0, 0];
- /**
- * @private
- * @type {import("./IconOrigin.js").default}
- */
- _this.offsetOrigin_ =
- options.offsetOrigin !== undefined
- ? options.offsetOrigin
- : IconOrigin.TOP_LEFT;
- /**
- * @private
- * @type {Array<number>}
- */
- _this.origin_ = null;
- /**
- * @private
- * @type {import("../size.js").Size}
- */
- _this.size_ = options.size !== undefined ? options.size : null;
- return _this;
- }
- /**
- * Clones the style. The underlying Image/HTMLCanvasElement is not cloned.
- * @return {Icon} The cloned style.
- * @api
- */
- Icon.prototype.clone = function () {
- var scale = this.getScale();
- return new Icon({
- anchor: this.anchor_.slice(),
- anchorOrigin: this.anchorOrigin_,
- anchorXUnits: this.anchorXUnits_,
- anchorYUnits: this.anchorYUnits_,
- color: this.color_ && this.color_.slice
- ? this.color_.slice()
- : this.color_ || undefined,
- crossOrigin: this.crossOrigin_,
- imgSize: this.imgSize_,
- offset: this.offset_.slice(),
- offsetOrigin: this.offsetOrigin_,
- opacity: this.getOpacity(),
- rotateWithView: this.getRotateWithView(),
- rotation: this.getRotation(),
- scale: Array.isArray(scale) ? scale.slice() : scale,
- size: this.size_ !== null ? this.size_.slice() : undefined,
- src: this.getSrc(),
- displacement: this.getDisplacement().slice(),
- declutterMode: this.getDeclutterMode(),
- });
- };
- /**
- * Get the anchor point in pixels. The anchor determines the center point for the
- * symbolizer.
- * @return {Array<number>} Anchor.
- * @api
- */
- Icon.prototype.getAnchor = function () {
- var anchor = this.normalizedAnchor_;
- if (!anchor) {
- anchor = this.anchor_;
- var size = this.getSize();
- if (this.anchorXUnits_ == IconAnchorUnits.FRACTION ||
- this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
- if (!size) {
- return null;
- }
- anchor = this.anchor_.slice();
- if (this.anchorXUnits_ == IconAnchorUnits.FRACTION) {
- anchor[0] *= size[0];
- }
- if (this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
- anchor[1] *= size[1];
- }
- }
- if (this.anchorOrigin_ != IconOrigin.TOP_LEFT) {
- if (!size) {
- return null;
- }
- if (anchor === this.anchor_) {
- anchor = this.anchor_.slice();
- }
- if (this.anchorOrigin_ == IconOrigin.TOP_RIGHT ||
- this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
- anchor[0] = -anchor[0] + size[0];
- }
- if (this.anchorOrigin_ == IconOrigin.BOTTOM_LEFT ||
- this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
- anchor[1] = -anchor[1] + size[1];
- }
- }
- this.normalizedAnchor_ = anchor;
- }
- var displacement = this.getDisplacement();
- return [anchor[0] - displacement[0], anchor[1] + displacement[1]];
- };
- /**
- * Set the anchor point. The anchor determines the center point for the
- * symbolizer.
- *
- * @param {Array<number>} anchor Anchor.
- * @api
- */
- Icon.prototype.setAnchor = function (anchor) {
- this.anchor_ = anchor;
- this.normalizedAnchor_ = null;
- };
- /**
- * Get the icon color.
- * @return {import("../color.js").Color} Color.
- * @api
- */
- Icon.prototype.getColor = function () {
- return this.color_;
- };
- /**
- * Get the image icon.
- * @param {number} pixelRatio Pixel ratio.
- * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
- * @api
- */
- Icon.prototype.getImage = function (pixelRatio) {
- return this.iconImage_.getImage(pixelRatio);
- };
- /**
- * Get the pixel ratio.
- * @param {number} pixelRatio Pixel ratio.
- * @return {number} The pixel ratio of the image.
- * @api
- */
- Icon.prototype.getPixelRatio = function (pixelRatio) {
- return this.iconImage_.getPixelRatio(pixelRatio);
- };
- /**
- * @return {import("../size.js").Size} Image size.
- */
- Icon.prototype.getImageSize = function () {
- return this.iconImage_.getSize();
- };
- /**
- * @return {import("../ImageState.js").default} Image state.
- */
- Icon.prototype.getImageState = function () {
- return this.iconImage_.getImageState();
- };
- /**
- * @return {HTMLImageElement|HTMLCanvasElement} Image element.
- */
- Icon.prototype.getHitDetectionImage = function () {
- return this.iconImage_.getHitDetectionImage();
- };
- /**
- * Get the origin of the symbolizer.
- * @return {Array<number>} Origin.
- * @api
- */
- Icon.prototype.getOrigin = function () {
- if (this.origin_) {
- return this.origin_;
- }
- var offset = this.offset_;
- if (this.offsetOrigin_ != IconOrigin.TOP_LEFT) {
- var size = this.getSize();
- var iconImageSize = this.iconImage_.getSize();
- if (!size || !iconImageSize) {
- return null;
- }
- offset = offset.slice();
- if (this.offsetOrigin_ == IconOrigin.TOP_RIGHT ||
- this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
- offset[0] = iconImageSize[0] - size[0] - offset[0];
- }
- if (this.offsetOrigin_ == IconOrigin.BOTTOM_LEFT ||
- this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
- offset[1] = iconImageSize[1] - size[1] - offset[1];
- }
- }
- this.origin_ = offset;
- return this.origin_;
- };
- /**
- * Get the image URL.
- * @return {string|undefined} Image src.
- * @api
- */
- Icon.prototype.getSrc = function () {
- return this.iconImage_.getSrc();
- };
- /**
- * Get the size of the icon (in pixels).
- * @return {import("../size.js").Size} Image size.
- * @api
- */
- Icon.prototype.getSize = function () {
- return !this.size_ ? this.iconImage_.getSize() : this.size_;
- };
- /**
- * @param {function(import("../events/Event.js").default): void} listener Listener function.
- */
- Icon.prototype.listenImageChange = function (listener) {
- this.iconImage_.addEventListener(EventType.CHANGE, listener);
- };
- /**
- * Load not yet loaded URI.
- * When rendering a feature with an icon style, the vector renderer will
- * automatically call this method. However, you might want to call this
- * method yourself for preloading or other purposes.
- * @api
- */
- Icon.prototype.load = function () {
- this.iconImage_.load();
- };
- /**
- * @param {function(import("../events/Event.js").default): void} listener Listener function.
- */
- Icon.prototype.unlistenImageChange = function (listener) {
- this.iconImage_.removeEventListener(EventType.CHANGE, listener);
- };
- return Icon;
- }(style_Image));
- /* harmony default export */ var style_Icon = (Icon);
- //# sourceMappingURL=Icon.js.map
- ;// ./node_modules/ol/render/canvas/hitdetect.js
- /**
- * @module ol/render/canvas/hitdetect
- */
- var HIT_DETECT_RESOLUTION = 0.5;
- /**
- * @param {import("../../size.js").Size} size Canvas size in css pixels.
- * @param {Array<import("../../transform.js").Transform>} transforms Transforms
- * for rendering features to all worlds of the viewport, from coordinates to css
- * pixels.
- * @param {Array<import("../../Feature.js").FeatureLike>} features
- * Features to consider for hit detection.
- * @param {import("../../style/Style.js").StyleFunction|undefined} styleFunction
- * Layer style function.
- * @param {import("../../extent.js").Extent} extent Extent.
- * @param {number} resolution Resolution.
- * @param {number} rotation Rotation.
- * @return {ImageData} Hit detection image data.
- */
- function createHitDetectionImageData(size, transforms, features, styleFunction, extent, resolution, rotation) {
- var width = size[0] * HIT_DETECT_RESOLUTION;
- var height = size[1] * HIT_DETECT_RESOLUTION;
- var context = createCanvasContext2D(width, height);
- context.imageSmoothingEnabled = false;
- var canvas = context.canvas;
- var renderer = new Immediate(context, HIT_DETECT_RESOLUTION, extent, null, rotation);
- var featureCount = features.length;
- // Stretch hit detection index to use the whole available color range
- var indexFactor = Math.floor((256 * 256 * 256 - 1) / featureCount);
- var featuresByZIndex = {};
- for (var i = 1; i <= featureCount; ++i) {
- var feature = features[i - 1];
- var featureStyleFunction = feature.getStyleFunction() || styleFunction;
- if (!styleFunction) {
- continue;
- }
- var styles = featureStyleFunction(feature, resolution);
- if (!styles) {
- continue;
- }
- if (!Array.isArray(styles)) {
- styles = [styles];
- }
- var index = i * indexFactor;
- var color = '#' + ('000000' + index.toString(16)).slice(-6);
- for (var j = 0, jj = styles.length; j < jj; ++j) {
- var originalStyle = styles[j];
- var geometry = originalStyle.getGeometryFunction()(feature);
- if (!geometry || !intersects(extent, geometry.getExtent())) {
- continue;
- }
- var style = originalStyle.clone();
- var fill = style.getFill();
- if (fill) {
- fill.setColor(color);
- }
- var stroke = style.getStroke();
- if (stroke) {
- stroke.setColor(color);
- stroke.setLineDash(null);
- }
- style.setText(undefined);
- var image = originalStyle.getImage();
- if (image && image.getOpacity() !== 0) {
- var imgSize = image.getImageSize();
- if (!imgSize) {
- continue;
- }
- var imgContext = createCanvasContext2D(imgSize[0], imgSize[1], undefined, { alpha: false });
- var img = imgContext.canvas;
- imgContext.fillStyle = color;
- imgContext.fillRect(0, 0, img.width, img.height);
- style.setImage(new style_Icon({
- img: img,
- imgSize: imgSize,
- anchor: image.getAnchor(),
- anchorXUnits: IconAnchorUnits.PIXELS,
- anchorYUnits: IconAnchorUnits.PIXELS,
- offset: image.getOrigin(),
- opacity: 1,
- size: image.getSize(),
- scale: image.getScale(),
- rotation: image.getRotation(),
- rotateWithView: image.getRotateWithView(),
- }));
- }
- var zIndex = style.getZIndex() || 0;
- var byGeometryType = featuresByZIndex[zIndex];
- if (!byGeometryType) {
- byGeometryType = {};
- featuresByZIndex[zIndex] = byGeometryType;
- byGeometryType['Polygon'] = [];
- byGeometryType['Circle'] = [];
- byGeometryType['LineString'] = [];
- byGeometryType['Point'] = [];
- }
- byGeometryType[geometry.getType().replace('Multi', '')].push(geometry, style);
- }
- }
- var zIndexKeys = Object.keys(featuresByZIndex)
- .map(Number)
- .sort(numberSafeCompareFunction);
- for (var i = 0, ii = zIndexKeys.length; i < ii; ++i) {
- var byGeometryType = featuresByZIndex[zIndexKeys[i]];
- for (var type in byGeometryType) {
- var geomAndStyle = byGeometryType[type];
- for (var j = 0, jj = geomAndStyle.length; j < jj; j += 2) {
- renderer.setStyle(geomAndStyle[j + 1]);
- for (var k = 0, kk = transforms.length; k < kk; ++k) {
- renderer.setTransform(transforms[k]);
- renderer.drawGeometry(geomAndStyle[j]);
- }
- }
- }
- }
- return context.getImageData(0, 0, canvas.width, canvas.height);
- }
- /**
- * @param {import("../../pixel").Pixel} pixel Pixel coordinate on the hit
- * detection canvas in css pixels.
- * @param {Array<import("../../Feature").FeatureLike>} features Features. Has to
- * match the `features` array that was passed to `createHitDetectionImageData()`.
- * @param {ImageData} imageData Hit detection image data generated by
- * `createHitDetectionImageData()`.
- * @return {Array<import("../../Feature").FeatureLike>} features Features.
- */
- function hitDetect(pixel, features, imageData) {
- var resultFeatures = [];
- if (imageData) {
- var x = Math.floor(Math.round(pixel[0]) * HIT_DETECT_RESOLUTION);
- var y = Math.floor(Math.round(pixel[1]) * HIT_DETECT_RESOLUTION);
- // The pixel coordinate is clamped down to the hit-detect canvas' size to account
- // for browsers returning coordinates slightly larger than the actual canvas size
- // due to a non-integer pixel ratio.
- var index = (math_clamp(x, 0, imageData.width - 1) +
- math_clamp(y, 0, imageData.height - 1) * imageData.width) *
- 4;
- var r = imageData.data[index];
- var g = imageData.data[index + 1];
- var b = imageData.data[index + 2];
- var i = b + 256 * (g + 256 * r);
- var indexFactor = Math.floor((256 * 256 * 256 - 1) / features.length);
- if (i && i % indexFactor === 0) {
- resultFeatures.push(features[i / indexFactor - 1]);
- }
- }
- return resultFeatures;
- }
- //# sourceMappingURL=hitdetect.js.map
- ;// ./node_modules/ol/renderer/vector.js
- /**
- * @module ol/renderer/vector
- */
- /**
- * Feature callback. The callback will be called with three arguments. The first
- * argument is one {@link module:ol/Feature~Feature feature} or {@link module:ol/render/Feature~RenderFeature render feature}
- * at the pixel, the second is the {@link module:ol/layer/Layer~Layer layer} of the feature and will be null for
- * unmanaged layers. The third is the {@link module:ol/geom/SimpleGeometry~SimpleGeometry} of the feature. For features
- * with a GeometryCollection geometry, it will be the first detected geometry from the collection.
- * @template T
- * @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default<import("../source/Source").default>, import("../geom/SimpleGeometry.js").default): T} FeatureCallback
- */
- /**
- * Tolerance for geometry simplification in device pixels.
- * @type {number}
- */
- var SIMPLIFY_TOLERANCE = 0.5;
- /**
- * @const
- * @type {Object<import("../geom/Geometry.js").Type,
- * function(import("../render/canvas/BuilderGroup.js").default, import("../geom/Geometry.js").default,
- * import("../style/Style.js").default, Object): void>}
- */
- var GEOMETRY_RENDERERS = {
- 'Point': renderPointGeometry,
- 'LineString': renderLineStringGeometry,
- 'Polygon': renderPolygonGeometry,
- 'MultiPoint': renderMultiPointGeometry,
- 'MultiLineString': renderMultiLineStringGeometry,
- 'MultiPolygon': renderMultiPolygonGeometry,
- 'GeometryCollection': renderGeometryCollectionGeometry,
- 'Circle': renderCircleGeometry,
- };
- /**
- * @param {import("../Feature.js").FeatureLike} feature1 Feature 1.
- * @param {import("../Feature.js").FeatureLike} feature2 Feature 2.
- * @return {number} Order.
- */
- function defaultOrder(feature1, feature2) {
- return parseInt(getUid(feature1), 10) - parseInt(getUid(feature2), 10);
- }
- /**
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- * @return {number} Squared pixel tolerance.
- */
- function getSquaredTolerance(resolution, pixelRatio) {
- var tolerance = getTolerance(resolution, pixelRatio);
- return tolerance * tolerance;
- }
- /**
- * @param {number} resolution Resolution.
- * @param {number} pixelRatio Pixel ratio.
- * @return {number} Pixel tolerance.
- */
- function getTolerance(resolution, pixelRatio) {
- return (SIMPLIFY_TOLERANCE * resolution) / pixelRatio;
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Builder group.
- * @param {import("../geom/Circle.js").default} geometry Geometry.
- * @param {import("../style/Style.js").default} style Style.
- * @param {import("../Feature.js").default} feature Feature.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- */
- function renderCircleGeometry(builderGroup, geometry, style, feature, opt_declutterBuilderGroup) {
- var fillStyle = style.getFill();
- var strokeStyle = style.getStroke();
- if (fillStyle || strokeStyle) {
- var circleReplay = builderGroup.getBuilder(style.getZIndex(), 'Circle');
- circleReplay.setFillStrokeStyle(fillStyle, strokeStyle);
- circleReplay.drawCircle(geometry, feature);
- }
- var textStyle = style.getText();
- if (textStyle && textStyle.getText()) {
- var textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(style.getZIndex(), 'Text');
- textReplay.setTextStyle(textStyle);
- textReplay.drawText(geometry, feature);
- }
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {import("../style/Style.js").default} style Style.
- * @param {number} squaredTolerance Squared tolerance.
- * @param {function(import("../events/Event.js").default): void} listener Listener function.
- * @param {import("../proj.js").TransformFunction} [opt_transform] Transform from user to view projection.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- * @return {boolean} `true` if style is loading.
- */
- function renderFeature(replayGroup, feature, style, squaredTolerance, listener, opt_transform, opt_declutterBuilderGroup) {
- var loading = false;
- var imageStyle = style.getImage();
- if (imageStyle) {
- var imageState = imageStyle.getImageState();
- if (imageState == ImageState.LOADED || imageState == ImageState.ERROR) {
- imageStyle.unlistenImageChange(listener);
- }
- else {
- if (imageState == ImageState.IDLE) {
- imageStyle.load();
- }
- imageStyle.listenImageChange(listener);
- loading = true;
- }
- }
- renderFeatureInternal(replayGroup, feature, style, squaredTolerance, opt_transform, opt_declutterBuilderGroup);
- return loading;
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {import("../style/Style.js").default} style Style.
- * @param {number} squaredTolerance Squared tolerance.
- * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- */
- function renderFeatureInternal(replayGroup, feature, style, squaredTolerance, opt_transform, opt_declutterBuilderGroup) {
- var geometry = style.getGeometryFunction()(feature);
- if (!geometry) {
- return;
- }
- var simplifiedGeometry = geometry.simplifyTransformed(squaredTolerance, opt_transform);
- var renderer = style.getRenderer();
- if (renderer) {
- renderGeometry(replayGroup, simplifiedGeometry, style, feature);
- }
- else {
- var geometryRenderer = GEOMETRY_RENDERERS[simplifiedGeometry.getType()];
- geometryRenderer(replayGroup, simplifiedGeometry, style, feature, opt_declutterBuilderGroup);
- }
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group.
- * @param {import("../geom/Geometry.js").default|import("../render/Feature.js").default} geometry Geometry.
- * @param {import("../style/Style.js").default} style Style.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- */
- function renderGeometry(replayGroup, geometry, style, feature) {
- if (geometry.getType() == 'GeometryCollection') {
- var geometries =
- /** @type {import("../geom/GeometryCollection.js").default} */ (geometry).getGeometries();
- for (var i = 0, ii = geometries.length; i < ii; ++i) {
- renderGeometry(replayGroup, geometries[i], style, feature);
- }
- return;
- }
- var replay = replayGroup.getBuilder(style.getZIndex(), 'Default');
- replay.drawCustom(
- /** @type {import("../geom/SimpleGeometry.js").default} */ (geometry), feature, style.getRenderer(), style.getHitDetectionRenderer());
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group.
- * @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
- * @param {import("../style/Style.js").default} style Style.
- * @param {import("../Feature.js").default} feature Feature.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- */
- function renderGeometryCollectionGeometry(replayGroup, geometry, style, feature, opt_declutterBuilderGroup) {
- var geometries = geometry.getGeometriesArray();
- var i, ii;
- for (i = 0, ii = geometries.length; i < ii; ++i) {
- var geometryRenderer = GEOMETRY_RENDERERS[geometries[i].getType()];
- geometryRenderer(replayGroup, geometries[i], style, feature, opt_declutterBuilderGroup);
- }
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
- * @param {import("../geom/LineString.js").default|import("../render/Feature.js").default} geometry Geometry.
- * @param {import("../style/Style.js").default} style Style.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- */
- function renderLineStringGeometry(builderGroup, geometry, style, feature, opt_declutterBuilderGroup) {
- var strokeStyle = style.getStroke();
- if (strokeStyle) {
- var lineStringReplay = builderGroup.getBuilder(style.getZIndex(), 'LineString');
- lineStringReplay.setFillStrokeStyle(null, strokeStyle);
- lineStringReplay.drawLineString(geometry, feature);
- }
- var textStyle = style.getText();
- if (textStyle && textStyle.getText()) {
- var textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(style.getZIndex(), 'Text');
- textReplay.setTextStyle(textStyle);
- textReplay.drawText(geometry, feature);
- }
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
- * @param {import("../geom/MultiLineString.js").default|import("../render/Feature.js").default} geometry Geometry.
- * @param {import("../style/Style.js").default} style Style.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- */
- function renderMultiLineStringGeometry(builderGroup, geometry, style, feature, opt_declutterBuilderGroup) {
- var strokeStyle = style.getStroke();
- if (strokeStyle) {
- var lineStringReplay = builderGroup.getBuilder(style.getZIndex(), 'LineString');
- lineStringReplay.setFillStrokeStyle(null, strokeStyle);
- lineStringReplay.drawMultiLineString(geometry, feature);
- }
- var textStyle = style.getText();
- if (textStyle && textStyle.getText()) {
- var textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(style.getZIndex(), 'Text');
- textReplay.setTextStyle(textStyle);
- textReplay.drawText(geometry, feature);
- }
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
- * @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
- * @param {import("../style/Style.js").default} style Style.
- * @param {import("../Feature.js").default} feature Feature.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- */
- function renderMultiPolygonGeometry(builderGroup, geometry, style, feature, opt_declutterBuilderGroup) {
- var fillStyle = style.getFill();
- var strokeStyle = style.getStroke();
- if (strokeStyle || fillStyle) {
- var polygonReplay = builderGroup.getBuilder(style.getZIndex(), 'Polygon');
- polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
- polygonReplay.drawMultiPolygon(geometry, feature);
- }
- var textStyle = style.getText();
- if (textStyle && textStyle.getText()) {
- var textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(style.getZIndex(), 'Text');
- textReplay.setTextStyle(textStyle);
- textReplay.drawText(geometry, feature);
- }
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
- * @param {import("../geom/Point.js").default|import("../render/Feature.js").default} geometry Geometry.
- * @param {import("../style/Style.js").default} style Style.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- */
- function renderPointGeometry(builderGroup, geometry, style, feature, opt_declutterBuilderGroup) {
- var imageStyle = style.getImage();
- var textStyle = style.getText();
- /** @type {import("../render/canvas.js").DeclutterImageWithText} */
- var declutterImageWithText;
- if (imageStyle) {
- if (imageStyle.getImageState() != ImageState.LOADED) {
- return;
- }
- var imageBuilderGroup = builderGroup;
- if (opt_declutterBuilderGroup) {
- var declutterMode = imageStyle.getDeclutterMode();
- if (declutterMode !== 'none') {
- imageBuilderGroup = opt_declutterBuilderGroup;
- if (declutterMode === 'obstacle') {
- // draw in non-declutter group:
- var imageReplay_1 = builderGroup.getBuilder(style.getZIndex(), 'Image');
- imageReplay_1.setImageStyle(imageStyle, declutterImageWithText);
- imageReplay_1.drawPoint(geometry, feature);
- }
- else if (textStyle && textStyle.getText()) {
- declutterImageWithText = {};
- }
- }
- }
- var imageReplay = imageBuilderGroup.getBuilder(style.getZIndex(), 'Image');
- imageReplay.setImageStyle(imageStyle, declutterImageWithText);
- imageReplay.drawPoint(geometry, feature);
- }
- if (textStyle && textStyle.getText()) {
- var textBuilderGroup = builderGroup;
- if (opt_declutterBuilderGroup) {
- textBuilderGroup = opt_declutterBuilderGroup;
- }
- var textReplay = textBuilderGroup.getBuilder(style.getZIndex(), 'Text');
- textReplay.setTextStyle(textStyle, declutterImageWithText);
- textReplay.drawText(geometry, feature);
- }
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
- * @param {import("../geom/MultiPoint.js").default|import("../render/Feature.js").default} geometry Geometry.
- * @param {import("../style/Style.js").default} style Style.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- */
- function renderMultiPointGeometry(builderGroup, geometry, style, feature, opt_declutterBuilderGroup) {
- var imageStyle = style.getImage();
- var textStyle = style.getText();
- /** @type {import("../render/canvas.js").DeclutterImageWithText} */
- var declutterImageWithText;
- if (imageStyle) {
- if (imageStyle.getImageState() != ImageState.LOADED) {
- return;
- }
- var imageBuilderGroup = builderGroup;
- if (opt_declutterBuilderGroup) {
- var declutterMode = imageStyle.getDeclutterMode();
- if (declutterMode !== 'none') {
- imageBuilderGroup = opt_declutterBuilderGroup;
- if (declutterMode === 'obstacle') {
- // draw in non-declutter group:
- var imageReplay_2 = builderGroup.getBuilder(style.getZIndex(), 'Image');
- imageReplay_2.setImageStyle(imageStyle, declutterImageWithText);
- imageReplay_2.drawMultiPoint(geometry, feature);
- }
- else if (textStyle && textStyle.getText()) {
- declutterImageWithText = {};
- }
- }
- }
- var imageReplay = imageBuilderGroup.getBuilder(style.getZIndex(), 'Image');
- imageReplay.setImageStyle(imageStyle, declutterImageWithText);
- imageReplay.drawMultiPoint(geometry, feature);
- }
- if (textStyle && textStyle.getText()) {
- var textBuilderGroup = builderGroup;
- if (opt_declutterBuilderGroup) {
- textBuilderGroup = opt_declutterBuilderGroup;
- }
- var textReplay = textBuilderGroup.getBuilder(style.getZIndex(), 'Text');
- textReplay.setTextStyle(textStyle, declutterImageWithText);
- textReplay.drawText(geometry, feature);
- }
- }
- /**
- * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
- * @param {import("../geom/Polygon.js").default|import("../render/Feature.js").default} geometry Geometry.
- * @param {import("../style/Style.js").default} style Style.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {import("../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- */
- function renderPolygonGeometry(builderGroup, geometry, style, feature, opt_declutterBuilderGroup) {
- var fillStyle = style.getFill();
- var strokeStyle = style.getStroke();
- if (fillStyle || strokeStyle) {
- var polygonReplay = builderGroup.getBuilder(style.getZIndex(), 'Polygon');
- polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
- polygonReplay.drawPolygon(geometry, feature);
- }
- var textStyle = style.getText();
- if (textStyle && textStyle.getText()) {
- var textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(style.getZIndex(), 'Text');
- textReplay.setTextStyle(textStyle);
- textReplay.drawText(geometry, feature);
- }
- }
- //# sourceMappingURL=vector.js.map
- ;// ./node_modules/ol/renderer/canvas/VectorLayer.js
- var VectorLayer_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/renderer/canvas/VectorLayer
- */
- /**
- * @classdesc
- * Canvas renderer for vector layers.
- * @api
- */
- var CanvasVectorLayerRenderer = /** @class */ (function (_super) {
- VectorLayer_extends(CanvasVectorLayerRenderer, _super);
- /**
- * @param {import("../../layer/BaseVector.js").default} vectorLayer Vector layer.
- */
- function CanvasVectorLayerRenderer(vectorLayer) {
- var _this = _super.call(this, vectorLayer) || this;
- /** @private */
- _this.boundHandleStyleImageChange_ = _this.handleStyleImageChange_.bind(_this);
- /**
- * @type {boolean}
- */
- _this.animatingOrInteracting_;
- /**
- * @type {ImageData}
- */
- _this.hitDetectionImageData_ = null;
- /**
- * @type {Array<import("../../Feature.js").default>}
- */
- _this.renderedFeatures_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.renderedRevision_ = -1;
- /**
- * @private
- * @type {number}
- */
- _this.renderedResolution_ = NaN;
- /**
- * @private
- * @type {import("../../extent.js").Extent}
- */
- _this.renderedExtent_ = createEmpty();
- /**
- * @private
- * @type {import("../../extent.js").Extent}
- */
- _this.wrappedRenderedExtent_ = createEmpty();
- /**
- * @private
- * @type {number}
- */
- _this.renderedRotation_;
- /**
- * @private
- * @type {import("../../coordinate").Coordinate}
- */
- _this.renderedCenter_ = null;
- /**
- * @private
- * @type {import("../../proj/Projection").default}
- */
- _this.renderedProjection_ = null;
- /**
- * @private
- * @type {function(import("../../Feature.js").default, import("../../Feature.js").default): number|null}
- */
- _this.renderedRenderOrder_ = null;
- /**
- * @private
- * @type {import("../../render/canvas/ExecutorGroup").default}
- */
- _this.replayGroup_ = null;
- /**
- * A new replay group had to be created by `prepareFrame()`
- * @type {boolean}
- */
- _this.replayGroupChanged = true;
- /**
- * @type {import("../../render/canvas/ExecutorGroup").default}
- */
- _this.declutterExecutorGroup = null;
- /**
- * Clipping to be performed by `renderFrame()`
- * @type {boolean}
- */
- _this.clipping = true;
- /**
- * @private
- * @type {CanvasRenderingContext2D}
- */
- _this.compositionContext_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.opacity_ = 1;
- return _this;
- }
- /**
- * @param {ExecutorGroup} executorGroup Executor group.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @param {import("rbush").default} [opt_declutterTree] Declutter tree.
- */
- CanvasVectorLayerRenderer.prototype.renderWorlds = function (executorGroup, frameState, opt_declutterTree) {
- var extent = frameState.extent;
- var viewState = frameState.viewState;
- var center = viewState.center;
- var resolution = viewState.resolution;
- var projection = viewState.projection;
- var rotation = viewState.rotation;
- var projectionExtent = projection.getExtent();
- var vectorSource = this.getLayer().getSource();
- var pixelRatio = frameState.pixelRatio;
- var viewHints = frameState.viewHints;
- var snapToPixel = !(viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]);
- var context = this.compositionContext_;
- var width = Math.round(frameState.size[0] * pixelRatio);
- var height = Math.round(frameState.size[1] * pixelRatio);
- var multiWorld = vectorSource.getWrapX() && projection.canWrapX();
- var worldWidth = multiWorld ? extent_getWidth(projectionExtent) : null;
- var endWorld = multiWorld
- ? Math.ceil((extent[2] - projectionExtent[2]) / worldWidth) + 1
- : 1;
- var world = multiWorld
- ? Math.floor((extent[0] - projectionExtent[0]) / worldWidth)
- : 0;
- do {
- var transform = this.getRenderTransform(center, resolution, rotation, pixelRatio, width, height, world * worldWidth);
- executorGroup.execute(context, 1, transform, rotation, snapToPixel, undefined, opt_declutterTree);
- } while (++world < endWorld);
- };
- CanvasVectorLayerRenderer.prototype.setupCompositionContext_ = function () {
- if (this.opacity_ !== 1) {
- var compositionContext = createCanvasContext2D(this.context.canvas.width, this.context.canvas.height, canvasPool);
- this.compositionContext_ = compositionContext;
- }
- else {
- this.compositionContext_ = this.context;
- }
- };
- CanvasVectorLayerRenderer.prototype.releaseCompositionContext_ = function () {
- if (this.opacity_ !== 1) {
- var alpha = this.context.globalAlpha;
- this.context.globalAlpha = this.opacity_;
- this.context.drawImage(this.compositionContext_.canvas, 0, 0);
- this.context.globalAlpha = alpha;
- releaseCanvas(this.compositionContext_);
- canvasPool.push(this.compositionContext_.canvas);
- this.compositionContext_ = null;
- }
- };
- /**
- * Render declutter items for this layer
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- */
- CanvasVectorLayerRenderer.prototype.renderDeclutter = function (frameState) {
- if (this.declutterExecutorGroup) {
- this.setupCompositionContext_();
- this.renderWorlds(this.declutterExecutorGroup, frameState, frameState.declutterTree);
- this.releaseCompositionContext_();
- }
- };
- /**
- * Render the layer.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @param {HTMLElement} target Target that may be used to render content to.
- * @return {HTMLElement} The rendered element.
- */
- CanvasVectorLayerRenderer.prototype.renderFrame = function (frameState, target) {
- var pixelRatio = frameState.pixelRatio;
- var layerState = frameState.layerStatesArray[frameState.layerIndex];
- // set forward and inverse pixel transforms
- makeScale(this.pixelTransform, 1 / pixelRatio, 1 / pixelRatio);
- makeInverse(this.inversePixelTransform, this.pixelTransform);
- var canvasTransform = transform_toString(this.pixelTransform);
- this.useContainer(target, canvasTransform, this.getBackground(frameState));
- var context = this.context;
- var canvas = context.canvas;
- var replayGroup = this.replayGroup_;
- var declutterExecutorGroup = this.declutterExecutorGroup;
- if ((!replayGroup || replayGroup.isEmpty()) &&
- (!declutterExecutorGroup || declutterExecutorGroup.isEmpty())) {
- return null;
- }
- // resize and clear
- var width = Math.round(frameState.size[0] * pixelRatio);
- var height = Math.round(frameState.size[1] * pixelRatio);
- if (canvas.width != width || canvas.height != height) {
- canvas.width = width;
- canvas.height = height;
- if (canvas.style.transform !== canvasTransform) {
- canvas.style.transform = canvasTransform;
- }
- }
- else if (!this.containerReused) {
- context.clearRect(0, 0, width, height);
- }
- this.preRender(context, frameState);
- var viewState = frameState.viewState;
- var projection = viewState.projection;
- this.opacity_ = layerState.opacity;
- this.setupCompositionContext_();
- // clipped rendering if layer extent is set
- var clipped = false;
- var render = true;
- if (layerState.extent && this.clipping) {
- var layerExtent = proj_fromUserExtent(layerState.extent, projection);
- render = intersects(layerExtent, frameState.extent);
- clipped = render && !containsExtent(layerExtent, frameState.extent);
- if (clipped) {
- this.clipUnrotated(this.compositionContext_, frameState, layerExtent);
- }
- }
- if (render) {
- this.renderWorlds(replayGroup, frameState);
- }
- if (clipped) {
- this.compositionContext_.restore();
- }
- this.releaseCompositionContext_();
- this.postRender(context, frameState);
- if (this.renderedRotation_ !== viewState.rotation) {
- this.renderedRotation_ = viewState.rotation;
- this.hitDetectionImageData_ = null;
- }
- return this.container;
- };
- /**
- * Asynchronous layer level hit detection.
- * @param {import("../../pixel.js").Pixel} pixel Pixel.
- * @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
- */
- CanvasVectorLayerRenderer.prototype.getFeatures = function (pixel) {
- return new Promise(
- /**
- * @param {function(Array<import("../../Feature").default|import("../../render/Feature").default>): void} resolve Resolver function.
- * @this {CanvasVectorLayerRenderer}
- */
- function (resolve) {
- if (!this.hitDetectionImageData_ && !this.animatingOrInteracting_) {
- var size = [this.context.canvas.width, this.context.canvas.height];
- apply(this.pixelTransform, size);
- var center = this.renderedCenter_;
- var resolution = this.renderedResolution_;
- var rotation = this.renderedRotation_;
- var projection = this.renderedProjection_;
- var extent = this.wrappedRenderedExtent_;
- var layer = this.getLayer();
- var transforms = [];
- var width = size[0] * HIT_DETECT_RESOLUTION;
- var height = size[1] * HIT_DETECT_RESOLUTION;
- transforms.push(this.getRenderTransform(center, resolution, rotation, HIT_DETECT_RESOLUTION, width, height, 0).slice());
- var source = layer.getSource();
- var projectionExtent = projection.getExtent();
- if (source.getWrapX() &&
- projection.canWrapX() &&
- !containsExtent(projectionExtent, extent)) {
- var startX = extent[0];
- var worldWidth = extent_getWidth(projectionExtent);
- var world = 0;
- var offsetX = void 0;
- while (startX < projectionExtent[0]) {
- --world;
- offsetX = worldWidth * world;
- transforms.push(this.getRenderTransform(center, resolution, rotation, HIT_DETECT_RESOLUTION, width, height, offsetX).slice());
- startX += worldWidth;
- }
- world = 0;
- startX = extent[2];
- while (startX > projectionExtent[2]) {
- ++world;
- offsetX = worldWidth * world;
- transforms.push(this.getRenderTransform(center, resolution, rotation, HIT_DETECT_RESOLUTION, width, height, offsetX).slice());
- startX -= worldWidth;
- }
- }
- this.hitDetectionImageData_ = createHitDetectionImageData(size, transforms, this.renderedFeatures_, layer.getStyleFunction(), extent, resolution, rotation);
- }
- resolve(hitDetect(pixel, this.renderedFeatures_, this.hitDetectionImageData_));
- }.bind(this));
- };
- /**
- * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @param {number} hitTolerance Hit tolerance in pixels.
- * @param {import("../vector.js").FeatureCallback<T>} callback Feature callback.
- * @param {Array<import("../Map.js").HitMatch<T>>} matches The hit detected matches with tolerance.
- * @return {T|undefined} Callback result.
- * @template T
- */
- CanvasVectorLayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, matches) {
- var _this = this;
- if (!this.replayGroup_) {
- return undefined;
- }
- var resolution = frameState.viewState.resolution;
- var rotation = frameState.viewState.rotation;
- var layer = this.getLayer();
- /** @type {!Object<string, import("../Map.js").HitMatch<T>|true>} */
- var features = {};
- /**
- * @param {import("../../Feature.js").FeatureLike} feature Feature.
- * @param {import("../../geom/SimpleGeometry.js").default} geometry Geometry.
- * @param {number} distanceSq The squared distance to the click position
- * @return {T|undefined} Callback result.
- */
- var featureCallback = function (feature, geometry, distanceSq) {
- var key = getUid(feature);
- var match = features[key];
- if (!match) {
- if (distanceSq === 0) {
- features[key] = true;
- return callback(feature, layer, geometry);
- }
- matches.push((features[key] = {
- feature: feature,
- layer: layer,
- geometry: geometry,
- distanceSq: distanceSq,
- callback: callback,
- }));
- }
- else if (match !== true && distanceSq < match.distanceSq) {
- if (distanceSq === 0) {
- features[key] = true;
- matches.splice(matches.lastIndexOf(match), 1);
- return callback(feature, layer, geometry);
- }
- match.geometry = geometry;
- match.distanceSq = distanceSq;
- }
- return undefined;
- };
- var result;
- var executorGroups = [this.replayGroup_];
- if (this.declutterExecutorGroup) {
- executorGroups.push(this.declutterExecutorGroup);
- }
- executorGroups.some(function (executorGroup) {
- return (result = executorGroup.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, featureCallback, executorGroup === _this.declutterExecutorGroup &&
- frameState.declutterTree
- ? frameState.declutterTree.all().map(function (item) { return item.value; })
- : null));
- });
- return result;
- };
- /**
- * Perform action necessary to get the layer rendered after new fonts have loaded
- */
- CanvasVectorLayerRenderer.prototype.handleFontsChanged = function () {
- var layer = this.getLayer();
- if (layer.getVisible() && this.replayGroup_) {
- layer.changed();
- }
- };
- /**
- * Handle changes in image style state.
- * @param {import("../../events/Event.js").default} event Image style change event.
- * @private
- */
- CanvasVectorLayerRenderer.prototype.handleStyleImageChange_ = function (event) {
- this.renderIfReadyAndVisible();
- };
- /**
- * Determine whether render should be called.
- * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
- * @return {boolean} Layer is ready to be rendered.
- */
- CanvasVectorLayerRenderer.prototype.prepareFrame = function (frameState) {
- var vectorLayer = this.getLayer();
- var vectorSource = vectorLayer.getSource();
- if (!vectorSource) {
- return false;
- }
- var animating = frameState.viewHints[ViewHint.ANIMATING];
- var interacting = frameState.viewHints[ViewHint.INTERACTING];
- var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
- var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
- if ((this.ready && !updateWhileAnimating && animating) ||
- (!updateWhileInteracting && interacting)) {
- this.animatingOrInteracting_ = true;
- return true;
- }
- this.animatingOrInteracting_ = false;
- var frameStateExtent = frameState.extent;
- var viewState = frameState.viewState;
- var projection = viewState.projection;
- var resolution = viewState.resolution;
- var pixelRatio = frameState.pixelRatio;
- var vectorLayerRevision = vectorLayer.getRevision();
- var vectorLayerRenderBuffer = vectorLayer.getRenderBuffer();
- var vectorLayerRenderOrder = vectorLayer.getRenderOrder();
- if (vectorLayerRenderOrder === undefined) {
- vectorLayerRenderOrder = defaultOrder;
- }
- var center = viewState.center.slice();
- var extent = buffer(frameStateExtent, vectorLayerRenderBuffer * resolution);
- var renderedExtent = extent.slice();
- var loadExtents = [extent.slice()];
- var projectionExtent = projection.getExtent();
- if (vectorSource.getWrapX() &&
- projection.canWrapX() &&
- !containsExtent(projectionExtent, frameState.extent)) {
- // For the replay group, we need an extent that intersects the real world
- // (-180° to +180°). To support geometries in a coordinate range from -540°
- // to +540°, we add at least 1 world width on each side of the projection
- // extent. If the viewport is wider than the world, we need to add half of
- // the viewport width to make sure we cover the whole viewport.
- var worldWidth = extent_getWidth(projectionExtent);
- var gutter = Math.max(extent_getWidth(extent) / 2, worldWidth);
- extent[0] = projectionExtent[0] - gutter;
- extent[2] = projectionExtent[2] + gutter;
- coordinate_wrapX(center, projection);
- var loadExtent = wrapX(loadExtents[0], projection);
- // If the extent crosses the date line, we load data for both edges of the worlds
- if (loadExtent[0] < projectionExtent[0] &&
- loadExtent[2] < projectionExtent[2]) {
- loadExtents.push([
- loadExtent[0] + worldWidth,
- loadExtent[1],
- loadExtent[2] + worldWidth,
- loadExtent[3],
- ]);
- }
- else if (loadExtent[0] > projectionExtent[0] &&
- loadExtent[2] > projectionExtent[2]) {
- loadExtents.push([
- loadExtent[0] - worldWidth,
- loadExtent[1],
- loadExtent[2] - worldWidth,
- loadExtent[3],
- ]);
- }
- }
- if (this.ready &&
- this.renderedResolution_ == resolution &&
- this.renderedRevision_ == vectorLayerRevision &&
- this.renderedRenderOrder_ == vectorLayerRenderOrder &&
- containsExtent(this.wrappedRenderedExtent_, extent)) {
- if (!equals(this.renderedExtent_, renderedExtent)) {
- this.hitDetectionImageData_ = null;
- this.renderedExtent_ = renderedExtent;
- }
- this.renderedCenter_ = center;
- this.replayGroupChanged = false;
- return true;
- }
- this.replayGroup_ = null;
- var replayGroup = new canvas_BuilderGroup(getTolerance(resolution, pixelRatio), extent, resolution, pixelRatio);
- var declutterBuilderGroup;
- if (this.getLayer().getDeclutter()) {
- declutterBuilderGroup = new canvas_BuilderGroup(getTolerance(resolution, pixelRatio), extent, resolution, pixelRatio);
- }
- var userProjection = getUserProjection();
- var userTransform;
- if (userProjection) {
- for (var i = 0, ii = loadExtents.length; i < ii; ++i) {
- var extent_1 = loadExtents[i];
- var userExtent_1 = proj_toUserExtent(extent_1, projection);
- vectorSource.loadFeatures(userExtent_1, toUserResolution(resolution, projection), userProjection);
- }
- userTransform = getTransformFromProjections(userProjection, projection);
- }
- else {
- for (var i = 0, ii = loadExtents.length; i < ii; ++i) {
- vectorSource.loadFeatures(loadExtents[i], resolution, projection);
- }
- }
- var squaredTolerance = getSquaredTolerance(resolution, pixelRatio);
- var ready = true;
- var render =
- /**
- * @param {import("../../Feature.js").default} feature Feature.
- * @this {CanvasVectorLayerRenderer}
- */
- function (feature) {
- var styles;
- var styleFunction = feature.getStyleFunction() || vectorLayer.getStyleFunction();
- if (styleFunction) {
- styles = styleFunction(feature, resolution);
- }
- if (styles) {
- var dirty = this.renderFeature(feature, squaredTolerance, styles, replayGroup, userTransform, declutterBuilderGroup);
- ready = ready && !dirty;
- }
- }.bind(this);
- var userExtent = proj_toUserExtent(extent, projection);
- /** @type {Array<import("../../Feature.js").default>} */
- var features = vectorSource.getFeaturesInExtent(userExtent);
- if (vectorLayerRenderOrder) {
- features.sort(vectorLayerRenderOrder);
- }
- for (var i = 0, ii = features.length; i < ii; ++i) {
- render(features[i]);
- }
- this.renderedFeatures_ = features;
- this.ready = ready;
- var replayGroupInstructions = replayGroup.finish();
- var executorGroup = new canvas_ExecutorGroup(extent, resolution, pixelRatio, vectorSource.getOverlaps(), replayGroupInstructions, vectorLayer.getRenderBuffer());
- if (declutterBuilderGroup) {
- this.declutterExecutorGroup = new canvas_ExecutorGroup(extent, resolution, pixelRatio, vectorSource.getOverlaps(), declutterBuilderGroup.finish(), vectorLayer.getRenderBuffer());
- }
- this.renderedResolution_ = resolution;
- this.renderedRevision_ = vectorLayerRevision;
- this.renderedRenderOrder_ = vectorLayerRenderOrder;
- this.renderedExtent_ = renderedExtent;
- this.wrappedRenderedExtent_ = extent;
- this.renderedCenter_ = center;
- this.renderedProjection_ = projection;
- this.replayGroup_ = executorGroup;
- this.hitDetectionImageData_ = null;
- this.replayGroupChanged = true;
- return true;
- };
- /**
- * @param {import("../../Feature.js").default} feature Feature.
- * @param {number} squaredTolerance Squared render tolerance.
- * @param {import("../../style/Style.js").default|Array<import("../../style/Style.js").default>} styles The style or array of styles.
- * @param {import("../../render/canvas/BuilderGroup.js").default} builderGroup Builder group.
- * @param {import("../../proj.js").TransformFunction} [opt_transform] Transform from user to view projection.
- * @param {import("../../render/canvas/BuilderGroup.js").default} [opt_declutterBuilderGroup] Builder for decluttering.
- * @return {boolean} `true` if an image is loading.
- */
- CanvasVectorLayerRenderer.prototype.renderFeature = function (feature, squaredTolerance, styles, builderGroup, opt_transform, opt_declutterBuilderGroup) {
- if (!styles) {
- return false;
- }
- var loading = false;
- if (Array.isArray(styles)) {
- for (var i = 0, ii = styles.length; i < ii; ++i) {
- loading =
- renderFeature(builderGroup, feature, styles[i], squaredTolerance, this.boundHandleStyleImageChange_, opt_transform, opt_declutterBuilderGroup) || loading;
- }
- }
- else {
- loading = renderFeature(builderGroup, feature, styles, squaredTolerance, this.boundHandleStyleImageChange_, opt_transform, opt_declutterBuilderGroup);
- }
- return loading;
- };
- return CanvasVectorLayerRenderer;
- }(canvas_Layer));
- /* harmony default export */ var canvas_VectorLayer = (CanvasVectorLayerRenderer);
- //# sourceMappingURL=VectorLayer.js.map
- ;// ./node_modules/ol/layer/Vector.js
- var Vector_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/layer/Vector
- */
- /**
- * @classdesc
- * Vector data is rendered client-side, as vectors. This layer type provides most accurate rendering
- * even during animations. Points and labels stay upright on rotated views. For very large
- * amounts of vector data, performance may suffer during pan and zoom animations. In this case,
- * try {@link module:ol/layer/VectorImage~VectorImageLayer}.
- *
- * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
- * property on the layer object; for example, setting `title: 'My Title'` in the
- * options means that `title` is observable, and has get/set accessors.
- *
- * @template {import("../source/Vector.js").default} VectorSourceType
- * @extends {BaseVectorLayer<VectorSourceType, CanvasVectorLayerRenderer>}
- * @api
- */
- var VectorLayer = /** @class */ (function (_super) {
- Vector_extends(VectorLayer, _super);
- /**
- * @param {import("./BaseVector.js").Options<VectorSourceType>} [opt_options] Options.
- */
- function VectorLayer(opt_options) {
- return _super.call(this, opt_options) || this;
- }
- VectorLayer.prototype.createRenderer = function () {
- return new canvas_VectorLayer(this);
- };
- return VectorLayer;
- }(BaseVector));
- /* harmony default export */ var Vector = (VectorLayer);
- //# sourceMappingURL=Vector.js.map
- ;// ./node_modules/ol/structs/LRUCache.js
- /**
- * @module ol/structs/LRUCache
- */
- /**
- * @typedef {Object} Entry
- * @property {string} key_ Key.
- * @property {Object} newer Newer.
- * @property {Object} older Older.
- * @property {*} value_ Value.
- */
- /**
- * @classdesc
- * Implements a Least-Recently-Used cache where the keys do not conflict with
- * Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring
- * items from the cache is the responsibility of the user.
- *
- * @fires import("../events/Event.js").default
- * @template T
- */
- var LRUCache = /** @class */ (function () {
- /**
- * @param {number} [opt_highWaterMark] High water mark.
- */
- function LRUCache(opt_highWaterMark) {
- /**
- * Desired max cache size after expireCache(). If set to 0, no cache entries
- * will be pruned at all.
- * @type {number}
- */
- this.highWaterMark =
- opt_highWaterMark !== undefined ? opt_highWaterMark : 2048;
- /**
- * @private
- * @type {number}
- */
- this.count_ = 0;
- /**
- * @private
- * @type {!Object<string, Entry>}
- */
- this.entries_ = {};
- /**
- * @private
- * @type {?Entry}
- */
- this.oldest_ = null;
- /**
- * @private
- * @type {?Entry}
- */
- this.newest_ = null;
- }
- /**
- * @return {boolean} Can expire cache.
- */
- LRUCache.prototype.canExpireCache = function () {
- return this.highWaterMark > 0 && this.getCount() > this.highWaterMark;
- };
- /**
- * Expire the cache.
- * @param {!Object<string, boolean>} [keep] Keys to keep. To be implemented by subclasses.
- */
- LRUCache.prototype.expireCache = function (keep) {
- while (this.canExpireCache()) {
- this.pop();
- }
- };
- /**
- * FIXME empty description for jsdoc
- */
- LRUCache.prototype.clear = function () {
- this.count_ = 0;
- this.entries_ = {};
- this.oldest_ = null;
- this.newest_ = null;
- };
- /**
- * @param {string} key Key.
- * @return {boolean} Contains key.
- */
- LRUCache.prototype.containsKey = function (key) {
- return this.entries_.hasOwnProperty(key);
- };
- /**
- * @param {function(T, string, LRUCache<T>): ?} f The function
- * to call for every entry from the oldest to the newer. This function takes
- * 3 arguments (the entry value, the entry key and the LRUCache object).
- * The return value is ignored.
- */
- LRUCache.prototype.forEach = function (f) {
- var entry = this.oldest_;
- while (entry) {
- f(entry.value_, entry.key_, this);
- entry = entry.newer;
- }
- };
- /**
- * @param {string} key Key.
- * @param {*} [opt_options] Options (reserved for subclasses).
- * @return {T} Value.
- */
- LRUCache.prototype.get = function (key, opt_options) {
- var entry = this.entries_[key];
- asserts_assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
- if (entry === this.newest_) {
- return entry.value_;
- }
- else if (entry === this.oldest_) {
- this.oldest_ = /** @type {Entry} */ (this.oldest_.newer);
- this.oldest_.older = null;
- }
- else {
- entry.newer.older = entry.older;
- entry.older.newer = entry.newer;
- }
- entry.newer = null;
- entry.older = this.newest_;
- this.newest_.newer = entry;
- this.newest_ = entry;
- return entry.value_;
- };
- /**
- * Remove an entry from the cache.
- * @param {string} key The entry key.
- * @return {T} The removed entry.
- */
- LRUCache.prototype.remove = function (key) {
- var entry = this.entries_[key];
- asserts_assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
- if (entry === this.newest_) {
- this.newest_ = /** @type {Entry} */ (entry.older);
- if (this.newest_) {
- this.newest_.newer = null;
- }
- }
- else if (entry === this.oldest_) {
- this.oldest_ = /** @type {Entry} */ (entry.newer);
- if (this.oldest_) {
- this.oldest_.older = null;
- }
- }
- else {
- entry.newer.older = entry.older;
- entry.older.newer = entry.newer;
- }
- delete this.entries_[key];
- --this.count_;
- return entry.value_;
- };
- /**
- * @return {number} Count.
- */
- LRUCache.prototype.getCount = function () {
- return this.count_;
- };
- /**
- * @return {Array<string>} Keys.
- */
- LRUCache.prototype.getKeys = function () {
- var keys = new Array(this.count_);
- var i = 0;
- var entry;
- for (entry = this.newest_; entry; entry = entry.older) {
- keys[i++] = entry.key_;
- }
- return keys;
- };
- /**
- * @return {Array<T>} Values.
- */
- LRUCache.prototype.getValues = function () {
- var values = new Array(this.count_);
- var i = 0;
- var entry;
- for (entry = this.newest_; entry; entry = entry.older) {
- values[i++] = entry.value_;
- }
- return values;
- };
- /**
- * @return {T} Last value.
- */
- LRUCache.prototype.peekLast = function () {
- return this.oldest_.value_;
- };
- /**
- * @return {string} Last key.
- */
- LRUCache.prototype.peekLastKey = function () {
- return this.oldest_.key_;
- };
- /**
- * Get the key of the newest item in the cache. Throws if the cache is empty.
- * @return {string} The newest key.
- */
- LRUCache.prototype.peekFirstKey = function () {
- return this.newest_.key_;
- };
- /**
- * Return an entry without updating least recently used time.
- * @param {string} key Key.
- * @return {T} Value.
- */
- LRUCache.prototype.peek = function (key) {
- if (!this.containsKey(key)) {
- return undefined;
- }
- return this.entries_[key].value_;
- };
- /**
- * @return {T} value Value.
- */
- LRUCache.prototype.pop = function () {
- var entry = this.oldest_;
- delete this.entries_[entry.key_];
- if (entry.newer) {
- entry.newer.older = null;
- }
- this.oldest_ = /** @type {Entry} */ (entry.newer);
- if (!this.oldest_) {
- this.newest_ = null;
- }
- --this.count_;
- return entry.value_;
- };
- /**
- * @param {string} key Key.
- * @param {T} value Value.
- */
- LRUCache.prototype.replace = function (key, value) {
- this.get(key); // update `newest_`
- this.entries_[key].value_ = value;
- };
- /**
- * @param {string} key Key.
- * @param {T} value Value.
- */
- LRUCache.prototype.set = function (key, value) {
- asserts_assert(!(key in this.entries_), 16); // Tried to set a value for a key that is used already
- var entry = {
- key_: key,
- newer: null,
- older: this.newest_,
- value_: value,
- };
- if (!this.newest_) {
- this.oldest_ = entry;
- }
- else {
- this.newest_.newer = entry;
- }
- this.newest_ = entry;
- this.entries_[key] = entry;
- ++this.count_;
- };
- /**
- * Set a maximum number of entries for the cache.
- * @param {number} size Cache size.
- * @api
- */
- LRUCache.prototype.setSize = function (size) {
- this.highWaterMark = size;
- };
- return LRUCache;
- }());
- /* harmony default export */ var structs_LRUCache = (LRUCache);
- //# sourceMappingURL=LRUCache.js.map
- ;// ./node_modules/ol/tilecoord.js
- /**
- * @module ol/tilecoord
- */
- /**
- * An array of three numbers representing the location of a tile in a tile
- * grid. The order is `z` (zoom level), `x` (column), and `y` (row).
- * @typedef {Array<number>} TileCoord
- * @api
- */
- /**
- * @param {number} z Z.
- * @param {number} x X.
- * @param {number} y Y.
- * @param {TileCoord} [opt_tileCoord] Tile coordinate.
- * @return {TileCoord} Tile coordinate.
- */
- function tilecoord_createOrUpdate(z, x, y, opt_tileCoord) {
- if (opt_tileCoord !== undefined) {
- opt_tileCoord[0] = z;
- opt_tileCoord[1] = x;
- opt_tileCoord[2] = y;
- return opt_tileCoord;
- }
- else {
- return [z, x, y];
- }
- }
- /**
- * @param {number} z Z.
- * @param {number} x X.
- * @param {number} y Y.
- * @return {string} Key.
- */
- function getKeyZXY(z, x, y) {
- return z + '/' + x + '/' + y;
- }
- /**
- * Get the key for a tile coord.
- * @param {TileCoord} tileCoord The tile coord.
- * @return {string} Key.
- */
- function tilecoord_getKey(tileCoord) {
- return getKeyZXY(tileCoord[0], tileCoord[1], tileCoord[2]);
- }
- /**
- * Get the tile cache key for a tile key obtained through `tile.getKey()`.
- * @param {string} tileKey The tile key.
- * @return {string} The cache key.
- */
- function getCacheKeyForTileKey(tileKey) {
- var _a = tileKey
- .substring(tileKey.lastIndexOf('/') + 1, tileKey.length)
- .split(',')
- .map(Number), z = _a[0], x = _a[1], y = _a[2];
- return getKeyZXY(z, x, y);
- }
- /**
- * Get a tile coord given a key.
- * @param {string} key The tile coord key.
- * @return {TileCoord} The tile coord.
- */
- function fromKey(key) {
- return key.split('/').map(Number);
- }
- /**
- * @param {TileCoord} tileCoord Tile coord.
- * @return {number} Hash.
- */
- function hash(tileCoord) {
- return (tileCoord[1] << tileCoord[0]) + tileCoord[2];
- }
- /**
- * @param {TileCoord} tileCoord Tile coordinate.
- * @param {!import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
- * @return {boolean} Tile coordinate is within extent and zoom level range.
- */
- function withinExtentAndZ(tileCoord, tileGrid) {
- var z = tileCoord[0];
- var x = tileCoord[1];
- var y = tileCoord[2];
- if (tileGrid.getMinZoom() > z || z > tileGrid.getMaxZoom()) {
- return false;
- }
- var tileRange = tileGrid.getFullTileRange(z);
- if (!tileRange) {
- return true;
- }
- else {
- return tileRange.containsXY(x, y);
- }
- }
- //# sourceMappingURL=tilecoord.js.map
- ;// ./node_modules/ol/TileCache.js
- var TileCache_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/TileCache
- */
- var TileCache = /** @class */ (function (_super) {
- TileCache_extends(TileCache, _super);
- function TileCache() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {!Object<string, boolean>} usedTiles Used tiles.
- */
- TileCache.prototype.expireCache = function (usedTiles) {
- while (this.canExpireCache()) {
- var tile = this.peekLast();
- if (tile.getKey() in usedTiles) {
- break;
- }
- else {
- this.pop().release();
- }
- }
- };
- /**
- * Prune all tiles from the cache that don't have the same z as the newest tile.
- */
- TileCache.prototype.pruneExceptNewestZ = function () {
- if (this.getCount() === 0) {
- return;
- }
- var key = this.peekFirstKey();
- var tileCoord = fromKey(key);
- var z = tileCoord[0];
- this.forEach(function (tile) {
- if (tile.tileCoord[0] !== z) {
- this.remove(tilecoord_getKey(tile.tileCoord));
- tile.release();
- }
- }.bind(this));
- };
- return TileCache;
- }(structs_LRUCache));
- /* harmony default export */ var ol_TileCache = (TileCache);
- //# sourceMappingURL=TileCache.js.map
- ;// ./node_modules/ol/source/TileEventType.js
- /**
- * @module ol/source/TileEventType
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var TileEventType = ({
- /**
- * Triggered when a tile starts loading.
- * @event module:ol/source/Tile.TileSourceEvent#tileloadstart
- * @api
- */
- TILELOADSTART: 'tileloadstart',
- /**
- * Triggered when a tile finishes loading, either when its data is loaded,
- * or when loading was aborted because the tile is no longer needed.
- * @event module:ol/source/Tile.TileSourceEvent#tileloadend
- * @api
- */
- TILELOADEND: 'tileloadend',
- /**
- * Triggered if tile loading results in an error.
- * @event module:ol/source/Tile.TileSourceEvent#tileloaderror
- * @api
- */
- TILELOADERROR: 'tileloaderror',
- });
- /**
- * @typedef {'tileloadstart'|'tileloadend'|'tileloaderror'} TileSourceEventTypes
- */
- //# sourceMappingURL=TileEventType.js.map
- ;// ./node_modules/ol/source/Source.js
- var Source_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/source/Source
- */
- /**
- * @typedef {'undefined' | 'loading' | 'ready' | 'error'} State
- * State of the source, one of 'undefined', 'loading', 'ready' or 'error'.
- */
- /**
- * A function that takes a {@link module:ol/PluggableMap~FrameState} and returns a string or
- * an array of strings representing source attributions.
- *
- * @typedef {function(import("../PluggableMap.js").FrameState): (string|Array<string>)} Attribution
- */
- /**
- * A type that can be used to provide attribution information for data sources.
- *
- * It represents either
- * * a simple string (e.g. `'© Acme Inc.'`)
- * * an array of simple strings (e.g. `['© Acme Inc.', '© Bacme Inc.']`)
- * * a function that returns a string or array of strings ({@link module:ol/source/Source~Attribution})
- *
- * @typedef {string|Array<string>|Attribution} AttributionLike
- */
- /**
- * @typedef {Object} Options
- * @property {AttributionLike} [attributions] Attributions.
- * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
- * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
- * @property {import("./Source.js").State} [state='ready'] State.
- * @property {boolean} [wrapX=false] WrapX.
- * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,
- * the nearest neighbor is used when resampling.
- */
- /**
- * @classdesc
- * Abstract base class; normally only used for creating subclasses and not
- * instantiated in apps.
- * Base class for {@link module:ol/layer/Layer~Layer} sources.
- *
- * A generic `change` event is triggered when the state of the source changes.
- * @abstract
- * @api
- */
- var Source = /** @class */ (function (_super) {
- Source_extends(Source, _super);
- /**
- * @param {Options} options Source options.
- */
- function Source(options) {
- var _this = _super.call(this) || this;
- /**
- * @protected
- * @type {import("../proj/Projection.js").default|null}
- */
- _this.projection = proj_get(options.projection);
- /**
- * @private
- * @type {?Attribution}
- */
- _this.attributions_ = adaptAttributions(options.attributions);
- /**
- * @private
- * @type {boolean}
- */
- _this.attributionsCollapsible_ =
- options.attributionsCollapsible !== undefined
- ? options.attributionsCollapsible
- : true;
- /**
- * This source is currently loading data. Sources that defer loading to the
- * map's tile queue never set this to `true`.
- * @type {boolean}
- */
- _this.loading = false;
- /**
- * @private
- * @type {import("./Source.js").State}
- */
- _this.state_ = options.state !== undefined ? options.state : 'ready';
- /**
- * @private
- * @type {boolean}
- */
- _this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;
- /**
- * @private
- * @type {boolean}
- */
- _this.interpolate_ = !!options.interpolate;
- /**
- * @protected
- * @type {function(import("../View.js").ViewOptions):void}
- */
- _this.viewResolver = null;
- /**
- * @protected
- * @type {function(Error):void}
- */
- _this.viewRejector = null;
- var self = _this;
- /**
- * @private
- * @type {Promise<import("../View.js").ViewOptions>}
- */
- _this.viewPromise_ = new Promise(function (resolve, reject) {
- self.viewResolver = resolve;
- self.viewRejector = reject;
- });
- return _this;
- }
- /**
- * Get the attribution function for the source.
- * @return {?Attribution} Attribution function.
- * @api
- */
- Source.prototype.getAttributions = function () {
- return this.attributions_;
- };
- /**
- * @return {boolean} Attributions are collapsible.
- * @api
- */
- Source.prototype.getAttributionsCollapsible = function () {
- return this.attributionsCollapsible_;
- };
- /**
- * Get the projection of the source.
- * @return {import("../proj/Projection.js").default|null} Projection.
- * @api
- */
- Source.prototype.getProjection = function () {
- return this.projection;
- };
- /**
- * @abstract
- * @return {Array<number>|null} Resolutions.
- */
- Source.prototype.getResolutions = function () {
- return util_abstract();
- };
- /**
- * @return {Promise<import("../View.js").ViewOptions>} A promise for view-related properties.
- */
- Source.prototype.getView = function () {
- return this.viewPromise_;
- };
- /**
- * Get the state of the source, see {@link import("./Source.js").State} for possible states.
- * @return {import("./Source.js").State} State.
- * @api
- */
- Source.prototype.getState = function () {
- return this.state_;
- };
- /**
- * @return {boolean|undefined} Wrap X.
- */
- Source.prototype.getWrapX = function () {
- return this.wrapX_;
- };
- /**
- * @return {boolean} Use linear interpolation when resampling.
- */
- Source.prototype.getInterpolate = function () {
- return this.interpolate_;
- };
- /**
- * Refreshes the source. The source will be cleared, and data from the server will be reloaded.
- * @api
- */
- Source.prototype.refresh = function () {
- this.changed();
- };
- /**
- * Set the attributions of the source.
- * @param {AttributionLike|undefined} attributions Attributions.
- * Can be passed as `string`, `Array<string>`, {@link module:ol/source/Source~Attribution},
- * or `undefined`.
- * @api
- */
- Source.prototype.setAttributions = function (attributions) {
- this.attributions_ = adaptAttributions(attributions);
- this.changed();
- };
- /**
- * Set the state of the source.
- * @param {import("./Source.js").State} state State.
- */
- Source.prototype.setState = function (state) {
- this.state_ = state;
- this.changed();
- };
- return Source;
- }(ol_Object));
- /**
- * Turns the attributions option into an attributions function.
- * @param {AttributionLike|undefined} attributionLike The attribution option.
- * @return {Attribution|null} An attribution function (or null).
- */
- function adaptAttributions(attributionLike) {
- if (!attributionLike) {
- return null;
- }
- if (Array.isArray(attributionLike)) {
- return function (frameState) {
- return attributionLike;
- };
- }
- if (typeof attributionLike === 'function') {
- return attributionLike;
- }
- return function (frameState) {
- return [attributionLike];
- };
- }
- /* harmony default export */ var source_Source = (Source);
- //# sourceMappingURL=Source.js.map
- ;// ./node_modules/ol/tilegrid/common.js
- /**
- * @module ol/tilegrid/common
- */
- /**
- * Default maximum zoom for default tile grids.
- * @type {number}
- */
- var DEFAULT_MAX_ZOOM = 42;
- /**
- * Default tile size.
- * @type {number}
- */
- var DEFAULT_TILE_SIZE = 256;
- //# sourceMappingURL=common.js.map
- ;// ./node_modules/ol/tilegrid/TileGrid.js
- /**
- * @module ol/tilegrid/TileGrid
- */
- /**
- * @private
- * @type {import("../tilecoord.js").TileCoord}
- */
- var tmpTileCoord = [0, 0, 0];
- /**
- * Number of decimal digits to consider in integer values when rounding.
- * @type {number}
- */
- var DECIMALS = 5;
- /**
- * @typedef {Object} Options
- * @property {import("../extent.js").Extent} [extent] Extent for the tile grid. No tiles outside this
- * extent will be requested by {@link module:ol/source/Tile~TileSource} sources. When no `origin` or
- * `origins` are configured, the `origin` will be set to the top-left corner of the extent.
- * @property {number} [minZoom=0] Minimum zoom.
- * @property {import("../coordinate.js").Coordinate} [origin] The tile grid origin, i.e. where the `x`
- * and `y` axes meet (`[z, 0, 0]`). Tile coordinates increase left to right and downwards. If not
- * specified, `extent` or `origins` must be provided.
- * @property {Array<import("../coordinate.js").Coordinate>} [origins] Tile grid origins, i.e. where
- * the `x` and `y` axes meet (`[z, 0, 0]`), for each zoom level. If given, the array length
- * should match the length of the `resolutions` array, i.e. each resolution can have a different
- * origin. Tile coordinates increase left to right and downwards. If not specified, `extent` or
- * `origin` must be provided.
- * @property {!Array<number>} resolutions Resolutions. The array index of each resolution needs
- * to match the zoom level. This means that even if a `minZoom` is configured, the resolutions
- * array will have a length of `maxZoom + 1`.
- * @property {Array<import("../size.js").Size>} [sizes] Number of tile rows and columns
- * of the grid for each zoom level. If specified the values
- * define each zoom level's extent together with the `origin` or `origins`.
- * A grid `extent` can be configured in addition, and will further limit the extent
- * for which tile requests are made by sources. If the bottom-left corner of
- * an extent is used as `origin` or `origins`, then the `y` value must be
- * negative because OpenLayers tile coordinates use the top left as the origin.
- * @property {number|import("../size.js").Size} [tileSize] Tile size.
- * Default is `[256, 256]`.
- * @property {Array<number|import("../size.js").Size>} [tileSizes] Tile sizes. If given, the array length
- * should match the length of the `resolutions` array, i.e. each resolution can have a different
- * tile size.
- */
- /**
- * @classdesc
- * Base class for setting the grid pattern for sources accessing tiled-image
- * servers.
- * @api
- */
- var TileGrid = /** @class */ (function () {
- /**
- * @param {Options} options Tile grid options.
- */
- function TileGrid(options) {
- /**
- * @protected
- * @type {number}
- */
- this.minZoom = options.minZoom !== undefined ? options.minZoom : 0;
- /**
- * @private
- * @type {!Array<number>}
- */
- this.resolutions_ = options.resolutions;
- asserts_assert(isSorted(this.resolutions_, function (a, b) {
- return b - a;
- }, true), 17); // `resolutions` must be sorted in descending order
- // check if we've got a consistent zoom factor and origin
- var zoomFactor;
- if (!options.origins) {
- for (var i = 0, ii = this.resolutions_.length - 1; i < ii; ++i) {
- if (!zoomFactor) {
- zoomFactor = this.resolutions_[i] / this.resolutions_[i + 1];
- }
- else {
- if (this.resolutions_[i] / this.resolutions_[i + 1] !== zoomFactor) {
- zoomFactor = undefined;
- break;
- }
- }
- }
- }
- /**
- * @private
- * @type {number|undefined}
- */
- this.zoomFactor_ = zoomFactor;
- /**
- * @protected
- * @type {number}
- */
- this.maxZoom = this.resolutions_.length - 1;
- /**
- * @private
- * @type {import("../coordinate.js").Coordinate|null}
- */
- this.origin_ = options.origin !== undefined ? options.origin : null;
- /**
- * @private
- * @type {Array<import("../coordinate.js").Coordinate>}
- */
- this.origins_ = null;
- if (options.origins !== undefined) {
- this.origins_ = options.origins;
- asserts_assert(this.origins_.length == this.resolutions_.length, 20); // Number of `origins` and `resolutions` must be equal
- }
- var extent = options.extent;
- if (extent !== undefined && !this.origin_ && !this.origins_) {
- this.origin_ = getTopLeft(extent);
- }
- asserts_assert((!this.origin_ && this.origins_) || (this.origin_ && !this.origins_), 18); // Either `origin` or `origins` must be configured, never both
- /**
- * @private
- * @type {Array<number|import("../size.js").Size>}
- */
- this.tileSizes_ = null;
- if (options.tileSizes !== undefined) {
- this.tileSizes_ = options.tileSizes;
- asserts_assert(this.tileSizes_.length == this.resolutions_.length, 19); // Number of `tileSizes` and `resolutions` must be equal
- }
- /**
- * @private
- * @type {number|import("../size.js").Size}
- */
- this.tileSize_ =
- options.tileSize !== undefined
- ? options.tileSize
- : !this.tileSizes_
- ? DEFAULT_TILE_SIZE
- : null;
- asserts_assert((!this.tileSize_ && this.tileSizes_) ||
- (this.tileSize_ && !this.tileSizes_), 22); // Either `tileSize` or `tileSizes` must be configured, never both
- /**
- * @private
- * @type {import("../extent.js").Extent}
- */
- this.extent_ = extent !== undefined ? extent : null;
- /**
- * @private
- * @type {Array<import("../TileRange.js").default>}
- */
- this.fullTileRanges_ = null;
- /**
- * @private
- * @type {import("../size.js").Size}
- */
- this.tmpSize_ = [0, 0];
- /**
- * @private
- * @type {import("../extent.js").Extent}
- */
- this.tmpExtent_ = [0, 0, 0, 0];
- if (options.sizes !== undefined) {
- this.fullTileRanges_ = options.sizes.map(function (size, z) {
- var tileRange = new ol_TileRange(Math.min(0, size[0]), Math.max(size[0] - 1, -1), Math.min(0, size[1]), Math.max(size[1] - 1, -1));
- if (extent) {
- var restrictedTileRange = this.getTileRangeForExtentAndZ(extent, z);
- tileRange.minX = Math.max(restrictedTileRange.minX, tileRange.minX);
- tileRange.maxX = Math.min(restrictedTileRange.maxX, tileRange.maxX);
- tileRange.minY = Math.max(restrictedTileRange.minY, tileRange.minY);
- tileRange.maxY = Math.min(restrictedTileRange.maxY, tileRange.maxY);
- }
- return tileRange;
- }, this);
- }
- else if (extent) {
- this.calculateTileRanges_(extent);
- }
- }
- /**
- * Call a function with each tile coordinate for a given extent and zoom level.
- *
- * @param {import("../extent.js").Extent} extent Extent.
- * @param {number} zoom Integer zoom level.
- * @param {function(import("../tilecoord.js").TileCoord): void} callback Function called with each tile coordinate.
- * @api
- */
- TileGrid.prototype.forEachTileCoord = function (extent, zoom, callback) {
- var tileRange = this.getTileRangeForExtentAndZ(extent, zoom);
- for (var i = tileRange.minX, ii = tileRange.maxX; i <= ii; ++i) {
- for (var j = tileRange.minY, jj = tileRange.maxY; j <= jj; ++j) {
- callback([zoom, i, j]);
- }
- }
- };
- /**
- * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {function(number, import("../TileRange.js").default): boolean} callback Callback.
- * @param {import("../TileRange.js").default} [opt_tileRange] Temporary import("../TileRange.js").default object.
- * @param {import("../extent.js").Extent} [opt_extent] Temporary import("../extent.js").Extent object.
- * @return {boolean} Callback succeeded.
- */
- TileGrid.prototype.forEachTileCoordParentTileRange = function (tileCoord, callback, opt_tileRange, opt_extent) {
- var tileRange, x, y;
- var tileCoordExtent = null;
- var z = tileCoord[0] - 1;
- if (this.zoomFactor_ === 2) {
- x = tileCoord[1];
- y = tileCoord[2];
- }
- else {
- tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent);
- }
- while (z >= this.minZoom) {
- if (this.zoomFactor_ === 2) {
- x = Math.floor(x / 2);
- y = Math.floor(y / 2);
- tileRange = TileRange_createOrUpdate(x, x, y, y, opt_tileRange);
- }
- else {
- tileRange = this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange);
- }
- if (callback(z, tileRange)) {
- return true;
- }
- --z;
- }
- return false;
- };
- /**
- * Get the extent for this tile grid, if it was configured.
- * @return {import("../extent.js").Extent} Extent.
- * @api
- */
- TileGrid.prototype.getExtent = function () {
- return this.extent_;
- };
- /**
- * Get the maximum zoom level for the grid.
- * @return {number} Max zoom.
- * @api
- */
- TileGrid.prototype.getMaxZoom = function () {
- return this.maxZoom;
- };
- /**
- * Get the minimum zoom level for the grid.
- * @return {number} Min zoom.
- * @api
- */
- TileGrid.prototype.getMinZoom = function () {
- return this.minZoom;
- };
- /**
- * Get the origin for the grid at the given zoom level.
- * @param {number} z Integer zoom level.
- * @return {import("../coordinate.js").Coordinate} Origin.
- * @api
- */
- TileGrid.prototype.getOrigin = function (z) {
- if (this.origin_) {
- return this.origin_;
- }
- else {
- return this.origins_[z];
- }
- };
- /**
- * Get the resolution for the given zoom level.
- * @param {number} z Integer zoom level.
- * @return {number} Resolution.
- * @api
- */
- TileGrid.prototype.getResolution = function (z) {
- return this.resolutions_[z];
- };
- /**
- * Get the list of resolutions for the tile grid.
- * @return {Array<number>} Resolutions.
- * @api
- */
- TileGrid.prototype.getResolutions = function () {
- return this.resolutions_;
- };
- /**
- * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {import("../TileRange.js").default} [opt_tileRange] Temporary import("../TileRange.js").default object.
- * @param {import("../extent.js").Extent} [opt_extent] Temporary import("../extent.js").Extent object.
- * @return {import("../TileRange.js").default|null} Tile range.
- */
- TileGrid.prototype.getTileCoordChildTileRange = function (tileCoord, opt_tileRange, opt_extent) {
- if (tileCoord[0] < this.maxZoom) {
- if (this.zoomFactor_ === 2) {
- var minX = tileCoord[1] * 2;
- var minY = tileCoord[2] * 2;
- return TileRange_createOrUpdate(minX, minX + 1, minY, minY + 1, opt_tileRange);
- }
- var tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent || this.tmpExtent_);
- return this.getTileRangeForExtentAndZ(tileCoordExtent, tileCoord[0] + 1, opt_tileRange);
- }
- return null;
- };
- /**
- * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {number} z Integer zoom level.
- * @param {import("../TileRange.js").default} [opt_tileRange] Temporary import("../TileRange.js").default object.
- * @return {import("../TileRange.js").default|null} Tile range.
- */
- TileGrid.prototype.getTileRangeForTileCoordAndZ = function (tileCoord, z, opt_tileRange) {
- if (z > this.maxZoom || z < this.minZoom) {
- return null;
- }
- var tileCoordZ = tileCoord[0];
- var tileCoordX = tileCoord[1];
- var tileCoordY = tileCoord[2];
- if (z === tileCoordZ) {
- return TileRange_createOrUpdate(tileCoordX, tileCoordY, tileCoordX, tileCoordY, opt_tileRange);
- }
- if (this.zoomFactor_) {
- var factor = Math.pow(this.zoomFactor_, z - tileCoordZ);
- var minX = Math.floor(tileCoordX * factor);
- var minY = Math.floor(tileCoordY * factor);
- if (z < tileCoordZ) {
- return TileRange_createOrUpdate(minX, minX, minY, minY, opt_tileRange);
- }
- var maxX = Math.floor(factor * (tileCoordX + 1)) - 1;
- var maxY = Math.floor(factor * (tileCoordY + 1)) - 1;
- return TileRange_createOrUpdate(minX, maxX, minY, maxY, opt_tileRange);
- }
- var tileCoordExtent = this.getTileCoordExtent(tileCoord, this.tmpExtent_);
- return this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange);
- };
- /**
- * Get the extent for a tile range.
- * @param {number} z Integer zoom level.
- * @param {import("../TileRange.js").default} tileRange Tile range.
- * @param {import("../extent.js").Extent} [opt_extent] Temporary import("../extent.js").Extent object.
- * @return {import("../extent.js").Extent} Extent.
- */
- TileGrid.prototype.getTileRangeExtent = function (z, tileRange, opt_extent) {
- var origin = this.getOrigin(z);
- var resolution = this.getResolution(z);
- var tileSize = toSize(this.getTileSize(z), this.tmpSize_);
- var minX = origin[0] + tileRange.minX * tileSize[0] * resolution;
- var maxX = origin[0] + (tileRange.maxX + 1) * tileSize[0] * resolution;
- var minY = origin[1] + tileRange.minY * tileSize[1] * resolution;
- var maxY = origin[1] + (tileRange.maxY + 1) * tileSize[1] * resolution;
- return createOrUpdate(minX, minY, maxX, maxY, opt_extent);
- };
- /**
- * Get a tile range for the given extent and integer zoom level.
- * @param {import("../extent.js").Extent} extent Extent.
- * @param {number} z Integer zoom level.
- * @param {import("../TileRange.js").default} [opt_tileRange] Temporary tile range object.
- * @return {import("../TileRange.js").default} Tile range.
- */
- TileGrid.prototype.getTileRangeForExtentAndZ = function (extent, z, opt_tileRange) {
- var tileCoord = tmpTileCoord;
- this.getTileCoordForXYAndZ_(extent[0], extent[3], z, false, tileCoord);
- var minX = tileCoord[1];
- var minY = tileCoord[2];
- this.getTileCoordForXYAndZ_(extent[2], extent[1], z, true, tileCoord);
- return TileRange_createOrUpdate(minX, tileCoord[1], minY, tileCoord[2], opt_tileRange);
- };
- /**
- * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @return {import("../coordinate.js").Coordinate} Tile center.
- */
- TileGrid.prototype.getTileCoordCenter = function (tileCoord) {
- var origin = this.getOrigin(tileCoord[0]);
- var resolution = this.getResolution(tileCoord[0]);
- var tileSize = toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);
- return [
- origin[0] + (tileCoord[1] + 0.5) * tileSize[0] * resolution,
- origin[1] - (tileCoord[2] + 0.5) * tileSize[1] * resolution,
- ];
- };
- /**
- * Get the extent of a tile coordinate.
- *
- * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {import("../extent.js").Extent} [opt_extent] Temporary extent object.
- * @return {import("../extent.js").Extent} Extent.
- * @api
- */
- TileGrid.prototype.getTileCoordExtent = function (tileCoord, opt_extent) {
- var origin = this.getOrigin(tileCoord[0]);
- var resolution = this.getResolution(tileCoord[0]);
- var tileSize = toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);
- var minX = origin[0] + tileCoord[1] * tileSize[0] * resolution;
- var minY = origin[1] - (tileCoord[2] + 1) * tileSize[1] * resolution;
- var maxX = minX + tileSize[0] * resolution;
- var maxY = minY + tileSize[1] * resolution;
- return createOrUpdate(minX, minY, maxX, maxY, opt_extent);
- };
- /**
- * Get the tile coordinate for the given map coordinate and resolution. This
- * method considers that coordinates that intersect tile boundaries should be
- * assigned the higher tile coordinate.
- *
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {number} resolution Resolution.
- * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
- * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
- * @api
- */
- TileGrid.prototype.getTileCoordForCoordAndResolution = function (coordinate, resolution, opt_tileCoord) {
- return this.getTileCoordForXYAndResolution_(coordinate[0], coordinate[1], resolution, false, opt_tileCoord);
- };
- /**
- * Note that this method should not be called for resolutions that correspond
- * to an integer zoom level. Instead call the `getTileCoordForXYAndZ_` method.
- * @param {number} x X.
- * @param {number} y Y.
- * @param {number} resolution Resolution (for a non-integer zoom level).
- * @param {boolean} reverseIntersectionPolicy Instead of letting edge
- * intersections go to the higher tile coordinate, let edge intersections
- * go to the lower tile coordinate.
- * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
- * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
- * @private
- */
- TileGrid.prototype.getTileCoordForXYAndResolution_ = function (x, y, resolution, reverseIntersectionPolicy, opt_tileCoord) {
- var z = this.getZForResolution(resolution);
- var scale = resolution / this.getResolution(z);
- var origin = this.getOrigin(z);
- var tileSize = toSize(this.getTileSize(z), this.tmpSize_);
- var tileCoordX = (scale * (x - origin[0])) / resolution / tileSize[0];
- var tileCoordY = (scale * (origin[1] - y)) / resolution / tileSize[1];
- if (reverseIntersectionPolicy) {
- tileCoordX = ceil(tileCoordX, DECIMALS) - 1;
- tileCoordY = ceil(tileCoordY, DECIMALS) - 1;
- }
- else {
- tileCoordX = floor(tileCoordX, DECIMALS);
- tileCoordY = floor(tileCoordY, DECIMALS);
- }
- return tilecoord_createOrUpdate(z, tileCoordX, tileCoordY, opt_tileCoord);
- };
- /**
- * Although there is repetition between this method and `getTileCoordForXYAndResolution_`,
- * they should have separate implementations. This method is for integer zoom
- * levels. The other method should only be called for resolutions corresponding
- * to non-integer zoom levels.
- * @param {number} x Map x coordinate.
- * @param {number} y Map y coordinate.
- * @param {number} z Integer zoom level.
- * @param {boolean} reverseIntersectionPolicy Instead of letting edge
- * intersections go to the higher tile coordinate, let edge intersections
- * go to the lower tile coordinate.
- * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
- * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
- * @private
- */
- TileGrid.prototype.getTileCoordForXYAndZ_ = function (x, y, z, reverseIntersectionPolicy, opt_tileCoord) {
- var origin = this.getOrigin(z);
- var resolution = this.getResolution(z);
- var tileSize = toSize(this.getTileSize(z), this.tmpSize_);
- var tileCoordX = (x - origin[0]) / resolution / tileSize[0];
- var tileCoordY = (origin[1] - y) / resolution / tileSize[1];
- if (reverseIntersectionPolicy) {
- tileCoordX = ceil(tileCoordX, DECIMALS) - 1;
- tileCoordY = ceil(tileCoordY, DECIMALS) - 1;
- }
- else {
- tileCoordX = floor(tileCoordX, DECIMALS);
- tileCoordY = floor(tileCoordY, DECIMALS);
- }
- return tilecoord_createOrUpdate(z, tileCoordX, tileCoordY, opt_tileCoord);
- };
- /**
- * Get a tile coordinate given a map coordinate and zoom level.
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {number} z Zoom level.
- * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
- * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
- * @api
- */
- TileGrid.prototype.getTileCoordForCoordAndZ = function (coordinate, z, opt_tileCoord) {
- return this.getTileCoordForXYAndZ_(coordinate[0], coordinate[1], z, false, opt_tileCoord);
- };
- /**
- * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @return {number} Tile resolution.
- */
- TileGrid.prototype.getTileCoordResolution = function (tileCoord) {
- return this.resolutions_[tileCoord[0]];
- };
- /**
- * Get the tile size for a zoom level. The type of the return value matches the
- * `tileSize` or `tileSizes` that the tile grid was configured with. To always
- * get an {@link import("../size.js").Size}, run the result through {@link module:ol/size.toSize}.
- * @param {number} z Z.
- * @return {number|import("../size.js").Size} Tile size.
- * @api
- */
- TileGrid.prototype.getTileSize = function (z) {
- if (this.tileSize_) {
- return this.tileSize_;
- }
- else {
- return this.tileSizes_[z];
- }
- };
- /**
- * @param {number} z Zoom level.
- * @return {import("../TileRange.js").default} Extent tile range for the specified zoom level.
- */
- TileGrid.prototype.getFullTileRange = function (z) {
- if (!this.fullTileRanges_) {
- return this.extent_
- ? this.getTileRangeForExtentAndZ(this.extent_, z)
- : null;
- }
- else {
- return this.fullTileRanges_[z];
- }
- };
- /**
- * @param {number} resolution Resolution.
- * @param {number|import("../array.js").NearestDirectionFunction} [opt_direction]
- * If 0, the nearest resolution will be used.
- * If 1, the nearest higher resolution (lower Z) will be used. If -1, the
- * nearest lower resolution (higher Z) will be used. Default is 0.
- * Use a {@link module:ol/array~NearestDirectionFunction} for more precise control.
- *
- * For example to change tile Z at the midpoint of zoom levels
- * ```js
- * function(value, high, low) {
- * return value - low * Math.sqrt(high / low);
- * }
- * ```
- * @return {number} Z.
- * @api
- */
- TileGrid.prototype.getZForResolution = function (resolution, opt_direction) {
- var z = linearFindNearest(this.resolutions_, resolution, opt_direction || 0);
- return math_clamp(z, this.minZoom, this.maxZoom);
- };
- /**
- * The tile with the provided tile coordinate intersects the given viewport.
- * @param {import('../tilecoord.js').TileCoord} tileCoord Tile coordinate.
- * @param {Array<number>} viewport Viewport as returned from {@link module:ol/extent.getRotatedViewport}.
- * @return {boolean} The tile with the provided tile coordinate intersects the given viewport.
- */
- TileGrid.prototype.tileCoordIntersectsViewport = function (tileCoord, viewport) {
- return intersectsLinearRing(viewport, 0, viewport.length, 2, this.getTileCoordExtent(tileCoord));
- };
- /**
- * @param {!import("../extent.js").Extent} extent Extent for this tile grid.
- * @private
- */
- TileGrid.prototype.calculateTileRanges_ = function (extent) {
- var length = this.resolutions_.length;
- var fullTileRanges = new Array(length);
- for (var z = this.minZoom; z < length; ++z) {
- fullTileRanges[z] = this.getTileRangeForExtentAndZ(extent, z);
- }
- this.fullTileRanges_ = fullTileRanges;
- };
- return TileGrid;
- }());
- /* harmony default export */ var tilegrid_TileGrid = (TileGrid);
- //# sourceMappingURL=TileGrid.js.map
- ;// ./node_modules/ol/tilegrid.js
- /**
- * @module ol/tilegrid
- */
- /**
- * @param {import("./proj/Projection.js").default} projection Projection.
- * @return {!TileGrid} Default tile grid for the
- * passed projection.
- */
- function getForProjection(projection) {
- var tileGrid = projection.getDefaultTileGrid();
- if (!tileGrid) {
- tileGrid = createForProjection(projection);
- projection.setDefaultTileGrid(tileGrid);
- }
- return tileGrid;
- }
- /**
- * @param {TileGrid} tileGrid Tile grid.
- * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {import("./proj/Projection.js").default} projection Projection.
- * @return {import("./tilecoord.js").TileCoord} Tile coordinate.
- */
- function tilegrid_wrapX(tileGrid, tileCoord, projection) {
- var z = tileCoord[0];
- var center = tileGrid.getTileCoordCenter(tileCoord);
- var projectionExtent = extentFromProjection(projection);
- if (!containsCoordinate(projectionExtent, center)) {
- var worldWidth = extent_getWidth(projectionExtent);
- var worldsAway = Math.ceil((projectionExtent[0] - center[0]) / worldWidth);
- center[0] += worldWidth * worldsAway;
- return tileGrid.getTileCoordForCoordAndZ(center, z);
- }
- else {
- return tileCoord;
- }
- }
- /**
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {number} [opt_maxZoom] Maximum zoom level (default is
- * DEFAULT_MAX_ZOOM).
- * @param {number|import("./size.js").Size} [opt_tileSize] Tile size (default uses
- * DEFAULT_TILE_SIZE).
- * @param {import("./extent.js").Corner} [opt_corner] Extent corner (default is `'top-left'`).
- * @return {!TileGrid} TileGrid instance.
- */
- function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) {
- var corner = opt_corner !== undefined ? opt_corner : 'top-left';
- var resolutions = resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize);
- return new tilegrid_TileGrid({
- extent: extent,
- origin: getCorner(extent, corner),
- resolutions: resolutions,
- tileSize: opt_tileSize,
- });
- }
- /**
- * @typedef {Object} XYZOptions
- * @property {import("./extent.js").Extent} [extent] Extent for the tile grid. The origin for an XYZ tile grid is the
- * top-left corner of the extent. If `maxResolution` is not provided the zero level of the grid is defined by the resolution
- * at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used.
- * @property {number} [maxResolution] Resolution at level zero.
- * @property {number} [maxZoom] Maximum zoom. The default is `42`. This determines the number of levels
- * in the grid set. For example, a `maxZoom` of 21 means there are 22 levels in the grid set.
- * @property {number} [minZoom=0] Minimum zoom.
- * @property {number|import("./size.js").Size} [tileSize=[256, 256]] Tile size in pixels.
- */
- /**
- * Creates a tile grid with a standard XYZ tiling scheme.
- * @param {XYZOptions} [opt_options] Tile grid options.
- * @return {!TileGrid} Tile grid instance.
- * @api
- */
- function createXYZ(opt_options) {
- var xyzOptions = opt_options || {};
- var extent = xyzOptions.extent || proj_get('EPSG:3857').getExtent();
- var gridOptions = {
- extent: extent,
- minZoom: xyzOptions.minZoom,
- tileSize: xyzOptions.tileSize,
- resolutions: resolutionsFromExtent(extent, xyzOptions.maxZoom, xyzOptions.tileSize, xyzOptions.maxResolution),
- };
- return new tilegrid_TileGrid(gridOptions);
- }
- /**
- * Create a resolutions array from an extent. A zoom factor of 2 is assumed.
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {number} [opt_maxZoom] Maximum zoom level (default is
- * DEFAULT_MAX_ZOOM).
- * @param {number|import("./size.js").Size} [opt_tileSize] Tile size (default uses
- * DEFAULT_TILE_SIZE).
- * @param {number} [opt_maxResolution] Resolution at level zero.
- * @return {!Array<number>} Resolutions array.
- */
- function resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize, opt_maxResolution) {
- var maxZoom = opt_maxZoom !== undefined ? opt_maxZoom : DEFAULT_MAX_ZOOM;
- var height = getHeight(extent);
- var width = extent_getWidth(extent);
- var tileSize = toSize(opt_tileSize !== undefined ? opt_tileSize : DEFAULT_TILE_SIZE);
- var maxResolution = opt_maxResolution > 0
- ? opt_maxResolution
- : Math.max(width / tileSize[0], height / tileSize[1]);
- var length = maxZoom + 1;
- var resolutions = new Array(length);
- for (var z = 0; z < length; ++z) {
- resolutions[z] = maxResolution / Math.pow(2, z);
- }
- return resolutions;
- }
- /**
- * @param {import("./proj.js").ProjectionLike} projection Projection.
- * @param {number} [opt_maxZoom] Maximum zoom level (default is
- * DEFAULT_MAX_ZOOM).
- * @param {number|import("./size.js").Size} [opt_tileSize] Tile size (default uses
- * DEFAULT_TILE_SIZE).
- * @param {import("./extent.js").Corner} [opt_corner] Extent corner (default is `'top-left'`).
- * @return {!TileGrid} TileGrid instance.
- */
- function createForProjection(projection, opt_maxZoom, opt_tileSize, opt_corner) {
- var extent = extentFromProjection(projection);
- return createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner);
- }
- /**
- * Generate a tile grid extent from a projection. If the projection has an
- * extent, it is used. If not, a global extent is assumed.
- * @param {import("./proj.js").ProjectionLike} projection Projection.
- * @return {import("./extent.js").Extent} Extent.
- */
- function extentFromProjection(projection) {
- projection = proj_get(projection);
- var extent = projection.getExtent();
- if (!extent) {
- var half = (180 * Units_METERS_PER_UNIT[proj_Units.DEGREES]) / projection.getMetersPerUnit();
- extent = createOrUpdate(-half, -half, half, half);
- }
- return extent;
- }
- //# sourceMappingURL=tilegrid.js.map
- ;// ./node_modules/ol/source/Tile.js
- var source_Tile_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/source/Tile
- */
- /***
- * @template Return
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
- * import("../Observable").OnSignature<import("../ObjectEventType").Types, import("../Object").ObjectEvent, Return> &
- * import("../Observable").OnSignature<import("./TileEventType").TileSourceEventTypes, TileSourceEvent, Return> &
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
- * import("./TileEventType").TileSourceEventTypes, Return>} TileSourceOnSignature
- */
- /**
- * @typedef {Object} Options
- * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
- * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
- * @property {number} [cacheSize] CacheSize.
- * @property {boolean} [opaque=false] Whether the layer is opaque.
- * @property {number} [tilePixelRatio] TilePixelRatio.
- * @property {import("../proj.js").ProjectionLike} [projection] Projection.
- * @property {import("./Source.js").State} [state] State.
- * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] TileGrid.
- * @property {boolean} [wrapX=false] WrapX.
- * @property {number} [transition] Transition.
- * @property {string} [key] Key.
- * @property {number|import("../array.js").NearestDirectionFunction} [zDirection=0] ZDirection.
- * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,
- * the nearest neighbor is used when resampling.
- */
- /**
- * @classdesc
- * Abstract base class; normally only used for creating subclasses and not
- * instantiated in apps.
- * Base class for sources providing images divided into a tile grid.
- * @abstract
- * @api
- */
- var TileSource = /** @class */ (function (_super) {
- source_Tile_extends(TileSource, _super);
- /**
- * @param {Options} options SourceTile source options.
- */
- function TileSource(options) {
- var _this = _super.call(this, {
- attributions: options.attributions,
- attributionsCollapsible: options.attributionsCollapsible,
- projection: options.projection,
- state: options.state,
- wrapX: options.wrapX,
- interpolate: options.interpolate,
- }) || this;
- /***
- * @type {TileSourceOnSignature<import("../events").EventsKey>}
- */
- _this.on;
- /***
- * @type {TileSourceOnSignature<import("../events").EventsKey>}
- */
- _this.once;
- /***
- * @type {TileSourceOnSignature<void>}
- */
- _this.un;
- /**
- * @private
- * @type {boolean}
- */
- _this.opaque_ = options.opaque !== undefined ? options.opaque : false;
- /**
- * @private
- * @type {number}
- */
- _this.tilePixelRatio_ =
- options.tilePixelRatio !== undefined ? options.tilePixelRatio : 1;
- /**
- * @type {import("../tilegrid/TileGrid.js").default|null}
- */
- _this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null;
- var tileSize = [256, 256];
- if (_this.tileGrid) {
- toSize(_this.tileGrid.getTileSize(_this.tileGrid.getMinZoom()), tileSize);
- }
- /**
- * @protected
- * @type {import("../TileCache.js").default}
- */
- _this.tileCache = new ol_TileCache(options.cacheSize || 0);
- /**
- * @protected
- * @type {import("../size.js").Size}
- */
- _this.tmpSize = [0, 0];
- /**
- * @private
- * @type {string}
- */
- _this.key_ = options.key || '';
- /**
- * @protected
- * @type {import("../Tile.js").Options}
- */
- _this.tileOptions = {
- transition: options.transition,
- interpolate: options.interpolate,
- };
- /**
- * zDirection hint, read by the renderer. Indicates which resolution should be used
- * by a renderer if the views resolution does not match any resolution of the tile source.
- * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
- * will be used. If -1, the nearest higher resolution will be used.
- * @type {number|import("../array.js").NearestDirectionFunction}
- */
- _this.zDirection = options.zDirection ? options.zDirection : 0;
- return _this;
- }
- /**
- * @return {boolean} Can expire cache.
- */
- TileSource.prototype.canExpireCache = function () {
- return this.tileCache.canExpireCache();
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @param {!Object<string, boolean>} usedTiles Used tiles.
- */
- TileSource.prototype.expireCache = function (projection, usedTiles) {
- var tileCache = this.getTileCacheForProjection(projection);
- if (tileCache) {
- tileCache.expireCache(usedTiles);
- }
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @param {number} z Zoom level.
- * @param {import("../TileRange.js").default} tileRange Tile range.
- * @param {function(import("../Tile.js").default):(boolean|void)} callback Called with each
- * loaded tile. If the callback returns `false`, the tile will not be
- * considered loaded.
- * @return {boolean} The tile range is fully covered with loaded tiles.
- */
- TileSource.prototype.forEachLoadedTile = function (projection, z, tileRange, callback) {
- var tileCache = this.getTileCacheForProjection(projection);
- if (!tileCache) {
- return false;
- }
- var covered = true;
- var tile, tileCoordKey, loaded;
- for (var x = tileRange.minX; x <= tileRange.maxX; ++x) {
- for (var y = tileRange.minY; y <= tileRange.maxY; ++y) {
- tileCoordKey = getKeyZXY(z, x, y);
- loaded = false;
- if (tileCache.containsKey(tileCoordKey)) {
- tile = /** @type {!import("../Tile.js").default} */ (tileCache.get(tileCoordKey));
- loaded = tile.getState() === TileState.LOADED;
- if (loaded) {
- loaded = callback(tile) !== false;
- }
- }
- if (!loaded) {
- covered = false;
- }
- }
- }
- return covered;
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {number} Gutter.
- */
- TileSource.prototype.getGutterForProjection = function (projection) {
- return 0;
- };
- /**
- * Return the key to be used for all tiles in the source.
- * @return {string} The key for all tiles.
- */
- TileSource.prototype.getKey = function () {
- return this.key_;
- };
- /**
- * Set the value to be used as the key for all tiles in the source.
- * @param {string} key The key for tiles.
- * @protected
- */
- TileSource.prototype.setKey = function (key) {
- if (this.key_ !== key) {
- this.key_ = key;
- this.changed();
- }
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {boolean} Opaque.
- */
- TileSource.prototype.getOpaque = function (projection) {
- return this.opaque_;
- };
- /**
- * @return {Array<number>|null} Resolutions.
- */
- TileSource.prototype.getResolutions = function () {
- if (!this.tileGrid) {
- return null;
- }
- return this.tileGrid.getResolutions();
- };
- /**
- * @abstract
- * @param {number} z Tile coordinate z.
- * @param {number} x Tile coordinate x.
- * @param {number} y Tile coordinate y.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {!import("../Tile.js").default} Tile.
- */
- TileSource.prototype.getTile = function (z, x, y, pixelRatio, projection) {
- return util_abstract();
- };
- /**
- * Return the tile grid of the tile source.
- * @return {import("../tilegrid/TileGrid.js").default|null} Tile grid.
- * @api
- */
- TileSource.prototype.getTileGrid = function () {
- return this.tileGrid;
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
- */
- TileSource.prototype.getTileGridForProjection = function (projection) {
- if (!this.tileGrid) {
- return getForProjection(projection);
- }
- else {
- return this.tileGrid;
- }
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {import("../TileCache.js").default} Tile cache.
- * @protected
- */
- TileSource.prototype.getTileCacheForProjection = function (projection) {
- var sourceProjection = this.getProjection();
- asserts_assert(sourceProjection === null || equivalent(sourceProjection, projection), 68 // A VectorTile source can only be rendered if it has a projection compatible with the view projection.
- );
- return this.tileCache;
- };
- /**
- * Get the tile pixel ratio for this source. Subclasses may override this
- * method, which is meant to return a supported pixel ratio that matches the
- * provided `pixelRatio` as close as possible.
- * @param {number} pixelRatio Pixel ratio.
- * @return {number} Tile pixel ratio.
- */
- TileSource.prototype.getTilePixelRatio = function (pixelRatio) {
- return this.tilePixelRatio_;
- };
- /**
- * @param {number} z Z.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {import("../size.js").Size} Tile size.
- */
- TileSource.prototype.getTilePixelSize = function (z, pixelRatio, projection) {
- var tileGrid = this.getTileGridForProjection(projection);
- var tilePixelRatio = this.getTilePixelRatio(pixelRatio);
- var tileSize = toSize(tileGrid.getTileSize(z), this.tmpSize);
- if (tilePixelRatio == 1) {
- return tileSize;
- }
- else {
- return size_scale(tileSize, tilePixelRatio, this.tmpSize);
- }
- };
- /**
- * Returns a tile coordinate wrapped around the x-axis. When the tile coordinate
- * is outside the resolution and extent range of the tile grid, `null` will be
- * returned.
- * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {import("../proj/Projection.js").default} [opt_projection] Projection.
- * @return {import("../tilecoord.js").TileCoord} Tile coordinate to be passed to the tileUrlFunction or
- * null if no tile URL should be created for the passed `tileCoord`.
- */
- TileSource.prototype.getTileCoordForTileUrlFunction = function (tileCoord, opt_projection) {
- var projection = opt_projection !== undefined ? opt_projection : this.getProjection();
- var tileGrid = this.getTileGridForProjection(projection);
- if (this.getWrapX() && projection.isGlobal()) {
- tileCoord = tilegrid_wrapX(tileGrid, tileCoord, projection);
- }
- return withinExtentAndZ(tileCoord, tileGrid) ? tileCoord : null;
- };
- /**
- * Remove all cached tiles from the source. The next render cycle will fetch new tiles.
- * @api
- */
- TileSource.prototype.clear = function () {
- this.tileCache.clear();
- };
- TileSource.prototype.refresh = function () {
- this.clear();
- _super.prototype.refresh.call(this);
- };
- /**
- * Increases the cache size if needed
- * @param {number} tileCount Minimum number of tiles needed.
- * @param {import("../proj/Projection.js").default} projection Projection.
- */
- TileSource.prototype.updateCacheSize = function (tileCount, projection) {
- var tileCache = this.getTileCacheForProjection(projection);
- if (tileCount > tileCache.highWaterMark) {
- tileCache.highWaterMark = tileCount;
- }
- };
- /**
- * Marks a tile coord as being used, without triggering a load.
- * @abstract
- * @param {number} z Tile coordinate z.
- * @param {number} x Tile coordinate x.
- * @param {number} y Tile coordinate y.
- * @param {import("../proj/Projection.js").default} projection Projection.
- */
- TileSource.prototype.useTile = function (z, x, y, projection) { };
- return TileSource;
- }(source_Source));
- /**
- * @classdesc
- * Events emitted by {@link module:ol/source/Tile~TileSource} instances are instances of this
- * type.
- */
- var TileSourceEvent = /** @class */ (function (_super) {
- source_Tile_extends(TileSourceEvent, _super);
- /**
- * @param {string} type Type.
- * @param {import("../Tile.js").default} tile The tile.
- */
- function TileSourceEvent(type, tile) {
- var _this = _super.call(this, type) || this;
- /**
- * The tile related to the event.
- * @type {import("../Tile.js").default}
- * @api
- */
- _this.tile = tile;
- return _this;
- }
- return TileSourceEvent;
- }(Event));
- /* harmony default export */ var source_Tile = (TileSource);
- //# sourceMappingURL=Tile.js.map
- ;// ./node_modules/ol/tileurlfunction.js
- /**
- * @module ol/tileurlfunction
- */
- /**
- * @param {string} template Template.
- * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
- * @return {import("./Tile.js").UrlFunction} Tile URL function.
- */
- function createFromTemplate(template, tileGrid) {
- var zRegEx = /\{z\}/g;
- var xRegEx = /\{x\}/g;
- var yRegEx = /\{y\}/g;
- var dashYRegEx = /\{-y\}/g;
- return (
- /**
- * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("./proj/Projection.js").default} projection Projection.
- * @return {string|undefined} Tile URL.
- */
- function (tileCoord, pixelRatio, projection) {
- if (!tileCoord) {
- return undefined;
- }
- else {
- return template
- .replace(zRegEx, tileCoord[0].toString())
- .replace(xRegEx, tileCoord[1].toString())
- .replace(yRegEx, tileCoord[2].toString())
- .replace(dashYRegEx, function () {
- var z = tileCoord[0];
- var range = tileGrid.getFullTileRange(z);
- asserts_assert(range, 55); // The {-y} placeholder requires a tile grid with extent
- var y = range.getHeight() - tileCoord[2] - 1;
- return y.toString();
- });
- }
- });
- }
- /**
- * @param {Array<string>} templates Templates.
- * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
- * @return {import("./Tile.js").UrlFunction} Tile URL function.
- */
- function createFromTemplates(templates, tileGrid) {
- var len = templates.length;
- var tileUrlFunctions = new Array(len);
- for (var i = 0; i < len; ++i) {
- tileUrlFunctions[i] = createFromTemplate(templates[i], tileGrid);
- }
- return createFromTileUrlFunctions(tileUrlFunctions);
- }
- /**
- * @param {Array<import("./Tile.js").UrlFunction>} tileUrlFunctions Tile URL Functions.
- * @return {import("./Tile.js").UrlFunction} Tile URL function.
- */
- function createFromTileUrlFunctions(tileUrlFunctions) {
- if (tileUrlFunctions.length === 1) {
- return tileUrlFunctions[0];
- }
- return (
- /**
- * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("./proj/Projection.js").default} projection Projection.
- * @return {string|undefined} Tile URL.
- */
- function (tileCoord, pixelRatio, projection) {
- if (!tileCoord) {
- return undefined;
- }
- else {
- var h = hash(tileCoord);
- var index = math_modulo(h, tileUrlFunctions.length);
- return tileUrlFunctions[index](tileCoord, pixelRatio, projection);
- }
- });
- }
- /**
- * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("./proj/Projection.js").default} projection Projection.
- * @return {string|undefined} Tile URL.
- */
- function nullTileUrlFunction(tileCoord, pixelRatio, projection) {
- return undefined;
- }
- /**
- * @param {string} url URL.
- * @return {Array<string>} Array of urls.
- */
- function expandUrl(url) {
- var urls = [];
- var match = /\{([a-z])-([a-z])\}/.exec(url);
- if (match) {
- // char range
- var startCharCode = match[1].charCodeAt(0);
- var stopCharCode = match[2].charCodeAt(0);
- var charCode = void 0;
- for (charCode = startCharCode; charCode <= stopCharCode; ++charCode) {
- urls.push(url.replace(match[0], String.fromCharCode(charCode)));
- }
- return urls;
- }
- match = /\{(\d+)-(\d+)\}/.exec(url);
- if (match) {
- // number range
- var stop_1 = parseInt(match[2], 10);
- for (var i = parseInt(match[1], 10); i <= stop_1; i++) {
- urls.push(url.replace(match[0], i.toString()));
- }
- return urls;
- }
- urls.push(url);
- return urls;
- }
- //# sourceMappingURL=tileurlfunction.js.map
- ;// ./node_modules/ol/source/UrlTile.js
- var UrlTile_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/source/UrlTile
- */
- /**
- * @typedef {Object} Options
- * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
- * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
- * @property {number} [cacheSize] Cache size.
- * @property {boolean} [opaque=false] Whether the layer is opaque.
- * @property {import("../proj.js").ProjectionLike} [projection] Projection.
- * @property {import("./Source.js").State} [state] State.
- * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] TileGrid.
- * @property {import("../Tile.js").LoadFunction} tileLoadFunction TileLoadFunction.
- * @property {number} [tilePixelRatio] TilePixelRatio.
- * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] TileUrlFunction.
- * @property {string} [url] Url.
- * @property {Array<string>} [urls] Urls.
- * @property {boolean} [wrapX=true] WrapX.
- * @property {number} [transition] Transition.
- * @property {string} [key] Key.
- * @property {number|import("../array.js").NearestDirectionFunction} [zDirection=0] ZDirection.
- * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,
- * the nearest neighbor is used when resampling.
- */
- /**
- * @classdesc
- * Base class for sources providing tiles divided into a tile grid over http.
- *
- * @fires import("./Tile.js").TileSourceEvent
- */
- var UrlTile = /** @class */ (function (_super) {
- UrlTile_extends(UrlTile, _super);
- /**
- * @param {Options} options Image tile options.
- */
- function UrlTile(options) {
- var _this = _super.call(this, {
- attributions: options.attributions,
- cacheSize: options.cacheSize,
- opaque: options.opaque,
- projection: options.projection,
- state: options.state,
- tileGrid: options.tileGrid,
- tilePixelRatio: options.tilePixelRatio,
- wrapX: options.wrapX,
- transition: options.transition,
- interpolate: options.interpolate,
- key: options.key,
- attributionsCollapsible: options.attributionsCollapsible,
- zDirection: options.zDirection,
- }) || this;
- /**
- * @private
- * @type {boolean}
- */
- _this.generateTileUrlFunction_ =
- _this.tileUrlFunction === UrlTile.prototype.tileUrlFunction;
- /**
- * @protected
- * @type {import("../Tile.js").LoadFunction}
- */
- _this.tileLoadFunction = options.tileLoadFunction;
- if (options.tileUrlFunction) {
- _this.tileUrlFunction = options.tileUrlFunction;
- }
- /**
- * @protected
- * @type {!Array<string>|null}
- */
- _this.urls = null;
- if (options.urls) {
- _this.setUrls(options.urls);
- }
- else if (options.url) {
- _this.setUrl(options.url);
- }
- /**
- * @private
- * @type {!Object<string, boolean>}
- */
- _this.tileLoadingKeys_ = {};
- return _this;
- }
- /**
- * Return the tile load function of the source.
- * @return {import("../Tile.js").LoadFunction} TileLoadFunction
- * @api
- */
- UrlTile.prototype.getTileLoadFunction = function () {
- return this.tileLoadFunction;
- };
- /**
- * Return the tile URL function of the source.
- * @return {import("../Tile.js").UrlFunction} TileUrlFunction
- * @api
- */
- UrlTile.prototype.getTileUrlFunction = function () {
- return Object.getPrototypeOf(this).tileUrlFunction === this.tileUrlFunction
- ? this.tileUrlFunction.bind(this)
- : this.tileUrlFunction;
- };
- /**
- * Return the URLs used for this source.
- * When a tileUrlFunction is used instead of url or urls,
- * null will be returned.
- * @return {!Array<string>|null} URLs.
- * @api
- */
- UrlTile.prototype.getUrls = function () {
- return this.urls;
- };
- /**
- * Handle tile change events.
- * @param {import("../events/Event.js").default} event Event.
- * @protected
- */
- UrlTile.prototype.handleTileChange = function (event) {
- var tile = /** @type {import("../Tile.js").default} */ (event.target);
- var uid = getUid(tile);
- var tileState = tile.getState();
- var type;
- if (tileState == TileState.LOADING) {
- this.tileLoadingKeys_[uid] = true;
- type = TileEventType.TILELOADSTART;
- }
- else if (uid in this.tileLoadingKeys_) {
- delete this.tileLoadingKeys_[uid];
- type =
- tileState == TileState.ERROR
- ? TileEventType.TILELOADERROR
- : tileState == TileState.LOADED
- ? TileEventType.TILELOADEND
- : undefined;
- }
- if (type != undefined) {
- this.dispatchEvent(new TileSourceEvent(type, tile));
- }
- };
- /**
- * Set the tile load function of the source.
- * @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
- * @api
- */
- UrlTile.prototype.setTileLoadFunction = function (tileLoadFunction) {
- this.tileCache.clear();
- this.tileLoadFunction = tileLoadFunction;
- this.changed();
- };
- /**
- * Set the tile URL function of the source.
- * @param {import("../Tile.js").UrlFunction} tileUrlFunction Tile URL function.
- * @param {string} [key] Optional new tile key for the source.
- * @api
- */
- UrlTile.prototype.setTileUrlFunction = function (tileUrlFunction, key) {
- this.tileUrlFunction = tileUrlFunction;
- this.tileCache.pruneExceptNewestZ();
- if (typeof key !== 'undefined') {
- this.setKey(key);
- }
- else {
- this.changed();
- }
- };
- /**
- * Set the URL to use for requests.
- * @param {string} url URL.
- * @api
- */
- UrlTile.prototype.setUrl = function (url) {
- var urls = expandUrl(url);
- this.urls = urls;
- this.setUrls(urls);
- };
- /**
- * Set the URLs to use for requests.
- * @param {Array<string>} urls URLs.
- * @api
- */
- UrlTile.prototype.setUrls = function (urls) {
- this.urls = urls;
- var key = urls.join('\n');
- if (this.generateTileUrlFunction_) {
- this.setTileUrlFunction(createFromTemplates(urls, this.tileGrid), key);
- }
- else {
- this.setKey(key);
- }
- };
- /**
- * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {string|undefined} Tile URL.
- */
- UrlTile.prototype.tileUrlFunction = function (tileCoord, pixelRatio, projection) {
- return undefined;
- };
- /**
- * Marks a tile coord as being used, without triggering a load.
- * @param {number} z Tile coordinate z.
- * @param {number} x Tile coordinate x.
- * @param {number} y Tile coordinate y.
- */
- UrlTile.prototype.useTile = function (z, x, y) {
- var tileCoordKey = getKeyZXY(z, x, y);
- if (this.tileCache.containsKey(tileCoordKey)) {
- this.tileCache.get(tileCoordKey);
- }
- };
- return UrlTile;
- }(source_Tile));
- /* harmony default export */ var source_UrlTile = (UrlTile);
- //# sourceMappingURL=UrlTile.js.map
- ;// ./node_modules/ol/source/TileImage.js
- var TileImage_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/source/TileImage
- */
- /**
- * @typedef {Object} Options
- * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
- * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
- * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
- * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
- * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
- * @property {boolean} [imageSmoothing=true] Deprecated. Use the `interpolate` option instead.
- * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
- * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
- * @property {boolean} [opaque=false] Whether the layer is opaque.
- * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
- * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
- * Higher values can increase reprojection performance, but decrease precision.
- * @property {import("./Source.js").State} [state] Source state.
- * @property {typeof import("../ImageTile.js").default} [tileClass] Class used to instantiate image tiles.
- * Default is {@link module:ol/ImageTile~ImageTile}.
- * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid.
- * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
- * ```js
- * function(imageTile, src) {
- * imageTile.getImage().src = src;
- * };
- * ```
- * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. For example, if the tile
- * service advertizes 256px by 256px tiles but actually sends 512px
- * by 512px images (for retina/hidpi devices) then `tilePixelRatio`
- * should be set to `2`.
- * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.
- * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
- * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
- * used instead of defining each one separately in the `urls` option.
- * @property {Array<string>} [urls] An array of URL templates.
- * @property {boolean} [wrapX] Whether to wrap the world horizontally. The default, is to
- * request out-of-bounds tiles from the server. When set to `false`, only one
- * world will be rendered. When set to `true`, tiles will be requested for one
- * world only, but they will be wrapped horizontally to render multiple worlds.
- * @property {number} [transition] Duration of the opacity transition for rendering.
- * To disable the opacity transition, pass `transition: 0`.
- * @property {string} [key] Optional tile key for proper cache fetching
- * @property {number|import("../array.js").NearestDirectionFunction} [zDirection=0]
- * Choose whether to use tiles with a higher or lower zoom level when between integer
- * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
- */
- /**
- * @classdesc
- * Base class for sources providing images divided into a tile grid.
- *
- * @fires import("./Tile.js").TileSourceEvent
- * @api
- */
- var TileImage = /** @class */ (function (_super) {
- TileImage_extends(TileImage, _super);
- /**
- * @param {!Options} options Image tile options.
- */
- function TileImage(options) {
- var _this = this;
- var interpolate = options.imageSmoothing !== undefined ? options.imageSmoothing : true;
- if (options.interpolate !== undefined) {
- interpolate = options.interpolate;
- }
- _this = _super.call(this, {
- attributions: options.attributions,
- cacheSize: options.cacheSize,
- opaque: options.opaque,
- projection: options.projection,
- state: options.state,
- tileGrid: options.tileGrid,
- tileLoadFunction: options.tileLoadFunction
- ? options.tileLoadFunction
- : defaultTileLoadFunction,
- tilePixelRatio: options.tilePixelRatio,
- tileUrlFunction: options.tileUrlFunction,
- url: options.url,
- urls: options.urls,
- wrapX: options.wrapX,
- transition: options.transition,
- interpolate: interpolate,
- key: options.key,
- attributionsCollapsible: options.attributionsCollapsible,
- zDirection: options.zDirection,
- }) || this;
- /**
- * @protected
- * @type {?string}
- */
- _this.crossOrigin =
- options.crossOrigin !== undefined ? options.crossOrigin : null;
- /**
- * @protected
- * @type {typeof ImageTile}
- */
- _this.tileClass =
- options.tileClass !== undefined ? options.tileClass : ol_ImageTile;
- /**
- * @protected
- * @type {!Object<string, TileCache>}
- */
- _this.tileCacheForProjection = {};
- /**
- * @protected
- * @type {!Object<string, import("../tilegrid/TileGrid.js").default>}
- */
- _this.tileGridForProjection = {};
- /**
- * @private
- * @type {number|undefined}
- */
- _this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold;
- /**
- * @private
- * @type {boolean}
- */
- _this.renderReprojectionEdges_ = false;
- return _this;
- }
- /**
- * @return {boolean} Can expire cache.
- */
- TileImage.prototype.canExpireCache = function () {
- if (!ENABLE_RASTER_REPROJECTION) {
- return _super.prototype.canExpireCache.call(this);
- }
- if (this.tileCache.canExpireCache()) {
- return true;
- }
- else {
- for (var key in this.tileCacheForProjection) {
- if (this.tileCacheForProjection[key].canExpireCache()) {
- return true;
- }
- }
- }
- return false;
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @param {!Object<string, boolean>} usedTiles Used tiles.
- */
- TileImage.prototype.expireCache = function (projection, usedTiles) {
- if (!ENABLE_RASTER_REPROJECTION) {
- _super.prototype.expireCache.call(this, projection, usedTiles);
- return;
- }
- var usedTileCache = this.getTileCacheForProjection(projection);
- this.tileCache.expireCache(this.tileCache == usedTileCache ? usedTiles : {});
- for (var id in this.tileCacheForProjection) {
- var tileCache = this.tileCacheForProjection[id];
- tileCache.expireCache(tileCache == usedTileCache ? usedTiles : {});
- }
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {number} Gutter.
- */
- TileImage.prototype.getGutterForProjection = function (projection) {
- if (ENABLE_RASTER_REPROJECTION &&
- this.getProjection() &&
- projection &&
- !equivalent(this.getProjection(), projection)) {
- return 0;
- }
- else {
- return this.getGutter();
- }
- };
- /**
- * @return {number} Gutter.
- */
- TileImage.prototype.getGutter = function () {
- return 0;
- };
- /**
- * Return the key to be used for all tiles in the source.
- * @return {string} The key for all tiles.
- */
- TileImage.prototype.getKey = function () {
- var key = _super.prototype.getKey.call(this);
- if (!this.getInterpolate()) {
- key += ':disable-interpolation';
- }
- return key;
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {boolean} Opaque.
- */
- TileImage.prototype.getOpaque = function (projection) {
- if (ENABLE_RASTER_REPROJECTION &&
- this.getProjection() &&
- projection &&
- !equivalent(this.getProjection(), projection)) {
- return false;
- }
- else {
- return _super.prototype.getOpaque.call(this, projection);
- }
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
- */
- TileImage.prototype.getTileGridForProjection = function (projection) {
- if (!ENABLE_RASTER_REPROJECTION) {
- return _super.prototype.getTileGridForProjection.call(this, projection);
- }
- var thisProj = this.getProjection();
- if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) {
- return this.tileGrid;
- }
- else {
- var projKey = getUid(projection);
- if (!(projKey in this.tileGridForProjection)) {
- this.tileGridForProjection[projKey] =
- getForProjection(projection);
- }
- return this.tileGridForProjection[projKey];
- }
- };
- /**
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {import("../TileCache.js").default} Tile cache.
- */
- TileImage.prototype.getTileCacheForProjection = function (projection) {
- if (!ENABLE_RASTER_REPROJECTION) {
- return _super.prototype.getTileCacheForProjection.call(this, projection);
- }
- var thisProj = this.getProjection();
- if (!thisProj || equivalent(thisProj, projection)) {
- return this.tileCache;
- }
- else {
- var projKey = getUid(projection);
- if (!(projKey in this.tileCacheForProjection)) {
- this.tileCacheForProjection[projKey] = new ol_TileCache(this.tileCache.highWaterMark);
- }
- return this.tileCacheForProjection[projKey];
- }
- };
- /**
- * @param {number} z Tile coordinate z.
- * @param {number} x Tile coordinate x.
- * @param {number} y Tile coordinate y.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @param {string} key The key set on the tile.
- * @return {!ImageTile} Tile.
- * @private
- */
- TileImage.prototype.createTile_ = function (z, x, y, pixelRatio, projection, key) {
- var tileCoord = [z, x, y];
- var urlTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection);
- var tileUrl = urlTileCoord
- ? this.tileUrlFunction(urlTileCoord, pixelRatio, projection)
- : undefined;
- var tile = new this.tileClass(tileCoord, tileUrl !== undefined ? TileState.IDLE : TileState.EMPTY, tileUrl !== undefined ? tileUrl : '', this.crossOrigin, this.tileLoadFunction, this.tileOptions);
- tile.key = key;
- tile.addEventListener(EventType.CHANGE, this.handleTileChange.bind(this));
- return tile;
- };
- /**
- * @param {number} z Tile coordinate z.
- * @param {number} x Tile coordinate x.
- * @param {number} y Tile coordinate y.
- * @param {number} pixelRatio Pixel ratio.
- * @param {import("../proj/Projection.js").default} projection Projection.
- * @return {!(ImageTile|ReprojTile)} Tile.
- */
- TileImage.prototype.getTile = function (z, x, y, pixelRatio, projection) {
- var sourceProjection = this.getProjection();
- if (!ENABLE_RASTER_REPROJECTION ||
- !sourceProjection ||
- !projection ||
- equivalent(sourceProjection, projection)) {
- return this.getTileInternal(z, x, y, pixelRatio, sourceProjection || projection);
- }
- else {
- var cache = this.getTileCacheForProjection(projection);
- var tileCoord = [z, x, y];
- var tile = void 0;
- var tileCoordKey = tilecoord_getKey(tileCoord);
- if (cache.containsKey(tileCoordKey)) {
- tile = cache.get(tileCoordKey);
- }
- var key = this.getKey();
- if (tile && tile.key == key) {
- return tile;
- }
- else {
- var sourceTileGrid = this.getTileGridForProjection(sourceProjection);
- var targetTileGrid = this.getTileGridForProjection(projection);
- var wrappedTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection);
- var newTile = new reproj_Tile(sourceProjection, sourceTileGrid, projection, targetTileGrid, tileCoord, wrappedTileCoord, this.getTilePixelRatio(pixelRatio), this.getGutter(), function (z, x, y, pixelRatio) {
- return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);
- }.bind(this), this.reprojectionErrorThreshold_, this.renderReprojectionEdges_, this.getInterpolate());
- newTile.key = key;
- if (tile) {
- newTile.interimTile = tile;
- newTile.refreshInterimChain();
- cache.replace(tileCoordKey, newTile);
- }
- else {
- cache.set(tileCoordKey, newTile);
- }
- return newTile;
- }
- }
- };
- /**
- * @param {number} z Tile coordinate z.
- * @param {number} x Tile coordinate x.
- * @param {number} y Tile coordinate y.
- * @param {number} pixelRatio Pixel ratio.
- * @param {!import("../proj/Projection.js").default} projection Projection.
- * @return {!(ImageTile|ReprojTile)} Tile.
- * @protected
- */
- TileImage.prototype.getTileInternal = function (z, x, y, pixelRatio, projection) {
- var tile = null;
- var tileCoordKey = getKeyZXY(z, x, y);
- var key = this.getKey();
- if (!this.tileCache.containsKey(tileCoordKey)) {
- tile = this.createTile_(z, x, y, pixelRatio, projection, key);
- this.tileCache.set(tileCoordKey, tile);
- }
- else {
- tile = this.tileCache.get(tileCoordKey);
- if (tile.key != key) {
- // The source's params changed. If the tile has an interim tile and if we
- // can use it then we use it. Otherwise we create a new tile. In both
- // cases we attempt to assign an interim tile to the new tile.
- var interimTile = tile;
- tile = this.createTile_(z, x, y, pixelRatio, projection, key);
- //make the new tile the head of the list,
- if (interimTile.getState() == TileState.IDLE) {
- //the old tile hasn't begun loading yet, and is now outdated, so we can simply discard it
- tile.interimTile = interimTile.interimTile;
- }
- else {
- tile.interimTile = interimTile;
- }
- tile.refreshInterimChain();
- this.tileCache.replace(tileCoordKey, tile);
- }
- }
- return tile;
- };
- /**
- * Sets whether to render reprojection edges or not (usually for debugging).
- * @param {boolean} render Render the edges.
- * @api
- */
- TileImage.prototype.setRenderReprojectionEdges = function (render) {
- if (!ENABLE_RASTER_REPROJECTION ||
- this.renderReprojectionEdges_ == render) {
- return;
- }
- this.renderReprojectionEdges_ = render;
- for (var id in this.tileCacheForProjection) {
- this.tileCacheForProjection[id].clear();
- }
- this.changed();
- };
- /**
- * Sets the tile grid to use when reprojecting the tiles to the given
- * projection instead of the default tile grid for the projection.
- *
- * This can be useful when the default tile grid cannot be created
- * (e.g. projection has no extent defined) or
- * for optimization reasons (custom tile size, resolutions, ...).
- *
- * @param {import("../proj.js").ProjectionLike} projection Projection.
- * @param {import("../tilegrid/TileGrid.js").default} tilegrid Tile grid to use for the projection.
- * @api
- */
- TileImage.prototype.setTileGridForProjection = function (projection, tilegrid) {
- if (ENABLE_RASTER_REPROJECTION) {
- var proj = proj_get(projection);
- if (proj) {
- var projKey = getUid(proj);
- if (!(projKey in this.tileGridForProjection)) {
- this.tileGridForProjection[projKey] = tilegrid;
- }
- }
- }
- };
- return TileImage;
- }(source_UrlTile));
- /**
- * @param {ImageTile} imageTile Image tile.
- * @param {string} src Source.
- */
- function defaultTileLoadFunction(imageTile, src) {
- /** @type {HTMLImageElement|HTMLVideoElement} */ (imageTile.getImage()).src =
- src;
- }
- /* harmony default export */ var source_TileImage = (TileImage);
- //# sourceMappingURL=TileImage.js.map
- ;// ./node_modules/ol/source/XYZ.js
- /**
- * @module ol/source/XYZ
- */
- var XYZ_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @typedef {Object} Options
- * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
- * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
- * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
- * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
- * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
- * @property {boolean} [imageSmoothing=true] Deprecated. Use the `interpolate` option instead.
- * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
- * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
- * @property {boolean} [opaque=false] Whether the layer is opaque.
- * @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection.
- * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
- * Higher values can increase reprojection performance, but decrease precision.
- * @property {number} [maxZoom=42] Optional max zoom level. Not used if `tileGrid` is provided.
- * @property {number} [minZoom=0] Optional min zoom level. Not used if `tileGrid` is provided.
- * @property {number} [maxResolution] Optional tile grid resolution at level zero. Not used if `tileGrid` is provided.
- * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid.
- * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
- * ```js
- * function(imageTile, src) {
- * imageTile.getImage().src = src;
- * };
- * ```
- * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service.
- * For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px
- * by 512px images (for retina/hidpi devices) then `tilePixelRatio`
- * should be set to `2`.
- * @property {number|import("../size.js").Size} [tileSize=[256, 256]] The tile size used by the tile service.
- * Not used if `tileGrid` is provided.
- * @property {number} [gutter=0] The size in pixels of the gutter around image tiles to ignore.
- * This allows artifacts of rendering at tile edges to be ignored.
- * Supported images should be wider and taller than the tile size by a value of `2 x gutter`.
- * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] Optional function to get
- * tile URL given a tile coordinate and the projection.
- * Required if `url` or `urls` are not provided.
- * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`,
- * and `{z}` placeholders. A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`,
- * may be used instead of defining each one separately in the `urls` option.
- * @property {Array<string>} [urls] An array of URL templates.
- * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
- * @property {number} [transition=250] Duration of the opacity transition for rendering.
- * To disable the opacity transition, pass `transition: 0`.
- * @property {number|import("../array.js").NearestDirectionFunction} [zDirection=0]
- * Choose whether to use tiles with a higher or lower zoom level when between integer
- * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
- */
- /**
- * @classdesc
- * Layer source for tile data with URLs in a set XYZ format that are
- * defined in a URL template. By default, this follows the widely-used
- * Google grid where `x` 0 and `y` 0 are in the top left. Grids like
- * TMS where `x` 0 and `y` 0 are in the bottom left can be used by
- * using the `{-y}` placeholder in the URL template, so long as the
- * source does not have a custom tile grid. In this case
- * a `tileUrlFunction` can be used, such as:
- * ```js
- * tileUrlFunction: function(coordinate) {
- * return 'http://mapserver.com/' + coordinate[0] + '/' +
- * coordinate[1] + '/' + (-coordinate[2] - 1) + '.png';
- * }
- * ```
- * @api
- */
- var XYZ = /** @class */ (function (_super) {
- XYZ_extends(XYZ, _super);
- /**
- * @param {Options} [opt_options] XYZ options.
- */
- function XYZ(opt_options) {
- var _this = this;
- var options = opt_options || {};
- var interpolate = options.imageSmoothing !== undefined ? options.imageSmoothing : true;
- if (options.interpolate !== undefined) {
- interpolate = options.interpolate;
- }
- var projection = options.projection !== undefined ? options.projection : 'EPSG:3857';
- var tileGrid = options.tileGrid !== undefined
- ? options.tileGrid
- : createXYZ({
- extent: extentFromProjection(projection),
- maxResolution: options.maxResolution,
- maxZoom: options.maxZoom,
- minZoom: options.minZoom,
- tileSize: options.tileSize,
- });
- _this = _super.call(this, {
- attributions: options.attributions,
- cacheSize: options.cacheSize,
- crossOrigin: options.crossOrigin,
- interpolate: interpolate,
- opaque: options.opaque,
- projection: projection,
- reprojectionErrorThreshold: options.reprojectionErrorThreshold,
- tileGrid: tileGrid,
- tileLoadFunction: options.tileLoadFunction,
- tilePixelRatio: options.tilePixelRatio,
- tileUrlFunction: options.tileUrlFunction,
- url: options.url,
- urls: options.urls,
- wrapX: options.wrapX !== undefined ? options.wrapX : true,
- transition: options.transition,
- attributionsCollapsible: options.attributionsCollapsible,
- zDirection: options.zDirection,
- }) || this;
- /**
- * @private
- * @type {number}
- */
- _this.gutter_ = options.gutter !== undefined ? options.gutter : 0;
- return _this;
- }
- /**
- * @return {number} Gutter.
- */
- XYZ.prototype.getGutter = function () {
- return this.gutter_;
- };
- return XYZ;
- }(source_TileImage));
- /* harmony default export */ var source_XYZ = (XYZ);
- //# sourceMappingURL=XYZ.js.map
- ;// ./node_modules/ol/source/OSM.js
- /**
- * @module ol/source/OSM
- */
- var OSM_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * The attribution containing a link to the OpenStreetMap Copyright and License
- * page.
- * @const
- * @type {string}
- * @api
- */
- var ATTRIBUTION = '© ' +
- '<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> ' +
- 'contributors.';
- /**
- * @typedef {Object} Options
- * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
- * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
- * @property {null|string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loaded images. Note that
- * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
- * @property {boolean} [imageSmoothing=true] Deprecated. Use the `interpolate` option instead.
- * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
- * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
- * @property {number} [maxZoom=19] Max zoom.
- * @property {boolean} [opaque=true] Whether the layer is opaque.
- * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
- * Higher values can increase reprojection performance, but decrease precision.
- * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
- * ```js
- * function(imageTile, src) {
- * imageTile.getImage().src = src;
- * };
- * ```
- * @property {number} [transition=250] Duration of the opacity transition for rendering.
- * To disable the opacity transition, pass `transition: 0`.
- * @property {string} [url='https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'] URL template.
- * Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
- * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
- * @property {number|import("../array.js").NearestDirectionFunction} [zDirection=0]
- * Choose whether to use tiles with a higher or lower zoom level when between integer
- * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
- */
- /**
- * @classdesc
- * Layer source for the OpenStreetMap tile server.
- * @api
- */
- var OSM = /** @class */ (function (_super) {
- OSM_extends(OSM, _super);
- /**
- * @param {Options} [opt_options] Open Street Map options.
- */
- function OSM(opt_options) {
- var options = opt_options || {};
- var interpolate = options.imageSmoothing !== undefined ? options.imageSmoothing : true;
- if (options.interpolate !== undefined) {
- interpolate = options.interpolate;
- }
- var attributions;
- if (options.attributions !== undefined) {
- attributions = options.attributions;
- }
- else {
- attributions = [ATTRIBUTION];
- }
- var crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous';
- var url = options.url !== undefined
- ? options.url
- : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
- return _super.call(this, {
- attributions: attributions,
- attributionsCollapsible: false,
- cacheSize: options.cacheSize,
- crossOrigin: crossOrigin,
- interpolate: interpolate,
- maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
- opaque: options.opaque !== undefined ? options.opaque : true,
- reprojectionErrorThreshold: options.reprojectionErrorThreshold,
- tileLoadFunction: options.tileLoadFunction,
- transition: options.transition,
- url: url,
- wrapX: options.wrapX,
- zDirection: options.zDirection,
- }) || this;
- }
- return OSM;
- }(source_XYZ));
- /* harmony default export */ var source_OSM = (OSM);
- //# sourceMappingURL=OSM.js.map
- ;// ./node_modules/ol/CollectionEventType.js
- /**
- * @module ol/CollectionEventType
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var CollectionEventType = ({
- /**
- * Triggered when an item is added to the collection.
- * @event module:ol/Collection.CollectionEvent#add
- * @api
- */
- ADD: 'add',
- /**
- * Triggered when an item is removed from the collection.
- * @event module:ol/Collection.CollectionEvent#remove
- * @api
- */
- REMOVE: 'remove',
- });
- //# sourceMappingURL=CollectionEventType.js.map
- ;// ./node_modules/ol/Collection.js
- var Collection_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/Collection
- */
- /**
- * @enum {string}
- * @private
- */
- var Collection_Property = {
- LENGTH: 'length',
- };
- /**
- * @classdesc
- * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this
- * type.
- */
- var CollectionEvent = /** @class */ (function (_super) {
- Collection_extends(CollectionEvent, _super);
- /**
- * @param {import("./CollectionEventType.js").default} type Type.
- * @param {*} [opt_element] Element.
- * @param {number} [opt_index] The index of the added or removed element.
- */
- function CollectionEvent(type, opt_element, opt_index) {
- var _this = _super.call(this, type) || this;
- /**
- * The element that is added to or removed from the collection.
- * @type {*}
- * @api
- */
- _this.element = opt_element;
- /**
- * The index of the added or removed element.
- * @type {number}
- * @api
- */
- _this.index = opt_index;
- return _this;
- }
- return CollectionEvent;
- }(Event));
- /***
- * @template Return
- * @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
- * import("./Observable").OnSignature<import("./ObjectEventType").Types|'change:length', import("./Object").ObjectEvent, Return> &
- * import("./Observable").OnSignature<'add'|'remove', CollectionEvent, Return> &
- * import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|import("./ObjectEventType").Types|
- * 'change:length'|'add'|'remove',Return>} CollectionOnSignature
- */
- /**
- * @typedef {Object} Options
- * @property {boolean} [unique=false] Disallow the same item from being added to
- * the collection twice.
- */
- /**
- * @classdesc
- * An expanded version of standard JS Array, adding convenience methods for
- * manipulation. Add and remove changes to the Collection trigger a Collection
- * event. Note that this does not cover changes to the objects _within_ the
- * Collection; they trigger events on the appropriate object, not on the
- * Collection as a whole.
- *
- * @fires CollectionEvent
- *
- * @template T
- * @api
- */
- var Collection = /** @class */ (function (_super) {
- Collection_extends(Collection, _super);
- /**
- * @param {Array<T>} [opt_array] Array.
- * @param {Options} [opt_options] Collection options.
- */
- function Collection(opt_array, opt_options) {
- var _this = _super.call(this) || this;
- /***
- * @type {CollectionOnSignature<import("./events").EventsKey>}
- */
- _this.on;
- /***
- * @type {CollectionOnSignature<import("./events").EventsKey>}
- */
- _this.once;
- /***
- * @type {CollectionOnSignature<void>}
- */
- _this.un;
- var options = opt_options || {};
- /**
- * @private
- * @type {boolean}
- */
- _this.unique_ = !!options.unique;
- /**
- * @private
- * @type {!Array<T>}
- */
- _this.array_ = opt_array ? opt_array : [];
- if (_this.unique_) {
- for (var i = 0, ii = _this.array_.length; i < ii; ++i) {
- _this.assertUnique_(_this.array_[i], i);
- }
- }
- _this.updateLength_();
- return _this;
- }
- /**
- * Remove all elements from the collection.
- * @api
- */
- Collection.prototype.clear = function () {
- while (this.getLength() > 0) {
- this.pop();
- }
- };
- /**
- * Add elements to the collection. This pushes each item in the provided array
- * to the end of the collection.
- * @param {!Array<T>} arr Array.
- * @return {Collection<T>} This collection.
- * @api
- */
- Collection.prototype.extend = function (arr) {
- for (var i = 0, ii = arr.length; i < ii; ++i) {
- this.push(arr[i]);
- }
- return this;
- };
- /**
- * Iterate over each element, calling the provided callback.
- * @param {function(T, number, Array<T>): *} f The function to call
- * for every element. This function takes 3 arguments (the element, the
- * index and the array). The return value is ignored.
- * @api
- */
- Collection.prototype.forEach = function (f) {
- var array = this.array_;
- for (var i = 0, ii = array.length; i < ii; ++i) {
- f(array[i], i, array);
- }
- };
- /**
- * Get a reference to the underlying Array object. Warning: if the array
- * is mutated, no events will be dispatched by the collection, and the
- * collection's "length" property won't be in sync with the actual length
- * of the array.
- * @return {!Array<T>} Array.
- * @api
- */
- Collection.prototype.getArray = function () {
- return this.array_;
- };
- /**
- * Get the element at the provided index.
- * @param {number} index Index.
- * @return {T} Element.
- * @api
- */
- Collection.prototype.item = function (index) {
- return this.array_[index];
- };
- /**
- * Get the length of this collection.
- * @return {number} The length of the array.
- * @observable
- * @api
- */
- Collection.prototype.getLength = function () {
- return this.get(Collection_Property.LENGTH);
- };
- /**
- * Insert an element at the provided index.
- * @param {number} index Index.
- * @param {T} elem Element.
- * @api
- */
- Collection.prototype.insertAt = function (index, elem) {
- if (this.unique_) {
- this.assertUnique_(elem);
- }
- this.array_.splice(index, 0, elem);
- this.updateLength_();
- this.dispatchEvent(new CollectionEvent(CollectionEventType.ADD, elem, index));
- };
- /**
- * Remove the last element of the collection and return it.
- * Return `undefined` if the collection is empty.
- * @return {T|undefined} Element.
- * @api
- */
- Collection.prototype.pop = function () {
- return this.removeAt(this.getLength() - 1);
- };
- /**
- * Insert the provided element at the end of the collection.
- * @param {T} elem Element.
- * @return {number} New length of the collection.
- * @api
- */
- Collection.prototype.push = function (elem) {
- if (this.unique_) {
- this.assertUnique_(elem);
- }
- var n = this.getLength();
- this.insertAt(n, elem);
- return this.getLength();
- };
- /**
- * Remove the first occurrence of an element from the collection.
- * @param {T} elem Element.
- * @return {T|undefined} The removed element or undefined if none found.
- * @api
- */
- Collection.prototype.remove = function (elem) {
- var arr = this.array_;
- for (var i = 0, ii = arr.length; i < ii; ++i) {
- if (arr[i] === elem) {
- return this.removeAt(i);
- }
- }
- return undefined;
- };
- /**
- * Remove the element at the provided index and return it.
- * Return `undefined` if the collection does not contain this index.
- * @param {number} index Index.
- * @return {T|undefined} Value.
- * @api
- */
- Collection.prototype.removeAt = function (index) {
- var prev = this.array_[index];
- this.array_.splice(index, 1);
- this.updateLength_();
- this.dispatchEvent(new CollectionEvent(CollectionEventType.REMOVE, prev, index));
- return prev;
- };
- /**
- * Set the element at the provided index.
- * @param {number} index Index.
- * @param {T} elem Element.
- * @api
- */
- Collection.prototype.setAt = function (index, elem) {
- var n = this.getLength();
- if (index < n) {
- if (this.unique_) {
- this.assertUnique_(elem, index);
- }
- var prev = this.array_[index];
- this.array_[index] = elem;
- this.dispatchEvent(new CollectionEvent(CollectionEventType.REMOVE, prev, index));
- this.dispatchEvent(new CollectionEvent(CollectionEventType.ADD, elem, index));
- }
- else {
- for (var j = n; j < index; ++j) {
- this.insertAt(j, undefined);
- }
- this.insertAt(index, elem);
- }
- };
- /**
- * @private
- */
- Collection.prototype.updateLength_ = function () {
- this.set(Collection_Property.LENGTH, this.array_.length);
- };
- /**
- * @private
- * @param {T} elem Element.
- * @param {number} [opt_except] Optional index to ignore.
- */
- Collection.prototype.assertUnique_ = function (elem, opt_except) {
- for (var i = 0, ii = this.array_.length; i < ii; ++i) {
- if (this.array_[i] === elem && i !== opt_except) {
- throw new ol_AssertionError(58);
- }
- }
- };
- return Collection;
- }(ol_Object));
- /* harmony default export */ var ol_Collection = (Collection);
- //# sourceMappingURL=Collection.js.map
- ;// ./node_modules/ol/structs/RBush.js
- /**
- * @module ol/structs/RBush
- */
- /**
- * @typedef {Object} Entry
- * @property {number} minX MinX.
- * @property {number} minY MinY.
- * @property {number} maxX MaxX.
- * @property {number} maxY MaxY.
- * @property {Object} [value] Value.
- */
- /**
- * @classdesc
- * Wrapper around the RBush by Vladimir Agafonkin.
- * See https://github.com/mourner/rbush.
- *
- * @template T
- */
- var RBush = /** @class */ (function () {
- /**
- * @param {number} [opt_maxEntries] Max entries.
- */
- function RBush(opt_maxEntries) {
- /**
- * @private
- */
- this.rbush_ = new rbush_min(opt_maxEntries);
- /**
- * A mapping between the objects added to this rbush wrapper
- * and the objects that are actually added to the internal rbush.
- * @private
- * @type {Object<string, Entry>}
- */
- this.items_ = {};
- }
- /**
- * Insert a value into the RBush.
- * @param {import("../extent.js").Extent} extent Extent.
- * @param {T} value Value.
- */
- RBush.prototype.insert = function (extent, value) {
- /** @type {Entry} */
- var item = {
- minX: extent[0],
- minY: extent[1],
- maxX: extent[2],
- maxY: extent[3],
- value: value,
- };
- this.rbush_.insert(item);
- this.items_[getUid(value)] = item;
- };
- /**
- * Bulk-insert values into the RBush.
- * @param {Array<import("../extent.js").Extent>} extents Extents.
- * @param {Array<T>} values Values.
- */
- RBush.prototype.load = function (extents, values) {
- var items = new Array(values.length);
- for (var i = 0, l = values.length; i < l; i++) {
- var extent = extents[i];
- var value = values[i];
- /** @type {Entry} */
- var item = {
- minX: extent[0],
- minY: extent[1],
- maxX: extent[2],
- maxY: extent[3],
- value: value,
- };
- items[i] = item;
- this.items_[getUid(value)] = item;
- }
- this.rbush_.load(items);
- };
- /**
- * Remove a value from the RBush.
- * @param {T} value Value.
- * @return {boolean} Removed.
- */
- RBush.prototype.remove = function (value) {
- var uid = getUid(value);
- // get the object in which the value was wrapped when adding to the
- // internal rbush. then use that object to do the removal.
- var item = this.items_[uid];
- delete this.items_[uid];
- return this.rbush_.remove(item) !== null;
- };
- /**
- * Update the extent of a value in the RBush.
- * @param {import("../extent.js").Extent} extent Extent.
- * @param {T} value Value.
- */
- RBush.prototype.update = function (extent, value) {
- var item = this.items_[getUid(value)];
- var bbox = [item.minX, item.minY, item.maxX, item.maxY];
- if (!extent_equals(bbox, extent)) {
- this.remove(value);
- this.insert(extent, value);
- }
- };
- /**
- * Return all values in the RBush.
- * @return {Array<T>} All.
- */
- RBush.prototype.getAll = function () {
- var items = this.rbush_.all();
- return items.map(function (item) {
- return item.value;
- });
- };
- /**
- * Return all values in the given extent.
- * @param {import("../extent.js").Extent} extent Extent.
- * @return {Array<T>} All in extent.
- */
- RBush.prototype.getInExtent = function (extent) {
- /** @type {Entry} */
- var bbox = {
- minX: extent[0],
- minY: extent[1],
- maxX: extent[2],
- maxY: extent[3],
- };
- var items = this.rbush_.search(bbox);
- return items.map(function (item) {
- return item.value;
- });
- };
- /**
- * Calls a callback function with each value in the tree.
- * If the callback returns a truthy value, this value is returned without
- * checking the rest of the tree.
- * @param {function(T): *} callback Callback.
- * @return {*} Callback return value.
- */
- RBush.prototype.forEach = function (callback) {
- return this.forEach_(this.getAll(), callback);
- };
- /**
- * Calls a callback function with each value in the provided extent.
- * @param {import("../extent.js").Extent} extent Extent.
- * @param {function(T): *} callback Callback.
- * @return {*} Callback return value.
- */
- RBush.prototype.forEachInExtent = function (extent, callback) {
- return this.forEach_(this.getInExtent(extent), callback);
- };
- /**
- * @param {Array<T>} values Values.
- * @param {function(T): *} callback Callback.
- * @private
- * @return {*} Callback return value.
- */
- RBush.prototype.forEach_ = function (values, callback) {
- var result;
- for (var i = 0, l = values.length; i < l; i++) {
- result = callback(values[i]);
- if (result) {
- return result;
- }
- }
- return result;
- };
- /**
- * @return {boolean} Is empty.
- */
- RBush.prototype.isEmpty = function () {
- return obj_isEmpty(this.items_);
- };
- /**
- * Remove all values from the RBush.
- */
- RBush.prototype.clear = function () {
- this.rbush_.clear();
- this.items_ = {};
- };
- /**
- * @param {import("../extent.js").Extent} [opt_extent] Extent.
- * @return {import("../extent.js").Extent} Extent.
- */
- RBush.prototype.getExtent = function (opt_extent) {
- var data = this.rbush_.toJSON();
- return createOrUpdate(data.minX, data.minY, data.maxX, data.maxY, opt_extent);
- };
- /**
- * @param {RBush} rbush R-Tree.
- */
- RBush.prototype.concat = function (rbush) {
- this.rbush_.load(rbush.rbush_.all());
- for (var i in rbush.items_) {
- this.items_[i] = rbush.items_[i];
- }
- };
- return RBush;
- }());
- /* harmony default export */ var structs_RBush = (RBush);
- //# sourceMappingURL=RBush.js.map
- ;// ./node_modules/ol/source/VectorEventType.js
- /**
- * @module ol/source/VectorEventType
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var VectorEventType = ({
- /**
- * Triggered when a feature is added to the source.
- * @event module:ol/source/Vector.VectorSourceEvent#addfeature
- * @api
- */
- ADDFEATURE: 'addfeature',
- /**
- * Triggered when a feature is updated.
- * @event module:ol/source/Vector.VectorSourceEvent#changefeature
- * @api
- */
- CHANGEFEATURE: 'changefeature',
- /**
- * Triggered when the clear method is called on the source.
- * @event module:ol/source/Vector.VectorSourceEvent#clear
- * @api
- */
- CLEAR: 'clear',
- /**
- * Triggered when a feature is removed from the source.
- * See {@link module:ol/source/Vector~VectorSource#clear source.clear()} for exceptions.
- * @event module:ol/source/Vector.VectorSourceEvent#removefeature
- * @api
- */
- REMOVEFEATURE: 'removefeature',
- /**
- * Triggered when features starts loading.
- * @event module:ol/source/Vector.VectorSourceEvent#featuresloadstart
- * @api
- */
- FEATURESLOADSTART: 'featuresloadstart',
- /**
- * Triggered when features finishes loading.
- * @event module:ol/source/Vector.VectorSourceEvent#featuresloadend
- * @api
- */
- FEATURESLOADEND: 'featuresloadend',
- /**
- * Triggered if feature loading results in an error.
- * @event module:ol/source/Vector.VectorSourceEvent#featuresloaderror
- * @api
- */
- FEATURESLOADERROR: 'featuresloaderror',
- });
- /**
- * @typedef {'addfeature'|'changefeature'|'clear'|'removefeature'|'featuresloadstart'|'featuresloadend'|'featuresloaderror'} VectorSourceEventTypes
- */
- //# sourceMappingURL=VectorEventType.js.map
- ;// ./node_modules/ol/loadingstrategy.js
- /**
- * @module ol/loadingstrategy
- */
- /**
- * Strategy function for loading all features with a single request.
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {number} resolution Resolution.
- * @return {Array<import("./extent.js").Extent>} Extents.
- * @api
- */
- function loadingstrategy_all(extent, resolution) {
- return [[-Infinity, -Infinity, Infinity, Infinity]];
- }
- /**
- * Strategy function for loading features based on the view's extent and
- * resolution.
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {number} resolution Resolution.
- * @return {Array<import("./extent.js").Extent>} Extents.
- * @api
- */
- function bbox(extent, resolution) {
- return [extent];
- }
- /**
- * Creates a strategy function for loading features based on a tile grid.
- * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
- * @return {function(import("./extent.js").Extent, number, import("./proj.js").Projection): Array<import("./extent.js").Extent>} Loading strategy.
- * @api
- */
- function tile(tileGrid) {
- return (
- /**
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {number} resolution Resolution.
- * @param {import("./proj.js").Projection} projection Projection.
- * @return {Array<import("./extent.js").Extent>} Extents.
- */
- function (extent, resolution, projection) {
- var z = tileGrid.getZForResolution(fromUserResolution(resolution, projection));
- var tileRange = tileGrid.getTileRangeForExtentAndZ(fromUserExtent(extent, projection), z);
- /** @type {Array<import("./extent.js").Extent>} */
- var extents = [];
- /** @type {import("./tilecoord.js").TileCoord} */
- var tileCoord = [z, 0, 0];
- for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX; ++tileCoord[1]) {
- for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY; ++tileCoord[2]) {
- extents.push(toUserExtent(tileGrid.getTileCoordExtent(tileCoord), projection));
- }
- }
- return extents;
- });
- }
- //# sourceMappingURL=loadingstrategy.js.map
- ;// ./node_modules/ol/featureloader.js
- /**
- * @module ol/featureloader
- */
- /**
- *
- * @type {boolean}
- * @private
- */
- var withCredentials = false;
- /**
- * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to
- * load features.
- *
- * This function takes up to 5 arguments. These are an {@link module:ol/extent~Extent} representing
- * the area to be loaded, a `{number}` representing the resolution (map units per pixel), an
- * {@link module:ol/proj/Projection~Projection} for the projection, an optional success callback that should get
- * the loaded features passed as an argument and an optional failure callback with no arguments. If
- * the callbacks are not used, the corresponding vector source will not fire `'featuresloadend'` and
- * `'featuresloaderror'` events. `this` within the function is bound to the
- * {@link module:ol/source/Vector~VectorSource} it's called from.
- *
- * The function is responsible for loading the features and adding them to the
- * source.
- * @typedef {function(this:(import("./source/Vector").default|import("./VectorTile.js").default),
- * import("./extent.js").Extent,
- * number,
- * import("./proj/Projection.js").default,
- * function(Array<import("./Feature.js").default>): void=,
- * function(): void=): void} FeatureLoader
- * @api
- */
- /**
- * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to
- * get the url to load features from.
- *
- * This function takes an {@link module:ol/extent~Extent} representing the area
- * to be loaded, a `{number}` representing the resolution (map units per pixel)
- * and an {@link module:ol/proj/Projection~Projection} for the projection as
- * arguments and returns a `{string}` representing the URL.
- * @typedef {function(import("./extent.js").Extent, number, import("./proj/Projection.js").default): string} FeatureUrlFunction
- * @api
- */
- /**
- * @param {string|FeatureUrlFunction} url Feature URL service.
- * @param {import("./format/Feature.js").default} format Feature format.
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {number} resolution Resolution.
- * @param {import("./proj/Projection.js").default} projection Projection.
- * @param {function(Array<import("./Feature.js").default>, import("./proj/Projection.js").default): void} success Success
- * Function called with the loaded features and optionally with the data projection.
- * @param {function(): void} failure Failure
- * Function called when loading failed.
- */
- function loadFeaturesXhr(url, format, extent, resolution, projection, success, failure) {
- var xhr = new XMLHttpRequest();
- xhr.open('GET', typeof url === 'function' ? url(extent, resolution, projection) : url, true);
- if (format.getType() == 'arraybuffer') {
- xhr.responseType = 'arraybuffer';
- }
- xhr.withCredentials = withCredentials;
- /**
- * @param {Event} event Event.
- * @private
- */
- xhr.onload = function (event) {
- // status will be 0 for file:// urls
- if (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) {
- var type = format.getType();
- /** @type {Document|Node|Object|string|undefined} */
- var source = void 0;
- if (type == 'json' || type == 'text') {
- source = xhr.responseText;
- }
- else if (type == 'xml') {
- source = xhr.responseXML;
- if (!source) {
- source = new DOMParser().parseFromString(xhr.responseText, 'application/xml');
- }
- }
- else if (type == 'arraybuffer') {
- source = /** @type {ArrayBuffer} */ (xhr.response);
- }
- if (source) {
- success(
- /** @type {Array<import("./Feature.js").default>} */
- (format.readFeatures(source, {
- extent: extent,
- featureProjection: projection,
- })), format.readProjection(source));
- }
- else {
- failure();
- }
- }
- else {
- failure();
- }
- };
- /**
- * @private
- */
- xhr.onerror = failure;
- xhr.send();
- }
- /**
- * Create an XHR feature loader for a `url` and `format`. The feature loader
- * loads features (with XHR), parses the features, and adds them to the
- * vector source.
- * @param {string|FeatureUrlFunction} url Feature URL service.
- * @param {import("./format/Feature.js").default} format Feature format.
- * @return {FeatureLoader} The feature loader.
- * @api
- */
- function xhr(url, format) {
- /**
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {number} resolution Resolution.
- * @param {import("./proj/Projection.js").default} projection Projection.
- * @param {function(Array<import("./Feature.js").default>): void} [success] Success
- * Function called when loading succeeded.
- * @param {function(): void} [failure] Failure
- * Function called when loading failed.
- * @this {import("./source/Vector").default}
- */
- return function (extent, resolution, projection, success, failure) {
- var source = /** @type {import("./source/Vector").default} */ (this);
- loadFeaturesXhr(url, format, extent, resolution, projection,
- /**
- * @param {Array<import("./Feature.js").default>} features The loaded features.
- * @param {import("./proj/Projection.js").default} dataProjection Data
- * projection.
- */
- function (features, dataProjection) {
- source.addFeatures(features);
- if (success !== undefined) {
- success(features);
- }
- },
- /* FIXME handle error */ failure ? failure : VOID);
- };
- }
- /**
- * Setter for the withCredentials configuration for the XHR.
- *
- * @param {boolean} xhrWithCredentials The value of withCredentials to set.
- * Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/
- * @api
- */
- function setWithCredentials(xhrWithCredentials) {
- withCredentials = xhrWithCredentials;
- }
- //# sourceMappingURL=featureloader.js.map
- ;// ./node_modules/ol/source/Vector.js
- /**
- * @module ol/source/Vector
- */
- var source_Vector_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and
- * returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this
- * is one of the standard {@link module:ol/loadingstrategy} strategies.
- *
- * @typedef {function(import("../extent.js").Extent, number, import("../proj/Projection.js").default): Array<import("../extent.js").Extent>} LoadingStrategy
- * @api
- */
- /**
- * @classdesc
- * Events emitted by {@link module:ol/source/Vector~VectorSource} instances are instances of this
- * type.
- * @template {import("../geom/Geometry.js").default} [Geometry=import("../geom/Geometry.js").default]
- */
- var VectorSourceEvent = /** @class */ (function (_super) {
- source_Vector_extends(VectorSourceEvent, _super);
- /**
- * @param {string} type Type.
- * @param {import("../Feature.js").default<Geometry>} [opt_feature] Feature.
- * @param {Array<import("../Feature.js").default<Geometry>>} [opt_features] Features.
- */
- function VectorSourceEvent(type, opt_feature, opt_features) {
- var _this = _super.call(this, type) || this;
- /**
- * The added or removed feature for the `ADDFEATURE` and `REMOVEFEATURE` events, `undefined` otherwise.
- * @type {import("../Feature.js").default<Geometry>|undefined}
- * @api
- */
- _this.feature = opt_feature;
- /**
- * The loaded features for the `FEATURESLOADED` event, `undefined` otherwise.
- * @type {Array<import("../Feature.js").default<Geometry>>|undefined}
- * @api
- */
- _this.features = opt_features;
- return _this;
- }
- return VectorSourceEvent;
- }(Event));
- /***
- * @template Return
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
- * import("../Observable").OnSignature<import("../ObjectEventType").Types, import("../Object").ObjectEvent, Return> &
- * import("../Observable").OnSignature<import("./VectorEventType").VectorSourceEventTypes, VectorSourceEvent, Return> &
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
- * import("./VectorEventType").VectorSourceEventTypes, Return>} VectorSourceOnSignature
- */
- /**
- * @typedef {Object} Options
- * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
- * @property {Array<import("../Feature.js").default>|Collection<import("../Feature.js").default>} [features]
- * Features. If provided as {@link module:ol/Collection~Collection}, the features in the source
- * and the collection will stay in sync.
- * @property {import("../format/Feature.js").default} [format] The feature format used by the XHR
- * feature loader when `url` is set. Required if `url` is set, otherwise ignored.
- * @property {import("../featureloader.js").FeatureLoader} [loader]
- * The loader function used to load features, from a remote source for example.
- * If this is not set and `url` is set, the source will create and use an XHR
- * feature loader. The `'featuresloadend'` and `'featuresloaderror'` events
- * will only fire if the `success` and `failure` callbacks are used.
- *
- * Example:
- *
- * ```js
- * import {Vector} from 'ol/source';
- * import {GeoJSON} from 'ol/format';
- * import {bbox} from 'ol/loadingstrategy';
- *
- * var vectorSource = new Vector({
- * format: new GeoJSON(),
- * loader: function(extent, resolution, projection, success, failure) {
- * var proj = projection.getCode();
- * var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +
- * 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
- * 'outputFormat=application/json&srsname=' + proj + '&' +
- * 'bbox=' + extent.join(',') + ',' + proj;
- * var xhr = new XMLHttpRequest();
- * xhr.open('GET', url);
- * var onError = function() {
- * vectorSource.removeLoadedExtent(extent);
- * failure();
- * }
- * xhr.onerror = onError;
- * xhr.onload = function() {
- * if (xhr.status == 200) {
- * var features = vectorSource.getFormat().readFeatures(xhr.responseText);
- * vectorSource.addFeatures(features);
- * success(features);
- * } else {
- * onError();
- * }
- * }
- * xhr.send();
- * },
- * strategy: bbox
- * });
- * ```
- * @property {boolean} [overlaps=true] This source may have overlapping geometries.
- * Setting this to `false` (e.g. for sources with polygons that represent administrative
- * boundaries or TopoJSON sources) allows the renderer to optimise fill and
- * stroke operations.
- * @property {LoadingStrategy} [strategy] The loading strategy to use.
- * By default an {@link module:ol/loadingstrategy.all}
- * strategy is used, a one-off strategy which loads all features at once.
- * @property {string|import("../featureloader.js").FeatureUrlFunction} [url]
- * Setting this option instructs the source to load features using an XHR loader
- * (see {@link module:ol/featureloader.xhr}). Use a `string` and an
- * {@link module:ol/loadingstrategy.all} for a one-off download of all features from
- * the given URL. Use a {@link module:ol/featureloader~FeatureUrlFunction} to generate the url with
- * other loading strategies.
- * Requires `format` to be set as well.
- * When default XHR feature loader is provided, the features will
- * be transformed from the data projection to the view projection
- * during parsing. If your remote data source does not advertise its projection
- * properly, this transformation will be incorrect. For some formats, the
- * default projection (usually EPSG:4326) can be overridden by setting the
- * dataProjection constructor option on the format.
- * Note that if a source contains non-feature data, such as a GeoJSON geometry
- * or a KML NetworkLink, these will be ignored. Use a custom loader to load these.
- * @property {boolean} [useSpatialIndex=true]
- * By default, an RTree is used as spatial index. When features are removed and
- * added frequently, and the total number of features is low, setting this to
- * `false` may improve performance.
- *
- * Note that
- * {@link module:ol/source/Vector~VectorSource#getFeaturesInExtent},
- * {@link module:ol/source/Vector~VectorSource#getClosestFeatureToCoordinate} and
- * {@link module:ol/source/Vector~VectorSource#getExtent} cannot be used when `useSpatialIndex` is
- * set to `false`, and {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent} will loop
- * through all features.
- *
- * When set to `false`, the features will be maintained in an
- * {@link module:ol/Collection~Collection}, which can be retrieved through
- * {@link module:ol/source/Vector~VectorSource#getFeaturesCollection}.
- * @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the
- * -180° and 180° meridians to work properly, this should be set to `false`. The
- * resulting geometry coordinates will then exceed the world bounds.
- */
- /**
- * @classdesc
- * Provides a source of features for vector layers. Vector features provided
- * by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for
- * vector data that is optimized for rendering.
- *
- * @fires VectorSourceEvent
- * @api
- * @template {import("../geom/Geometry.js").default} [Geometry=import("../geom/Geometry.js").default]
- */
- var VectorSource = /** @class */ (function (_super) {
- source_Vector_extends(VectorSource, _super);
- /**
- * @param {Options} [opt_options] Vector source options.
- */
- function VectorSource(opt_options) {
- var _this = this;
- var options = opt_options || {};
- _this = _super.call(this, {
- attributions: options.attributions,
- interpolate: true,
- projection: undefined,
- state: 'ready',
- wrapX: options.wrapX !== undefined ? options.wrapX : true,
- }) || this;
- /***
- * @type {VectorSourceOnSignature<import("../events").EventsKey>}
- */
- _this.on;
- /***
- * @type {VectorSourceOnSignature<import("../events").EventsKey>}
- */
- _this.once;
- /***
- * @type {VectorSourceOnSignature<void>}
- */
- _this.un;
- /**
- * @private
- * @type {import("../featureloader.js").FeatureLoader}
- */
- _this.loader_ = VOID;
- /**
- * @private
- * @type {import("../format/Feature.js").default|undefined}
- */
- _this.format_ = options.format;
- /**
- * @private
- * @type {boolean}
- */
- _this.overlaps_ = options.overlaps === undefined ? true : options.overlaps;
- /**
- * @private
- * @type {string|import("../featureloader.js").FeatureUrlFunction|undefined}
- */
- _this.url_ = options.url;
- if (options.loader !== undefined) {
- _this.loader_ = options.loader;
- }
- else if (_this.url_ !== undefined) {
- asserts_assert(_this.format_, 7); // `format` must be set when `url` is set
- // create a XHR feature loader for "url" and "format"
- _this.loader_ = xhr(_this.url_,
- /** @type {import("../format/Feature.js").default} */ (_this.format_));
- }
- /**
- * @private
- * @type {LoadingStrategy}
- */
- _this.strategy_ =
- options.strategy !== undefined ? options.strategy : loadingstrategy_all;
- var useSpatialIndex = options.useSpatialIndex !== undefined ? options.useSpatialIndex : true;
- /**
- * @private
- * @type {RBush<import("../Feature.js").default<Geometry>>}
- */
- _this.featuresRtree_ = useSpatialIndex ? new structs_RBush() : null;
- /**
- * @private
- * @type {RBush<{extent: import("../extent.js").Extent}>}
- */
- _this.loadedExtentsRtree_ = new structs_RBush();
- /**
- * @type {number}
- * @private
- */
- _this.loadingExtentsCount_ = 0;
- /**
- * @private
- * @type {!Object<string, import("../Feature.js").default<Geometry>>}
- */
- _this.nullGeometryFeatures_ = {};
- /**
- * A lookup of features by id (the return from feature.getId()).
- * @private
- * @type {!Object<string, import("../Feature.js").default<Geometry>>}
- */
- _this.idIndex_ = {};
- /**
- * A lookup of features by uid (using getUid(feature)).
- * @private
- * @type {!Object<string, import("../Feature.js").default<Geometry>>}
- */
- _this.uidIndex_ = {};
- /**
- * @private
- * @type {Object<string, Array<import("../events.js").EventsKey>>}
- */
- _this.featureChangeKeys_ = {};
- /**
- * @private
- * @type {Collection<import("../Feature.js").default<Geometry>>|null}
- */
- _this.featuresCollection_ = null;
- var collection, features;
- if (Array.isArray(options.features)) {
- features =
- /** @type {Array<import("../Feature.js").default<Geometry>>} */ (options.features);
- }
- else if (options.features) {
- collection =
- /** @type {Collection<import("../Feature.js").default<Geometry>>} */ (options.features);
- features = collection.getArray();
- }
- if (!useSpatialIndex && collection === undefined) {
- collection = new ol_Collection(features);
- }
- if (features !== undefined) {
- _this.addFeaturesInternal(features);
- }
- if (collection !== undefined) {
- _this.bindFeaturesCollection_(collection);
- }
- return _this;
- }
- /**
- * Add a single feature to the source. If you want to add a batch of features
- * at once, call {@link module:ol/source/Vector~VectorSource#addFeatures #addFeatures()}
- * instead. A feature will not be added to the source if feature with
- * the same id is already there. The reason for this behavior is to avoid
- * feature duplication when using bbox or tile loading strategies.
- * Note: this also applies if an {@link module:ol/Collection~Collection} is used for features,
- * meaning that if a feature with a duplicate id is added in the collection, it will
- * be removed from it right away.
- * @param {import("../Feature.js").default<Geometry>} feature Feature to add.
- * @api
- */
- VectorSource.prototype.addFeature = function (feature) {
- this.addFeatureInternal(feature);
- this.changed();
- };
- /**
- * Add a feature without firing a `change` event.
- * @param {import("../Feature.js").default<Geometry>} feature Feature.
- * @protected
- */
- VectorSource.prototype.addFeatureInternal = function (feature) {
- var featureKey = getUid(feature);
- if (!this.addToIndex_(featureKey, feature)) {
- if (this.featuresCollection_) {
- this.featuresCollection_.remove(feature);
- }
- return;
- }
- this.setupChangeEvents_(featureKey, feature);
- var geometry = feature.getGeometry();
- if (geometry) {
- var extent = geometry.getExtent();
- if (this.featuresRtree_) {
- this.featuresRtree_.insert(extent, feature);
- }
- }
- else {
- this.nullGeometryFeatures_[featureKey] = feature;
- }
- this.dispatchEvent(new VectorSourceEvent(VectorEventType.ADDFEATURE, feature));
- };
- /**
- * @param {string} featureKey Unique identifier for the feature.
- * @param {import("../Feature.js").default<Geometry>} feature The feature.
- * @private
- */
- VectorSource.prototype.setupChangeEvents_ = function (featureKey, feature) {
- this.featureChangeKeys_[featureKey] = [
- listen(feature, EventType.CHANGE, this.handleFeatureChange_, this),
- listen(feature, ObjectEventType.PROPERTYCHANGE, this.handleFeatureChange_, this),
- ];
- };
- /**
- * @param {string} featureKey Unique identifier for the feature.
- * @param {import("../Feature.js").default<Geometry>} feature The feature.
- * @return {boolean} The feature is "valid", in the sense that it is also a
- * candidate for insertion into the Rtree.
- * @private
- */
- VectorSource.prototype.addToIndex_ = function (featureKey, feature) {
- var valid = true;
- var id = feature.getId();
- if (id !== undefined) {
- if (!(id.toString() in this.idIndex_)) {
- this.idIndex_[id.toString()] = feature;
- }
- else {
- valid = false;
- }
- }
- if (valid) {
- asserts_assert(!(featureKey in this.uidIndex_), 30); // The passed `feature` was already added to the source
- this.uidIndex_[featureKey] = feature;
- }
- return valid;
- };
- /**
- * Add a batch of features to the source.
- * @param {Array<import("../Feature.js").default<Geometry>>} features Features to add.
- * @api
- */
- VectorSource.prototype.addFeatures = function (features) {
- this.addFeaturesInternal(features);
- this.changed();
- };
- /**
- * Add features without firing a `change` event.
- * @param {Array<import("../Feature.js").default<Geometry>>} features Features.
- * @protected
- */
- VectorSource.prototype.addFeaturesInternal = function (features) {
- var extents = [];
- var newFeatures = [];
- var geometryFeatures = [];
- for (var i = 0, length_1 = features.length; i < length_1; i++) {
- var feature = features[i];
- var featureKey = getUid(feature);
- if (this.addToIndex_(featureKey, feature)) {
- newFeatures.push(feature);
- }
- }
- for (var i = 0, length_2 = newFeatures.length; i < length_2; i++) {
- var feature = newFeatures[i];
- var featureKey = getUid(feature);
- this.setupChangeEvents_(featureKey, feature);
- var geometry = feature.getGeometry();
- if (geometry) {
- var extent = geometry.getExtent();
- extents.push(extent);
- geometryFeatures.push(feature);
- }
- else {
- this.nullGeometryFeatures_[featureKey] = feature;
- }
- }
- if (this.featuresRtree_) {
- this.featuresRtree_.load(extents, geometryFeatures);
- }
- if (this.hasListener(VectorEventType.ADDFEATURE)) {
- for (var i = 0, length_3 = newFeatures.length; i < length_3; i++) {
- this.dispatchEvent(new VectorSourceEvent(VectorEventType.ADDFEATURE, newFeatures[i]));
- }
- }
- };
- /**
- * @param {!Collection<import("../Feature.js").default<Geometry>>} collection Collection.
- * @private
- */
- VectorSource.prototype.bindFeaturesCollection_ = function (collection) {
- var modifyingCollection = false;
- this.addEventListener(VectorEventType.ADDFEATURE,
- /**
- * @param {VectorSourceEvent<Geometry>} evt The vector source event
- */
- function (evt) {
- if (!modifyingCollection) {
- modifyingCollection = true;
- collection.push(evt.feature);
- modifyingCollection = false;
- }
- });
- this.addEventListener(VectorEventType.REMOVEFEATURE,
- /**
- * @param {VectorSourceEvent<Geometry>} evt The vector source event
- */
- function (evt) {
- if (!modifyingCollection) {
- modifyingCollection = true;
- collection.remove(evt.feature);
- modifyingCollection = false;
- }
- });
- collection.addEventListener(CollectionEventType.ADD,
- /**
- * @param {import("../Collection.js").CollectionEvent} evt The collection event
- */
- function (evt) {
- if (!modifyingCollection) {
- modifyingCollection = true;
- this.addFeature(
- /** @type {import("../Feature.js").default<Geometry>} */ (evt.element));
- modifyingCollection = false;
- }
- }.bind(this));
- collection.addEventListener(CollectionEventType.REMOVE,
- /**
- * @param {import("../Collection.js").CollectionEvent} evt The collection event
- */
- function (evt) {
- if (!modifyingCollection) {
- modifyingCollection = true;
- this.removeFeature(
- /** @type {import("../Feature.js").default<Geometry>} */ (evt.element));
- modifyingCollection = false;
- }
- }.bind(this));
- this.featuresCollection_ = collection;
- };
- /**
- * Remove all features from the source.
- * @param {boolean} [opt_fast] Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#event:removefeature removefeature} events.
- * @api
- */
- VectorSource.prototype.clear = function (opt_fast) {
- if (opt_fast) {
- for (var featureId in this.featureChangeKeys_) {
- var keys = this.featureChangeKeys_[featureId];
- keys.forEach(unlistenByKey);
- }
- if (!this.featuresCollection_) {
- this.featureChangeKeys_ = {};
- this.idIndex_ = {};
- this.uidIndex_ = {};
- }
- }
- else {
- if (this.featuresRtree_) {
- var removeAndIgnoreReturn = function (feature) {
- this.removeFeatureInternal(feature);
- }.bind(this);
- this.featuresRtree_.forEach(removeAndIgnoreReturn);
- for (var id in this.nullGeometryFeatures_) {
- this.removeFeatureInternal(this.nullGeometryFeatures_[id]);
- }
- }
- }
- if (this.featuresCollection_) {
- this.featuresCollection_.clear();
- }
- if (this.featuresRtree_) {
- this.featuresRtree_.clear();
- }
- this.nullGeometryFeatures_ = {};
- var clearEvent = new VectorSourceEvent(VectorEventType.CLEAR);
- this.dispatchEvent(clearEvent);
- this.changed();
- };
- /**
- * Iterate through all features on the source, calling the provided callback
- * with each one. If the callback returns any "truthy" value, iteration will
- * stop and the function will return the same value.
- * Note: this function only iterate through the feature that have a defined geometry.
- *
- * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
- * on the source. Return a truthy value to stop iteration.
- * @return {T|undefined} The return value from the last call to the callback.
- * @template T
- * @api
- */
- VectorSource.prototype.forEachFeature = function (callback) {
- if (this.featuresRtree_) {
- return this.featuresRtree_.forEach(callback);
- }
- else if (this.featuresCollection_) {
- this.featuresCollection_.forEach(callback);
- }
- };
- /**
- * Iterate through all features whose geometries contain the provided
- * coordinate, calling the callback with each feature. If the callback returns
- * a "truthy" value, iteration will stop and the function will return the same
- * value.
- *
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
- * whose goemetry contains the provided coordinate.
- * @return {T|undefined} The return value from the last call to the callback.
- * @template T
- */
- VectorSource.prototype.forEachFeatureAtCoordinateDirect = function (coordinate, callback) {
- var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]];
- return this.forEachFeatureInExtent(extent, function (feature) {
- var geometry = feature.getGeometry();
- if (geometry.intersectsCoordinate(coordinate)) {
- return callback(feature);
- }
- else {
- return undefined;
- }
- });
- };
- /**
- * Iterate through all features whose bounding box intersects the provided
- * extent (note that the feature's geometry may not intersect the extent),
- * calling the callback with each feature. If the callback returns a "truthy"
- * value, iteration will stop and the function will return the same value.
- *
- * If you are interested in features whose geometry intersects an extent, call
- * the {@link module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent()} method instead.
- *
- * When `useSpatialIndex` is set to false, this method will loop through all
- * features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.
- *
- * @param {import("../extent.js").Extent} extent Extent.
- * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
- * whose bounding box intersects the provided extent.
- * @return {T|undefined} The return value from the last call to the callback.
- * @template T
- * @api
- */
- VectorSource.prototype.forEachFeatureInExtent = function (extent, callback) {
- if (this.featuresRtree_) {
- return this.featuresRtree_.forEachInExtent(extent, callback);
- }
- else if (this.featuresCollection_) {
- this.featuresCollection_.forEach(callback);
- }
- };
- /**
- * Iterate through all features whose geometry intersects the provided extent,
- * calling the callback with each feature. If the callback returns a "truthy"
- * value, iteration will stop and the function will return the same value.
- *
- * If you only want to test for bounding box intersection, call the
- * {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.
- *
- * @param {import("../extent.js").Extent} extent Extent.
- * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
- * whose geometry intersects the provided extent.
- * @return {T|undefined} The return value from the last call to the callback.
- * @template T
- * @api
- */
- VectorSource.prototype.forEachFeatureIntersectingExtent = function (extent, callback) {
- return this.forEachFeatureInExtent(extent,
- /**
- * @param {import("../Feature.js").default<Geometry>} feature Feature.
- * @return {T|undefined} The return value from the last call to the callback.
- */
- function (feature) {
- var geometry = feature.getGeometry();
- if (geometry.intersectsExtent(extent)) {
- var result = callback(feature);
- if (result) {
- return result;
- }
- }
- });
- };
- /**
- * Get the features collection associated with this source. Will be `null`
- * unless the source was configured with `useSpatialIndex` set to `false`, or
- * with an {@link module:ol/Collection~Collection} as `features`.
- * @return {Collection<import("../Feature.js").default<Geometry>>|null} The collection of features.
- * @api
- */
- VectorSource.prototype.getFeaturesCollection = function () {
- return this.featuresCollection_;
- };
- /**
- * Get a snapshot of the features currently on the source in random order. The returned array
- * is a copy, the features are references to the features in the source.
- * @return {Array<import("../Feature.js").default<Geometry>>} Features.
- * @api
- */
- VectorSource.prototype.getFeatures = function () {
- var features;
- if (this.featuresCollection_) {
- features = this.featuresCollection_.getArray().slice(0);
- }
- else if (this.featuresRtree_) {
- features = this.featuresRtree_.getAll();
- if (!obj_isEmpty(this.nullGeometryFeatures_)) {
- array_extend(features, getValues(this.nullGeometryFeatures_));
- }
- }
- return /** @type {Array<import("../Feature.js").default<Geometry>>} */ (features);
- };
- /**
- * Get all features whose geometry intersects the provided coordinate.
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @return {Array<import("../Feature.js").default<Geometry>>} Features.
- * @api
- */
- VectorSource.prototype.getFeaturesAtCoordinate = function (coordinate) {
- var features = [];
- this.forEachFeatureAtCoordinateDirect(coordinate, function (feature) {
- features.push(feature);
- });
- return features;
- };
- /**
- * Get all features whose bounding box intersects the provided extent. Note that this returns an array of
- * all features intersecting the given extent in random order (so it may include
- * features whose geometries do not intersect the extent).
- *
- * When `useSpatialIndex` is set to false, this method will return all
- * features.
- *
- * @param {import("../extent.js").Extent} extent Extent.
- * @param {import("../proj/Projection.js").default} [opt_projection] Include features
- * where `extent` exceeds the x-axis bounds of `projection` and wraps around the world.
- * @return {Array<import("../Feature.js").default<Geometry>>} Features.
- * @api
- */
- VectorSource.prototype.getFeaturesInExtent = function (extent, opt_projection) {
- var _this = this;
- if (this.featuresRtree_) {
- var multiWorld = opt_projection && opt_projection.canWrapX() && this.getWrapX();
- if (!multiWorld) {
- return this.featuresRtree_.getInExtent(extent);
- }
- var extents = wrapAndSliceX(extent, opt_projection);
- return [].concat.apply([], extents.map(function (anExtent) { return _this.featuresRtree_.getInExtent(anExtent); }));
- }
- else if (this.featuresCollection_) {
- return this.featuresCollection_.getArray().slice(0);
- }
- else {
- return [];
- }
- };
- /**
- * Get the closest feature to the provided coordinate.
- *
- * This method is not available when the source is configured with
- * `useSpatialIndex` set to `false`.
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {function(import("../Feature.js").default<Geometry>):boolean} [opt_filter] Feature filter function.
- * The filter function will receive one argument, the {@link module:ol/Feature~Feature feature}
- * and it should return a boolean value. By default, no filtering is made.
- * @return {import("../Feature.js").default<Geometry>} Closest feature.
- * @api
- */
- VectorSource.prototype.getClosestFeatureToCoordinate = function (coordinate, opt_filter) {
- // Find the closest feature using branch and bound. We start searching an
- // infinite extent, and find the distance from the first feature found. This
- // becomes the closest feature. We then compute a smaller extent which any
- // closer feature must intersect. We continue searching with this smaller
- // extent, trying to find a closer feature. Every time we find a closer
- // feature, we update the extent being searched so that any even closer
- // feature must intersect it. We continue until we run out of features.
- var x = coordinate[0];
- var y = coordinate[1];
- var closestFeature = null;
- var closestPoint = [NaN, NaN];
- var minSquaredDistance = Infinity;
- var extent = [-Infinity, -Infinity, Infinity, Infinity];
- var filter = opt_filter ? opt_filter : TRUE;
- this.featuresRtree_.forEachInExtent(extent,
- /**
- * @param {import("../Feature.js").default<Geometry>} feature Feature.
- */
- function (feature) {
- if (filter(feature)) {
- var geometry = feature.getGeometry();
- var previousMinSquaredDistance = minSquaredDistance;
- minSquaredDistance = geometry.closestPointXY(x, y, closestPoint, minSquaredDistance);
- if (minSquaredDistance < previousMinSquaredDistance) {
- closestFeature = feature;
- // This is sneaky. Reduce the extent that it is currently being
- // searched while the R-Tree traversal using this same extent object
- // is still in progress. This is safe because the new extent is
- // strictly contained by the old extent.
- var minDistance = Math.sqrt(minSquaredDistance);
- extent[0] = x - minDistance;
- extent[1] = y - minDistance;
- extent[2] = x + minDistance;
- extent[3] = y + minDistance;
- }
- }
- });
- return closestFeature;
- };
- /**
- * Get the extent of the features currently in the source.
- *
- * This method is not available when the source is configured with
- * `useSpatialIndex` set to `false`.
- * @param {import("../extent.js").Extent} [opt_extent] Destination extent. If provided, no new extent
- * will be created. Instead, that extent's coordinates will be overwritten.
- * @return {import("../extent.js").Extent} Extent.
- * @api
- */
- VectorSource.prototype.getExtent = function (opt_extent) {
- return this.featuresRtree_.getExtent(opt_extent);
- };
- /**
- * Get a feature by its identifier (the value returned by feature.getId()).
- * Note that the index treats string and numeric identifiers as the same. So
- * `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.
- *
- * @param {string|number} id Feature identifier.
- * @return {import("../Feature.js").default<Geometry>|null} The feature (or `null` if not found).
- * @api
- */
- VectorSource.prototype.getFeatureById = function (id) {
- var feature = this.idIndex_[id.toString()];
- return feature !== undefined ? feature : null;
- };
- /**
- * Get a feature by its internal unique identifier (using `getUid`).
- *
- * @param {string} uid Feature identifier.
- * @return {import("../Feature.js").default<Geometry>|null} The feature (or `null` if not found).
- */
- VectorSource.prototype.getFeatureByUid = function (uid) {
- var feature = this.uidIndex_[uid];
- return feature !== undefined ? feature : null;
- };
- /**
- * Get the format associated with this source.
- *
- * @return {import("../format/Feature.js").default|undefined} The feature format.
- * @api
- */
- VectorSource.prototype.getFormat = function () {
- return this.format_;
- };
- /**
- * @return {boolean} The source can have overlapping geometries.
- */
- VectorSource.prototype.getOverlaps = function () {
- return this.overlaps_;
- };
- /**
- * Get the url associated with this source.
- *
- * @return {string|import("../featureloader.js").FeatureUrlFunction|undefined} The url.
- * @api
- */
- VectorSource.prototype.getUrl = function () {
- return this.url_;
- };
- /**
- * @param {Event} event Event.
- * @private
- */
- VectorSource.prototype.handleFeatureChange_ = function (event) {
- var feature = /** @type {import("../Feature.js").default<Geometry>} */ (event.target);
- var featureKey = getUid(feature);
- var geometry = feature.getGeometry();
- if (!geometry) {
- if (!(featureKey in this.nullGeometryFeatures_)) {
- if (this.featuresRtree_) {
- this.featuresRtree_.remove(feature);
- }
- this.nullGeometryFeatures_[featureKey] = feature;
- }
- }
- else {
- var extent = geometry.getExtent();
- if (featureKey in this.nullGeometryFeatures_) {
- delete this.nullGeometryFeatures_[featureKey];
- if (this.featuresRtree_) {
- this.featuresRtree_.insert(extent, feature);
- }
- }
- else {
- if (this.featuresRtree_) {
- this.featuresRtree_.update(extent, feature);
- }
- }
- }
- var id = feature.getId();
- if (id !== undefined) {
- var sid = id.toString();
- if (this.idIndex_[sid] !== feature) {
- this.removeFromIdIndex_(feature);
- this.idIndex_[sid] = feature;
- }
- }
- else {
- this.removeFromIdIndex_(feature);
- this.uidIndex_[featureKey] = feature;
- }
- this.changed();
- this.dispatchEvent(new VectorSourceEvent(VectorEventType.CHANGEFEATURE, feature));
- };
- /**
- * Returns true if the feature is contained within the source.
- * @param {import("../Feature.js").default<Geometry>} feature Feature.
- * @return {boolean} Has feature.
- * @api
- */
- VectorSource.prototype.hasFeature = function (feature) {
- var id = feature.getId();
- if (id !== undefined) {
- return id in this.idIndex_;
- }
- else {
- return getUid(feature) in this.uidIndex_;
- }
- };
- /**
- * @return {boolean} Is empty.
- */
- VectorSource.prototype.isEmpty = function () {
- if (this.featuresRtree_) {
- return (this.featuresRtree_.isEmpty() && obj_isEmpty(this.nullGeometryFeatures_));
- }
- if (this.featuresCollection_) {
- return this.featuresCollection_.getLength() === 0;
- }
- return true;
- };
- /**
- * @param {import("../extent.js").Extent} extent Extent.
- * @param {number} resolution Resolution.
- * @param {import("../proj/Projection.js").default} projection Projection.
- */
- VectorSource.prototype.loadFeatures = function (extent, resolution, projection) {
- var loadedExtentsRtree = this.loadedExtentsRtree_;
- var extentsToLoad = this.strategy_(extent, resolution, projection);
- var _loop_1 = function (i, ii) {
- var extentToLoad = extentsToLoad[i];
- var alreadyLoaded = loadedExtentsRtree.forEachInExtent(extentToLoad,
- /**
- * @param {{extent: import("../extent.js").Extent}} object Object.
- * @return {boolean} Contains.
- */
- function (object) {
- return containsExtent(object.extent, extentToLoad);
- });
- if (!alreadyLoaded) {
- ++this_1.loadingExtentsCount_;
- this_1.dispatchEvent(new VectorSourceEvent(VectorEventType.FEATURESLOADSTART));
- this_1.loader_.call(this_1, extentToLoad, resolution, projection, function (features) {
- --this.loadingExtentsCount_;
- this.dispatchEvent(new VectorSourceEvent(VectorEventType.FEATURESLOADEND, undefined, features));
- }.bind(this_1), function () {
- --this.loadingExtentsCount_;
- this.dispatchEvent(new VectorSourceEvent(VectorEventType.FEATURESLOADERROR));
- }.bind(this_1));
- loadedExtentsRtree.insert(extentToLoad, { extent: extentToLoad.slice() });
- }
- };
- var this_1 = this;
- for (var i = 0, ii = extentsToLoad.length; i < ii; ++i) {
- _loop_1(i, ii);
- }
- this.loading =
- this.loader_.length < 4 ? false : this.loadingExtentsCount_ > 0;
- };
- VectorSource.prototype.refresh = function () {
- this.clear(true);
- this.loadedExtentsRtree_.clear();
- _super.prototype.refresh.call(this);
- };
- /**
- * Remove an extent from the list of loaded extents.
- * @param {import("../extent.js").Extent} extent Extent.
- * @api
- */
- VectorSource.prototype.removeLoadedExtent = function (extent) {
- var loadedExtentsRtree = this.loadedExtentsRtree_;
- var obj;
- loadedExtentsRtree.forEachInExtent(extent, function (object) {
- if (extent_equals(object.extent, extent)) {
- obj = object;
- return true;
- }
- });
- if (obj) {
- loadedExtentsRtree.remove(obj);
- }
- };
- /**
- * Remove a single feature from the source. If you want to remove all features
- * at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method
- * instead.
- * @param {import("../Feature.js").default<Geometry>} feature Feature to remove.
- * @api
- */
- VectorSource.prototype.removeFeature = function (feature) {
- if (!feature) {
- return;
- }
- var featureKey = getUid(feature);
- if (featureKey in this.nullGeometryFeatures_) {
- delete this.nullGeometryFeatures_[featureKey];
- }
- else {
- if (this.featuresRtree_) {
- this.featuresRtree_.remove(feature);
- }
- }
- var result = this.removeFeatureInternal(feature);
- if (result) {
- this.changed();
- }
- };
- /**
- * Remove feature without firing a `change` event.
- * @param {import("../Feature.js").default<Geometry>} feature Feature.
- * @return {import("../Feature.js").default<Geometry>|undefined} The removed feature
- * (or undefined if the feature was not found).
- * @protected
- */
- VectorSource.prototype.removeFeatureInternal = function (feature) {
- var featureKey = getUid(feature);
- var featureChangeKeys = this.featureChangeKeys_[featureKey];
- if (!featureChangeKeys) {
- return;
- }
- featureChangeKeys.forEach(unlistenByKey);
- delete this.featureChangeKeys_[featureKey];
- var id = feature.getId();
- if (id !== undefined) {
- delete this.idIndex_[id.toString()];
- }
- delete this.uidIndex_[featureKey];
- this.dispatchEvent(new VectorSourceEvent(VectorEventType.REMOVEFEATURE, feature));
- return feature;
- };
- /**
- * Remove a feature from the id index. Called internally when the feature id
- * may have changed.
- * @param {import("../Feature.js").default<Geometry>} feature The feature.
- * @return {boolean} Removed the feature from the index.
- * @private
- */
- VectorSource.prototype.removeFromIdIndex_ = function (feature) {
- var removed = false;
- for (var id in this.idIndex_) {
- if (this.idIndex_[id] === feature) {
- delete this.idIndex_[id];
- removed = true;
- break;
- }
- }
- return removed;
- };
- /**
- * Set the new loader of the source. The next render cycle will use the
- * new loader.
- * @param {import("../featureloader.js").FeatureLoader} loader The loader to set.
- * @api
- */
- VectorSource.prototype.setLoader = function (loader) {
- this.loader_ = loader;
- };
- /**
- * Points the source to a new url. The next render cycle will use the new url.
- * @param {string|import("../featureloader.js").FeatureUrlFunction} url Url.
- * @api
- */
- VectorSource.prototype.setUrl = function (url) {
- asserts_assert(this.format_, 7); // `format` must be set when `url` is set
- this.url_ = url;
- this.setLoader(xhr(url, this.format_));
- };
- return VectorSource;
- }(source_Source));
- /* harmony default export */ var source_Vector = (VectorSource);
- //# sourceMappingURL=Vector.js.map
- ;// ./node_modules/ol/style/Text.js
- /**
- * @module ol/style/Text
- */
- /**
- * The default fill color to use if no fill was set at construction time; a
- * blackish `#333`.
- *
- * @const {string}
- */
- var DEFAULT_FILL_COLOR = '#333';
- /**
- * @typedef {Object} Options
- * @property {string} [font] Font style as CSS 'font' value, see:
- * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is '10px sans-serif'
- * @property {number} [maxAngle=Math.PI/4] When `placement` is set to `'line'`, allow a maximum angle between adjacent characters.
- * The expected value is in radians, and the default is 45° (`Math.PI / 4`).
- * @property {number} [offsetX=0] Horizontal text offset in pixels. A positive will shift the text right.
- * @property {number} [offsetY=0] Vertical text offset in pixels. A positive will shift the text down.
- * @property {boolean} [overflow=false] For polygon labels or when `placement` is set to `'line'`, allow text to exceed
- * the width of the polygon at the label position or the length of the path that it follows.
- * @property {import("./TextPlacement.js").default|string} [placement='point'] Text placement.
- * @property {number|import("../size.js").Size} [scale] Scale.
- * @property {boolean} [rotateWithView=false] Whether to rotate the text with the view.
- * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
- * @property {string|Array<string>} [text] Text content or rich text content. For plain text provide a string, which can
- * contain line breaks (`\n`). For rich text provide an array of text/font tuples. A tuple consists of the text to
- * render and the font to use (or `''` to use the text style's font). A line break has to be a separate tuple (i.e. `'\n', ''`).
- * **Example:** `['foo', 'bold 10px sans-serif', ' bar', 'italic 10px sans-serif', ' baz', '']` will yield "**foo** *bar* baz".
- * **Note:** Rich text is not supported for the immediate rendering API.
- * @property {string} [textAlign] Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'.
- * Default is 'center' for `placement: 'point'`. For `placement: 'line'`, the default is to let the renderer choose a
- * placement where `maxAngle` is not exceeded.
- * @property {string} [justify] Text justification within the text box.
- * If not set, text is justified towards the `textAlign` anchor.
- * Otherwise, use options `'left'`, `'center'`, or `'right'` to justify the text within the text box.
- * **Note:** `justify` is ignored for immediate rendering and also for `placement: 'line'`.
- * @property {string} [textBaseline='middle'] Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',
- * 'hanging', 'ideographic'.
- * @property {import("./Fill.js").default} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333).
- * @property {import("./Stroke.js").default} [stroke] Stroke style.
- * @property {import("./Fill.js").default} [backgroundFill] Fill style for the text background when `placement` is
- * `'point'`. Default is no fill.
- * @property {import("./Stroke.js").default} [backgroundStroke] Stroke style for the text background when `placement`
- * is `'point'`. Default is no stroke.
- * @property {Array<number>} [padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of
- * values in the array is `[top, right, bottom, left]`.
- */
- /**
- * @classdesc
- * Set text style for vector features.
- * @api
- */
- var Text = /** @class */ (function () {
- /**
- * @param {Options} [opt_options] Options.
- */
- function Text(opt_options) {
- var options = opt_options || {};
- /**
- * @private
- * @type {string|undefined}
- */
- this.font_ = options.font;
- /**
- * @private
- * @type {number|undefined}
- */
- this.rotation_ = options.rotation;
- /**
- * @private
- * @type {boolean|undefined}
- */
- this.rotateWithView_ = options.rotateWithView;
- /**
- * @private
- * @type {number|import("../size.js").Size|undefined}
- */
- this.scale_ = options.scale;
- /**
- * @private
- * @type {import("../size.js").Size}
- */
- this.scaleArray_ = toSize(options.scale !== undefined ? options.scale : 1);
- /**
- * @private
- * @type {string|Array<string>|undefined}
- */
- this.text_ = options.text;
- /**
- * @private
- * @type {string|undefined}
- */
- this.textAlign_ = options.textAlign;
- /**
- * @private
- * @type {string|undefined}
- */
- this.justify_ = options.justify;
- /**
- * @private
- * @type {string|undefined}
- */
- this.textBaseline_ = options.textBaseline;
- /**
- * @private
- * @type {import("./Fill.js").default}
- */
- this.fill_ =
- options.fill !== undefined
- ? options.fill
- : new style_Fill({ color: DEFAULT_FILL_COLOR });
- /**
- * @private
- * @type {number}
- */
- this.maxAngle_ =
- options.maxAngle !== undefined ? options.maxAngle : Math.PI / 4;
- /**
- * @private
- * @type {import("./TextPlacement.js").default|string}
- */
- this.placement_ =
- options.placement !== undefined ? options.placement : TextPlacement.POINT;
- /**
- * @private
- * @type {boolean}
- */
- this.overflow_ = !!options.overflow;
- /**
- * @private
- * @type {import("./Stroke.js").default}
- */
- this.stroke_ = options.stroke !== undefined ? options.stroke : null;
- /**
- * @private
- * @type {number}
- */
- this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0;
- /**
- * @private
- * @type {number}
- */
- this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0;
- /**
- * @private
- * @type {import("./Fill.js").default}
- */
- this.backgroundFill_ = options.backgroundFill
- ? options.backgroundFill
- : null;
- /**
- * @private
- * @type {import("./Stroke.js").default}
- */
- this.backgroundStroke_ = options.backgroundStroke
- ? options.backgroundStroke
- : null;
- /**
- * @private
- * @type {Array<number>|null}
- */
- this.padding_ = options.padding === undefined ? null : options.padding;
- }
- /**
- * Clones the style.
- * @return {Text} The cloned style.
- * @api
- */
- Text.prototype.clone = function () {
- var scale = this.getScale();
- return new Text({
- font: this.getFont(),
- placement: this.getPlacement(),
- maxAngle: this.getMaxAngle(),
- overflow: this.getOverflow(),
- rotation: this.getRotation(),
- rotateWithView: this.getRotateWithView(),
- scale: Array.isArray(scale) ? scale.slice() : scale,
- text: this.getText(),
- textAlign: this.getTextAlign(),
- justify: this.getJustify(),
- textBaseline: this.getTextBaseline(),
- fill: this.getFill() ? this.getFill().clone() : undefined,
- stroke: this.getStroke() ? this.getStroke().clone() : undefined,
- offsetX: this.getOffsetX(),
- offsetY: this.getOffsetY(),
- backgroundFill: this.getBackgroundFill()
- ? this.getBackgroundFill().clone()
- : undefined,
- backgroundStroke: this.getBackgroundStroke()
- ? this.getBackgroundStroke().clone()
- : undefined,
- padding: this.getPadding() || undefined,
- });
- };
- /**
- * Get the `overflow` configuration.
- * @return {boolean} Let text overflow the length of the path they follow.
- * @api
- */
- Text.prototype.getOverflow = function () {
- return this.overflow_;
- };
- /**
- * Get the font name.
- * @return {string|undefined} Font.
- * @api
- */
- Text.prototype.getFont = function () {
- return this.font_;
- };
- /**
- * Get the maximum angle between adjacent characters.
- * @return {number} Angle in radians.
- * @api
- */
- Text.prototype.getMaxAngle = function () {
- return this.maxAngle_;
- };
- /**
- * Get the label placement.
- * @return {import("./TextPlacement.js").default|string} Text placement.
- * @api
- */
- Text.prototype.getPlacement = function () {
- return this.placement_;
- };
- /**
- * Get the x-offset for the text.
- * @return {number} Horizontal text offset.
- * @api
- */
- Text.prototype.getOffsetX = function () {
- return this.offsetX_;
- };
- /**
- * Get the y-offset for the text.
- * @return {number} Vertical text offset.
- * @api
- */
- Text.prototype.getOffsetY = function () {
- return this.offsetY_;
- };
- /**
- * Get the fill style for the text.
- * @return {import("./Fill.js").default} Fill style.
- * @api
- */
- Text.prototype.getFill = function () {
- return this.fill_;
- };
- /**
- * Determine whether the text rotates with the map.
- * @return {boolean|undefined} Rotate with map.
- * @api
- */
- Text.prototype.getRotateWithView = function () {
- return this.rotateWithView_;
- };
- /**
- * Get the text rotation.
- * @return {number|undefined} Rotation.
- * @api
- */
- Text.prototype.getRotation = function () {
- return this.rotation_;
- };
- /**
- * Get the text scale.
- * @return {number|import("../size.js").Size|undefined} Scale.
- * @api
- */
- Text.prototype.getScale = function () {
- return this.scale_;
- };
- /**
- * Get the symbolizer scale array.
- * @return {import("../size.js").Size} Scale array.
- */
- Text.prototype.getScaleArray = function () {
- return this.scaleArray_;
- };
- /**
- * Get the stroke style for the text.
- * @return {import("./Stroke.js").default} Stroke style.
- * @api
- */
- Text.prototype.getStroke = function () {
- return this.stroke_;
- };
- /**
- * Get the text to be rendered.
- * @return {string|Array<string>|undefined} Text.
- * @api
- */
- Text.prototype.getText = function () {
- return this.text_;
- };
- /**
- * Get the text alignment.
- * @return {string|undefined} Text align.
- * @api
- */
- Text.prototype.getTextAlign = function () {
- return this.textAlign_;
- };
- /**
- * Get the justification.
- * @return {string|undefined} Justification.
- * @api
- */
- Text.prototype.getJustify = function () {
- return this.justify_;
- };
- /**
- * Get the text baseline.
- * @return {string|undefined} Text baseline.
- * @api
- */
- Text.prototype.getTextBaseline = function () {
- return this.textBaseline_;
- };
- /**
- * Get the background fill style for the text.
- * @return {import("./Fill.js").default} Fill style.
- * @api
- */
- Text.prototype.getBackgroundFill = function () {
- return this.backgroundFill_;
- };
- /**
- * Get the background stroke style for the text.
- * @return {import("./Stroke.js").default} Stroke style.
- * @api
- */
- Text.prototype.getBackgroundStroke = function () {
- return this.backgroundStroke_;
- };
- /**
- * Get the padding for the text.
- * @return {Array<number>|null} Padding.
- * @api
- */
- Text.prototype.getPadding = function () {
- return this.padding_;
- };
- /**
- * Set the `overflow` property.
- *
- * @param {boolean} overflow Let text overflow the path that it follows.
- * @api
- */
- Text.prototype.setOverflow = function (overflow) {
- this.overflow_ = overflow;
- };
- /**
- * Set the font.
- *
- * @param {string|undefined} font Font.
- * @api
- */
- Text.prototype.setFont = function (font) {
- this.font_ = font;
- };
- /**
- * Set the maximum angle between adjacent characters.
- *
- * @param {number} maxAngle Angle in radians.
- * @api
- */
- Text.prototype.setMaxAngle = function (maxAngle) {
- this.maxAngle_ = maxAngle;
- };
- /**
- * Set the x offset.
- *
- * @param {number} offsetX Horizontal text offset.
- * @api
- */
- Text.prototype.setOffsetX = function (offsetX) {
- this.offsetX_ = offsetX;
- };
- /**
- * Set the y offset.
- *
- * @param {number} offsetY Vertical text offset.
- * @api
- */
- Text.prototype.setOffsetY = function (offsetY) {
- this.offsetY_ = offsetY;
- };
- /**
- * Set the text placement.
- *
- * @param {import("./TextPlacement.js").default|string} placement Placement.
- * @api
- */
- Text.prototype.setPlacement = function (placement) {
- this.placement_ = placement;
- };
- /**
- * Set whether to rotate the text with the view.
- *
- * @param {boolean} rotateWithView Rotate with map.
- * @api
- */
- Text.prototype.setRotateWithView = function (rotateWithView) {
- this.rotateWithView_ = rotateWithView;
- };
- /**
- * Set the fill.
- *
- * @param {import("./Fill.js").default} fill Fill style.
- * @api
- */
- Text.prototype.setFill = function (fill) {
- this.fill_ = fill;
- };
- /**
- * Set the rotation.
- *
- * @param {number|undefined} rotation Rotation.
- * @api
- */
- Text.prototype.setRotation = function (rotation) {
- this.rotation_ = rotation;
- };
- /**
- * Set the scale.
- *
- * @param {number|import("../size.js").Size|undefined} scale Scale.
- * @api
- */
- Text.prototype.setScale = function (scale) {
- this.scale_ = scale;
- this.scaleArray_ = toSize(scale !== undefined ? scale : 1);
- };
- /**
- * Set the stroke.
- *
- * @param {import("./Stroke.js").default} stroke Stroke style.
- * @api
- */
- Text.prototype.setStroke = function (stroke) {
- this.stroke_ = stroke;
- };
- /**
- * Set the text.
- *
- * @param {string|Array<string>|undefined} text Text.
- * @api
- */
- Text.prototype.setText = function (text) {
- this.text_ = text;
- };
- /**
- * Set the text alignment.
- *
- * @param {string|undefined} textAlign Text align.
- * @api
- */
- Text.prototype.setTextAlign = function (textAlign) {
- this.textAlign_ = textAlign;
- };
- /**
- * Set the justification.
- *
- * @param {string|undefined} justify Justification.
- * @api
- */
- Text.prototype.setJustify = function (justify) {
- this.justify_ = justify;
- };
- /**
- * Set the text baseline.
- *
- * @param {string|undefined} textBaseline Text baseline.
- * @api
- */
- Text.prototype.setTextBaseline = function (textBaseline) {
- this.textBaseline_ = textBaseline;
- };
- /**
- * Set the background fill.
- *
- * @param {import("./Fill.js").default} fill Fill style.
- * @api
- */
- Text.prototype.setBackgroundFill = function (fill) {
- this.backgroundFill_ = fill;
- };
- /**
- * Set the background stroke.
- *
- * @param {import("./Stroke.js").default} stroke Stroke style.
- * @api
- */
- Text.prototype.setBackgroundStroke = function (stroke) {
- this.backgroundStroke_ = stroke;
- };
- /**
- * Set the padding (`[top, right, bottom, left]`).
- *
- * @param {Array<number>|null} padding Padding.
- * @api
- */
- Text.prototype.setPadding = function (padding) {
- this.padding_ = padding;
- };
- return Text;
- }());
- /* harmony default export */ var style_Text = (Text);
- //# sourceMappingURL=Text.js.map
- ;// ./node_modules/ol/Feature.js
- var Feature_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/Feature
- */
- /**
- * @typedef {typeof Feature|typeof import("./render/Feature.js").default} FeatureClass
- */
- /**
- * @typedef {Feature|import("./render/Feature.js").default} FeatureLike
- */
- /***
- * @template Return
- * @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
- * import("./Observable").OnSignature<import("./ObjectEventType").Types|'change:geometry', import("./Object").ObjectEvent, Return> &
- * import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|import("./ObjectEventType").Types
- * |'change:geometry', Return>} FeatureOnSignature
- */
- /***
- * @template Geometry
- * @typedef {Object<string, *> & { geometry?: Geometry }} ObjectWithGeometry
- */
- /**
- * @classdesc
- * A vector object for geographic features with a geometry and other
- * attribute properties, similar to the features in vector file formats like
- * GeoJSON.
- *
- * Features can be styled individually with `setStyle`; otherwise they use the
- * style of their vector layer.
- *
- * Note that attribute properties are set as {@link module:ol/Object~BaseObject} properties on
- * the feature object, so they are observable, and have get/set accessors.
- *
- * Typically, a feature has a single geometry property. You can set the
- * geometry using the `setGeometry` method and get it with `getGeometry`.
- * It is possible to store more than one geometry on a feature using attribute
- * properties. By default, the geometry used for rendering is identified by
- * the property name `geometry`. If you want to use another geometry property
- * for rendering, use the `setGeometryName` method to change the attribute
- * property associated with the geometry for the feature. For example:
- *
- * ```js
- *
- * import Feature from 'ol/Feature';
- * import Polygon from 'ol/geom/Polygon';
- * import Point from 'ol/geom/Point';
- *
- * var feature = new Feature({
- * geometry: new Polygon(polyCoords),
- * labelPoint: new Point(labelCoords),
- * name: 'My Polygon'
- * });
- *
- * // get the polygon geometry
- * var poly = feature.getGeometry();
- *
- * // Render the feature as a point using the coordinates from labelPoint
- * feature.setGeometryName('labelPoint');
- *
- * // get the point geometry
- * var point = feature.getGeometry();
- * ```
- *
- * @api
- * @template {import("./geom/Geometry.js").default} [Geometry=import("./geom/Geometry.js").default]
- */
- var Feature = /** @class */ (function (_super) {
- Feature_extends(Feature, _super);
- /**
- * @param {Geometry|ObjectWithGeometry<Geometry>} [opt_geometryOrProperties]
- * You may pass a Geometry object directly, or an object literal containing
- * properties. If you pass an object literal, you may include a Geometry
- * associated with a `geometry` key.
- */
- function Feature(opt_geometryOrProperties) {
- var _this = _super.call(this) || this;
- /***
- * @type {FeatureOnSignature<import("./events").EventsKey>}
- */
- _this.on;
- /***
- * @type {FeatureOnSignature<import("./events").EventsKey>}
- */
- _this.once;
- /***
- * @type {FeatureOnSignature<void>}
- */
- _this.un;
- /**
- * @private
- * @type {number|string|undefined}
- */
- _this.id_ = undefined;
- /**
- * @type {string}
- * @private
- */
- _this.geometryName_ = 'geometry';
- /**
- * User provided style.
- * @private
- * @type {import("./style/Style.js").StyleLike}
- */
- _this.style_ = null;
- /**
- * @private
- * @type {import("./style/Style.js").StyleFunction|undefined}
- */
- _this.styleFunction_ = undefined;
- /**
- * @private
- * @type {?import("./events.js").EventsKey}
- */
- _this.geometryChangeKey_ = null;
- _this.addChangeListener(_this.geometryName_, _this.handleGeometryChanged_);
- if (opt_geometryOrProperties) {
- if (typeof (
- /** @type {?} */ (opt_geometryOrProperties).getSimplifiedGeometry) === 'function') {
- var geometry = /** @type {Geometry} */ (opt_geometryOrProperties);
- _this.setGeometry(geometry);
- }
- else {
- /** @type {Object<string, *>} */
- var properties = opt_geometryOrProperties;
- _this.setProperties(properties);
- }
- }
- return _this;
- }
- /**
- * Clone this feature. If the original feature has a geometry it
- * is also cloned. The feature id is not set in the clone.
- * @return {Feature<Geometry>} The clone.
- * @api
- */
- Feature.prototype.clone = function () {
- var clone = /** @type {Feature<Geometry>} */ (new Feature(this.hasProperties() ? this.getProperties() : null));
- clone.setGeometryName(this.getGeometryName());
- var geometry = this.getGeometry();
- if (geometry) {
- clone.setGeometry(/** @type {Geometry} */ (geometry.clone()));
- }
- var style = this.getStyle();
- if (style) {
- clone.setStyle(style);
- }
- return clone;
- };
- /**
- * Get the feature's default geometry. A feature may have any number of named
- * geometries. The "default" geometry (the one that is rendered by default) is
- * set when calling {@link module:ol/Feature~Feature#setGeometry}.
- * @return {Geometry|undefined} The default geometry for the feature.
- * @api
- * @observable
- */
- Feature.prototype.getGeometry = function () {
- return /** @type {Geometry|undefined} */ (this.get(this.geometryName_));
- };
- /**
- * Get the feature identifier. This is a stable identifier for the feature and
- * is either set when reading data from a remote source or set explicitly by
- * calling {@link module:ol/Feature~Feature#setId}.
- * @return {number|string|undefined} Id.
- * @api
- */
- Feature.prototype.getId = function () {
- return this.id_;
- };
- /**
- * Get the name of the feature's default geometry. By default, the default
- * geometry is named `geometry`.
- * @return {string} Get the property name associated with the default geometry
- * for this feature.
- * @api
- */
- Feature.prototype.getGeometryName = function () {
- return this.geometryName_;
- };
- /**
- * Get the feature's style. Will return what was provided to the
- * {@link module:ol/Feature~Feature#setStyle} method.
- * @return {import("./style/Style.js").StyleLike|undefined} The feature style.
- * @api
- */
- Feature.prototype.getStyle = function () {
- return this.style_;
- };
- /**
- * Get the feature's style function.
- * @return {import("./style/Style.js").StyleFunction|undefined} Return a function
- * representing the current style of this feature.
- * @api
- */
- Feature.prototype.getStyleFunction = function () {
- return this.styleFunction_;
- };
- /**
- * @private
- */
- Feature.prototype.handleGeometryChange_ = function () {
- this.changed();
- };
- /**
- * @private
- */
- Feature.prototype.handleGeometryChanged_ = function () {
- if (this.geometryChangeKey_) {
- unlistenByKey(this.geometryChangeKey_);
- this.geometryChangeKey_ = null;
- }
- var geometry = this.getGeometry();
- if (geometry) {
- this.geometryChangeKey_ = listen(geometry, EventType.CHANGE, this.handleGeometryChange_, this);
- }
- this.changed();
- };
- /**
- * Set the default geometry for the feature. This will update the property
- * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.
- * @param {Geometry|undefined} geometry The new geometry.
- * @api
- * @observable
- */
- Feature.prototype.setGeometry = function (geometry) {
- this.set(this.geometryName_, geometry);
- };
- /**
- * Set the style for the feature to override the layer style. This can be a
- * single style object, an array of styles, or a function that takes a
- * resolution and returns an array of styles. To unset the feature style, call
- * `setStyle()` without arguments or a falsey value.
- * @param {import("./style/Style.js").StyleLike} [opt_style] Style for this feature.
- * @api
- * @fires module:ol/events/Event~BaseEvent#event:change
- */
- Feature.prototype.setStyle = function (opt_style) {
- this.style_ = opt_style;
- this.styleFunction_ = !opt_style
- ? undefined
- : createStyleFunction(opt_style);
- this.changed();
- };
- /**
- * Set the feature id. The feature id is considered stable and may be used when
- * requesting features or comparing identifiers returned from a remote source.
- * The feature id can be used with the
- * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.
- * @param {number|string|undefined} id The feature id.
- * @api
- * @fires module:ol/events/Event~BaseEvent#event:change
- */
- Feature.prototype.setId = function (id) {
- this.id_ = id;
- this.changed();
- };
- /**
- * Set the property name to be used when getting the feature's default geometry.
- * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with
- * this name will be returned.
- * @param {string} name The property name of the default geometry.
- * @api
- */
- Feature.prototype.setGeometryName = function (name) {
- this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_);
- this.geometryName_ = name;
- this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);
- this.handleGeometryChanged_();
- };
- return Feature;
- }(ol_Object));
- /**
- * Convert the provided object into a feature style function. Functions passed
- * through unchanged. Arrays of Style or single style objects wrapped
- * in a new feature style function.
- * @param {!import("./style/Style.js").StyleFunction|!Array<import("./style/Style.js").default>|!import("./style/Style.js").default} obj
- * A feature style function, a single style, or an array of styles.
- * @return {import("./style/Style.js").StyleFunction} A style function.
- */
- function createStyleFunction(obj) {
- if (typeof obj === 'function') {
- return obj;
- }
- else {
- /**
- * @type {Array<import("./style/Style.js").default>}
- */
- var styles_1;
- if (Array.isArray(obj)) {
- styles_1 = obj;
- }
- else {
- asserts_assert(typeof ( /** @type {?} */(obj).getZIndex) === 'function', 41); // Expected an `import("./style/Style.js").Style` or an array of `import("./style/Style.js").Style`
- var style = /** @type {import("./style/Style.js").default} */ (obj);
- styles_1 = [style];
- }
- return function () {
- return styles_1;
- };
- }
- }
- /* harmony default export */ var ol_Feature = (Feature);
- //# sourceMappingURL=Feature.js.map
- ;// ./node_modules/ol/renderer/Map.js
- var Map_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/renderer/Map
- */
- /**
- * @typedef HitMatch
- * @property {import("../Feature.js").FeatureLike} feature Feature.
- * @property {import("../layer/Layer.js").default} layer Layer.
- * @property {import("../geom/SimpleGeometry.js").default} geometry Geometry.
- * @property {number} distanceSq Squared distance.
- * @property {import("./vector.js").FeatureCallback<T>} callback Callback.
- * @template T
- */
- /**
- * @abstract
- */
- var MapRenderer = /** @class */ (function (_super) {
- Map_extends(MapRenderer, _super);
- /**
- * @param {import("../PluggableMap.js").default} map Map.
- */
- function MapRenderer(map) {
- var _this = _super.call(this) || this;
- /**
- * @private
- * @type {import("../PluggableMap.js").default}
- */
- _this.map_ = map;
- return _this;
- }
- /**
- * @abstract
- * @param {import("../render/EventType.js").default} type Event type.
- * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
- */
- MapRenderer.prototype.dispatchRenderEvent = function (type, frameState) {
- util_abstract();
- };
- /**
- * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
- * @protected
- */
- MapRenderer.prototype.calculateMatrices2D = function (frameState) {
- var viewState = frameState.viewState;
- var coordinateToPixelTransform = frameState.coordinateToPixelTransform;
- var pixelToCoordinateTransform = frameState.pixelToCoordinateTransform;
- compose(coordinateToPixelTransform, frameState.size[0] / 2, frameState.size[1] / 2, 1 / viewState.resolution, -1 / viewState.resolution, -viewState.rotation, -viewState.center[0], -viewState.center[1]);
- makeInverse(pixelToCoordinateTransform, coordinateToPixelTransform);
- };
- /**
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
- * @param {number} hitTolerance Hit tolerance in pixels.
- * @param {boolean} checkWrapped Check for wrapped geometries.
- * @param {import("./vector.js").FeatureCallback<T>} callback Feature callback.
- * @param {S} thisArg Value to use as `this` when executing `callback`.
- * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
- * function, only layers which are visible and for which this function
- * returns `true` will be tested for features. By default, all visible
- * layers will be tested.
- * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`.
- * @return {T|undefined} Callback result.
- * @template S,T,U
- */
- MapRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, checkWrapped, callback, thisArg, layerFilter, thisArg2) {
- var result;
- var viewState = frameState.viewState;
- /**
- * @param {boolean} managed Managed layer.
- * @param {import("../Feature.js").FeatureLike} feature Feature.
- * @param {import("../layer/Layer.js").default} layer Layer.
- * @param {import("../geom/Geometry.js").default} geometry Geometry.
- * @return {T|undefined} Callback result.
- */
- function forEachFeatureAtCoordinate(managed, feature, layer, geometry) {
- return callback.call(thisArg, feature, managed ? layer : null, geometry);
- }
- var projection = viewState.projection;
- var translatedCoordinate = coordinate_wrapX(coordinate.slice(), projection);
- var offsets = [[0, 0]];
- if (projection.canWrapX() && checkWrapped) {
- var projectionExtent = projection.getExtent();
- var worldWidth = extent_getWidth(projectionExtent);
- offsets.push([-worldWidth, 0], [worldWidth, 0]);
- }
- var layerStates = frameState.layerStatesArray;
- var numLayers = layerStates.length;
- var matches = /** @type {Array<HitMatch<T>>} */ ([]);
- var tmpCoord = [];
- for (var i = 0; i < offsets.length; i++) {
- for (var j = numLayers - 1; j >= 0; --j) {
- var layerState = layerStates[j];
- var layer = layerState.layer;
- if (layer.hasRenderer() &&
- inView(layerState, viewState) &&
- layerFilter.call(thisArg2, layer)) {
- var layerRenderer = layer.getRenderer();
- var source = layer.getSource();
- if (layerRenderer && source) {
- var coordinates = source.getWrapX()
- ? translatedCoordinate
- : coordinate;
- var callback_1 = forEachFeatureAtCoordinate.bind(null, layerState.managed);
- tmpCoord[0] = coordinates[0] + offsets[i][0];
- tmpCoord[1] = coordinates[1] + offsets[i][1];
- result = layerRenderer.forEachFeatureAtCoordinate(tmpCoord, frameState, hitTolerance, callback_1, matches);
- }
- if (result) {
- return result;
- }
- }
- }
- }
- if (matches.length === 0) {
- return undefined;
- }
- var order = 1 / matches.length;
- matches.forEach(function (m, i) { return (m.distanceSq += i * order); });
- matches.sort(function (a, b) { return a.distanceSq - b.distanceSq; });
- matches.some(function (m) {
- return (result = m.callback(m.feature, m.layer, m.geometry));
- });
- return result;
- };
- /**
- * @abstract
- * @param {import("../pixel.js").Pixel} pixel Pixel.
- * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
- * @param {number} hitTolerance Hit tolerance in pixels.
- * @param {function(import("../layer/Layer.js").default<import("../source/Source").default>, (Uint8ClampedArray|Uint8Array)): T} callback Layer
- * callback.
- * @param {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} layerFilter Layer filter
- * function, only layers which are visible and for which this function
- * returns `true` will be tested for features. By default, all visible
- * layers will be tested.
- * @return {T|undefined} Callback result.
- * @template T
- */
- MapRenderer.prototype.forEachLayerAtPixel = function (pixel, frameState, hitTolerance, callback, layerFilter) {
- return util_abstract();
- };
- /**
- * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
- * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
- * @param {number} hitTolerance Hit tolerance in pixels.
- * @param {boolean} checkWrapped Check for wrapped geometries.
- * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
- * function, only layers which are visible and for which this function
- * returns `true` will be tested for features. By default, all visible
- * layers will be tested.
- * @param {U} thisArg Value to use as `this` when executing `layerFilter`.
- * @return {boolean} Is there a feature at the given coordinate?
- * @template U
- */
- MapRenderer.prototype.hasFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, checkWrapped, layerFilter, thisArg) {
- var hasFeature = this.forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, checkWrapped, TRUE, this, layerFilter, thisArg);
- return hasFeature !== undefined;
- };
- /**
- * @return {import("../PluggableMap.js").default} Map.
- */
- MapRenderer.prototype.getMap = function () {
- return this.map_;
- };
- /**
- * Render.
- * @abstract
- * @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
- */
- MapRenderer.prototype.renderFrame = function (frameState) {
- util_abstract();
- };
- /**
- * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
- * @protected
- */
- MapRenderer.prototype.scheduleExpireIconCache = function (frameState) {
- if (shared.canExpireCache()) {
- frameState.postRenderFunctions.push(expireIconCache);
- }
- };
- return MapRenderer;
- }(ol_Disposable));
- /**
- * @param {import("../PluggableMap.js").default} map Map.
- * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
- */
- function expireIconCache(map, frameState) {
- shared.expire();
- }
- /* harmony default export */ var Map = (MapRenderer);
- //# sourceMappingURL=Map.js.map
- ;// ./node_modules/ol/renderer/Composite.js
- var Composite_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/renderer/Composite
- */
- /**
- * @classdesc
- * Canvas map renderer.
- * @api
- */
- var CompositeMapRenderer = /** @class */ (function (_super) {
- Composite_extends(CompositeMapRenderer, _super);
- /**
- * @param {import("../PluggableMap.js").default} map Map.
- */
- function CompositeMapRenderer(map) {
- var _this = _super.call(this, map) || this;
- /**
- * @type {import("../events.js").EventsKey}
- */
- _this.fontChangeListenerKey_ = listen(checkedFonts, ObjectEventType.PROPERTYCHANGE, map.redrawText.bind(map));
- /**
- * @private
- * @type {HTMLDivElement}
- */
- _this.element_ = document.createElement('div');
- var style = _this.element_.style;
- style.position = 'absolute';
- style.width = '100%';
- style.height = '100%';
- style.zIndex = '0';
- _this.element_.className = CLASS_UNSELECTABLE + ' ol-layers';
- var container = map.getViewport();
- container.insertBefore(_this.element_, container.firstChild || null);
- /**
- * @private
- * @type {Array<HTMLElement>}
- */
- _this.children_ = [];
- /**
- * @private
- * @type {boolean}
- */
- _this.renderedVisible_ = true;
- return _this;
- }
- /**
- * @param {import("../render/EventType.js").default} type Event type.
- * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
- */
- CompositeMapRenderer.prototype.dispatchRenderEvent = function (type, frameState) {
- var map = this.getMap();
- if (map.hasListener(type)) {
- var event_1 = new render_Event(type, undefined, frameState);
- map.dispatchEvent(event_1);
- }
- };
- CompositeMapRenderer.prototype.disposeInternal = function () {
- unlistenByKey(this.fontChangeListenerKey_);
- this.element_.parentNode.removeChild(this.element_);
- _super.prototype.disposeInternal.call(this);
- };
- /**
- * Render.
- * @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
- */
- CompositeMapRenderer.prototype.renderFrame = function (frameState) {
- if (!frameState) {
- if (this.renderedVisible_) {
- this.element_.style.display = 'none';
- this.renderedVisible_ = false;
- }
- return;
- }
- this.calculateMatrices2D(frameState);
- this.dispatchRenderEvent(render_EventType.PRECOMPOSE, frameState);
- var layerStatesArray = frameState.layerStatesArray.sort(function (a, b) {
- return a.zIndex - b.zIndex;
- });
- var viewState = frameState.viewState;
- this.children_.length = 0;
- /**
- * @type {Array<import("../layer/BaseVector.js").default>}
- */
- var declutterLayers = [];
- var previousElement = null;
- for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
- var layerState = layerStatesArray[i];
- frameState.layerIndex = i;
- var layer = layerState.layer;
- var sourceState = layer.getSourceState();
- if (!inView(layerState, viewState) ||
- (sourceState != 'ready' && sourceState != 'undefined')) {
- layer.unrender();
- continue;
- }
- var element = layer.render(frameState, previousElement);
- if (!element) {
- continue;
- }
- if (element !== previousElement) {
- this.children_.push(element);
- previousElement = element;
- }
- if ('getDeclutter' in layer) {
- declutterLayers.push(
- /** @type {import("../layer/BaseVector.js").default} */ (layer));
- }
- }
- for (var i = declutterLayers.length - 1; i >= 0; --i) {
- declutterLayers[i].renderDeclutter(frameState);
- }
- replaceChildren(this.element_, this.children_);
- this.dispatchRenderEvent(render_EventType.POSTCOMPOSE, frameState);
- if (!this.renderedVisible_) {
- this.element_.style.display = '';
- this.renderedVisible_ = true;
- }
- this.scheduleExpireIconCache(frameState);
- };
- /**
- * @param {import("../pixel.js").Pixel} pixel Pixel.
- * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
- * @param {number} hitTolerance Hit tolerance in pixels.
- * @param {function(import("../layer/Layer.js").default<import("../source/Source").default>, (Uint8ClampedArray|Uint8Array)): T} callback Layer
- * callback.
- * @param {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} layerFilter Layer filter
- * function, only layers which are visible and for which this function
- * returns `true` will be tested for features. By default, all visible
- * layers will be tested.
- * @return {T|undefined} Callback result.
- * @template T
- */
- CompositeMapRenderer.prototype.forEachLayerAtPixel = function (pixel, frameState, hitTolerance, callback, layerFilter) {
- var viewState = frameState.viewState;
- var layerStates = frameState.layerStatesArray;
- var numLayers = layerStates.length;
- for (var i = numLayers - 1; i >= 0; --i) {
- var layerState = layerStates[i];
- var layer = layerState.layer;
- if (layer.hasRenderer() &&
- inView(layerState, viewState) &&
- layerFilter(layer)) {
- var layerRenderer = layer.getRenderer();
- var data = layerRenderer.getDataAtPixel(pixel, frameState, hitTolerance);
- if (data) {
- var result = callback(layer, data);
- if (result) {
- return result;
- }
- }
- }
- }
- return undefined;
- };
- return CompositeMapRenderer;
- }(Map));
- /* harmony default export */ var Composite = (CompositeMapRenderer);
- //# sourceMappingURL=Composite.js.map
- ;// ./node_modules/ol/layer/Group.js
- var Group_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/layer/Group
- */
- /**
- * @typedef {'addlayer'|'removelayer'} EventType
- */
- /**
- * @classdesc
- * A layer group triggers 'addlayer' and 'removelayer' events when layers are added to or removed from
- * the group or one of its child groups. When a layer group is added to or removed from another layer group,
- * a single event will be triggered (instead of one per layer in the group added or removed).
- */
- var GroupEvent = /** @class */ (function (_super) {
- Group_extends(GroupEvent, _super);
- /**
- * @param {EventType} type The event type.
- * @param {BaseLayer} layer The layer.
- */
- function GroupEvent(type, layer) {
- var _this = _super.call(this, type) || this;
- /**
- * The added or removed layer.
- * @type {BaseLayer}
- * @api
- */
- _this.layer = layer;
- return _this;
- }
- return GroupEvent;
- }(Event));
- /***
- * @template Return
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
- * import("../Observable").OnSignature<import("./Base").BaseLayerObjectEventTypes|
- * 'change:layers', import("../Object").ObjectEvent, Return> &
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("./Base").BaseLayerObjectEventTypes|'change:layers', Return>} GroupOnSignature
- */
- /**
- * @typedef {Object} Options
- * @property {number} [opacity=1] Opacity (0, 1).
- * @property {boolean} [visible=true] Visibility.
- * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
- * rendered outside of this extent.
- * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
- * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
- * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
- * method was used.
- * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
- * visible.
- * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
- * be visible.
- * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
- * visible.
- * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
- * be visible.
- * @property {Array<import("./Base.js").default>|import("../Collection.js").default<import("./Base.js").default>} [layers] Child layers.
- * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.
- */
- /**
- * @enum {string}
- * @private
- */
- var Group_Property = {
- LAYERS: 'layers',
- };
- /**
- * @classdesc
- * A {@link module:ol/Collection~Collection} of layers that are handled together.
- *
- * A generic `change` event is triggered when the group/Collection changes.
- *
- * @api
- */
- var LayerGroup = /** @class */ (function (_super) {
- Group_extends(LayerGroup, _super);
- /**
- * @param {Options} [opt_options] Layer options.
- */
- function LayerGroup(opt_options) {
- var _this = this;
- var options = opt_options || {};
- var baseOptions = /** @type {Options} */ (obj_assign({}, options));
- delete baseOptions.layers;
- var layers = options.layers;
- _this = _super.call(this, baseOptions) || this;
- /***
- * @type {GroupOnSignature<import("../events").EventsKey>}
- */
- _this.on;
- /***
- * @type {GroupOnSignature<import("../events").EventsKey>}
- */
- _this.once;
- /***
- * @type {GroupOnSignature<void>}
- */
- _this.un;
- /**
- * @private
- * @type {Array<import("../events.js").EventsKey>}
- */
- _this.layersListenerKeys_ = [];
- /**
- * @private
- * @type {Object<string, Array<import("../events.js").EventsKey>>}
- */
- _this.listenerKeys_ = {};
- _this.addChangeListener(Group_Property.LAYERS, _this.handleLayersChanged_);
- if (layers) {
- if (Array.isArray(layers)) {
- layers = new ol_Collection(layers.slice(), { unique: true });
- }
- else {
- asserts_assert(typeof ( /** @type {?} */(layers).getArray) === 'function', 43); // Expected `layers` to be an array or a `Collection`
- }
- }
- else {
- layers = new ol_Collection(undefined, { unique: true });
- }
- _this.setLayers(layers);
- return _this;
- }
- /**
- * @private
- */
- LayerGroup.prototype.handleLayerChange_ = function () {
- this.changed();
- };
- /**
- * @private
- */
- LayerGroup.prototype.handleLayersChanged_ = function () {
- this.layersListenerKeys_.forEach(unlistenByKey);
- this.layersListenerKeys_.length = 0;
- var layers = this.getLayers();
- this.layersListenerKeys_.push(listen(layers, CollectionEventType.ADD, this.handleLayersAdd_, this), listen(layers, CollectionEventType.REMOVE, this.handleLayersRemove_, this));
- for (var id in this.listenerKeys_) {
- this.listenerKeys_[id].forEach(unlistenByKey);
- }
- clear(this.listenerKeys_);
- var layersArray = layers.getArray();
- for (var i = 0, ii = layersArray.length; i < ii; i++) {
- var layer = layersArray[i];
- this.registerLayerListeners_(layer);
- this.dispatchEvent(new GroupEvent('addlayer', layer));
- }
- this.changed();
- };
- /**
- * @param {BaseLayer} layer The layer.
- */
- LayerGroup.prototype.registerLayerListeners_ = function (layer) {
- var listenerKeys = [
- listen(layer, ObjectEventType.PROPERTYCHANGE, this.handleLayerChange_, this),
- listen(layer, EventType.CHANGE, this.handleLayerChange_, this),
- ];
- if (layer instanceof LayerGroup) {
- listenerKeys.push(listen(layer, 'addlayer', this.handleLayerGroupAdd_, this), listen(layer, 'removelayer', this.handleLayerGroupRemove_, this));
- }
- this.listenerKeys_[getUid(layer)] = listenerKeys;
- };
- /**
- * @param {GroupEvent} event The layer group event.
- */
- LayerGroup.prototype.handleLayerGroupAdd_ = function (event) {
- this.dispatchEvent(new GroupEvent('addlayer', event.layer));
- };
- /**
- * @param {GroupEvent} event The layer group event.
- */
- LayerGroup.prototype.handleLayerGroupRemove_ = function (event) {
- this.dispatchEvent(new GroupEvent('removelayer', event.layer));
- };
- /**
- * @param {import("../Collection.js").CollectionEvent} collectionEvent CollectionEvent.
- * @private
- */
- LayerGroup.prototype.handleLayersAdd_ = function (collectionEvent) {
- var layer = /** @type {import("./Base.js").default} */ (collectionEvent.element);
- this.registerLayerListeners_(layer);
- this.dispatchEvent(new GroupEvent('addlayer', layer));
- this.changed();
- };
- /**
- * @param {import("../Collection.js").CollectionEvent} collectionEvent CollectionEvent.
- * @private
- */
- LayerGroup.prototype.handleLayersRemove_ = function (collectionEvent) {
- var layer = /** @type {import("./Base.js").default} */ (collectionEvent.element);
- var key = getUid(layer);
- this.listenerKeys_[key].forEach(unlistenByKey);
- delete this.listenerKeys_[key];
- this.dispatchEvent(new GroupEvent('removelayer', layer));
- this.changed();
- };
- /**
- * Returns the {@link module:ol/Collection~Collection collection} of {@link module:ol/layer/Layer~Layer layers}
- * in this group.
- * @return {!import("../Collection.js").default<import("./Base.js").default>} Collection of
- * {@link module:ol/layer/Base~BaseLayer layers} that are part of this group.
- * @observable
- * @api
- */
- LayerGroup.prototype.getLayers = function () {
- return /** @type {!import("../Collection.js").default<import("./Base.js").default>} */ (this.get(Group_Property.LAYERS));
- };
- /**
- * Set the {@link module:ol/Collection~Collection collection} of {@link module:ol/layer/Layer~Layer layers}
- * in this group.
- * @param {!import("../Collection.js").default<import("./Base.js").default>} layers Collection of
- * {@link module:ol/layer/Base~BaseLayer layers} that are part of this group.
- * @observable
- * @api
- */
- LayerGroup.prototype.setLayers = function (layers) {
- var collection = this.getLayers();
- if (collection) {
- var currentLayers = collection.getArray();
- for (var i = 0, ii = currentLayers.length; i < ii; ++i) {
- this.dispatchEvent(new GroupEvent('removelayer', currentLayers[i]));
- }
- }
- this.set(Group_Property.LAYERS, layers);
- };
- /**
- * @param {Array<import("./Layer.js").default>} [opt_array] Array of layers (to be modified in place).
- * @return {Array<import("./Layer.js").default>} Array of layers.
- */
- LayerGroup.prototype.getLayersArray = function (opt_array) {
- var array = opt_array !== undefined ? opt_array : [];
- this.getLayers().forEach(function (layer) {
- layer.getLayersArray(array);
- });
- return array;
- };
- /**
- * Get the layer states list and use this groups z-index as the default
- * for all layers in this and nested groups, if it is unset at this point.
- * If opt_states is not provided and this group's z-index is undefined
- * 0 is used a the default z-index.
- * @param {Array<import("./Layer.js").State>} [opt_states] Optional list
- * of layer states (to be modified in place).
- * @return {Array<import("./Layer.js").State>} List of layer states.
- */
- LayerGroup.prototype.getLayerStatesArray = function (opt_states) {
- var states = opt_states !== undefined ? opt_states : [];
- var pos = states.length;
- this.getLayers().forEach(function (layer) {
- layer.getLayerStatesArray(states);
- });
- var ownLayerState = this.getLayerState();
- var defaultZIndex = ownLayerState.zIndex;
- if (!opt_states && ownLayerState.zIndex === undefined) {
- defaultZIndex = 0;
- }
- for (var i = pos, ii = states.length; i < ii; i++) {
- var layerState = states[i];
- layerState.opacity *= ownLayerState.opacity;
- layerState.visible = layerState.visible && ownLayerState.visible;
- layerState.maxResolution = Math.min(layerState.maxResolution, ownLayerState.maxResolution);
- layerState.minResolution = Math.max(layerState.minResolution, ownLayerState.minResolution);
- layerState.minZoom = Math.max(layerState.minZoom, ownLayerState.minZoom);
- layerState.maxZoom = Math.min(layerState.maxZoom, ownLayerState.maxZoom);
- if (ownLayerState.extent !== undefined) {
- if (layerState.extent !== undefined) {
- layerState.extent = getIntersection(layerState.extent, ownLayerState.extent);
- }
- else {
- layerState.extent = ownLayerState.extent;
- }
- }
- if (layerState.zIndex === undefined) {
- layerState.zIndex = defaultZIndex;
- }
- }
- return states;
- };
- /**
- * @return {import("../source/Source.js").State} Source state.
- */
- LayerGroup.prototype.getSourceState = function () {
- return 'ready';
- };
- return LayerGroup;
- }(Base));
- /* harmony default export */ var Group = (LayerGroup);
- //# sourceMappingURL=Group.js.map
- ;// ./node_modules/ol/MapEvent.js
- var MapEvent_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/MapEvent
- */
- /**
- * @classdesc
- * Events emitted as map events are instances of this type.
- * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map event.
- */
- var MapEvent = /** @class */ (function (_super) {
- MapEvent_extends(MapEvent, _super);
- /**
- * @param {string} type Event type.
- * @param {import("./PluggableMap.js").default} map Map.
- * @param {?import("./PluggableMap.js").FrameState} [opt_frameState] Frame state.
- */
- function MapEvent(type, map, opt_frameState) {
- var _this = _super.call(this, type) || this;
- /**
- * The map where the event occurred.
- * @type {import("./PluggableMap.js").default}
- * @api
- */
- _this.map = map;
- /**
- * The frame state at the time of the event.
- * @type {?import("./PluggableMap.js").FrameState}
- * @api
- */
- _this.frameState = opt_frameState !== undefined ? opt_frameState : null;
- return _this;
- }
- return MapEvent;
- }(Event));
- /* harmony default export */ var ol_MapEvent = (MapEvent);
- //# sourceMappingURL=MapEvent.js.map
- ;// ./node_modules/ol/MapBrowserEvent.js
- var MapBrowserEvent_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/MapBrowserEvent
- */
- /**
- * @classdesc
- * Events emitted as map browser events are instances of this type.
- * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map browser event.
- * @template {UIEvent} EVENT
- */
- var MapBrowserEvent = /** @class */ (function (_super) {
- MapBrowserEvent_extends(MapBrowserEvent, _super);
- /**
- * @param {string} type Event type.
- * @param {import("./PluggableMap.js").default} map Map.
- * @param {EVENT} originalEvent Original event.
- * @param {boolean} [opt_dragging] Is the map currently being dragged?
- * @param {import("./PluggableMap.js").FrameState} [opt_frameState] Frame state.
- * @param {Array<PointerEvent>} [opt_activePointers] Active pointers.
- */
- function MapBrowserEvent(type, map, originalEvent, opt_dragging, opt_frameState, opt_activePointers) {
- var _this = _super.call(this, type, map, opt_frameState) || this;
- /**
- * The original browser event.
- * @const
- * @type {EVENT}
- * @api
- */
- _this.originalEvent = originalEvent;
- /**
- * The map pixel relative to the viewport corresponding to the original browser event.
- * @type {?import("./pixel.js").Pixel}
- */
- _this.pixel_ = null;
- /**
- * The coordinate in the user projection corresponding to the original browser event.
- * @type {?import("./coordinate.js").Coordinate}
- */
- _this.coordinate_ = null;
- /**
- * Indicates if the map is currently being dragged. Only set for
- * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`.
- *
- * @type {boolean}
- * @api
- */
- _this.dragging = opt_dragging !== undefined ? opt_dragging : false;
- /**
- * @type {Array<PointerEvent>|undefined}
- */
- _this.activePointers = opt_activePointers;
- return _this;
- }
- Object.defineProperty(MapBrowserEvent.prototype, "pixel", {
- /**
- * The map pixel relative to the viewport corresponding to the original event.
- * @type {import("./pixel.js").Pixel}
- * @api
- */
- get: function () {
- if (!this.pixel_) {
- this.pixel_ = this.map.getEventPixel(this.originalEvent);
- }
- return this.pixel_;
- },
- set: function (pixel) {
- this.pixel_ = pixel;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(MapBrowserEvent.prototype, "coordinate", {
- /**
- * The coordinate corresponding to the original browser event. This will be in the user
- * projection if one is set. Otherwise it will be in the view projection.
- * @type {import("./coordinate.js").Coordinate}
- * @api
- */
- get: function () {
- if (!this.coordinate_) {
- this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel);
- }
- return this.coordinate_;
- },
- set: function (coordinate) {
- this.coordinate_ = coordinate;
- },
- enumerable: false,
- configurable: true
- });
- /**
- * Prevents the default browser action.
- * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.
- * @api
- */
- MapBrowserEvent.prototype.preventDefault = function () {
- _super.prototype.preventDefault.call(this);
- if ('preventDefault' in this.originalEvent) {
- /** @type {UIEvent} */ (this.originalEvent).preventDefault();
- }
- };
- /**
- * Prevents further propagation of the current event.
- * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.
- * @api
- */
- MapBrowserEvent.prototype.stopPropagation = function () {
- _super.prototype.stopPropagation.call(this);
- if ('stopPropagation' in this.originalEvent) {
- /** @type {UIEvent} */ (this.originalEvent).stopPropagation();
- }
- };
- return MapBrowserEvent;
- }(ol_MapEvent));
- /* harmony default export */ var ol_MapBrowserEvent = (MapBrowserEvent);
- //# sourceMappingURL=MapBrowserEvent.js.map
- ;// ./node_modules/ol/MapBrowserEventType.js
- /**
- * @module ol/MapBrowserEventType
- */
- /**
- * Constants for event names.
- * @enum {string}
- */
- /* harmony default export */ var ol_MapBrowserEventType = ({
- /**
- * A true single click with no dragging and no double click. Note that this
- * event is delayed by 250 ms to ensure that it is not a double click.
- * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick
- * @api
- */
- SINGLECLICK: 'singleclick',
- /**
- * A click with no dragging. A double click will fire two of this.
- * @event module:ol/MapBrowserEvent~MapBrowserEvent#click
- * @api
- */
- CLICK: EventType.CLICK,
- /**
- * A true double click, with no dragging.
- * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick
- * @api
- */
- DBLCLICK: EventType.DBLCLICK,
- /**
- * Triggered when a pointer is dragged.
- * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag
- * @api
- */
- POINTERDRAG: 'pointerdrag',
- /**
- * Triggered when a pointer is moved. Note that on touch devices this is
- * triggered when the map is panned, so is not the same as mousemove.
- * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove
- * @api
- */
- POINTERMOVE: 'pointermove',
- POINTERDOWN: 'pointerdown',
- POINTERUP: 'pointerup',
- POINTEROVER: 'pointerover',
- POINTEROUT: 'pointerout',
- POINTERENTER: 'pointerenter',
- POINTERLEAVE: 'pointerleave',
- POINTERCANCEL: 'pointercancel',
- });
- /***
- * @typedef {'singleclick'|'click'|'dblclick'|'pointerdrag'|'pointermove'} Types
- */
- //# sourceMappingURL=MapBrowserEventType.js.map
- ;// ./node_modules/ol/MapBrowserEventHandler.js
- /**
- * @module ol/MapBrowserEventHandler
- */
- var MapBrowserEventHandler_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var MapBrowserEventHandler = /** @class */ (function (_super) {
- MapBrowserEventHandler_extends(MapBrowserEventHandler, _super);
- /**
- * @param {import("./PluggableMap.js").default} map The map with the viewport to listen to events on.
- * @param {number} [moveTolerance] The minimal distance the pointer must travel to trigger a move.
- */
- function MapBrowserEventHandler(map, moveTolerance) {
- var _this = _super.call(this, map) || this;
- /**
- * This is the element that we will listen to the real events on.
- * @type {import("./PluggableMap.js").default}
- * @private
- */
- _this.map_ = map;
- /**
- * @type {any}
- * @private
- */
- _this.clickTimeoutId_;
- /**
- * Emulate dblclick and singleclick. Will be true when only one pointer is active.
- * @type {boolean}
- */
- _this.emulateClicks_ = false;
- /**
- * @type {boolean}
- * @private
- */
- _this.dragging_ = false;
- /**
- * @type {!Array<import("./events.js").EventsKey>}
- * @private
- */
- _this.dragListenerKeys_ = [];
- /**
- * @type {number}
- * @private
- */
- _this.moveTolerance_ = moveTolerance === undefined ? 1 : moveTolerance;
- /**
- * The most recent "down" type event (or null if none have occurred).
- * Set on pointerdown.
- * @type {PointerEvent|null}
- * @private
- */
- _this.down_ = null;
- var element = _this.map_.getViewport();
- /**
- * @type {Array<PointerEvent>}
- * @private
- */
- _this.activePointers_ = [];
- /**
- * @type {!Object<number, Event>}
- * @private
- */
- _this.trackedTouches_ = {};
- _this.element_ = element;
- /**
- * @type {?import("./events.js").EventsKey}
- * @private
- */
- _this.pointerdownListenerKey_ = listen(element, pointer_EventType.POINTERDOWN, _this.handlePointerDown_, _this);
- /**
- * @type {PointerEvent}
- * @private
- */
- _this.originalPointerMoveEvent_;
- /**
- * @type {?import("./events.js").EventsKey}
- * @private
- */
- _this.relayedListenerKey_ = listen(element, pointer_EventType.POINTERMOVE, _this.relayMoveEvent_, _this);
- /**
- * @private
- */
- _this.boundHandleTouchMove_ = _this.handleTouchMove_.bind(_this);
- _this.element_.addEventListener(EventType.TOUCHMOVE, _this.boundHandleTouchMove_, PASSIVE_EVENT_LISTENERS ? { passive: false } : false);
- return _this;
- }
- /**
- * @param {PointerEvent} pointerEvent Pointer
- * event.
- * @private
- */
- MapBrowserEventHandler.prototype.emulateClick_ = function (pointerEvent) {
- var newEvent = new ol_MapBrowserEvent(ol_MapBrowserEventType.CLICK, this.map_, pointerEvent);
- this.dispatchEvent(newEvent);
- if (this.clickTimeoutId_ !== undefined) {
- // double-click
- clearTimeout(this.clickTimeoutId_);
- this.clickTimeoutId_ = undefined;
- newEvent = new ol_MapBrowserEvent(ol_MapBrowserEventType.DBLCLICK, this.map_, pointerEvent);
- this.dispatchEvent(newEvent);
- }
- else {
- // click
- this.clickTimeoutId_ = setTimeout(
- /** @this {MapBrowserEventHandler} */
- function () {
- this.clickTimeoutId_ = undefined;
- var newEvent = new ol_MapBrowserEvent(ol_MapBrowserEventType.SINGLECLICK, this.map_, pointerEvent);
- this.dispatchEvent(newEvent);
- }.bind(this), 250);
- }
- };
- /**
- * Keeps track on how many pointers are currently active.
- *
- * @param {PointerEvent} pointerEvent Pointer
- * event.
- * @private
- */
- MapBrowserEventHandler.prototype.updateActivePointers_ = function (pointerEvent) {
- var event = pointerEvent;
- var id = event.pointerId;
- if (event.type == ol_MapBrowserEventType.POINTERUP ||
- event.type == ol_MapBrowserEventType.POINTERCANCEL) {
- delete this.trackedTouches_[id];
- for (var pointerId in this.trackedTouches_) {
- if (this.trackedTouches_[pointerId].target !== event.target) {
- // Some platforms assign a new pointerId when the target changes.
- // If this happens, delete one tracked pointer. If there is more
- // than one tracked pointer for the old target, it will be cleared
- // by subsequent POINTERUP events from other pointers.
- delete this.trackedTouches_[pointerId];
- break;
- }
- }
- }
- else if (event.type == ol_MapBrowserEventType.POINTERDOWN ||
- event.type == ol_MapBrowserEventType.POINTERMOVE) {
- this.trackedTouches_[id] = event;
- }
- this.activePointers_ = getValues(this.trackedTouches_);
- };
- /**
- * @param {PointerEvent} pointerEvent Pointer
- * event.
- * @private
- */
- MapBrowserEventHandler.prototype.handlePointerUp_ = function (pointerEvent) {
- this.updateActivePointers_(pointerEvent);
- var newEvent = new ol_MapBrowserEvent(ol_MapBrowserEventType.POINTERUP, this.map_, pointerEvent, undefined, undefined, this.activePointers_);
- this.dispatchEvent(newEvent);
- // We emulate click events on left mouse button click, touch contact, and pen
- // contact. isMouseActionButton returns true in these cases (evt.button is set
- // to 0).
- // See http://www.w3.org/TR/pointerevents/#button-states
- // We only fire click, singleclick, and doubleclick if nobody has called
- // event.preventDefault().
- if (this.emulateClicks_ &&
- !newEvent.defaultPrevented &&
- !this.dragging_ &&
- this.isMouseActionButton_(pointerEvent)) {
- this.emulateClick_(this.down_);
- }
- if (this.activePointers_.length === 0) {
- this.dragListenerKeys_.forEach(unlistenByKey);
- this.dragListenerKeys_.length = 0;
- this.dragging_ = false;
- this.down_ = null;
- }
- };
- /**
- * @param {PointerEvent} pointerEvent Pointer
- * event.
- * @return {boolean} If the left mouse button was pressed.
- * @private
- */
- MapBrowserEventHandler.prototype.isMouseActionButton_ = function (pointerEvent) {
- return pointerEvent.button === 0;
- };
- /**
- * @param {PointerEvent} pointerEvent Pointer
- * event.
- * @private
- */
- MapBrowserEventHandler.prototype.handlePointerDown_ = function (pointerEvent) {
- this.emulateClicks_ = this.activePointers_.length === 0;
- this.updateActivePointers_(pointerEvent);
- var newEvent = new ol_MapBrowserEvent(ol_MapBrowserEventType.POINTERDOWN, this.map_, pointerEvent, undefined, undefined, this.activePointers_);
- this.dispatchEvent(newEvent);
- // Store a copy of the down event
- this.down_ = /** @type {PointerEvent} */ ({});
- for (var property in pointerEvent) {
- var value = pointerEvent[property];
- this.down_[property] = typeof value === 'function' ? VOID : value;
- }
- if (this.dragListenerKeys_.length === 0) {
- var doc = this.map_.getOwnerDocument();
- this.dragListenerKeys_.push(listen(doc, ol_MapBrowserEventType.POINTERMOVE, this.handlePointerMove_, this), listen(doc, ol_MapBrowserEventType.POINTERUP, this.handlePointerUp_, this),
- /* Note that the listener for `pointercancel is set up on
- * `pointerEventHandler_` and not `documentPointerEventHandler_` like
- * the `pointerup` and `pointermove` listeners.
- *
- * The reason for this is the following: `TouchSource.vacuumTouches_()`
- * issues `pointercancel` events, when there was no `touchend` for a
- * `touchstart`. Now, let's say a first `touchstart` is registered on
- * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.
- * But `documentPointerEventHandler_` doesn't know about the first
- * `touchstart`. If there is no `touchend` for the `touchstart`, we can
- * only receive a `touchcancel` from `pointerEventHandler_`, because it is
- * only registered there.
- */
- listen(this.element_, ol_MapBrowserEventType.POINTERCANCEL, this.handlePointerUp_, this));
- if (this.element_.getRootNode && this.element_.getRootNode() !== doc) {
- this.dragListenerKeys_.push(listen(this.element_.getRootNode(), ol_MapBrowserEventType.POINTERUP, this.handlePointerUp_, this));
- }
- }
- };
- /**
- * @param {PointerEvent} pointerEvent Pointer
- * event.
- * @private
- */
- MapBrowserEventHandler.prototype.handlePointerMove_ = function (pointerEvent) {
- // Between pointerdown and pointerup, pointermove events are triggered.
- // To avoid a 'false' touchmove event to be dispatched, we test if the pointer
- // moved a significant distance.
- if (this.isMoving_(pointerEvent)) {
- this.updateActivePointers_(pointerEvent);
- this.dragging_ = true;
- var newEvent = new ol_MapBrowserEvent(ol_MapBrowserEventType.POINTERDRAG, this.map_, pointerEvent, this.dragging_, undefined, this.activePointers_);
- this.dispatchEvent(newEvent);
- }
- };
- /**
- * Wrap and relay a pointermove event.
- * @param {PointerEvent} pointerEvent Pointer
- * event.
- * @private
- */
- MapBrowserEventHandler.prototype.relayMoveEvent_ = function (pointerEvent) {
- this.originalPointerMoveEvent_ = pointerEvent;
- var dragging = !!(this.down_ && this.isMoving_(pointerEvent));
- this.dispatchEvent(new ol_MapBrowserEvent(ol_MapBrowserEventType.POINTERMOVE, this.map_, pointerEvent, dragging));
- };
- /**
- * Flexible handling of a `touch-action: none` css equivalent: because calling
- * `preventDefault()` on a `pointermove` event does not stop native page scrolling
- * and zooming, we also listen for `touchmove` and call `preventDefault()` on it
- * when an interaction (currently `DragPan` handles the event.
- * @param {TouchEvent} event Event.
- * @private
- */
- MapBrowserEventHandler.prototype.handleTouchMove_ = function (event) {
- // Due to https://github.com/mpizenberg/elm-pep/issues/2, `this.originalPointerMoveEvent_`
- // may not be initialized yet when we get here on a platform without native pointer events.
- var originalEvent = this.originalPointerMoveEvent_;
- if ((!originalEvent || originalEvent.defaultPrevented) &&
- (typeof event.cancelable !== 'boolean' || event.cancelable === true)) {
- event.preventDefault();
- }
- };
- /**
- * @param {PointerEvent} pointerEvent Pointer
- * event.
- * @return {boolean} Is moving.
- * @private
- */
- MapBrowserEventHandler.prototype.isMoving_ = function (pointerEvent) {
- return (this.dragging_ ||
- Math.abs(pointerEvent.clientX - this.down_.clientX) >
- this.moveTolerance_ ||
- Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_);
- };
- /**
- * Clean up.
- */
- MapBrowserEventHandler.prototype.disposeInternal = function () {
- if (this.relayedListenerKey_) {
- unlistenByKey(this.relayedListenerKey_);
- this.relayedListenerKey_ = null;
- }
- this.element_.removeEventListener(EventType.TOUCHMOVE, this.boundHandleTouchMove_);
- if (this.pointerdownListenerKey_) {
- unlistenByKey(this.pointerdownListenerKey_);
- this.pointerdownListenerKey_ = null;
- }
- this.dragListenerKeys_.forEach(unlistenByKey);
- this.dragListenerKeys_.length = 0;
- this.element_ = null;
- _super.prototype.disposeInternal.call(this);
- };
- return MapBrowserEventHandler;
- }(events_Target));
- /* harmony default export */ var ol_MapBrowserEventHandler = (MapBrowserEventHandler);
- //# sourceMappingURL=MapBrowserEventHandler.js.map
- ;// ./node_modules/ol/MapProperty.js
- /**
- * @module ol/MapProperty
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var MapProperty = ({
- LAYERGROUP: 'layergroup',
- SIZE: 'size',
- TARGET: 'target',
- VIEW: 'view',
- });
- //# sourceMappingURL=MapProperty.js.map
- ;// ./node_modules/ol/structs/PriorityQueue.js
- /**
- * @module ol/structs/PriorityQueue
- */
- /**
- * @type {number}
- */
- var DROP = Infinity;
- /**
- * @classdesc
- * Priority queue.
- *
- * The implementation is inspired from the Closure Library's Heap class and
- * Python's heapq module.
- *
- * See https://github.com/google/closure-library/blob/master/closure/goog/structs/heap.js
- * and https://hg.python.org/cpython/file/2.7/Lib/heapq.py.
- *
- * @template T
- */
- var PriorityQueue = /** @class */ (function () {
- /**
- * @param {function(T): number} priorityFunction Priority function.
- * @param {function(T): string} keyFunction Key function.
- */
- function PriorityQueue(priorityFunction, keyFunction) {
- /**
- * @type {function(T): number}
- * @private
- */
- this.priorityFunction_ = priorityFunction;
- /**
- * @type {function(T): string}
- * @private
- */
- this.keyFunction_ = keyFunction;
- /**
- * @type {Array<T>}
- * @private
- */
- this.elements_ = [];
- /**
- * @type {Array<number>}
- * @private
- */
- this.priorities_ = [];
- /**
- * @type {!Object<string, boolean>}
- * @private
- */
- this.queuedElements_ = {};
- }
- /**
- * FIXME empty description for jsdoc
- */
- PriorityQueue.prototype.clear = function () {
- this.elements_.length = 0;
- this.priorities_.length = 0;
- clear(this.queuedElements_);
- };
- /**
- * Remove and return the highest-priority element. O(log N).
- * @return {T} Element.
- */
- PriorityQueue.prototype.dequeue = function () {
- var elements = this.elements_;
- var priorities = this.priorities_;
- var element = elements[0];
- if (elements.length == 1) {
- elements.length = 0;
- priorities.length = 0;
- }
- else {
- elements[0] = elements.pop();
- priorities[0] = priorities.pop();
- this.siftUp_(0);
- }
- var elementKey = this.keyFunction_(element);
- delete this.queuedElements_[elementKey];
- return element;
- };
- /**
- * Enqueue an element. O(log N).
- * @param {T} element Element.
- * @return {boolean} The element was added to the queue.
- */
- PriorityQueue.prototype.enqueue = function (element) {
- asserts_assert(!(this.keyFunction_(element) in this.queuedElements_), 31); // Tried to enqueue an `element` that was already added to the queue
- var priority = this.priorityFunction_(element);
- if (priority != DROP) {
- this.elements_.push(element);
- this.priorities_.push(priority);
- this.queuedElements_[this.keyFunction_(element)] = true;
- this.siftDown_(0, this.elements_.length - 1);
- return true;
- }
- return false;
- };
- /**
- * @return {number} Count.
- */
- PriorityQueue.prototype.getCount = function () {
- return this.elements_.length;
- };
- /**
- * Gets the index of the left child of the node at the given index.
- * @param {number} index The index of the node to get the left child for.
- * @return {number} The index of the left child.
- * @private
- */
- PriorityQueue.prototype.getLeftChildIndex_ = function (index) {
- return index * 2 + 1;
- };
- /**
- * Gets the index of the right child of the node at the given index.
- * @param {number} index The index of the node to get the right child for.
- * @return {number} The index of the right child.
- * @private
- */
- PriorityQueue.prototype.getRightChildIndex_ = function (index) {
- return index * 2 + 2;
- };
- /**
- * Gets the index of the parent of the node at the given index.
- * @param {number} index The index of the node to get the parent for.
- * @return {number} The index of the parent.
- * @private
- */
- PriorityQueue.prototype.getParentIndex_ = function (index) {
- return (index - 1) >> 1;
- };
- /**
- * Make this a heap. O(N).
- * @private
- */
- PriorityQueue.prototype.heapify_ = function () {
- var i;
- for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) {
- this.siftUp_(i);
- }
- };
- /**
- * @return {boolean} Is empty.
- */
- PriorityQueue.prototype.isEmpty = function () {
- return this.elements_.length === 0;
- };
- /**
- * @param {string} key Key.
- * @return {boolean} Is key queued.
- */
- PriorityQueue.prototype.isKeyQueued = function (key) {
- return key in this.queuedElements_;
- };
- /**
- * @param {T} element Element.
- * @return {boolean} Is queued.
- */
- PriorityQueue.prototype.isQueued = function (element) {
- return this.isKeyQueued(this.keyFunction_(element));
- };
- /**
- * @param {number} index The index of the node to move down.
- * @private
- */
- PriorityQueue.prototype.siftUp_ = function (index) {
- var elements = this.elements_;
- var priorities = this.priorities_;
- var count = elements.length;
- var element = elements[index];
- var priority = priorities[index];
- var startIndex = index;
- while (index < count >> 1) {
- var lIndex = this.getLeftChildIndex_(index);
- var rIndex = this.getRightChildIndex_(index);
- var smallerChildIndex = rIndex < count && priorities[rIndex] < priorities[lIndex]
- ? rIndex
- : lIndex;
- elements[index] = elements[smallerChildIndex];
- priorities[index] = priorities[smallerChildIndex];
- index = smallerChildIndex;
- }
- elements[index] = element;
- priorities[index] = priority;
- this.siftDown_(startIndex, index);
- };
- /**
- * @param {number} startIndex The index of the root.
- * @param {number} index The index of the node to move up.
- * @private
- */
- PriorityQueue.prototype.siftDown_ = function (startIndex, index) {
- var elements = this.elements_;
- var priorities = this.priorities_;
- var element = elements[index];
- var priority = priorities[index];
- while (index > startIndex) {
- var parentIndex = this.getParentIndex_(index);
- if (priorities[parentIndex] > priority) {
- elements[index] = elements[parentIndex];
- priorities[index] = priorities[parentIndex];
- index = parentIndex;
- }
- else {
- break;
- }
- }
- elements[index] = element;
- priorities[index] = priority;
- };
- /**
- * FIXME empty description for jsdoc
- */
- PriorityQueue.prototype.reprioritize = function () {
- var priorityFunction = this.priorityFunction_;
- var elements = this.elements_;
- var priorities = this.priorities_;
- var index = 0;
- var n = elements.length;
- var element, i, priority;
- for (i = 0; i < n; ++i) {
- element = elements[i];
- priority = priorityFunction(element);
- if (priority == DROP) {
- delete this.queuedElements_[this.keyFunction_(element)];
- }
- else {
- priorities[index] = priority;
- elements[index++] = element;
- }
- }
- elements.length = index;
- priorities.length = index;
- this.heapify_();
- };
- return PriorityQueue;
- }());
- /* harmony default export */ var structs_PriorityQueue = (PriorityQueue);
- //# sourceMappingURL=PriorityQueue.js.map
- ;// ./node_modules/ol/TileQueue.js
- var TileQueue_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/TileQueue
- */
- /**
- * @typedef {function(import("./Tile.js").default, string, import("./coordinate.js").Coordinate, number): number} PriorityFunction
- */
- var TileQueue = /** @class */ (function (_super) {
- TileQueue_extends(TileQueue, _super);
- /**
- * @param {PriorityFunction} tilePriorityFunction Tile priority function.
- * @param {function(): ?} tileChangeCallback Function called on each tile change event.
- */
- function TileQueue(tilePriorityFunction, tileChangeCallback) {
- var _this = _super.call(this,
- /**
- * @param {Array} element Element.
- * @return {number} Priority.
- */
- function (element) {
- return tilePriorityFunction.apply(null, element);
- },
- /**
- * @param {Array} element Element.
- * @return {string} Key.
- */
- function (element) {
- return /** @type {import("./Tile.js").default} */ (element[0]).getKey();
- }) || this;
- /** @private */
- _this.boundHandleTileChange_ = _this.handleTileChange.bind(_this);
- /**
- * @private
- * @type {function(): ?}
- */
- _this.tileChangeCallback_ = tileChangeCallback;
- /**
- * @private
- * @type {number}
- */
- _this.tilesLoading_ = 0;
- /**
- * @private
- * @type {!Object<string,boolean>}
- */
- _this.tilesLoadingKeys_ = {};
- return _this;
- }
- /**
- * @param {Array} element Element.
- * @return {boolean} The element was added to the queue.
- */
- TileQueue.prototype.enqueue = function (element) {
- var added = _super.prototype.enqueue.call(this, element);
- if (added) {
- var tile = element[0];
- tile.addEventListener(EventType.CHANGE, this.boundHandleTileChange_);
- }
- return added;
- };
- /**
- * @return {number} Number of tiles loading.
- */
- TileQueue.prototype.getTilesLoading = function () {
- return this.tilesLoading_;
- };
- /**
- * @param {import("./events/Event.js").default} event Event.
- * @protected
- */
- TileQueue.prototype.handleTileChange = function (event) {
- var tile = /** @type {import("./Tile.js").default} */ (event.target);
- var state = tile.getState();
- if (state === TileState.LOADED ||
- state === TileState.ERROR ||
- state === TileState.EMPTY) {
- tile.removeEventListener(EventType.CHANGE, this.boundHandleTileChange_);
- var tileKey = tile.getKey();
- if (tileKey in this.tilesLoadingKeys_) {
- delete this.tilesLoadingKeys_[tileKey];
- --this.tilesLoading_;
- }
- this.tileChangeCallback_();
- }
- };
- /**
- * @param {number} maxTotalLoading Maximum number tiles to load simultaneously.
- * @param {number} maxNewLoads Maximum number of new tiles to load.
- */
- TileQueue.prototype.loadMoreTiles = function (maxTotalLoading, maxNewLoads) {
- var newLoads = 0;
- var state, tile, tileKey;
- while (this.tilesLoading_ < maxTotalLoading &&
- newLoads < maxNewLoads &&
- this.getCount() > 0) {
- tile = /** @type {import("./Tile.js").default} */ (this.dequeue()[0]);
- tileKey = tile.getKey();
- state = tile.getState();
- if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
- this.tilesLoadingKeys_[tileKey] = true;
- ++this.tilesLoading_;
- ++newLoads;
- tile.load();
- }
- }
- };
- return TileQueue;
- }(structs_PriorityQueue));
- /* harmony default export */ var ol_TileQueue = (TileQueue);
- /**
- * @param {import('./PluggableMap.js').FrameState} frameState Frame state.
- * @param {import("./Tile.js").default} tile Tile.
- * @param {string} tileSourceKey Tile source key.
- * @param {import("./coordinate.js").Coordinate} tileCenter Tile center.
- * @param {number} tileResolution Tile resolution.
- * @return {number} Tile priority.
- */
- function getTilePriority(frameState, tile, tileSourceKey, tileCenter, tileResolution) {
- // Filter out tiles at higher zoom levels than the current zoom level, or that
- // are outside the visible extent.
- if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {
- return DROP;
- }
- if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) {
- return DROP;
- }
- // Prioritize the highest zoom level tiles closest to the focus.
- // Tiles at higher zoom levels are prioritized using Math.log(tileResolution).
- // Within a zoom level, tiles are prioritized by the distance in pixels between
- // the center of the tile and the center of the viewport. The factor of 65536
- // means that the prioritization should behave as desired for tiles up to
- // 65536 * Math.log(2) = 45426 pixels from the focus.
- var center = frameState.viewState.center;
- var deltaX = tileCenter[0] - center[0];
- var deltaY = tileCenter[1] - center[1];
- return (65536 * Math.log(tileResolution) +
- Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution);
- }
- //# sourceMappingURL=TileQueue.js.map
- ;// ./node_modules/ol/ViewProperty.js
- /**
- * @module ol/ViewProperty
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var ViewProperty = ({
- CENTER: 'center',
- RESOLUTION: 'resolution',
- ROTATION: 'rotation',
- });
- //# sourceMappingURL=ViewProperty.js.map
- ;// ./node_modules/ol/centerconstraint.js
- /**
- * @module ol/centerconstraint
- */
- /**
- * @typedef {function((import("./coordinate.js").Coordinate|undefined), number, import("./size.js").Size, boolean=, Array<number>=): (import("./coordinate.js").Coordinate|undefined)} Type
- */
- /**
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {boolean} onlyCenter If true, the constraint will only apply to the view center.
- * @param {boolean} smooth If true, the view will be able to go slightly out of the given extent
- * (only during interaction and animation).
- * @return {Type} The constraint.
- */
- function createExtent(extent, onlyCenter, smooth) {
- return (
- /**
- * @param {import("./coordinate.js").Coordinate|undefined} center Center.
- * @param {number|undefined} resolution Resolution.
- * @param {import("./size.js").Size} size Viewport size; unused if `onlyCenter` was specified.
- * @param {boolean} [opt_isMoving] True if an interaction or animation is in progress.
- * @param {Array<number>} [opt_centerShift] Shift between map center and viewport center.
- * @return {import("./coordinate.js").Coordinate|undefined} Center.
- */
- function (center, resolution, size, opt_isMoving, opt_centerShift) {
- if (!center) {
- return undefined;
- }
- if (!resolution && !onlyCenter) {
- return center;
- }
- var viewWidth = onlyCenter ? 0 : size[0] * resolution;
- var viewHeight = onlyCenter ? 0 : size[1] * resolution;
- var shiftX = opt_centerShift ? opt_centerShift[0] : 0;
- var shiftY = opt_centerShift ? opt_centerShift[1] : 0;
- var minX = extent[0] + viewWidth / 2 + shiftX;
- var maxX = extent[2] - viewWidth / 2 + shiftX;
- var minY = extent[1] + viewHeight / 2 + shiftY;
- var maxY = extent[3] - viewHeight / 2 + shiftY;
- // note: when zooming out of bounds, min and max values for x and y may
- // end up inverted (min > max); this has to be accounted for
- if (minX > maxX) {
- minX = (maxX + minX) / 2;
- maxX = minX;
- }
- if (minY > maxY) {
- minY = (maxY + minY) / 2;
- maxY = minY;
- }
- var x = math_clamp(center[0], minX, maxX);
- var y = math_clamp(center[1], minY, maxY);
- // during an interaction, allow some overscroll
- if (opt_isMoving && smooth && resolution) {
- var ratio = 30 * resolution;
- x +=
- -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +
- ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio);
- y +=
- -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +
- ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio);
- }
- return [x, y];
- });
- }
- /**
- * @param {import("./coordinate.js").Coordinate} [center] Center.
- * @return {import("./coordinate.js").Coordinate|undefined} Center.
- */
- function none(center) {
- return center;
- }
- //# sourceMappingURL=centerconstraint.js.map
- ;// ./node_modules/ol/resolutionconstraint.js
- /**
- * @module ol/resolutionconstraint
- */
- /**
- * @typedef {function((number|undefined), number, import("./size.js").Size, boolean=): (number|undefined)} Type
- */
- /**
- * Returns a modified resolution taking into account the viewport size and maximum
- * allowed extent.
- * @param {number} resolution Resolution
- * @param {import("./extent.js").Extent} maxExtent Maximum allowed extent.
- * @param {import("./size.js").Size} viewportSize Viewport size.
- * @param {boolean} showFullExtent Whether to show the full extent.
- * @return {number} Capped resolution.
- */
- function getViewportClampedResolution(resolution, maxExtent, viewportSize, showFullExtent) {
- var xResolution = extent_getWidth(maxExtent) / viewportSize[0];
- var yResolution = getHeight(maxExtent) / viewportSize[1];
- if (showFullExtent) {
- return Math.min(resolution, Math.max(xResolution, yResolution));
- }
- return Math.min(resolution, Math.min(xResolution, yResolution));
- }
- /**
- * Returns a modified resolution to be between maxResolution and minResolution while
- * still allowing the value to be slightly out of bounds.
- * Note: the computation is based on the logarithm function (ln):
- * - at 1, ln(x) is 0
- * - above 1, ln(x) keeps increasing but at a much slower pace than x
- * The final result is clamped to prevent getting too far away from bounds.
- * @param {number} resolution Resolution.
- * @param {number} maxResolution Max resolution.
- * @param {number} minResolution Min resolution.
- * @return {number} Smoothed resolution.
- */
- function getSmoothClampedResolution(resolution, maxResolution, minResolution) {
- var result = Math.min(resolution, maxResolution);
- var ratio = 50;
- result *=
- Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio +
- 1;
- if (minResolution) {
- result = Math.max(result, minResolution);
- result /=
- Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) /
- ratio +
- 1;
- }
- return math_clamp(result, minResolution / 2, maxResolution * 2);
- }
- /**
- * @param {Array<number>} resolutions Resolutions.
- * @param {boolean} [opt_smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.
- * @param {import("./extent.js").Extent} [opt_maxExtent] Maximum allowed extent.
- * @param {boolean} [opt_showFullExtent] If true, allows us to show the full extent. Default: false.
- * @return {Type} Zoom function.
- */
- function createSnapToResolutions(resolutions, opt_smooth, opt_maxExtent, opt_showFullExtent) {
- return (
- /**
- * @param {number|undefined} resolution Resolution.
- * @param {number} direction Direction.
- * @param {import("./size.js").Size} size Viewport size.
- * @param {boolean} [opt_isMoving] True if an interaction or animation is in progress.
- * @return {number|undefined} Resolution.
- */
- function (resolution, direction, size, opt_isMoving) {
- if (resolution !== undefined) {
- var maxResolution = resolutions[0];
- var minResolution = resolutions[resolutions.length - 1];
- var cappedMaxRes = opt_maxExtent
- ? getViewportClampedResolution(maxResolution, opt_maxExtent, size, opt_showFullExtent)
- : maxResolution;
- // during interacting or animating, allow intermediary values
- if (opt_isMoving) {
- var smooth = opt_smooth !== undefined ? opt_smooth : true;
- if (!smooth) {
- return math_clamp(resolution, minResolution, cappedMaxRes);
- }
- return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution);
- }
- var capped = Math.min(cappedMaxRes, resolution);
- var z = Math.floor(linearFindNearest(resolutions, capped, direction));
- if (resolutions[z] > cappedMaxRes && z < resolutions.length - 1) {
- return resolutions[z + 1];
- }
- return resolutions[z];
- }
- else {
- return undefined;
- }
- });
- }
- /**
- * @param {number} power Power.
- * @param {number} maxResolution Maximum resolution.
- * @param {number} [opt_minResolution] Minimum resolution.
- * @param {boolean} [opt_smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.
- * @param {import("./extent.js").Extent} [opt_maxExtent] Maximum allowed extent.
- * @param {boolean} [opt_showFullExtent] If true, allows us to show the full extent. Default: false.
- * @return {Type} Zoom function.
- */
- function createSnapToPower(power, maxResolution, opt_minResolution, opt_smooth, opt_maxExtent, opt_showFullExtent) {
- return (
- /**
- * @param {number|undefined} resolution Resolution.
- * @param {number} direction Direction.
- * @param {import("./size.js").Size} size Viewport size.
- * @param {boolean} [opt_isMoving] True if an interaction or animation is in progress.
- * @return {number|undefined} Resolution.
- */
- function (resolution, direction, size, opt_isMoving) {
- if (resolution !== undefined) {
- var cappedMaxRes = opt_maxExtent
- ? getViewportClampedResolution(maxResolution, opt_maxExtent, size, opt_showFullExtent)
- : maxResolution;
- var minResolution = opt_minResolution !== undefined ? opt_minResolution : 0;
- // during interacting or animating, allow intermediary values
- if (opt_isMoving) {
- var smooth = opt_smooth !== undefined ? opt_smooth : true;
- if (!smooth) {
- return math_clamp(resolution, minResolution, cappedMaxRes);
- }
- return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution);
- }
- var tolerance = 1e-9;
- var minZoomLevel = Math.ceil(Math.log(maxResolution / cappedMaxRes) / Math.log(power) - tolerance);
- var offset = -direction * (0.5 - tolerance) + 0.5;
- var capped = Math.min(cappedMaxRes, resolution);
- var cappedZoomLevel = Math.floor(Math.log(maxResolution / capped) / Math.log(power) + offset);
- var zoomLevel = Math.max(minZoomLevel, cappedZoomLevel);
- var newResolution = maxResolution / Math.pow(power, zoomLevel);
- return math_clamp(newResolution, minResolution, cappedMaxRes);
- }
- else {
- return undefined;
- }
- });
- }
- /**
- * @param {number} maxResolution Max resolution.
- * @param {number} minResolution Min resolution.
- * @param {boolean} [opt_smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.
- * @param {import("./extent.js").Extent} [opt_maxExtent] Maximum allowed extent.
- * @param {boolean} [opt_showFullExtent] If true, allows us to show the full extent. Default: false.
- * @return {Type} Zoom function.
- */
- function createMinMaxResolution(maxResolution, minResolution, opt_smooth, opt_maxExtent, opt_showFullExtent) {
- return (
- /**
- * @param {number|undefined} resolution Resolution.
- * @param {number} direction Direction.
- * @param {import("./size.js").Size} size Viewport size.
- * @param {boolean} [opt_isMoving] True if an interaction or animation is in progress.
- * @return {number|undefined} Resolution.
- */
- function (resolution, direction, size, opt_isMoving) {
- if (resolution !== undefined) {
- var cappedMaxRes = opt_maxExtent
- ? getViewportClampedResolution(maxResolution, opt_maxExtent, size, opt_showFullExtent)
- : maxResolution;
- var smooth = opt_smooth !== undefined ? opt_smooth : true;
- if (!smooth || !opt_isMoving) {
- return math_clamp(resolution, minResolution, cappedMaxRes);
- }
- return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution);
- }
- else {
- return undefined;
- }
- });
- }
- //# sourceMappingURL=resolutionconstraint.js.map
- ;// ./node_modules/ol/rotationconstraint.js
- /**
- * @module ol/rotationconstraint
- */
- /**
- * @typedef {function((number|undefined), boolean=): (number|undefined)} Type
- */
- /**
- * @param {number|undefined} rotation Rotation.
- * @return {number|undefined} Rotation.
- */
- function disable(rotation) {
- if (rotation !== undefined) {
- return 0;
- }
- else {
- return undefined;
- }
- }
- /**
- * @param {number|undefined} rotation Rotation.
- * @return {number|undefined} Rotation.
- */
- function rotationconstraint_none(rotation) {
- if (rotation !== undefined) {
- return rotation;
- }
- else {
- return undefined;
- }
- }
- /**
- * @param {number} n N.
- * @return {Type} Rotation constraint.
- */
- function createSnapToN(n) {
- var theta = (2 * Math.PI) / n;
- return (
- /**
- * @param {number|undefined} rotation Rotation.
- * @param {boolean} [opt_isMoving] True if an interaction or animation is in progress.
- * @return {number|undefined} Rotation.
- */
- function (rotation, opt_isMoving) {
- if (opt_isMoving) {
- return rotation;
- }
- if (rotation !== undefined) {
- rotation = Math.floor(rotation / theta + 0.5) * theta;
- return rotation;
- }
- else {
- return undefined;
- }
- });
- }
- /**
- * @param {number} [opt_tolerance] Tolerance.
- * @return {Type} Rotation constraint.
- */
- function createSnapToZero(opt_tolerance) {
- var tolerance = opt_tolerance || math_toRadians(5);
- return (
- /**
- * @param {number|undefined} rotation Rotation.
- * @param {boolean} [opt_isMoving] True if an interaction or animation is in progress.
- * @return {number|undefined} Rotation.
- */
- function (rotation, opt_isMoving) {
- if (opt_isMoving) {
- return rotation;
- }
- if (rotation !== undefined) {
- if (Math.abs(rotation) <= tolerance) {
- return 0;
- }
- else {
- return rotation;
- }
- }
- else {
- return undefined;
- }
- });
- }
- //# sourceMappingURL=rotationconstraint.js.map
- ;// ./node_modules/ol/View.js
- var View_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/View
- */
- /**
- * An animation configuration
- *
- * @typedef {Object} Animation
- * @property {import("./coordinate.js").Coordinate} [sourceCenter] Source center.
- * @property {import("./coordinate.js").Coordinate} [targetCenter] Target center.
- * @property {number} [sourceResolution] Source resolution.
- * @property {number} [targetResolution] Target resolution.
- * @property {number} [sourceRotation] Source rotation.
- * @property {number} [targetRotation] Target rotation.
- * @property {import("./coordinate.js").Coordinate} [anchor] Anchor.
- * @property {number} start Start.
- * @property {number} duration Duration.
- * @property {boolean} complete Complete.
- * @property {function(number):number} easing Easing.
- * @property {function(boolean):void} callback Callback.
- */
- /**
- * @typedef {Object} Constraints
- * @property {import("./centerconstraint.js").Type} center Center.
- * @property {import("./resolutionconstraint.js").Type} resolution Resolution.
- * @property {import("./rotationconstraint.js").Type} rotation Rotation.
- */
- /**
- * @typedef {Object} FitOptions
- * @property {import("./size.js").Size} [size] The size in pixels of the box to fit
- * the extent into. Default is the current size of the first map in the DOM that
- * uses this view, or `[100, 100]` if no such map is found.
- * @property {!Array<number>} [padding=[0, 0, 0, 0]] Padding (in pixels) to be
- * cleared inside the view. Values in the array are top, right, bottom and left
- * padding.
- * @property {boolean} [nearest=false] If the view `constrainResolution` option is `true`,
- * get the nearest extent instead of the closest that actually fits the view.
- * @property {number} [minResolution=0] Minimum resolution that we zoom to.
- * @property {number} [maxZoom] Maximum zoom level that we zoom to. If
- * `minResolution` is given, this property is ignored.
- * @property {number} [duration] The duration of the animation in milliseconds.
- * By default, there is no animation to the target extent.
- * @property {function(number):number} [easing] The easing function used during
- * the animation (defaults to {@link module:ol/easing.inAndOut}).
- * The function will be called for each frame with a number representing a
- * fraction of the animation's duration. The function should return a number
- * between 0 and 1 representing the progress toward the destination state.
- * @property {function(boolean):void} [callback] Function called when the view is in
- * its final position. The callback will be called with `true` if the animation
- * series completed on its own or `false` if it was cancelled.
- */
- /**
- * @typedef {Object} ViewOptions
- * @property {import("./coordinate.js").Coordinate} [center] The initial center for
- * the view. If a user projection is not set, the coordinate system for the center is
- * specified with the `projection` option. Layer sources will not be fetched if this
- * is not set, but the center can be set later with {@link #setCenter}.
- * @property {boolean|number} [constrainRotation=true] Rotation constraint.
- * `false` means no constraint. `true` means no constraint, but snap to zero
- * near zero. A number constrains the rotation to that number of values. For
- * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees.
- * @property {boolean} [enableRotation=true] Enable rotation.
- * If `false`, a rotation constraint that always sets the rotation to zero is
- * used. The `constrainRotation` option has no effect if `enableRotation` is
- * `false`.
- * @property {import("./extent.js").Extent} [extent] The extent that constrains the
- * view, in other words, nothing outside of this extent can be visible on the map.
- * @property {boolean} [constrainOnlyCenter=false] If true, the extent
- * constraint will only apply to the view center and not the whole extent.
- * @property {boolean} [smoothExtentConstraint=true] If true, the extent
- * constraint will be applied smoothly, i.e. allow the view to go slightly outside
- * of the given `extent`.
- * @property {number} [maxResolution] The maximum resolution used to determine
- * the resolution constraint. It is used together with `minResolution` (or
- * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way
- * that the projection's validity extent fits in a 256x256 px tile. If the
- * projection is Spherical Mercator (the default) then `maxResolution` defaults
- * to `40075016.68557849 / 256 = 156543.03392804097`.
- * @property {number} [minResolution] The minimum resolution used to determine
- * the resolution constraint. It is used together with `maxResolution` (or
- * `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29
- * zoom levels (with a factor of 2). If the projection is Spherical Mercator
- * (the default) then `minResolution` defaults to
- * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`.
- * @property {number} [maxZoom=28] The maximum zoom level used to determine the
- * resolution constraint. It is used together with `minZoom` (or
- * `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also
- * provided, it is given precedence over `maxZoom`.
- * @property {number} [minZoom=0] The minimum zoom level used to determine the
- * resolution constraint. It is used together with `maxZoom` (or
- * `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also
- * provided, it is given precedence over `minZoom`.
- * @property {boolean} [multiWorld=false] If `false` the view is constrained so
- * only one world is visible, and you cannot pan off the edge. If `true` the map
- * may show multiple worlds at low zoom levels. Only used if the `projection` is
- * global. Note that if `extent` is also provided it is given precedence.
- * @property {boolean} [constrainResolution=false] If true, the view will always
- * animate to the closest zoom level after an interaction; false means
- * intermediary zoom levels are allowed.
- * @property {boolean} [smoothResolutionConstraint=true] If true, the resolution
- * min/max values will be applied smoothly, i. e. allow the view to exceed slightly
- * the given resolution or zoom bounds.
- * @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to
- * show the full configured extent. By default, when a view is configured with an
- * extent, users will not be able to zoom out so the viewport exceeds the extent in
- * either dimension. This means the full extent may not be visible if the viewport
- * is taller or wider than the aspect ratio of the configured extent. If
- * showFullExtent is true, the user will be able to zoom out so that the viewport
- * exceeds the height or width of the configured extent, but not both, allowing the
- * full extent to be shown.
- * @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] The
- * projection. The default is Spherical Mercator.
- * @property {number} [resolution] The initial resolution for the view. The
- * units are `projection` units per pixel (e.g. meters per pixel). An
- * alternative to setting this is to set `zoom`. Layer sources will not be
- * fetched if neither this nor `zoom` are defined, but they can be set later
- * with {@link #setZoom} or {@link #setResolution}.
- * @property {Array<number>} [resolutions] Resolutions that determine the
- * zoom levels if specified. The index in the array corresponds to the zoom level,
- * therefore the resolution values have to be in descending order. It also constrains
- * the resolution by the minimum and maximum value. If set the `maxResolution`,
- * `minResolution`, `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.
- * @property {number} [rotation=0] The initial rotation for the view in radians
- * (positive rotation clockwise, 0 means North).
- * @property {number} [zoom] Only used if `resolution` is not defined. Zoom
- * level used to calculate the initial resolution for the view.
- * @property {number} [zoomFactor=2] The zoom factor used to compute the
- * corresponding resolution.
- * @property {!Array<number>} [padding=[0, 0, 0, 0]] Padding (in css pixels).
- * If the map viewport is partially covered with other content (overlays) along
- * its edges, this setting allows to shift the center of the viewport away from
- * that content. The order of the values is top, right, bottom, left.
- */
- /**
- * @typedef {Object} AnimationOptions
- * @property {import("./coordinate.js").Coordinate} [center] The center of the view at the end of
- * the animation.
- * @property {number} [zoom] The zoom level of the view at the end of the
- * animation. This takes precedence over `resolution`.
- * @property {number} [resolution] The resolution of the view at the end
- * of the animation. If `zoom` is also provided, this option will be ignored.
- * @property {number} [rotation] The rotation of the view at the end of
- * the animation.
- * @property {import("./coordinate.js").Coordinate} [anchor] Optional anchor to remain fixed
- * during a rotation or resolution animation.
- * @property {number} [duration=1000] The duration of the animation in milliseconds.
- * @property {function(number):number} [easing] The easing function used
- * during the animation (defaults to {@link module:ol/easing.inAndOut}).
- * The function will be called for each frame with a number representing a
- * fraction of the animation's duration. The function should return a number
- * between 0 and 1 representing the progress toward the destination state.
- */
- /**
- * @typedef {Object} State
- * @property {import("./coordinate.js").Coordinate} center Center.
- * @property {import("./proj/Projection.js").default} projection Projection.
- * @property {number} resolution Resolution.
- * @property {import("./coordinate.js").Coordinate} [nextCenter] The next center during an animation series.
- * @property {number} [nextResolution] The next resolution during an animation series.
- * @property {number} [nextRotation] The next rotation during an animation series.
- * @property {number} rotation Rotation.
- * @property {number} zoom Zoom.
- */
- /**
- * Default min zoom level for the map view.
- * @type {number}
- */
- var DEFAULT_MIN_ZOOM = 0;
- /**
- * @typedef {import("./ObjectEventType").Types|'change:center'|'change:resolution'|'change:rotation'} ViewObjectEventTypes
- */
- /***
- * @template Return
- * @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
- * import("./Observable").OnSignature<ViewObjectEventTypes, import("./Object").ObjectEvent, Return> &
- * import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|ViewObjectEventTypes, Return>} ViewOnSignature
- */
- /**
- * @classdesc
- * A View object represents a simple 2D view of the map.
- *
- * This is the object to act upon to change the center, resolution,
- * and rotation of the map.
- *
- * A View has a `projection`. The projection determines the
- * coordinate system of the center, and its units determine the units of the
- * resolution (projection units per pixel). The default projection is
- * Web Mercator (EPSG:3857).
- *
- * ### The view states
- *
- * A View is determined by three states: `center`, `resolution`,
- * and `rotation`. Each state has a corresponding getter and setter, e.g.
- * `getCenter` and `setCenter` for the `center` state.
- *
- * The `zoom` state is actually not saved on the view: all computations
- * internally use the `resolution` state. Still, the `setZoom` and `getZoom`
- * methods are available, as well as `getResolutionForZoom` and
- * `getZoomForResolution` to switch from one system to the other.
- *
- * ### The constraints
- *
- * `setCenter`, `setResolution` and `setRotation` can be used to change the
- * states of the view, but any constraint defined in the constructor will
- * be applied along the way.
- *
- * A View object can have a *resolution constraint*, a *rotation constraint*
- * and a *center constraint*.
- *
- * The *resolution constraint* typically restricts min/max values and
- * snaps to specific resolutions. It is determined by the following
- * options: `resolutions`, `maxResolution`, `maxZoom` and `zoomFactor`.
- * If `resolutions` is set, the other three options are ignored. See
- * documentation for each option for more information. By default, the view
- * only has a min/max restriction and allow intermediary zoom levels when
- * pinch-zooming for example.
- *
- * The *rotation constraint* snaps to specific angles. It is determined
- * by the following options: `enableRotation` and `constrainRotation`.
- * By default rotation is allowed and its value is snapped to zero when approaching the
- * horizontal.
- *
- * The *center constraint* is determined by the `extent` option. By
- * default the view center is not constrained at all.
- *
- * ### Changing the view state
- *
- * It is important to note that `setZoom`, `setResolution`, `setCenter` and
- * `setRotation` are subject to the above mentioned constraints. As such, it
- * may sometimes not be possible to know in advance the resulting state of the
- * View. For example, calling `setResolution(10)` does not guarantee that
- * `getResolution()` will return `10`.
- *
- * A consequence of this is that, when applying a delta on the view state, one
- * should use `adjustCenter`, `adjustRotation`, `adjustZoom` and `adjustResolution`
- * rather than the corresponding setters. This will let view do its internal
- * computations. Besides, the `adjust*` methods also take an `opt_anchor`
- * argument which allows specifying an origin for the transformation.
- *
- * ### Interacting with the view
- *
- * View constraints are usually only applied when the view is *at rest*, meaning that
- * no interaction or animation is ongoing. As such, if the user puts the view in a
- * state that is not equivalent to a constrained one (e.g. rotating the view when
- * the snap angle is 0), an animation will be triggered at the interaction end to
- * put back the view to a stable state;
- *
- * @api
- */
- var View = /** @class */ (function (_super) {
- View_extends(View, _super);
- /**
- * @param {ViewOptions} [opt_options] View options.
- */
- function View(opt_options) {
- var _this = _super.call(this) || this;
- /***
- * @type {ViewOnSignature<import("./events").EventsKey>}
- */
- _this.on;
- /***
- * @type {ViewOnSignature<import("./events").EventsKey>}
- */
- _this.once;
- /***
- * @type {ViewOnSignature<void>}
- */
- _this.un;
- var options = obj_assign({}, opt_options);
- /**
- * @private
- * @type {Array<number>}
- */
- _this.hints_ = [0, 0];
- /**
- * @private
- * @type {Array<Array<Animation>>}
- */
- _this.animations_ = [];
- /**
- * @private
- * @type {number|undefined}
- */
- _this.updateAnimationKey_;
- /**
- * @private
- * @const
- * @type {import("./proj/Projection.js").default}
- */
- _this.projection_ = createProjection(options.projection, 'EPSG:3857');
- /**
- * @private
- * @type {import("./size.js").Size}
- */
- _this.viewportSize_ = [100, 100];
- /**
- * @private
- * @type {import("./coordinate.js").Coordinate|undefined}
- */
- _this.targetCenter_ = null;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.targetResolution_;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.targetRotation_;
- /**
- * @private
- * @type {import("./coordinate.js").Coordinate}
- */
- _this.nextCenter_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.nextResolution_;
- /**
- * @private
- * @type {number}
- */
- _this.nextRotation_;
- /**
- * @private
- * @type {import("./coordinate.js").Coordinate|undefined}
- */
- _this.cancelAnchor_ = undefined;
- if (options.projection) {
- disableCoordinateWarning();
- }
- if (options.center) {
- options.center = fromUserCoordinate(options.center, _this.projection_);
- }
- if (options.extent) {
- options.extent = proj_fromUserExtent(options.extent, _this.projection_);
- }
- _this.applyOptions_(options);
- return _this;
- }
- /**
- * Set up the view with the given options.
- * @param {ViewOptions} options View options.
- */
- View.prototype.applyOptions_ = function (options) {
- var properties = obj_assign({}, options);
- for (var key in ViewProperty) {
- delete properties[key];
- }
- this.setProperties(properties, true);
- var resolutionConstraintInfo = createResolutionConstraint(options);
- /**
- * @private
- * @type {number}
- */
- this.maxResolution_ = resolutionConstraintInfo.maxResolution;
- /**
- * @private
- * @type {number}
- */
- this.minResolution_ = resolutionConstraintInfo.minResolution;
- /**
- * @private
- * @type {number}
- */
- this.zoomFactor_ = resolutionConstraintInfo.zoomFactor;
- /**
- * @private
- * @type {Array<number>|undefined}
- */
- this.resolutions_ = options.resolutions;
- /**
- * @type {Array<number>|undefined}
- * @private
- */
- this.padding_ = options.padding;
- /**
- * @private
- * @type {number}
- */
- this.minZoom_ = resolutionConstraintInfo.minZoom;
- var centerConstraint = createCenterConstraint(options);
- var resolutionConstraint = resolutionConstraintInfo.constraint;
- var rotationConstraint = createRotationConstraint(options);
- /**
- * @private
- * @type {Constraints}
- */
- this.constraints_ = {
- center: centerConstraint,
- resolution: resolutionConstraint,
- rotation: rotationConstraint,
- };
- this.setRotation(options.rotation !== undefined ? options.rotation : 0);
- this.setCenterInternal(options.center !== undefined ? options.center : null);
- if (options.resolution !== undefined) {
- this.setResolution(options.resolution);
- }
- else if (options.zoom !== undefined) {
- this.setZoom(options.zoom);
- }
- };
- Object.defineProperty(View.prototype, "padding", {
- /**
- * Padding (in css pixels).
- * If the map viewport is partially covered with other content (overlays) along
- * its edges, this setting allows to shift the center of the viewport away from that
- * content. The order of the values in the array is top, right, bottom, left.
- * The default is no padding, which is equivalent to `[0, 0, 0, 0]`.
- * @type {Array<number>|undefined}
- * @api
- */
- get: function () {
- return this.padding_;
- },
- set: function (padding) {
- var oldPadding = this.padding_;
- this.padding_ = padding;
- var center = this.getCenter();
- if (center) {
- var newPadding = padding || [0, 0, 0, 0];
- oldPadding = oldPadding || [0, 0, 0, 0];
- var resolution = this.getResolution();
- var offsetX = (resolution / 2) *
- (newPadding[3] - oldPadding[3] + oldPadding[1] - newPadding[1]);
- var offsetY = (resolution / 2) *
- (newPadding[0] - oldPadding[0] + oldPadding[2] - newPadding[2]);
- this.setCenterInternal([center[0] + offsetX, center[1] - offsetY]);
- }
- },
- enumerable: false,
- configurable: true
- });
- /**
- * Get an updated version of the view options used to construct the view. The
- * current resolution (or zoom), center, and rotation are applied to any stored
- * options. The provided options can be used to apply new min/max zoom or
- * resolution limits.
- * @param {ViewOptions} newOptions New options to be applied.
- * @return {ViewOptions} New options updated with the current view state.
- */
- View.prototype.getUpdatedOptions_ = function (newOptions) {
- var options = this.getProperties();
- // preserve resolution (or zoom)
- if (options.resolution !== undefined) {
- options.resolution = this.getResolution();
- }
- else {
- options.zoom = this.getZoom();
- }
- // preserve center
- options.center = this.getCenterInternal();
- // preserve rotation
- options.rotation = this.getRotation();
- return obj_assign({}, options, newOptions);
- };
- /**
- * Animate the view. The view's center, zoom (or resolution), and rotation
- * can be animated for smooth transitions between view states. For example,
- * to animate the view to a new zoom level:
- *
- * view.animate({zoom: view.getZoom() + 1});
- *
- * By default, the animation lasts one second and uses in-and-out easing. You
- * can customize this behavior by including `duration` (in milliseconds) and
- * `easing` options (see {@link module:ol/easing}).
- *
- * To chain together multiple animations, call the method with multiple
- * animation objects. For example, to first zoom and then pan:
- *
- * view.animate({zoom: 10}, {center: [0, 0]});
- *
- * If you provide a function as the last argument to the animate method, it
- * will get called at the end of an animation series. The callback will be
- * called with `true` if the animation series completed on its own or `false`
- * if it was cancelled.
- *
- * Animations are cancelled by user interactions (e.g. dragging the map) or by
- * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`
- * (or another method that calls one of these).
- *
- * @param {...(AnimationOptions|function(boolean): void)} var_args Animation
- * options. Multiple animations can be run in series by passing multiple
- * options objects. To run multiple animations in parallel, call the method
- * multiple times. An optional callback can be provided as a final
- * argument. The callback will be called with a boolean indicating whether
- * the animation completed without being cancelled.
- * @api
- */
- View.prototype.animate = function (var_args) {
- if (this.isDef() && !this.getAnimating()) {
- this.resolveConstraints(0);
- }
- var args = new Array(arguments.length);
- for (var i = 0; i < args.length; ++i) {
- var options = arguments[i];
- if (options.center) {
- options = obj_assign({}, options);
- options.center = fromUserCoordinate(options.center, this.getProjection());
- }
- if (options.anchor) {
- options = obj_assign({}, options);
- options.anchor = fromUserCoordinate(options.anchor, this.getProjection());
- }
- args[i] = options;
- }
- this.animateInternal.apply(this, args);
- };
- /**
- * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.
- */
- View.prototype.animateInternal = function (var_args) {
- var animationCount = arguments.length;
- var callback;
- if (animationCount > 1 &&
- typeof arguments[animationCount - 1] === 'function') {
- callback = arguments[animationCount - 1];
- --animationCount;
- }
- var i = 0;
- for (; i < animationCount && !this.isDef(); ++i) {
- // if view properties are not yet set, shortcut to the final state
- var state = arguments[i];
- if (state.center) {
- this.setCenterInternal(state.center);
- }
- if (state.zoom !== undefined) {
- this.setZoom(state.zoom);
- }
- else if (state.resolution) {
- this.setResolution(state.resolution);
- }
- if (state.rotation !== undefined) {
- this.setRotation(state.rotation);
- }
- }
- if (i === animationCount) {
- if (callback) {
- animationCallback(callback, true);
- }
- return;
- }
- var start = Date.now();
- var center = this.targetCenter_.slice();
- var resolution = this.targetResolution_;
- var rotation = this.targetRotation_;
- var series = [];
- for (; i < animationCount; ++i) {
- var options = /** @type {AnimationOptions} */ (arguments[i]);
- var animation = {
- start: start,
- complete: false,
- anchor: options.anchor,
- duration: options.duration !== undefined ? options.duration : 1000,
- easing: options.easing || inAndOut,
- callback: callback,
- };
- if (options.center) {
- animation.sourceCenter = center;
- animation.targetCenter = options.center.slice();
- center = animation.targetCenter;
- }
- if (options.zoom !== undefined) {
- animation.sourceResolution = resolution;
- animation.targetResolution = this.getResolutionForZoom(options.zoom);
- resolution = animation.targetResolution;
- }
- else if (options.resolution) {
- animation.sourceResolution = resolution;
- animation.targetResolution = options.resolution;
- resolution = animation.targetResolution;
- }
- if (options.rotation !== undefined) {
- animation.sourceRotation = rotation;
- var delta = math_modulo(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;
- animation.targetRotation = rotation + delta;
- rotation = animation.targetRotation;
- }
- // check if animation is a no-op
- if (isNoopAnimation(animation)) {
- animation.complete = true;
- // we still push it onto the series for callback handling
- }
- else {
- start += animation.duration;
- }
- series.push(animation);
- }
- this.animations_.push(series);
- this.setHint(ViewHint.ANIMATING, 1);
- this.updateAnimations_();
- };
- /**
- * Determine if the view is being animated.
- * @return {boolean} The view is being animated.
- * @api
- */
- View.prototype.getAnimating = function () {
- return this.hints_[ViewHint.ANIMATING] > 0;
- };
- /**
- * Determine if the user is interacting with the view, such as panning or zooming.
- * @return {boolean} The view is being interacted with.
- * @api
- */
- View.prototype.getInteracting = function () {
- return this.hints_[ViewHint.INTERACTING] > 0;
- };
- /**
- * Cancel any ongoing animations.
- * @api
- */
- View.prototype.cancelAnimations = function () {
- this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);
- var anchor;
- for (var i = 0, ii = this.animations_.length; i < ii; ++i) {
- var series = this.animations_[i];
- if (series[0].callback) {
- animationCallback(series[0].callback, false);
- }
- if (!anchor) {
- for (var j = 0, jj = series.length; j < jj; ++j) {
- var animation = series[j];
- if (!animation.complete) {
- anchor = animation.anchor;
- break;
- }
- }
- }
- }
- this.animations_.length = 0;
- this.cancelAnchor_ = anchor;
- this.nextCenter_ = null;
- this.nextResolution_ = NaN;
- this.nextRotation_ = NaN;
- };
- /**
- * Update all animations.
- */
- View.prototype.updateAnimations_ = function () {
- if (this.updateAnimationKey_ !== undefined) {
- cancelAnimationFrame(this.updateAnimationKey_);
- this.updateAnimationKey_ = undefined;
- }
- if (!this.getAnimating()) {
- return;
- }
- var now = Date.now();
- var more = false;
- for (var i = this.animations_.length - 1; i >= 0; --i) {
- var series = this.animations_[i];
- var seriesComplete = true;
- for (var j = 0, jj = series.length; j < jj; ++j) {
- var animation = series[j];
- if (animation.complete) {
- continue;
- }
- var elapsed = now - animation.start;
- var fraction = animation.duration > 0 ? elapsed / animation.duration : 1;
- if (fraction >= 1) {
- animation.complete = true;
- fraction = 1;
- }
- else {
- seriesComplete = false;
- }
- var progress = animation.easing(fraction);
- if (animation.sourceCenter) {
- var x0 = animation.sourceCenter[0];
- var y0 = animation.sourceCenter[1];
- var x1 = animation.targetCenter[0];
- var y1 = animation.targetCenter[1];
- this.nextCenter_ = animation.targetCenter;
- var x = x0 + progress * (x1 - x0);
- var y = y0 + progress * (y1 - y0);
- this.targetCenter_ = [x, y];
- }
- if (animation.sourceResolution && animation.targetResolution) {
- var resolution = progress === 1
- ? animation.targetResolution
- : animation.sourceResolution +
- progress *
- (animation.targetResolution - animation.sourceResolution);
- if (animation.anchor) {
- var size = this.getViewportSize_(this.getRotation());
- var constrainedResolution = this.constraints_.resolution(resolution, 0, size, true);
- this.targetCenter_ = this.calculateCenterZoom(constrainedResolution, animation.anchor);
- }
- this.nextResolution_ = animation.targetResolution;
- this.targetResolution_ = resolution;
- this.applyTargetState_(true);
- }
- if (animation.sourceRotation !== undefined &&
- animation.targetRotation !== undefined) {
- var rotation = progress === 1
- ? math_modulo(animation.targetRotation + Math.PI, 2 * Math.PI) -
- Math.PI
- : animation.sourceRotation +
- progress *
- (animation.targetRotation - animation.sourceRotation);
- if (animation.anchor) {
- var constrainedRotation = this.constraints_.rotation(rotation, true);
- this.targetCenter_ = this.calculateCenterRotate(constrainedRotation, animation.anchor);
- }
- this.nextRotation_ = animation.targetRotation;
- this.targetRotation_ = rotation;
- }
- this.applyTargetState_(true);
- more = true;
- if (!animation.complete) {
- break;
- }
- }
- if (seriesComplete) {
- this.animations_[i] = null;
- this.setHint(ViewHint.ANIMATING, -1);
- this.nextCenter_ = null;
- this.nextResolution_ = NaN;
- this.nextRotation_ = NaN;
- var callback = series[0].callback;
- if (callback) {
- animationCallback(callback, true);
- }
- }
- }
- // prune completed series
- this.animations_ = this.animations_.filter(Boolean);
- if (more && this.updateAnimationKey_ === undefined) {
- this.updateAnimationKey_ = requestAnimationFrame(this.updateAnimations_.bind(this));
- }
- };
- /**
- * @param {number} rotation Target rotation.
- * @param {import("./coordinate.js").Coordinate} anchor Rotation anchor.
- * @return {import("./coordinate.js").Coordinate|undefined} Center for rotation and anchor.
- */
- View.prototype.calculateCenterRotate = function (rotation, anchor) {
- var center;
- var currentCenter = this.getCenterInternal();
- if (currentCenter !== undefined) {
- center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];
- rotate(center, rotation - this.getRotation());
- coordinate_add(center, anchor);
- }
- return center;
- };
- /**
- * @param {number} resolution Target resolution.
- * @param {import("./coordinate.js").Coordinate} anchor Zoom anchor.
- * @return {import("./coordinate.js").Coordinate|undefined} Center for resolution and anchor.
- */
- View.prototype.calculateCenterZoom = function (resolution, anchor) {
- var center;
- var currentCenter = this.getCenterInternal();
- var currentResolution = this.getResolution();
- if (currentCenter !== undefined && currentResolution !== undefined) {
- var x = anchor[0] -
- (resolution * (anchor[0] - currentCenter[0])) / currentResolution;
- var y = anchor[1] -
- (resolution * (anchor[1] - currentCenter[1])) / currentResolution;
- center = [x, y];
- }
- return center;
- };
- /**
- * Returns the current viewport size.
- * @private
- * @param {number} [opt_rotation] Take into account the rotation of the viewport when giving the size
- * @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found.
- */
- View.prototype.getViewportSize_ = function (opt_rotation) {
- var size = this.viewportSize_;
- if (opt_rotation) {
- var w = size[0];
- var h = size[1];
- return [
- Math.abs(w * Math.cos(opt_rotation)) +
- Math.abs(h * Math.sin(opt_rotation)),
- Math.abs(w * Math.sin(opt_rotation)) +
- Math.abs(h * Math.cos(opt_rotation)),
- ];
- }
- else {
- return size;
- }
- };
- /**
- * Stores the viewport size on the view. The viewport size is not read every time from the DOM
- * to avoid performance hit and layout reflow.
- * This should be done on map size change.
- * Note: the constraints are not resolved during an animation to avoid stopping it
- * @param {import("./size.js").Size} [opt_size] Viewport size; if undefined, [100, 100] is assumed
- */
- View.prototype.setViewportSize = function (opt_size) {
- this.viewportSize_ = Array.isArray(opt_size)
- ? opt_size.slice()
- : [100, 100];
- if (!this.getAnimating()) {
- this.resolveConstraints(0);
- }
- };
- /**
- * Get the view center.
- * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
- * @observable
- * @api
- */
- View.prototype.getCenter = function () {
- var center = this.getCenterInternal();
- if (!center) {
- return center;
- }
- return toUserCoordinate(center, this.getProjection());
- };
- /**
- * Get the view center without transforming to user projection.
- * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
- */
- View.prototype.getCenterInternal = function () {
- return /** @type {import("./coordinate.js").Coordinate|undefined} */ (this.get(ViewProperty.CENTER));
- };
- /**
- * @return {Constraints} Constraints.
- */
- View.prototype.getConstraints = function () {
- return this.constraints_;
- };
- /**
- * @return {boolean} Resolution constraint is set
- */
- View.prototype.getConstrainResolution = function () {
- return this.get('constrainResolution');
- };
- /**
- * @param {Array<number>} [opt_hints] Destination array.
- * @return {Array<number>} Hint.
- */
- View.prototype.getHints = function (opt_hints) {
- if (opt_hints !== undefined) {
- opt_hints[0] = this.hints_[0];
- opt_hints[1] = this.hints_[1];
- return opt_hints;
- }
- else {
- return this.hints_.slice();
- }
- };
- /**
- * Calculate the extent for the current view state and the passed size.
- * The size is the pixel dimensions of the box into which the calculated extent
- * should fit. In most cases you want to get the extent of the entire map,
- * that is `map.getSize()`.
- * @param {import("./size.js").Size} [opt_size] Box pixel size. If not provided, the size
- * of the map that uses this view will be used.
- * @return {import("./extent.js").Extent} Extent.
- * @api
- */
- View.prototype.calculateExtent = function (opt_size) {
- var extent = this.calculateExtentInternal(opt_size);
- return proj_toUserExtent(extent, this.getProjection());
- };
- /**
- * @param {import("./size.js").Size} [opt_size] Box pixel size. If not provided,
- * the map's last known viewport size will be used.
- * @return {import("./extent.js").Extent} Extent.
- */
- View.prototype.calculateExtentInternal = function (opt_size) {
- var size = opt_size || this.getViewportSizeMinusPadding_();
- var center = /** @type {!import("./coordinate.js").Coordinate} */ (this.getCenterInternal());
- asserts_assert(center, 1); // The view center is not defined
- var resolution = /** @type {!number} */ (this.getResolution());
- asserts_assert(resolution !== undefined, 2); // The view resolution is not defined
- var rotation = /** @type {!number} */ (this.getRotation());
- asserts_assert(rotation !== undefined, 3); // The view rotation is not defined
- return getForViewAndSize(center, resolution, rotation, size);
- };
- /**
- * Get the maximum resolution of the view.
- * @return {number} The maximum resolution of the view.
- * @api
- */
- View.prototype.getMaxResolution = function () {
- return this.maxResolution_;
- };
- /**
- * Get the minimum resolution of the view.
- * @return {number} The minimum resolution of the view.
- * @api
- */
- View.prototype.getMinResolution = function () {
- return this.minResolution_;
- };
- /**
- * Get the maximum zoom level for the view.
- * @return {number} The maximum zoom level.
- * @api
- */
- View.prototype.getMaxZoom = function () {
- return /** @type {number} */ (this.getZoomForResolution(this.minResolution_));
- };
- /**
- * Set a new maximum zoom level for the view.
- * @param {number} zoom The maximum zoom level.
- * @api
- */
- View.prototype.setMaxZoom = function (zoom) {
- this.applyOptions_(this.getUpdatedOptions_({ maxZoom: zoom }));
- };
- /**
- * Get the minimum zoom level for the view.
- * @return {number} The minimum zoom level.
- * @api
- */
- View.prototype.getMinZoom = function () {
- return /** @type {number} */ (this.getZoomForResolution(this.maxResolution_));
- };
- /**
- * Set a new minimum zoom level for the view.
- * @param {number} zoom The minimum zoom level.
- * @api
- */
- View.prototype.setMinZoom = function (zoom) {
- this.applyOptions_(this.getUpdatedOptions_({ minZoom: zoom }));
- };
- /**
- * Set whether the view should allow intermediary zoom levels.
- * @param {boolean} enabled Whether the resolution is constrained.
- * @api
- */
- View.prototype.setConstrainResolution = function (enabled) {
- this.applyOptions_(this.getUpdatedOptions_({ constrainResolution: enabled }));
- };
- /**
- * Get the view projection.
- * @return {import("./proj/Projection.js").default} The projection of the view.
- * @api
- */
- View.prototype.getProjection = function () {
- return this.projection_;
- };
- /**
- * Get the view resolution.
- * @return {number|undefined} The resolution of the view.
- * @observable
- * @api
- */
- View.prototype.getResolution = function () {
- return /** @type {number|undefined} */ (this.get(ViewProperty.RESOLUTION));
- };
- /**
- * Get the resolutions for the view. This returns the array of resolutions
- * passed to the constructor of the View, or undefined if none were given.
- * @return {Array<number>|undefined} The resolutions of the view.
- * @api
- */
- View.prototype.getResolutions = function () {
- return this.resolutions_;
- };
- /**
- * Get the resolution for a provided extent (in map units) and size (in pixels).
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {import("./size.js").Size} [opt_size] Box pixel size.
- * @return {number} The resolution at which the provided extent will render at
- * the given size.
- * @api
- */
- View.prototype.getResolutionForExtent = function (extent, opt_size) {
- return this.getResolutionForExtentInternal(proj_fromUserExtent(extent, this.getProjection()), opt_size);
- };
- /**
- * Get the resolution for a provided extent (in map units) and size (in pixels).
- * @param {import("./extent.js").Extent} extent Extent.
- * @param {import("./size.js").Size} [opt_size] Box pixel size.
- * @return {number} The resolution at which the provided extent will render at
- * the given size.
- */
- View.prototype.getResolutionForExtentInternal = function (extent, opt_size) {
- var size = opt_size || this.getViewportSizeMinusPadding_();
- var xResolution = extent_getWidth(extent) / size[0];
- var yResolution = getHeight(extent) / size[1];
- return Math.max(xResolution, yResolution);
- };
- /**
- * Return a function that returns a value between 0 and 1 for a
- * resolution. Exponential scaling is assumed.
- * @param {number} [opt_power] Power.
- * @return {function(number): number} Resolution for value function.
- */
- View.prototype.getResolutionForValueFunction = function (opt_power) {
- var power = opt_power || 2;
- var maxResolution = this.getConstrainedResolution(this.maxResolution_);
- var minResolution = this.minResolution_;
- var max = Math.log(maxResolution / minResolution) / Math.log(power);
- return (
- /**
- * @param {number} value Value.
- * @return {number} Resolution.
- */
- function (value) {
- var resolution = maxResolution / Math.pow(power, value * max);
- return resolution;
- });
- };
- /**
- * Get the view rotation.
- * @return {number} The rotation of the view in radians.
- * @observable
- * @api
- */
- View.prototype.getRotation = function () {
- return /** @type {number} */ (this.get(ViewProperty.ROTATION));
- };
- /**
- * Return a function that returns a resolution for a value between
- * 0 and 1. Exponential scaling is assumed.
- * @param {number} [opt_power] Power.
- * @return {function(number): number} Value for resolution function.
- */
- View.prototype.getValueForResolutionFunction = function (opt_power) {
- var logPower = Math.log(opt_power || 2);
- var maxResolution = this.getConstrainedResolution(this.maxResolution_);
- var minResolution = this.minResolution_;
- var max = Math.log(maxResolution / minResolution) / logPower;
- return (
- /**
- * @param {number} resolution Resolution.
- * @return {number} Value.
- */
- function (resolution) {
- var value = Math.log(maxResolution / resolution) / logPower / max;
- return value;
- });
- };
- /**
- * Returns the size of the viewport minus padding.
- * @private
- * @param {number} [opt_rotation] Take into account the rotation of the viewport when giving the size
- * @return {import("./size.js").Size} Viewport size reduced by the padding.
- */
- View.prototype.getViewportSizeMinusPadding_ = function (opt_rotation) {
- var size = this.getViewportSize_(opt_rotation);
- var padding = this.padding_;
- if (padding) {
- size = [
- size[0] - padding[1] - padding[3],
- size[1] - padding[0] - padding[2],
- ];
- }
- return size;
- };
- /**
- * @return {State} View state.
- */
- View.prototype.getState = function () {
- var projection = this.getProjection();
- var resolution = this.getResolution();
- var rotation = this.getRotation();
- var center = /** @type {import("./coordinate.js").Coordinate} */ (this.getCenterInternal());
- var padding = this.padding_;
- if (padding) {
- var reducedSize = this.getViewportSizeMinusPadding_();
- center = calculateCenterOn(center, this.getViewportSize_(), [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]], resolution, rotation);
- }
- return {
- center: center.slice(0),
- projection: projection !== undefined ? projection : null,
- resolution: resolution,
- nextCenter: this.nextCenter_,
- nextResolution: this.nextResolution_,
- nextRotation: this.nextRotation_,
- rotation: rotation,
- zoom: this.getZoom(),
- };
- };
- /**
- * Get the current zoom level. This method may return non-integer zoom levels
- * if the view does not constrain the resolution, or if an interaction or
- * animation is underway.
- * @return {number|undefined} Zoom.
- * @api
- */
- View.prototype.getZoom = function () {
- var zoom;
- var resolution = this.getResolution();
- if (resolution !== undefined) {
- zoom = this.getZoomForResolution(resolution);
- }
- return zoom;
- };
- /**
- * Get the zoom level for a resolution.
- * @param {number} resolution The resolution.
- * @return {number|undefined} The zoom level for the provided resolution.
- * @api
- */
- View.prototype.getZoomForResolution = function (resolution) {
- var offset = this.minZoom_ || 0;
- var max, zoomFactor;
- if (this.resolutions_) {
- var nearest = linearFindNearest(this.resolutions_, resolution, 1);
- offset = nearest;
- max = this.resolutions_[nearest];
- if (nearest == this.resolutions_.length - 1) {
- zoomFactor = 2;
- }
- else {
- zoomFactor = max / this.resolutions_[nearest + 1];
- }
- }
- else {
- max = this.maxResolution_;
- zoomFactor = this.zoomFactor_;
- }
- return offset + Math.log(max / resolution) / Math.log(zoomFactor);
- };
- /**
- * Get the resolution for a zoom level.
- * @param {number} zoom Zoom level.
- * @return {number} The view resolution for the provided zoom level.
- * @api
- */
- View.prototype.getResolutionForZoom = function (zoom) {
- if (this.resolutions_) {
- if (this.resolutions_.length <= 1) {
- return 0;
- }
- var baseLevel = math_clamp(Math.floor(zoom), 0, this.resolutions_.length - 2);
- var zoomFactor = this.resolutions_[baseLevel] / this.resolutions_[baseLevel + 1];
- return (this.resolutions_[baseLevel] /
- Math.pow(zoomFactor, math_clamp(zoom - baseLevel, 0, 1)));
- }
- else {
- return (this.maxResolution_ / Math.pow(this.zoomFactor_, zoom - this.minZoom_));
- }
- };
- /**
- * Fit the given geometry or extent based on the given map size and border.
- * The size is pixel dimensions of the box to fit the extent into.
- * In most cases you will want to use the map size, that is `map.getSize()`.
- * Takes care of the map angle.
- * @param {import("./geom/SimpleGeometry.js").default|import("./extent.js").Extent} geometryOrExtent The geometry or
- * extent to fit the view to.
- * @param {FitOptions} [opt_options] Options.
- * @api
- */
- View.prototype.fit = function (geometryOrExtent, opt_options) {
- /** @type {import("./geom/SimpleGeometry.js").default} */
- var geometry;
- asserts_assert(Array.isArray(geometryOrExtent) ||
- typeof ( /** @type {?} */(geometryOrExtent).getSimplifiedGeometry) ===
- 'function', 24); // Invalid extent or geometry provided as `geometry`
- if (Array.isArray(geometryOrExtent)) {
- asserts_assert(!extent_isEmpty(geometryOrExtent), 25); // Cannot fit empty extent provided as `geometry`
- var extent = proj_fromUserExtent(geometryOrExtent, this.getProjection());
- geometry = fromExtent(extent);
- }
- else if (geometryOrExtent.getType() === 'Circle') {
- var extent = proj_fromUserExtent(geometryOrExtent.getExtent(), this.getProjection());
- geometry = fromExtent(extent);
- geometry.rotate(this.getRotation(), getCenter(extent));
- }
- else {
- var userProjection = getUserProjection();
- if (userProjection) {
- geometry = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometryOrExtent
- .clone()
- .transform(userProjection, this.getProjection()));
- }
- else {
- geometry = geometryOrExtent;
- }
- }
- this.fitInternal(geometry, opt_options);
- };
- /**
- * Calculate rotated extent
- * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry.
- * @return {import("./extent").Extent} The rotated extent for the geometry.
- */
- View.prototype.rotatedExtentForGeometry = function (geometry) {
- var rotation = this.getRotation();
- var cosAngle = Math.cos(rotation);
- var sinAngle = Math.sin(-rotation);
- var coords = geometry.getFlatCoordinates();
- var stride = geometry.getStride();
- var minRotX = +Infinity;
- var minRotY = +Infinity;
- var maxRotX = -Infinity;
- var maxRotY = -Infinity;
- for (var i = 0, ii = coords.length; i < ii; i += stride) {
- var rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle;
- var rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle;
- minRotX = Math.min(minRotX, rotX);
- minRotY = Math.min(minRotY, rotY);
- maxRotX = Math.max(maxRotX, rotX);
- maxRotY = Math.max(maxRotY, rotY);
- }
- return [minRotX, minRotY, maxRotX, maxRotY];
- };
- /**
- * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry.
- * @param {FitOptions} [opt_options] Options.
- */
- View.prototype.fitInternal = function (geometry, opt_options) {
- var options = opt_options || {};
- var size = options.size;
- if (!size) {
- size = this.getViewportSizeMinusPadding_();
- }
- var padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0];
- var nearest = options.nearest !== undefined ? options.nearest : false;
- var minResolution;
- if (options.minResolution !== undefined) {
- minResolution = options.minResolution;
- }
- else if (options.maxZoom !== undefined) {
- minResolution = this.getResolutionForZoom(options.maxZoom);
- }
- else {
- minResolution = 0;
- }
- var rotatedExtent = this.rotatedExtentForGeometry(geometry);
- // calculate resolution
- var resolution = this.getResolutionForExtentInternal(rotatedExtent, [
- size[0] - padding[1] - padding[3],
- size[1] - padding[0] - padding[2],
- ]);
- resolution = isNaN(resolution)
- ? minResolution
- : Math.max(resolution, minResolution);
- resolution = this.getConstrainedResolution(resolution, nearest ? 0 : 1);
- // calculate center
- var rotation = this.getRotation();
- var sinAngle = Math.sin(rotation);
- var cosAngle = Math.cos(rotation);
- var centerRot = getCenter(rotatedExtent);
- centerRot[0] += ((padding[1] - padding[3]) / 2) * resolution;
- centerRot[1] += ((padding[0] - padding[2]) / 2) * resolution;
- var centerX = centerRot[0] * cosAngle - centerRot[1] * sinAngle;
- var centerY = centerRot[1] * cosAngle + centerRot[0] * sinAngle;
- var center = this.getConstrainedCenter([centerX, centerY], resolution);
- var callback = options.callback ? options.callback : VOID;
- if (options.duration !== undefined) {
- this.animateInternal({
- resolution: resolution,
- center: center,
- duration: options.duration,
- easing: options.easing,
- }, callback);
- }
- else {
- this.targetResolution_ = resolution;
- this.targetCenter_ = center;
- this.applyTargetState_(false, true);
- animationCallback(callback, true);
- }
- };
- /**
- * Center on coordinate and view position.
- * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
- * @param {import("./size.js").Size} size Box pixel size.
- * @param {import("./pixel.js").Pixel} position Position on the view to center on.
- * @api
- */
- View.prototype.centerOn = function (coordinate, size, position) {
- this.centerOnInternal(fromUserCoordinate(coordinate, this.getProjection()), size, position);
- };
- /**
- * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
- * @param {import("./size.js").Size} size Box pixel size.
- * @param {import("./pixel.js").Pixel} position Position on the view to center on.
- */
- View.prototype.centerOnInternal = function (coordinate, size, position) {
- this.setCenterInternal(calculateCenterOn(coordinate, size, position, this.getResolution(), this.getRotation()));
- };
- /**
- * Calculates the shift between map and viewport center.
- * @param {import("./coordinate.js").Coordinate} center Center.
- * @param {number} resolution Resolution.
- * @param {number} rotation Rotation.
- * @param {import("./size.js").Size} size Size.
- * @return {Array<number>|undefined} Center shift.
- */
- View.prototype.calculateCenterShift = function (center, resolution, rotation, size) {
- var centerShift;
- var padding = this.padding_;
- if (padding && center) {
- var reducedSize = this.getViewportSizeMinusPadding_(-rotation);
- var shiftedCenter = calculateCenterOn(center, size, [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]], resolution, rotation);
- centerShift = [
- center[0] - shiftedCenter[0],
- center[1] - shiftedCenter[1],
- ];
- }
- return centerShift;
- };
- /**
- * @return {boolean} Is defined.
- */
- View.prototype.isDef = function () {
- return !!this.getCenterInternal() && this.getResolution() !== undefined;
- };
- /**
- * Adds relative coordinates to the center of the view. Any extent constraint will apply.
- * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
- * @api
- */
- View.prototype.adjustCenter = function (deltaCoordinates) {
- var center = toUserCoordinate(this.targetCenter_, this.getProjection());
- this.setCenter([
- center[0] + deltaCoordinates[0],
- center[1] + deltaCoordinates[1],
- ]);
- };
- /**
- * Adds relative coordinates to the center of the view. Any extent constraint will apply.
- * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
- */
- View.prototype.adjustCenterInternal = function (deltaCoordinates) {
- var center = this.targetCenter_;
- this.setCenterInternal([
- center[0] + deltaCoordinates[0],
- center[1] + deltaCoordinates[1],
- ]);
- };
- /**
- * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
- * constraint will apply.
- * @param {number} ratio The ratio to apply on the view resolution.
- * @param {import("./coordinate.js").Coordinate} [opt_anchor] The origin of the transformation.
- * @api
- */
- View.prototype.adjustResolution = function (ratio, opt_anchor) {
- var anchor = opt_anchor && fromUserCoordinate(opt_anchor, this.getProjection());
- this.adjustResolutionInternal(ratio, anchor);
- };
- /**
- * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
- * constraint will apply.
- * @param {number} ratio The ratio to apply on the view resolution.
- * @param {import("./coordinate.js").Coordinate} [opt_anchor] The origin of the transformation.
- */
- View.prototype.adjustResolutionInternal = function (ratio, opt_anchor) {
- var isMoving = this.getAnimating() || this.getInteracting();
- var size = this.getViewportSize_(this.getRotation());
- var newResolution = this.constraints_.resolution(this.targetResolution_ * ratio, 0, size, isMoving);
- if (opt_anchor) {
- this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor);
- }
- this.targetResolution_ *= ratio;
- this.applyTargetState_();
- };
- /**
- * Adds a value to the view zoom level, optionally using an anchor. Any resolution
- * constraint will apply.
- * @param {number} delta Relative value to add to the zoom level.
- * @param {import("./coordinate.js").Coordinate} [opt_anchor] The origin of the transformation.
- * @api
- */
- View.prototype.adjustZoom = function (delta, opt_anchor) {
- this.adjustResolution(Math.pow(this.zoomFactor_, -delta), opt_anchor);
- };
- /**
- * Adds a value to the view rotation, optionally using an anchor. Any rotation
- * constraint will apply.
- * @param {number} delta Relative value to add to the zoom rotation, in radians.
- * @param {import("./coordinate.js").Coordinate} [opt_anchor] The rotation center.
- * @api
- */
- View.prototype.adjustRotation = function (delta, opt_anchor) {
- if (opt_anchor) {
- opt_anchor = fromUserCoordinate(opt_anchor, this.getProjection());
- }
- this.adjustRotationInternal(delta, opt_anchor);
- };
- /**
- * @param {number} delta Relative value to add to the zoom rotation, in radians.
- * @param {import("./coordinate.js").Coordinate} [opt_anchor] The rotation center.
- */
- View.prototype.adjustRotationInternal = function (delta, opt_anchor) {
- var isMoving = this.getAnimating() || this.getInteracting();
- var newRotation = this.constraints_.rotation(this.targetRotation_ + delta, isMoving);
- if (opt_anchor) {
- this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor);
- }
- this.targetRotation_ += delta;
- this.applyTargetState_();
- };
- /**
- * Set the center of the current view. Any extent constraint will apply.
- * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
- * @observable
- * @api
- */
- View.prototype.setCenter = function (center) {
- this.setCenterInternal(center ? fromUserCoordinate(center, this.getProjection()) : center);
- };
- /**
- * Set the center using the view projection (not the user projection).
- * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
- */
- View.prototype.setCenterInternal = function (center) {
- this.targetCenter_ = center;
- this.applyTargetState_();
- };
- /**
- * @param {import("./ViewHint.js").default} hint Hint.
- * @param {number} delta Delta.
- * @return {number} New value.
- */
- View.prototype.setHint = function (hint, delta) {
- this.hints_[hint] += delta;
- this.changed();
- return this.hints_[hint];
- };
- /**
- * Set the resolution for this view. Any resolution constraint will apply.
- * @param {number|undefined} resolution The resolution of the view.
- * @observable
- * @api
- */
- View.prototype.setResolution = function (resolution) {
- this.targetResolution_ = resolution;
- this.applyTargetState_();
- };
- /**
- * Set the rotation for this view. Any rotation constraint will apply.
- * @param {number} rotation The rotation of the view in radians.
- * @observable
- * @api
- */
- View.prototype.setRotation = function (rotation) {
- this.targetRotation_ = rotation;
- this.applyTargetState_();
- };
- /**
- * Zoom to a specific zoom level. Any resolution constrain will apply.
- * @param {number} zoom Zoom level.
- * @api
- */
- View.prototype.setZoom = function (zoom) {
- this.setResolution(this.getResolutionForZoom(zoom));
- };
- /**
- * Recompute rotation/resolution/center based on target values.
- * Note: we have to compute rotation first, then resolution and center considering that
- * parameters can influence one another in case a view extent constraint is present.
- * @param {boolean} [opt_doNotCancelAnims] Do not cancel animations.
- * @param {boolean} [opt_forceMoving] Apply constraints as if the view is moving.
- * @private
- */
- View.prototype.applyTargetState_ = function (opt_doNotCancelAnims, opt_forceMoving) {
- var isMoving = this.getAnimating() || this.getInteracting() || opt_forceMoving;
- // compute rotation
- var newRotation = this.constraints_.rotation(this.targetRotation_, isMoving);
- var size = this.getViewportSize_(newRotation);
- var newResolution = this.constraints_.resolution(this.targetResolution_, 0, size, isMoving);
- var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size, isMoving, this.calculateCenterShift(this.targetCenter_, newResolution, newRotation, size));
- if (this.get(ViewProperty.ROTATION) !== newRotation) {
- this.set(ViewProperty.ROTATION, newRotation);
- }
- if (this.get(ViewProperty.RESOLUTION) !== newResolution) {
- this.set(ViewProperty.RESOLUTION, newResolution);
- this.set('zoom', this.getZoom(), true);
- }
- if (!newCenter ||
- !this.get(ViewProperty.CENTER) ||
- !coordinate_equals(this.get(ViewProperty.CENTER), newCenter)) {
- this.set(ViewProperty.CENTER, newCenter);
- }
- if (this.getAnimating() && !opt_doNotCancelAnims) {
- this.cancelAnimations();
- }
- this.cancelAnchor_ = undefined;
- };
- /**
- * If any constraints need to be applied, an animation will be triggered.
- * This is typically done on interaction end.
- * Note: calling this with a duration of 0 will apply the constrained values straight away,
- * without animation.
- * @param {number} [opt_duration] The animation duration in ms.
- * @param {number} [opt_resolutionDirection] Which direction to zoom.
- * @param {import("./coordinate.js").Coordinate} [opt_anchor] The origin of the transformation.
- */
- View.prototype.resolveConstraints = function (opt_duration, opt_resolutionDirection, opt_anchor) {
- var duration = opt_duration !== undefined ? opt_duration : 200;
- var direction = opt_resolutionDirection || 0;
- var newRotation = this.constraints_.rotation(this.targetRotation_);
- var size = this.getViewportSize_(newRotation);
- var newResolution = this.constraints_.resolution(this.targetResolution_, direction, size);
- var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size, false, this.calculateCenterShift(this.targetCenter_, newResolution, newRotation, size));
- if (duration === 0 && !this.cancelAnchor_) {
- this.targetResolution_ = newResolution;
- this.targetRotation_ = newRotation;
- this.targetCenter_ = newCenter;
- this.applyTargetState_();
- return;
- }
- var anchor = opt_anchor || (duration === 0 ? this.cancelAnchor_ : undefined);
- this.cancelAnchor_ = undefined;
- if (this.getResolution() !== newResolution ||
- this.getRotation() !== newRotation ||
- !this.getCenterInternal() ||
- !coordinate_equals(this.getCenterInternal(), newCenter)) {
- if (this.getAnimating()) {
- this.cancelAnimations();
- }
- this.animateInternal({
- rotation: newRotation,
- center: newCenter,
- resolution: newResolution,
- duration: duration,
- easing: easeOut,
- anchor: anchor,
- });
- }
- };
- /**
- * Notify the View that an interaction has started.
- * The view state will be resolved to a stable one if needed
- * (depending on its constraints).
- * @api
- */
- View.prototype.beginInteraction = function () {
- this.resolveConstraints(0);
- this.setHint(ViewHint.INTERACTING, 1);
- };
- /**
- * Notify the View that an interaction has ended. The view state will be resolved
- * to a stable one if needed (depending on its constraints).
- * @param {number} [opt_duration] Animation duration in ms.
- * @param {number} [opt_resolutionDirection] Which direction to zoom.
- * @param {import("./coordinate.js").Coordinate} [opt_anchor] The origin of the transformation.
- * @api
- */
- View.prototype.endInteraction = function (opt_duration, opt_resolutionDirection, opt_anchor) {
- var anchor = opt_anchor && fromUserCoordinate(opt_anchor, this.getProjection());
- this.endInteractionInternal(opt_duration, opt_resolutionDirection, anchor);
- };
- /**
- * Notify the View that an interaction has ended. The view state will be resolved
- * to a stable one if needed (depending on its constraints).
- * @param {number} [opt_duration] Animation duration in ms.
- * @param {number} [opt_resolutionDirection] Which direction to zoom.
- * @param {import("./coordinate.js").Coordinate} [opt_anchor] The origin of the transformation.
- */
- View.prototype.endInteractionInternal = function (opt_duration, opt_resolutionDirection, opt_anchor) {
- this.setHint(ViewHint.INTERACTING, -1);
- this.resolveConstraints(opt_duration, opt_resolutionDirection, opt_anchor);
- };
- /**
- * Get a valid position for the view center according to the current constraints.
- * @param {import("./coordinate.js").Coordinate|undefined} targetCenter Target center position.
- * @param {number} [opt_targetResolution] Target resolution. If not supplied, the current one will be used.
- * This is useful to guess a valid center position at a different zoom level.
- * @return {import("./coordinate.js").Coordinate|undefined} Valid center position.
- */
- View.prototype.getConstrainedCenter = function (targetCenter, opt_targetResolution) {
- var size = this.getViewportSize_(this.getRotation());
- return this.constraints_.center(targetCenter, opt_targetResolution || this.getResolution(), size);
- };
- /**
- * Get a valid zoom level according to the current view constraints.
- * @param {number|undefined} targetZoom Target zoom.
- * @param {number} [opt_direction=0] Indicate which resolution should be used
- * by a renderer if the view resolution does not match any resolution of the tile source.
- * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
- * will be used. If -1, the nearest higher resolution will be used.
- * @return {number|undefined} Valid zoom level.
- */
- View.prototype.getConstrainedZoom = function (targetZoom, opt_direction) {
- var targetRes = this.getResolutionForZoom(targetZoom);
- return this.getZoomForResolution(this.getConstrainedResolution(targetRes, opt_direction));
- };
- /**
- * Get a valid resolution according to the current view constraints.
- * @param {number|undefined} targetResolution Target resolution.
- * @param {number} [opt_direction=0] Indicate which resolution should be used
- * by a renderer if the view resolution does not match any resolution of the tile source.
- * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
- * will be used. If -1, the nearest higher resolution will be used.
- * @return {number|undefined} Valid resolution.
- */
- View.prototype.getConstrainedResolution = function (targetResolution, opt_direction) {
- var direction = opt_direction || 0;
- var size = this.getViewportSize_(this.getRotation());
- return this.constraints_.resolution(targetResolution, direction, size);
- };
- return View;
- }(ol_Object));
- /**
- * @param {Function} callback Callback.
- * @param {*} returnValue Return value.
- */
- function animationCallback(callback, returnValue) {
- setTimeout(function () {
- callback(returnValue);
- }, 0);
- }
- /**
- * @param {ViewOptions} options View options.
- * @return {import("./centerconstraint.js").Type} The constraint.
- */
- function createCenterConstraint(options) {
- if (options.extent !== undefined) {
- var smooth = options.smoothExtentConstraint !== undefined
- ? options.smoothExtentConstraint
- : true;
- return createExtent(options.extent, options.constrainOnlyCenter, smooth);
- }
- var projection = createProjection(options.projection, 'EPSG:3857');
- if (options.multiWorld !== true && projection.isGlobal()) {
- var extent = projection.getExtent().slice();
- extent[0] = -Infinity;
- extent[2] = Infinity;
- return createExtent(extent, false, false);
- }
- return none;
- }
- /**
- * @param {ViewOptions} options View options.
- * @return {{constraint: import("./resolutionconstraint.js").Type, maxResolution: number,
- * minResolution: number, minZoom: number, zoomFactor: number}} The constraint.
- */
- function createResolutionConstraint(options) {
- var resolutionConstraint;
- var maxResolution;
- var minResolution;
- // TODO: move these to be ol constants
- // see https://github.com/openlayers/openlayers/issues/2076
- var defaultMaxZoom = 28;
- var defaultZoomFactor = 2;
- var minZoom = options.minZoom !== undefined ? options.minZoom : DEFAULT_MIN_ZOOM;
- var maxZoom = options.maxZoom !== undefined ? options.maxZoom : defaultMaxZoom;
- var zoomFactor = options.zoomFactor !== undefined ? options.zoomFactor : defaultZoomFactor;
- var multiWorld = options.multiWorld !== undefined ? options.multiWorld : false;
- var smooth = options.smoothResolutionConstraint !== undefined
- ? options.smoothResolutionConstraint
- : true;
- var showFullExtent = options.showFullExtent !== undefined ? options.showFullExtent : false;
- var projection = createProjection(options.projection, 'EPSG:3857');
- var projExtent = projection.getExtent();
- var constrainOnlyCenter = options.constrainOnlyCenter;
- var extent = options.extent;
- if (!multiWorld && !extent && projection.isGlobal()) {
- constrainOnlyCenter = false;
- extent = projExtent;
- }
- if (options.resolutions !== undefined) {
- var resolutions = options.resolutions;
- maxResolution = resolutions[minZoom];
- minResolution =
- resolutions[maxZoom] !== undefined
- ? resolutions[maxZoom]
- : resolutions[resolutions.length - 1];
- if (options.constrainResolution) {
- resolutionConstraint = createSnapToResolutions(resolutions, smooth, !constrainOnlyCenter && extent, showFullExtent);
- }
- else {
- resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent, showFullExtent);
- }
- }
- else {
- // calculate the default min and max resolution
- var size = !projExtent
- ? // use an extent that can fit the whole world if need be
- (360 * Units_METERS_PER_UNIT[proj_Units.DEGREES]) / projection.getMetersPerUnit()
- : Math.max(extent_getWidth(projExtent), getHeight(projExtent));
- var defaultMaxResolution = size / DEFAULT_TILE_SIZE / Math.pow(defaultZoomFactor, DEFAULT_MIN_ZOOM);
- var defaultMinResolution = defaultMaxResolution /
- Math.pow(defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM);
- // user provided maxResolution takes precedence
- maxResolution = options.maxResolution;
- if (maxResolution !== undefined) {
- minZoom = 0;
- }
- else {
- maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);
- }
- // user provided minResolution takes precedence
- minResolution = options.minResolution;
- if (minResolution === undefined) {
- if (options.maxZoom !== undefined) {
- if (options.maxResolution !== undefined) {
- minResolution = maxResolution / Math.pow(zoomFactor, maxZoom);
- }
- else {
- minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom);
- }
- }
- else {
- minResolution = defaultMinResolution;
- }
- }
- // given discrete zoom levels, minResolution may be different than provided
- maxZoom =
- minZoom +
- Math.floor(Math.log(maxResolution / minResolution) / Math.log(zoomFactor));
- minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);
- if (options.constrainResolution) {
- resolutionConstraint = createSnapToPower(zoomFactor, maxResolution, minResolution, smooth, !constrainOnlyCenter && extent, showFullExtent);
- }
- else {
- resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent, showFullExtent);
- }
- }
- return {
- constraint: resolutionConstraint,
- maxResolution: maxResolution,
- minResolution: minResolution,
- minZoom: minZoom,
- zoomFactor: zoomFactor,
- };
- }
- /**
- * @param {ViewOptions} options View options.
- * @return {import("./rotationconstraint.js").Type} Rotation constraint.
- */
- function createRotationConstraint(options) {
- var enableRotation = options.enableRotation !== undefined ? options.enableRotation : true;
- if (enableRotation) {
- var constrainRotation = options.constrainRotation;
- if (constrainRotation === undefined || constrainRotation === true) {
- return createSnapToZero();
- }
- else if (constrainRotation === false) {
- return rotationconstraint_none;
- }
- else if (typeof constrainRotation === 'number') {
- return createSnapToN(constrainRotation);
- }
- else {
- return rotationconstraint_none;
- }
- }
- else {
- return disable;
- }
- }
- /**
- * Determine if an animation involves no view change.
- * @param {Animation} animation The animation.
- * @return {boolean} The animation involves no view change.
- */
- function isNoopAnimation(animation) {
- if (animation.sourceCenter && animation.targetCenter) {
- if (!coordinate_equals(animation.sourceCenter, animation.targetCenter)) {
- return false;
- }
- }
- if (animation.sourceResolution !== animation.targetResolution) {
- return false;
- }
- if (animation.sourceRotation !== animation.targetRotation) {
- return false;
- }
- return true;
- }
- /**
- * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
- * @param {import("./size.js").Size} size Box pixel size.
- * @param {import("./pixel.js").Pixel} position Position on the view to center on.
- * @param {number} resolution Resolution.
- * @param {number} rotation Rotation.
- * @return {import("./coordinate.js").Coordinate} Shifted center.
- */
- function calculateCenterOn(coordinate, size, position, resolution, rotation) {
- // calculate rotated position
- var cosAngle = Math.cos(-rotation);
- var sinAngle = Math.sin(-rotation);
- var rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle;
- var rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle;
- rotX += (size[0] / 2 - position[0]) * resolution;
- rotY += (position[1] - size[1] / 2) * resolution;
- // go back to original angle
- sinAngle = -sinAngle; // go back to original rotation
- var centerX = rotX * cosAngle - rotY * sinAngle;
- var centerY = rotY * cosAngle + rotX * sinAngle;
- return [centerX, centerY];
- }
- /* harmony default export */ var ol_View = (View);
- //# sourceMappingURL=View.js.map
- ;// ./node_modules/ol/PluggableMap.js
- var PluggableMap_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/PluggableMap
- */
- /**
- * State of the current frame. Only `pixelRatio`, `time` and `viewState` should
- * be used in applications.
- * @typedef {Object} FrameState
- * @property {number} pixelRatio The pixel ratio of the frame.
- * @property {number} time The time when rendering of the frame was requested.
- * @property {import("./View.js").State} viewState The state of the current view.
- * @property {boolean} animate Animate.
- * @property {import("./transform.js").Transform} coordinateToPixelTransform CoordinateToPixelTransform.
- * @property {import("rbush").default} declutterTree DeclutterTree.
- * @property {null|import("./extent.js").Extent} extent Extent.
- * @property {import("./extent.js").Extent} [nextExtent] Next extent during an animation series.
- * @property {number} index Index.
- * @property {Array<import("./layer/Layer.js").State>} layerStatesArray LayerStatesArray.
- * @property {number} layerIndex LayerIndex.
- * @property {import("./transform.js").Transform} pixelToCoordinateTransform PixelToCoordinateTransform.
- * @property {Array<PostRenderFunction>} postRenderFunctions PostRenderFunctions.
- * @property {import("./size.js").Size} size Size.
- * @property {TileQueue} tileQueue TileQueue.
- * @property {!Object<string, Object<string, boolean>>} usedTiles UsedTiles.
- * @property {Array<number>} viewHints ViewHints.
- * @property {!Object<string, Object<string, boolean>>} wantedTiles WantedTiles.
- * @property {string} mapId The id of the map.
- * @property {Object<string, boolean>} renderTargets Identifiers of previously rendered elements.
- */
- /**
- * @typedef {function(PluggableMap, ?FrameState): any} PostRenderFunction
- */
- /**
- * @typedef {Object} AtPixelOptions
- * @property {undefined|function(import("./layer/Layer.js").default<import("./source/Source").default>): boolean} [layerFilter] Layer filter
- * function. The filter function will receive one argument, the
- * {@link module:ol/layer/Layer~Layer layer-candidate} and it should return a boolean value.
- * Only layers which are visible and for which this function returns `true`
- * will be tested for features. By default, all visible layers will be tested.
- * @property {number} [hitTolerance=0] Hit-detection tolerance in css pixels. Pixels
- * inside the radius around the given position will be checked for features.
- * @property {boolean} [checkWrapped=true] Check-Wrapped Will check for for wrapped geometries inside the range of
- * +/- 1 world width. Works only if a projection is used that can be wrapped.
- */
- /**
- * @typedef {Object} MapOptionsInternal
- * @property {Collection<import("./control/Control.js").default>} [controls] Controls.
- * @property {Collection<import("./interaction/Interaction.js").default>} [interactions] Interactions.
- * @property {HTMLElement|Document} keyboardEventTarget KeyboardEventTarget.
- * @property {Collection<import("./Overlay.js").default>} overlays Overlays.
- * @property {Object<string, *>} values Values.
- */
- /**
- * @typedef {import("./ObjectEventType").Types|'change:layergroup'|'change:size'|'change:target'|'change:view'} MapObjectEventTypes
- */
- /***
- * @template Return
- * @typedef {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default, Return> &
- * import("./Observable").OnSignature<MapObjectEventTypes, import("./Object").ObjectEvent, Return> &
- * import("./Observable").OnSignature<import("./MapBrowserEventType").Types, import("./MapBrowserEvent").default, Return> &
- * import("./Observable").OnSignature<import("./MapEventType").Types, import("./MapEvent").default, Return> &
- * import("./Observable").OnSignature<import("./render/EventType").MapRenderEventTypes, import("./render/Event").default, Return> &
- * import("./Observable").CombinedOnSignature<import("./Observable").EventTypes|MapObjectEventTypes|
- * import("./MapBrowserEventType").Types|import("./MapEventType").Types|
- * import("./render/EventType").MapRenderEventTypes, Return>} PluggableMapOnSignature
- */
- /**
- * Object literal with config options for the map.
- * @typedef {Object} MapOptions
- * @property {Collection<import("./control/Control.js").default>|Array<import("./control/Control.js").default>} [controls]
- * Controls initially added to the map. If not specified,
- * {@link module:ol/control.defaults} is used.
- * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between
- * physical pixels and device-independent pixels (dips) on the device.
- * @property {Collection<import("./interaction/Interaction.js").default>|Array<import("./interaction/Interaction.js").default>} [interactions]
- * Interactions that are initially added to the map. If not specified,
- * {@link module:ol/interaction.defaults} is used.
- * @property {HTMLElement|Document|string} [keyboardEventTarget] The element to
- * listen to keyboard events on. This determines when the `KeyboardPan` and
- * `KeyboardZoom` interactions trigger. For example, if this option is set to
- * `document` the keyboard interactions will always trigger. If this option is
- * not specified, the element the library listens to keyboard events on is the
- * map target (i.e. the user-provided div for the map). If this is not
- * `document`, the target element needs to be focused for key events to be
- * emitted, requiring that the target element has a `tabindex` attribute.
- * @property {Array<import("./layer/Base.js").default>|Collection<import("./layer/Base.js").default>|LayerGroup} [layers]
- * Layers. If this is not defined, a map with no layers will be rendered. Note
- * that layers are rendered in the order supplied, so if you want, for example,
- * a vector layer to appear on top of a tile layer, it must come after the tile
- * layer.
- * @property {number} [maxTilesLoading=16] Maximum number tiles to load
- * simultaneously.
- * @property {number} [moveTolerance=1] The minimum distance in pixels the
- * cursor must move to be detected as a map move event instead of a click.
- * Increasing this value can make it easier to click on the map.
- * @property {Collection<import("./Overlay.js").default>|Array<import("./Overlay.js").default>} [overlays]
- * Overlays initially added to the map. By default, no overlays are added.
- * @property {HTMLElement|string} [target] The container for the map, either the
- * element itself or the `id` of the element. If not specified at construction
- * time, {@link module:ol/Map~Map#setTarget} must be called for the map to be
- * rendered. If passed by element, the container can be in a secondary document.
- * @property {View|Promise<import("./View.js").ViewOptions>} [view] The map's view. No layer sources will be
- * fetched unless this is specified at construction time or through
- * {@link module:ol/Map~Map#setView}.
- */
- /**
- * @param {import("./layer/Base.js").default} layer Layer.
- */
- function removeLayerMapProperty(layer) {
- if (layer instanceof layer_Layer) {
- layer.setMapInternal(null);
- return;
- }
- if (layer instanceof Group) {
- layer.getLayers().forEach(removeLayerMapProperty);
- }
- }
- /**
- * @param {import("./layer/Base.js").default} layer Layer.
- * @param {PluggableMap} map Map.
- */
- function setLayerMapProperty(layer, map) {
- if (layer instanceof layer_Layer) {
- layer.setMapInternal(map);
- return;
- }
- if (layer instanceof Group) {
- var layers = layer.getLayers().getArray();
- for (var i = 0, ii = layers.length; i < ii; ++i) {
- setLayerMapProperty(layers[i], map);
- }
- }
- }
- /**
- * @fires import("./MapBrowserEvent.js").MapBrowserEvent
- * @fires import("./MapEvent.js").MapEvent
- * @fires import("./render/Event.js").default#precompose
- * @fires import("./render/Event.js").default#postcompose
- * @fires import("./render/Event.js").default#rendercomplete
- * @api
- */
- var PluggableMap = /** @class */ (function (_super) {
- PluggableMap_extends(PluggableMap, _super);
- /**
- * @param {MapOptions} options Map options.
- */
- function PluggableMap(options) {
- var _this = _super.call(this) || this;
- /***
- * @type {PluggableMapOnSignature<import("./events").EventsKey>}
- */
- _this.on;
- /***
- * @type {PluggableMapOnSignature<import("./events").EventsKey>}
- */
- _this.once;
- /***
- * @type {PluggableMapOnSignature<void>}
- */
- _this.un;
- var optionsInternal = createOptionsInternal(options);
- /**
- * @private
- * @type {boolean|undefined}
- */
- _this.renderComplete_;
- /**
- * @private
- * @type {boolean}
- */
- _this.loaded_ = true;
- /** @private */
- _this.boundHandleBrowserEvent_ = _this.handleBrowserEvent.bind(_this);
- /**
- * @type {number}
- * @private
- */
- _this.maxTilesLoading_ =
- options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16;
- /**
- * @private
- * @type {number}
- */
- _this.pixelRatio_ =
- options.pixelRatio !== undefined
- ? options.pixelRatio
- : DEVICE_PIXEL_RATIO;
- /**
- * @private
- * @type {*}
- */
- _this.postRenderTimeoutHandle_;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.animationDelayKey_;
- /**
- * @private
- */
- _this.animationDelay_ = /** @this {PluggableMap} */ function () {
- this.animationDelayKey_ = undefined;
- this.renderFrame_(Date.now());
- }.bind(_this);
- /**
- * @private
- * @type {import("./transform.js").Transform}
- */
- _this.coordinateToPixelTransform_ = create();
- /**
- * @private
- * @type {import("./transform.js").Transform}
- */
- _this.pixelToCoordinateTransform_ = create();
- /**
- * @private
- * @type {number}
- */
- _this.frameIndex_ = 0;
- /**
- * @private
- * @type {?FrameState}
- */
- _this.frameState_ = null;
- /**
- * The extent at the previous 'moveend' event.
- * @private
- * @type {import("./extent.js").Extent}
- */
- _this.previousExtent_ = null;
- /**
- * @private
- * @type {?import("./events.js").EventsKey}
- */
- _this.viewPropertyListenerKey_ = null;
- /**
- * @private
- * @type {?import("./events.js").EventsKey}
- */
- _this.viewChangeListenerKey_ = null;
- /**
- * @private
- * @type {?Array<import("./events.js").EventsKey>}
- */
- _this.layerGroupPropertyListenerKeys_ = null;
- /**
- * @private
- * @type {!HTMLElement}
- */
- _this.viewport_ = document.createElement('div');
- _this.viewport_.className =
- 'ol-viewport' + ('ontouchstart' in window ? ' ol-touch' : '');
- _this.viewport_.style.position = 'relative';
- _this.viewport_.style.overflow = 'hidden';
- _this.viewport_.style.width = '100%';
- _this.viewport_.style.height = '100%';
- /**
- * @private
- * @type {!HTMLElement}
- */
- _this.overlayContainer_ = document.createElement('div');
- _this.overlayContainer_.style.position = 'absolute';
- _this.overlayContainer_.style.zIndex = '0';
- _this.overlayContainer_.style.width = '100%';
- _this.overlayContainer_.style.height = '100%';
- _this.overlayContainer_.style.pointerEvents = 'none';
- _this.overlayContainer_.className = 'ol-overlaycontainer';
- _this.viewport_.appendChild(_this.overlayContainer_);
- /**
- * @private
- * @type {!HTMLElement}
- */
- _this.overlayContainerStopEvent_ = document.createElement('div');
- _this.overlayContainerStopEvent_.style.position = 'absolute';
- _this.overlayContainerStopEvent_.style.zIndex = '0';
- _this.overlayContainerStopEvent_.style.width = '100%';
- _this.overlayContainerStopEvent_.style.height = '100%';
- _this.overlayContainerStopEvent_.style.pointerEvents = 'none';
- _this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent';
- _this.viewport_.appendChild(_this.overlayContainerStopEvent_);
- /**
- * @private
- * @type {MapBrowserEventHandler}
- */
- _this.mapBrowserEventHandler_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.moveTolerance_ = options.moveTolerance;
- /**
- * @private
- * @type {HTMLElement|Document}
- */
- _this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget;
- /**
- * @private
- * @type {?Array<import("./events.js").EventsKey>}
- */
- _this.targetChangeHandlerKeys_ = null;
- /**
- * @type {Collection<import("./control/Control.js").default>}
- * @protected
- */
- _this.controls = optionsInternal.controls || new ol_Collection();
- /**
- * @type {Collection<import("./interaction/Interaction.js").default>}
- * @protected
- */
- _this.interactions = optionsInternal.interactions || new ol_Collection();
- /**
- * @type {Collection<import("./Overlay.js").default>}
- * @private
- */
- _this.overlays_ = optionsInternal.overlays;
- /**
- * A lookup of overlays by id.
- * @private
- * @type {Object<string, import("./Overlay.js").default>}
- */
- _this.overlayIdIndex_ = {};
- /**
- * @type {import("./renderer/Map.js").default|null}
- * @private
- */
- _this.renderer_ = null;
- /**
- * @private
- * @type {!Array<PostRenderFunction>}
- */
- _this.postRenderFunctions_ = [];
- /**
- * @private
- * @type {TileQueue}
- */
- _this.tileQueue_ = new ol_TileQueue(_this.getTilePriority.bind(_this), _this.handleTileChange_.bind(_this));
- _this.addChangeListener(MapProperty.LAYERGROUP, _this.handleLayerGroupChanged_);
- _this.addChangeListener(MapProperty.VIEW, _this.handleViewChanged_);
- _this.addChangeListener(MapProperty.SIZE, _this.handleSizeChanged_);
- _this.addChangeListener(MapProperty.TARGET, _this.handleTargetChanged_);
- // setProperties will trigger the rendering of the map if the map
- // is "defined" already.
- _this.setProperties(optionsInternal.values);
- var map = _this;
- if (options.view && !(options.view instanceof ol_View)) {
- options.view.then(function (viewOptions) {
- map.setView(new ol_View(viewOptions));
- });
- }
- _this.controls.addEventListener(CollectionEventType.ADD,
- /**
- * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
- */
- function (event) {
- event.element.setMap(this);
- }.bind(_this));
- _this.controls.addEventListener(CollectionEventType.REMOVE,
- /**
- * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
- */
- function (event) {
- event.element.setMap(null);
- }.bind(_this));
- _this.interactions.addEventListener(CollectionEventType.ADD,
- /**
- * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
- */
- function (event) {
- event.element.setMap(this);
- }.bind(_this));
- _this.interactions.addEventListener(CollectionEventType.REMOVE,
- /**
- * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
- */
- function (event) {
- event.element.setMap(null);
- }.bind(_this));
- _this.overlays_.addEventListener(CollectionEventType.ADD,
- /**
- * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
- */
- function (event) {
- this.addOverlayInternal_(
- /** @type {import("./Overlay.js").default} */ (event.element));
- }.bind(_this));
- _this.overlays_.addEventListener(CollectionEventType.REMOVE,
- /**
- * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
- */
- function (event) {
- var overlay = /** @type {import("./Overlay.js").default} */ (event.element);
- var id = overlay.getId();
- if (id !== undefined) {
- delete this.overlayIdIndex_[id.toString()];
- }
- event.element.setMap(null);
- }.bind(_this));
- _this.controls.forEach(
- /**
- * @param {import("./control/Control.js").default} control Control.
- * @this {PluggableMap}
- */
- function (control) {
- control.setMap(this);
- }.bind(_this));
- _this.interactions.forEach(
- /**
- * @param {import("./interaction/Interaction.js").default} interaction Interaction.
- * @this {PluggableMap}
- */
- function (interaction) {
- interaction.setMap(this);
- }.bind(_this));
- _this.overlays_.forEach(_this.addOverlayInternal_.bind(_this));
- return _this;
- }
- /**
- * @abstract
- * @return {import("./renderer/Map.js").default} The map renderer
- */
- PluggableMap.prototype.createRenderer = function () {
- throw new Error('Use a map type that has a createRenderer method');
- };
- /**
- * Add the given control to the map.
- * @param {import("./control/Control.js").default} control Control.
- * @api
- */
- PluggableMap.prototype.addControl = function (control) {
- this.getControls().push(control);
- };
- /**
- * Add the given interaction to the map. If you want to add an interaction
- * at another point of the collection use `getInteractions()` and the methods
- * available on {@link module:ol/Collection~Collection}. This can be used to
- * stop the event propagation from the handleEvent function. The interactions
- * get to handle the events in the reverse order of this collection.
- * @param {import("./interaction/Interaction.js").default} interaction Interaction to add.
- * @api
- */
- PluggableMap.prototype.addInteraction = function (interaction) {
- this.getInteractions().push(interaction);
- };
- /**
- * Adds the given layer to the top of this map. If you want to add a layer
- * elsewhere in the stack, use `getLayers()` and the methods available on
- * {@link module:ol/Collection~Collection}.
- * @param {import("./layer/Base.js").default} layer Layer.
- * @api
- */
- PluggableMap.prototype.addLayer = function (layer) {
- var layers = this.getLayerGroup().getLayers();
- layers.push(layer);
- };
- /**
- * @param {import("./layer/Group.js").GroupEvent} event The layer add event.
- * @private
- */
- PluggableMap.prototype.handleLayerAdd_ = function (event) {
- setLayerMapProperty(event.layer, this);
- };
- /**
- * Add the given overlay to the map.
- * @param {import("./Overlay.js").default} overlay Overlay.
- * @api
- */
- PluggableMap.prototype.addOverlay = function (overlay) {
- this.getOverlays().push(overlay);
- };
- /**
- * This deals with map's overlay collection changes.
- * @param {import("./Overlay.js").default} overlay Overlay.
- * @private
- */
- PluggableMap.prototype.addOverlayInternal_ = function (overlay) {
- var id = overlay.getId();
- if (id !== undefined) {
- this.overlayIdIndex_[id.toString()] = overlay;
- }
- overlay.setMap(this);
- };
- /**
- *
- * Clean up.
- */
- PluggableMap.prototype.disposeInternal = function () {
- this.controls.clear();
- this.interactions.clear();
- this.overlays_.clear();
- this.setTarget(null);
- _super.prototype.disposeInternal.call(this);
- };
- /**
- * Detect features that intersect a pixel on the viewport, and execute a
- * callback with each intersecting feature. Layers included in the detection can
- * be configured through the `layerFilter` option in `opt_options`.
- * @param {import("./pixel.js").Pixel} pixel Pixel.
- * @param {function(import("./Feature.js").FeatureLike, import("./layer/Layer.js").default<import("./source/Source").default>, import("./geom/SimpleGeometry.js").default): T} callback Feature callback. The callback will be
- * called with two arguments. The first argument is one
- * {@link module:ol/Feature~Feature feature} or
- * {@link module:ol/render/Feature~RenderFeature render feature} at the pixel, the second is
- * the {@link module:ol/layer/Layer~Layer layer} of the feature and will be null for
- * unmanaged layers. To stop detection, callback functions can return a
- * truthy value.
- * @param {AtPixelOptions} [opt_options] Optional options.
- * @return {T|undefined} Callback result, i.e. the return value of last
- * callback execution, or the first truthy callback return value.
- * @template T
- * @api
- */
- PluggableMap.prototype.forEachFeatureAtPixel = function (pixel, callback, opt_options) {
- if (!this.frameState_ || !this.renderer_) {
- return;
- }
- var coordinate = this.getCoordinateFromPixelInternal(pixel);
- opt_options = opt_options !== undefined ? opt_options : {};
- var hitTolerance = opt_options.hitTolerance !== undefined ? opt_options.hitTolerance : 0;
- var layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE;
- var checkWrapped = opt_options.checkWrapped !== false;
- return this.renderer_.forEachFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, checkWrapped, callback, null, layerFilter, null);
- };
- /**
- * Get all features that intersect a pixel on the viewport.
- * @param {import("./pixel.js").Pixel} pixel Pixel.
- * @param {AtPixelOptions} [opt_options] Optional options.
- * @return {Array<import("./Feature.js").FeatureLike>} The detected features or
- * an empty array if none were found.
- * @api
- */
- PluggableMap.prototype.getFeaturesAtPixel = function (pixel, opt_options) {
- var features = [];
- this.forEachFeatureAtPixel(pixel, function (feature) {
- features.push(feature);
- }, opt_options);
- return features;
- };
- /**
- * Get all layers from all layer groups.
- * @return {Array<import("./layer/Layer.js").default>} Layers.
- * @api
- */
- PluggableMap.prototype.getAllLayers = function () {
- var layers = [];
- function addLayersFrom(layerGroup) {
- layerGroup.forEach(function (layer) {
- if (layer instanceof Group) {
- addLayersFrom(layer.getLayers());
- }
- else {
- layers.push(layer);
- }
- });
- }
- addLayersFrom(this.getLayers());
- return layers;
- };
- /**
- * Please the `layer.getData()` method for {@link module:ol/layer/Tile~TileLayer#getData tile layers} or
- * {@link module:ol/layer/Image~ImageLayer#getData image layers} instead of using this method.
- *
- * Detect layers that have a color value at a pixel on the viewport, and
- * execute a callback with each matching layer. Layers included in the
- * detection can be configured through `opt_layerFilter`.
- *
- * Note: In maps with more than one layer, this method will typically return pixel data
- * representing the composed image of all layers visible at the given pixel – because layers
- * will generally share the same rendering context. To force layers to render separately, and
- * to get pixel data representing only one layer at a time, you can assign each layer a unique
- * `className` in its constructor.
- *
- * @param {import("./pixel.js").Pixel} pixel Pixel.
- * @param {function(this: S, import("./layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback
- * Layer callback. This callback will receive two arguments: first is the
- * {@link module:ol/layer/Layer~Layer layer}, second argument is an array representing
- * [R, G, B, A] pixel values (0 - 255) and will be `null` for layer types
- * that do not currently support this argument. To stop detection, callback
- * functions can return a truthy value.
- * @param {AtPixelOptions} [opt_options] Configuration options.
- * @return {T|undefined} Callback result, i.e. the return value of last
- * callback execution, or the first truthy callback return value.
- * @template S,T
- * @api
- * @deprecated
- */
- PluggableMap.prototype.forEachLayerAtPixel = function (pixel, callback, opt_options) {
- if (!this.frameState_ || !this.renderer_) {
- return;
- }
- var options = opt_options || {};
- var hitTolerance = options.hitTolerance !== undefined ? options.hitTolerance : 0;
- var layerFilter = options.layerFilter || TRUE;
- return this.renderer_.forEachLayerAtPixel(pixel, this.frameState_, hitTolerance, callback, layerFilter);
- };
- /**
- * Detect if features intersect a pixel on the viewport. Layers included in the
- * detection can be configured through `opt_layerFilter`.
- * @param {import("./pixel.js").Pixel} pixel Pixel.
- * @param {AtPixelOptions} [opt_options] Optional options.
- * @return {boolean} Is there a feature at the given pixel?
- * @api
- */
- PluggableMap.prototype.hasFeatureAtPixel = function (pixel, opt_options) {
- if (!this.frameState_ || !this.renderer_) {
- return false;
- }
- var coordinate = this.getCoordinateFromPixelInternal(pixel);
- opt_options = opt_options !== undefined ? opt_options : {};
- var layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE;
- var hitTolerance = opt_options.hitTolerance !== undefined ? opt_options.hitTolerance : 0;
- var checkWrapped = opt_options.checkWrapped !== false;
- return this.renderer_.hasFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, checkWrapped, layerFilter, null);
- };
- /**
- * Returns the coordinate in user projection for a browser event.
- * @param {MouseEvent} event Event.
- * @return {import("./coordinate.js").Coordinate} Coordinate.
- * @api
- */
- PluggableMap.prototype.getEventCoordinate = function (event) {
- return this.getCoordinateFromPixel(this.getEventPixel(event));
- };
- /**
- * Returns the coordinate in view projection for a browser event.
- * @param {MouseEvent} event Event.
- * @return {import("./coordinate.js").Coordinate} Coordinate.
- */
- PluggableMap.prototype.getEventCoordinateInternal = function (event) {
- return this.getCoordinateFromPixelInternal(this.getEventPixel(event));
- };
- /**
- * Returns the map pixel position for a browser event relative to the viewport.
- * @param {UIEvent} event Event.
- * @return {import("./pixel.js").Pixel} Pixel.
- * @api
- */
- PluggableMap.prototype.getEventPixel = function (event) {
- var viewportPosition = this.viewport_.getBoundingClientRect();
- var eventPosition =
- //FIXME Are we really calling this with a TouchEvent anywhere?
- 'changedTouches' in event
- ? /** @type {TouchEvent} */ (event).changedTouches[0]
- : /** @type {MouseEvent} */ (event);
- return [
- eventPosition.clientX - viewportPosition.left,
- eventPosition.clientY - viewportPosition.top,
- ];
- };
- /**
- * Get the target in which this map is rendered.
- * Note that this returns what is entered as an option or in setTarget:
- * if that was an element, it returns an element; if a string, it returns that.
- * @return {HTMLElement|string|undefined} The Element or id of the Element that the
- * map is rendered in.
- * @observable
- * @api
- */
- PluggableMap.prototype.getTarget = function () {
- return /** @type {HTMLElement|string|undefined} */ (this.get(MapProperty.TARGET));
- };
- /**
- * Get the DOM element into which this map is rendered. In contrast to
- * `getTarget` this method always return an `Element`, or `null` if the
- * map has no target.
- * @return {HTMLElement} The element that the map is rendered in.
- * @api
- */
- PluggableMap.prototype.getTargetElement = function () {
- var target = this.getTarget();
- if (target !== undefined) {
- return typeof target === 'string'
- ? document.getElementById(target)
- : target;
- }
- else {
- return null;
- }
- };
- /**
- * Get the coordinate for a given pixel. This returns a coordinate in the
- * user projection.
- * @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport.
- * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position.
- * @api
- */
- PluggableMap.prototype.getCoordinateFromPixel = function (pixel) {
- return toUserCoordinate(this.getCoordinateFromPixelInternal(pixel), this.getView().getProjection());
- };
- /**
- * Get the coordinate for a given pixel. This returns a coordinate in the
- * map view projection.
- * @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport.
- * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position.
- */
- PluggableMap.prototype.getCoordinateFromPixelInternal = function (pixel) {
- var frameState = this.frameState_;
- if (!frameState) {
- return null;
- }
- else {
- return apply(frameState.pixelToCoordinateTransform, pixel.slice());
- }
- };
- /**
- * Get the map controls. Modifying this collection changes the controls
- * associated with the map.
- * @return {Collection<import("./control/Control.js").default>} Controls.
- * @api
- */
- PluggableMap.prototype.getControls = function () {
- return this.controls;
- };
- /**
- * Get the map overlays. Modifying this collection changes the overlays
- * associated with the map.
- * @return {Collection<import("./Overlay.js").default>} Overlays.
- * @api
- */
- PluggableMap.prototype.getOverlays = function () {
- return this.overlays_;
- };
- /**
- * Get an overlay by its identifier (the value returned by overlay.getId()).
- * Note that the index treats string and numeric identifiers as the same. So
- * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`.
- * @param {string|number} id Overlay identifier.
- * @return {import("./Overlay.js").default} Overlay.
- * @api
- */
- PluggableMap.prototype.getOverlayById = function (id) {
- var overlay = this.overlayIdIndex_[id.toString()];
- return overlay !== undefined ? overlay : null;
- };
- /**
- * Get the map interactions. Modifying this collection changes the interactions
- * associated with the map.
- *
- * Interactions are used for e.g. pan, zoom and rotate.
- * @return {Collection<import("./interaction/Interaction.js").default>} Interactions.
- * @api
- */
- PluggableMap.prototype.getInteractions = function () {
- return this.interactions;
- };
- /**
- * Get the layergroup associated with this map.
- * @return {LayerGroup} A layer group containing the layers in this map.
- * @observable
- * @api
- */
- PluggableMap.prototype.getLayerGroup = function () {
- return /** @type {LayerGroup} */ (this.get(MapProperty.LAYERGROUP));
- };
- /**
- * Clear any existing layers and add layers to the map.
- * @param {Array<import("./layer/Base.js").default>|Collection<import("./layer/Base.js").default>} layers The layers to be added to the map.
- * @api
- */
- PluggableMap.prototype.setLayers = function (layers) {
- var group = this.getLayerGroup();
- if (layers instanceof ol_Collection) {
- group.setLayers(layers);
- return;
- }
- var collection = group.getLayers();
- collection.clear();
- collection.extend(layers);
- };
- /**
- * Get the collection of layers associated with this map.
- * @return {!Collection<import("./layer/Base.js").default>} Layers.
- * @api
- */
- PluggableMap.prototype.getLayers = function () {
- var layers = this.getLayerGroup().getLayers();
- return layers;
- };
- /**
- * @return {boolean} Layers have sources that are still loading.
- */
- PluggableMap.prototype.getLoadingOrNotReady = function () {
- var layerStatesArray = this.getLayerGroup().getLayerStatesArray();
- for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
- var state = layerStatesArray[i];
- if (!state.visible) {
- continue;
- }
- var renderer = state.layer.getRenderer();
- if (renderer && !renderer.ready) {
- return true;
- }
- var source = /** @type {import("./layer/Layer.js").default} */ (state.layer).getSource();
- if (source && source.loading) {
- return true;
- }
- }
- return false;
- };
- /**
- * Get the pixel for a coordinate. This takes a coordinate in the user
- * projection and returns the corresponding pixel.
- * @param {import("./coordinate.js").Coordinate} coordinate A map coordinate.
- * @return {import("./pixel.js").Pixel} A pixel position in the map viewport.
- * @api
- */
- PluggableMap.prototype.getPixelFromCoordinate = function (coordinate) {
- var viewCoordinate = fromUserCoordinate(coordinate, this.getView().getProjection());
- return this.getPixelFromCoordinateInternal(viewCoordinate);
- };
- /**
- * Get the pixel for a coordinate. This takes a coordinate in the map view
- * projection and returns the corresponding pixel.
- * @param {import("./coordinate.js").Coordinate} coordinate A map coordinate.
- * @return {import("./pixel.js").Pixel} A pixel position in the map viewport.
- */
- PluggableMap.prototype.getPixelFromCoordinateInternal = function (coordinate) {
- var frameState = this.frameState_;
- if (!frameState) {
- return null;
- }
- else {
- return apply(frameState.coordinateToPixelTransform, coordinate.slice(0, 2));
- }
- };
- /**
- * Get the map renderer.
- * @return {import("./renderer/Map.js").default|null} Renderer
- */
- PluggableMap.prototype.getRenderer = function () {
- return this.renderer_;
- };
- /**
- * Get the size of this map.
- * @return {import("./size.js").Size|undefined} The size in pixels of the map in the DOM.
- * @observable
- * @api
- */
- PluggableMap.prototype.getSize = function () {
- return /** @type {import("./size.js").Size|undefined} */ (this.get(MapProperty.SIZE));
- };
- /**
- * Get the view associated with this map. A view manages properties such as
- * center and resolution.
- * @return {View} The view that controls this map.
- * @observable
- * @api
- */
- PluggableMap.prototype.getView = function () {
- return /** @type {View} */ (this.get(MapProperty.VIEW));
- };
- /**
- * Get the element that serves as the map viewport.
- * @return {HTMLElement} Viewport.
- * @api
- */
- PluggableMap.prototype.getViewport = function () {
- return this.viewport_;
- };
- /**
- * Get the element that serves as the container for overlays. Elements added to
- * this container will let mousedown and touchstart events through to the map,
- * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent}
- * events.
- * @return {!HTMLElement} The map's overlay container.
- */
- PluggableMap.prototype.getOverlayContainer = function () {
- return this.overlayContainer_;
- };
- /**
- * Get the element that serves as a container for overlays that don't allow
- * event propagation. Elements added to this container won't let mousedown and
- * touchstart events through to the map, so clicks and gestures on an overlay
- * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
- * @return {!HTMLElement} The map's overlay container that stops events.
- */
- PluggableMap.prototype.getOverlayContainerStopEvent = function () {
- return this.overlayContainerStopEvent_;
- };
- /**
- * @return {!Document} The document where the map is displayed.
- */
- PluggableMap.prototype.getOwnerDocument = function () {
- var targetElement = this.getTargetElement();
- return targetElement ? targetElement.ownerDocument : document;
- };
- /**
- * @param {import("./Tile.js").default} tile Tile.
- * @param {string} tileSourceKey Tile source key.
- * @param {import("./coordinate.js").Coordinate} tileCenter Tile center.
- * @param {number} tileResolution Tile resolution.
- * @return {number} Tile priority.
- */
- PluggableMap.prototype.getTilePriority = function (tile, tileSourceKey, tileCenter, tileResolution) {
- return getTilePriority(this.frameState_, tile, tileSourceKey, tileCenter, tileResolution);
- };
- /**
- * @param {UIEvent} browserEvent Browser event.
- * @param {string} [opt_type] Type.
- */
- PluggableMap.prototype.handleBrowserEvent = function (browserEvent, opt_type) {
- var type = opt_type || browserEvent.type;
- var mapBrowserEvent = new ol_MapBrowserEvent(type, this, browserEvent);
- this.handleMapBrowserEvent(mapBrowserEvent);
- };
- /**
- * @param {MapBrowserEvent} mapBrowserEvent The event to handle.
- */
- PluggableMap.prototype.handleMapBrowserEvent = function (mapBrowserEvent) {
- if (!this.frameState_) {
- // With no view defined, we cannot translate pixels into geographical
- // coordinates so interactions cannot be used.
- return;
- }
- var originalEvent = /** @type {PointerEvent} */ (mapBrowserEvent.originalEvent);
- var eventType = originalEvent.type;
- if (eventType === pointer_EventType.POINTERDOWN ||
- eventType === EventType.WHEEL ||
- eventType === EventType.KEYDOWN) {
- var doc = this.getOwnerDocument();
- var rootNode = this.viewport_.getRootNode
- ? this.viewport_.getRootNode()
- : doc;
- var target = /** @type {Node} */ (originalEvent.target);
- if (
- // Abort if the target is a child of the container for elements whose events are not meant
- // to be handled by map interactions.
- this.overlayContainerStopEvent_.contains(target) ||
- // Abort if the event target is a child of the container that is no longer in the page.
- // It's possible for the target to no longer be in the page if it has been removed in an
- // event listener, this might happen in a Control that recreates it's content based on
- // user interaction either manually or via a render in something like https://reactjs.org/
- !(rootNode === doc ? doc.documentElement : rootNode).contains(target)) {
- return;
- }
- }
- mapBrowserEvent.frameState = this.frameState_;
- if (this.dispatchEvent(mapBrowserEvent) !== false) {
- var interactionsArray = this.getInteractions().getArray().slice();
- for (var i = interactionsArray.length - 1; i >= 0; i--) {
- var interaction = interactionsArray[i];
- if (interaction.getMap() !== this ||
- !interaction.getActive() ||
- !this.getTargetElement()) {
- continue;
- }
- var cont = interaction.handleEvent(mapBrowserEvent);
- if (!cont || mapBrowserEvent.propagationStopped) {
- break;
- }
- }
- }
- };
- /**
- * @protected
- */
- PluggableMap.prototype.handlePostRender = function () {
- var frameState = this.frameState_;
- // Manage the tile queue
- // Image loads are expensive and a limited resource, so try to use them
- // efficiently:
- // * When the view is static we allow a large number of parallel tile loads
- // to complete the frame as quickly as possible.
- // * When animating or interacting, image loads can cause janks, so we reduce
- // the maximum number of loads per frame and limit the number of parallel
- // tile loads to remain reactive to view changes and to reduce the chance of
- // loading tiles that will quickly disappear from view.
- var tileQueue = this.tileQueue_;
- if (!tileQueue.isEmpty()) {
- var maxTotalLoading = this.maxTilesLoading_;
- var maxNewLoads = maxTotalLoading;
- if (frameState) {
- var hints = frameState.viewHints;
- if (hints[ViewHint.ANIMATING] || hints[ViewHint.INTERACTING]) {
- var lowOnFrameBudget = Date.now() - frameState.time > 8;
- maxTotalLoading = lowOnFrameBudget ? 0 : 8;
- maxNewLoads = lowOnFrameBudget ? 0 : 2;
- }
- }
- if (tileQueue.getTilesLoading() < maxTotalLoading) {
- tileQueue.reprioritize(); // FIXME only call if view has changed
- tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads);
- }
- }
- if (frameState && this.renderer_ && !frameState.animate) {
- if (this.renderComplete_ === true) {
- if (this.hasListener(render_EventType.RENDERCOMPLETE)) {
- this.renderer_.dispatchRenderEvent(render_EventType.RENDERCOMPLETE, frameState);
- }
- if (this.loaded_ === false) {
- this.loaded_ = true;
- this.dispatchEvent(new ol_MapEvent(MapEventType.LOADEND, this, frameState));
- }
- }
- else if (this.loaded_ === true) {
- this.loaded_ = false;
- this.dispatchEvent(new ol_MapEvent(MapEventType.LOADSTART, this, frameState));
- }
- }
- var postRenderFunctions = this.postRenderFunctions_;
- for (var i = 0, ii = postRenderFunctions.length; i < ii; ++i) {
- postRenderFunctions[i](this, frameState);
- }
- postRenderFunctions.length = 0;
- };
- /**
- * @private
- */
- PluggableMap.prototype.handleSizeChanged_ = function () {
- if (this.getView() && !this.getView().getAnimating()) {
- this.getView().resolveConstraints(0);
- }
- this.render();
- };
- /**
- * @private
- */
- PluggableMap.prototype.handleTargetChanged_ = function () {
- if (this.mapBrowserEventHandler_) {
- for (var i = 0, ii = this.targetChangeHandlerKeys_.length; i < ii; ++i) {
- unlistenByKey(this.targetChangeHandlerKeys_[i]);
- }
- this.targetChangeHandlerKeys_ = null;
- this.viewport_.removeEventListener(EventType.CONTEXTMENU, this.boundHandleBrowserEvent_);
- this.viewport_.removeEventListener(EventType.WHEEL, this.boundHandleBrowserEvent_);
- this.mapBrowserEventHandler_.dispose();
- this.mapBrowserEventHandler_ = null;
- removeNode(this.viewport_);
- }
- // target may be undefined, null, a string or an Element.
- // If it's a string we convert it to an Element before proceeding.
- // If it's not now an Element we remove the viewport from the DOM.
- // If it's an Element we append the viewport element to it.
- var targetElement = this.getTargetElement();
- if (!targetElement) {
- if (this.renderer_) {
- clearTimeout(this.postRenderTimeoutHandle_);
- this.postRenderTimeoutHandle_ = undefined;
- this.postRenderFunctions_.length = 0;
- this.renderer_.dispose();
- this.renderer_ = null;
- }
- if (this.animationDelayKey_) {
- cancelAnimationFrame(this.animationDelayKey_);
- this.animationDelayKey_ = undefined;
- }
- }
- else {
- targetElement.appendChild(this.viewport_);
- if (!this.renderer_) {
- this.renderer_ = this.createRenderer();
- }
- this.mapBrowserEventHandler_ = new ol_MapBrowserEventHandler(this, this.moveTolerance_);
- for (var key in ol_MapBrowserEventType) {
- this.mapBrowserEventHandler_.addEventListener(ol_MapBrowserEventType[key], this.handleMapBrowserEvent.bind(this));
- }
- this.viewport_.addEventListener(EventType.CONTEXTMENU, this.boundHandleBrowserEvent_, false);
- this.viewport_.addEventListener(EventType.WHEEL, this.boundHandleBrowserEvent_, PASSIVE_EVENT_LISTENERS ? { passive: false } : false);
- var defaultView = this.getOwnerDocument().defaultView;
- var keyboardEventTarget = !this.keyboardEventTarget_
- ? targetElement
- : this.keyboardEventTarget_;
- this.targetChangeHandlerKeys_ = [
- listen(keyboardEventTarget, EventType.KEYDOWN, this.handleBrowserEvent, this),
- listen(keyboardEventTarget, EventType.KEYPRESS, this.handleBrowserEvent, this),
- listen(defaultView, EventType.RESIZE, this.updateSize, this),
- ];
- }
- this.updateSize();
- // updateSize calls setSize, so no need to call this.render
- // ourselves here.
- };
- /**
- * @private
- */
- PluggableMap.prototype.handleTileChange_ = function () {
- this.render();
- };
- /**
- * @private
- */
- PluggableMap.prototype.handleViewPropertyChanged_ = function () {
- this.render();
- };
- /**
- * @private
- */
- PluggableMap.prototype.handleViewChanged_ = function () {
- if (this.viewPropertyListenerKey_) {
- unlistenByKey(this.viewPropertyListenerKey_);
- this.viewPropertyListenerKey_ = null;
- }
- if (this.viewChangeListenerKey_) {
- unlistenByKey(this.viewChangeListenerKey_);
- this.viewChangeListenerKey_ = null;
- }
- var view = this.getView();
- if (view) {
- this.updateViewportSize_();
- this.viewPropertyListenerKey_ = listen(view, ObjectEventType.PROPERTYCHANGE, this.handleViewPropertyChanged_, this);
- this.viewChangeListenerKey_ = listen(view, EventType.CHANGE, this.handleViewPropertyChanged_, this);
- view.resolveConstraints(0);
- }
- this.render();
- };
- /**
- * @private
- */
- PluggableMap.prototype.handleLayerGroupChanged_ = function () {
- if (this.layerGroupPropertyListenerKeys_) {
- this.layerGroupPropertyListenerKeys_.forEach(unlistenByKey);
- this.layerGroupPropertyListenerKeys_ = null;
- }
- var layerGroup = this.getLayerGroup();
- if (layerGroup) {
- this.handleLayerAdd_(new GroupEvent('addlayer', layerGroup));
- this.layerGroupPropertyListenerKeys_ = [
- listen(layerGroup, ObjectEventType.PROPERTYCHANGE, this.render, this),
- listen(layerGroup, EventType.CHANGE, this.render, this),
- listen(layerGroup, 'addlayer', this.handleLayerAdd_, this),
- listen(layerGroup, 'removelayer', this.handleLayerRemove_, this),
- ];
- }
- this.render();
- };
- /**
- * @return {boolean} Is rendered.
- */
- PluggableMap.prototype.isRendered = function () {
- return !!this.frameState_;
- };
- /**
- * Requests an immediate render in a synchronous manner.
- * @api
- */
- PluggableMap.prototype.renderSync = function () {
- if (this.animationDelayKey_) {
- cancelAnimationFrame(this.animationDelayKey_);
- }
- this.animationDelay_();
- };
- /**
- * Redraws all text after new fonts have loaded
- */
- PluggableMap.prototype.redrawText = function () {
- var layerStates = this.getLayerGroup().getLayerStatesArray();
- for (var i = 0, ii = layerStates.length; i < ii; ++i) {
- var layer = layerStates[i].layer;
- if (layer.hasRenderer()) {
- layer.getRenderer().handleFontsChanged();
- }
- }
- };
- /**
- * Request a map rendering (at the next animation frame).
- * @api
- */
- PluggableMap.prototype.render = function () {
- if (this.renderer_ && this.animationDelayKey_ === undefined) {
- this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_);
- }
- };
- /**
- * Remove the given control from the map.
- * @param {import("./control/Control.js").default} control Control.
- * @return {import("./control/Control.js").default|undefined} The removed control (or undefined
- * if the control was not found).
- * @api
- */
- PluggableMap.prototype.removeControl = function (control) {
- return this.getControls().remove(control);
- };
- /**
- * Remove the given interaction from the map.
- * @param {import("./interaction/Interaction.js").default} interaction Interaction to remove.
- * @return {import("./interaction/Interaction.js").default|undefined} The removed interaction (or
- * undefined if the interaction was not found).
- * @api
- */
- PluggableMap.prototype.removeInteraction = function (interaction) {
- return this.getInteractions().remove(interaction);
- };
- /**
- * Removes the given layer from the map.
- * @param {import("./layer/Base.js").default} layer Layer.
- * @return {import("./layer/Base.js").default|undefined} The removed layer (or undefined if the
- * layer was not found).
- * @api
- */
- PluggableMap.prototype.removeLayer = function (layer) {
- var layers = this.getLayerGroup().getLayers();
- return layers.remove(layer);
- };
- /**
- * @param {import("./layer/Group.js").GroupEvent} event The layer remove event.
- * @private
- */
- PluggableMap.prototype.handleLayerRemove_ = function (event) {
- removeLayerMapProperty(event.layer);
- };
- /**
- * Remove the given overlay from the map.
- * @param {import("./Overlay.js").default} overlay Overlay.
- * @return {import("./Overlay.js").default|undefined} The removed overlay (or undefined
- * if the overlay was not found).
- * @api
- */
- PluggableMap.prototype.removeOverlay = function (overlay) {
- return this.getOverlays().remove(overlay);
- };
- /**
- * @param {number} time Time.
- * @private
- */
- PluggableMap.prototype.renderFrame_ = function (time) {
- var _this = this;
- var size = this.getSize();
- var view = this.getView();
- var previousFrameState = this.frameState_;
- /** @type {?FrameState} */
- var frameState = null;
- if (size !== undefined && hasArea(size) && view && view.isDef()) {
- var viewHints = view.getHints(this.frameState_ ? this.frameState_.viewHints : undefined);
- var viewState = view.getState();
- frameState = {
- animate: false,
- coordinateToPixelTransform: this.coordinateToPixelTransform_,
- declutterTree: null,
- extent: getForViewAndSize(viewState.center, viewState.resolution, viewState.rotation, size),
- index: this.frameIndex_++,
- layerIndex: 0,
- layerStatesArray: this.getLayerGroup().getLayerStatesArray(),
- pixelRatio: this.pixelRatio_,
- pixelToCoordinateTransform: this.pixelToCoordinateTransform_,
- postRenderFunctions: [],
- size: size,
- tileQueue: this.tileQueue_,
- time: time,
- usedTiles: {},
- viewState: viewState,
- viewHints: viewHints,
- wantedTiles: {},
- mapId: getUid(this),
- renderTargets: {},
- };
- if (viewState.nextCenter && viewState.nextResolution) {
- var rotation = isNaN(viewState.nextRotation)
- ? viewState.rotation
- : viewState.nextRotation;
- frameState.nextExtent = getForViewAndSize(viewState.nextCenter, viewState.nextResolution, rotation, size);
- }
- }
- this.frameState_ = frameState;
- /** @type {import("./renderer/Map.js").default} */ (this.renderer_).renderFrame(frameState);
- if (frameState) {
- if (frameState.animate) {
- this.render();
- }
- Array.prototype.push.apply(this.postRenderFunctions_, frameState.postRenderFunctions);
- if (previousFrameState) {
- var moveStart = !this.previousExtent_ ||
- (!extent_isEmpty(this.previousExtent_) &&
- !extent_equals(frameState.extent, this.previousExtent_));
- if (moveStart) {
- this.dispatchEvent(new ol_MapEvent(MapEventType.MOVESTART, this, previousFrameState));
- this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_);
- }
- }
- var idle = this.previousExtent_ &&
- !frameState.viewHints[ViewHint.ANIMATING] &&
- !frameState.viewHints[ViewHint.INTERACTING] &&
- !extent_equals(frameState.extent, this.previousExtent_);
- if (idle) {
- this.dispatchEvent(new ol_MapEvent(MapEventType.MOVEEND, this, frameState));
- clone(frameState.extent, this.previousExtent_);
- }
- }
- this.dispatchEvent(new ol_MapEvent(MapEventType.POSTRENDER, this, frameState));
- this.renderComplete_ =
- this.hasListener(MapEventType.LOADSTART) ||
- this.hasListener(MapEventType.LOADEND) ||
- this.hasListener(render_EventType.RENDERCOMPLETE)
- ? !this.tileQueue_.getTilesLoading() &&
- !this.tileQueue_.getCount() &&
- !this.getLoadingOrNotReady()
- : undefined;
- if (!this.postRenderTimeoutHandle_) {
- this.postRenderTimeoutHandle_ = setTimeout(function () {
- _this.postRenderTimeoutHandle_ = undefined;
- _this.handlePostRender();
- }, 0);
- }
- };
- /**
- * Sets the layergroup of this map.
- * @param {LayerGroup} layerGroup A layer group containing the layers in this map.
- * @observable
- * @api
- */
- PluggableMap.prototype.setLayerGroup = function (layerGroup) {
- var oldLayerGroup = this.getLayerGroup();
- if (oldLayerGroup) {
- this.handleLayerRemove_(new GroupEvent('removelayer', oldLayerGroup));
- }
- this.set(MapProperty.LAYERGROUP, layerGroup);
- };
- /**
- * Set the size of this map.
- * @param {import("./size.js").Size|undefined} size The size in pixels of the map in the DOM.
- * @observable
- * @api
- */
- PluggableMap.prototype.setSize = function (size) {
- this.set(MapProperty.SIZE, size);
- };
- /**
- * Set the target element to render this map into.
- * @param {HTMLElement|string} [target] The Element or id of the Element
- * that the map is rendered in.
- * @observable
- * @api
- */
- PluggableMap.prototype.setTarget = function (target) {
- this.set(MapProperty.TARGET, target);
- };
- /**
- * Set the view for this map.
- * @param {View|Promise<import("./View.js").ViewOptions>} view The view that controls this map.
- * It is also possible to pass a promise that resolves to options for constructing a view. This
- * alternative allows view properties to be resolved by sources or other components that load
- * view-related metadata.
- * @observable
- * @api
- */
- PluggableMap.prototype.setView = function (view) {
- if (!view || view instanceof ol_View) {
- this.set(MapProperty.VIEW, view);
- return;
- }
- this.set(MapProperty.VIEW, new ol_View());
- var map = this;
- view.then(function (viewOptions) {
- map.setView(new ol_View(viewOptions));
- });
- };
- /**
- * Force a recalculation of the map viewport size. This should be called when
- * third-party code changes the size of the map viewport.
- * @api
- */
- PluggableMap.prototype.updateSize = function () {
- var targetElement = this.getTargetElement();
- var size = undefined;
- if (targetElement) {
- var computedStyle = getComputedStyle(targetElement);
- var width = targetElement.offsetWidth -
- parseFloat(computedStyle['borderLeftWidth']) -
- parseFloat(computedStyle['paddingLeft']) -
- parseFloat(computedStyle['paddingRight']) -
- parseFloat(computedStyle['borderRightWidth']);
- var height = targetElement.offsetHeight -
- parseFloat(computedStyle['borderTopWidth']) -
- parseFloat(computedStyle['paddingTop']) -
- parseFloat(computedStyle['paddingBottom']) -
- parseFloat(computedStyle['borderBottomWidth']);
- if (!isNaN(width) && !isNaN(height)) {
- size = [width, height];
- if (!hasArea(size) &&
- !!(targetElement.offsetWidth ||
- targetElement.offsetHeight ||
- targetElement.getClientRects().length)) {
- // eslint-disable-next-line
- console.warn("No map visible because the map container's width or height are 0.");
- }
- }
- }
- this.setSize(size);
- this.updateViewportSize_();
- };
- /**
- * Recomputes the viewport size and save it on the view object (if any)
- * @private
- */
- PluggableMap.prototype.updateViewportSize_ = function () {
- var view = this.getView();
- if (view) {
- var size = undefined;
- var computedStyle = getComputedStyle(this.viewport_);
- if (computedStyle.width && computedStyle.height) {
- size = [
- parseInt(computedStyle.width, 10),
- parseInt(computedStyle.height, 10),
- ];
- }
- view.setViewportSize(size);
- }
- };
- return PluggableMap;
- }(ol_Object));
- /**
- * @param {MapOptions} options Map options.
- * @return {MapOptionsInternal} Internal map options.
- */
- function createOptionsInternal(options) {
- /**
- * @type {HTMLElement|Document}
- */
- var keyboardEventTarget = null;
- if (options.keyboardEventTarget !== undefined) {
- keyboardEventTarget =
- typeof options.keyboardEventTarget === 'string'
- ? document.getElementById(options.keyboardEventTarget)
- : options.keyboardEventTarget;
- }
- /**
- * @type {Object<string, *>}
- */
- var values = {};
- var layerGroup = options.layers &&
- typeof ( /** @type {?} */(options.layers).getLayers) === 'function'
- ? /** @type {LayerGroup} */ (options.layers)
- : new Group({ layers: /** @type {Collection} */ (options.layers) });
- values[MapProperty.LAYERGROUP] = layerGroup;
- values[MapProperty.TARGET] = options.target;
- values[MapProperty.VIEW] =
- options.view instanceof ol_View ? options.view : new ol_View();
- var controls;
- if (options.controls !== undefined) {
- if (Array.isArray(options.controls)) {
- controls = new ol_Collection(options.controls.slice());
- }
- else {
- asserts_assert(typeof ( /** @type {?} */(options.controls).getArray) === 'function', 47); // Expected `controls` to be an array or an `import("./Collection.js").Collection`
- controls = /** @type {Collection} */ (options.controls);
- }
- }
- var interactions;
- if (options.interactions !== undefined) {
- if (Array.isArray(options.interactions)) {
- interactions = new ol_Collection(options.interactions.slice());
- }
- else {
- asserts_assert(typeof ( /** @type {?} */(options.interactions).getArray) ===
- 'function', 48); // Expected `interactions` to be an array or an `import("./Collection.js").Collection`
- interactions = /** @type {Collection} */ (options.interactions);
- }
- }
- var overlays;
- if (options.overlays !== undefined) {
- if (Array.isArray(options.overlays)) {
- overlays = new ol_Collection(options.overlays.slice());
- }
- else {
- asserts_assert(typeof ( /** @type {?} */(options.overlays).getArray) === 'function', 49); // Expected `overlays` to be an array or an `import("./Collection.js").Collection`
- overlays = options.overlays;
- }
- }
- else {
- overlays = new ol_Collection();
- }
- return {
- controls: controls,
- interactions: interactions,
- keyboardEventTarget: keyboardEventTarget,
- overlays: overlays,
- values: values,
- };
- }
- /* harmony default export */ var ol_PluggableMap = (PluggableMap);
- //# sourceMappingURL=PluggableMap.js.map
- ;// ./node_modules/ol/control/Rotate.js
- var Rotate_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/control/Rotate
- */
- /**
- * @typedef {Object} Options
- * @property {string} [className='ol-rotate'] CSS class name.
- * @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.
- * Instead of text, also an element (e.g. a `span` element) can be used.
- * @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.
- * @property {string} [compassClassName='ol-compass'] CSS class name for the compass.
- * @property {number} [duration=250] Animation duration in milliseconds.
- * @property {boolean} [autoHide=true] Hide the control when rotation is 0.
- * @property {function(import("../MapEvent.js").default):void} [render] Function called when the control should
- * be re-rendered. This is called in a `requestAnimationFrame` callback.
- * @property {function():void} [resetNorth] Function called when the control is clicked.
- * This will override the default `resetNorth`.
- * @property {HTMLElement|string} [target] Specify a target if you want the control to be
- * rendered outside of the map's viewport.
- */
- /**
- * @classdesc
- * A button control to reset rotation to 0.
- * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css
- * selector is added to the button when the rotation is 0.
- *
- * @api
- */
- var Rotate = /** @class */ (function (_super) {
- Rotate_extends(Rotate, _super);
- /**
- * @param {Options} [opt_options] Rotate options.
- */
- function Rotate(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- _this = _super.call(this, {
- element: document.createElement('div'),
- render: options.render,
- target: options.target,
- }) || this;
- var className = options.className !== undefined ? options.className : 'ol-rotate';
- var label = options.label !== undefined ? options.label : '\u21E7';
- var compassClassName = options.compassClassName !== undefined
- ? options.compassClassName
- : 'ol-compass';
- /**
- * @type {HTMLElement}
- * @private
- */
- _this.label_ = null;
- if (typeof label === 'string') {
- _this.label_ = document.createElement('span');
- _this.label_.className = compassClassName;
- _this.label_.textContent = label;
- }
- else {
- _this.label_ = label;
- _this.label_.classList.add(compassClassName);
- }
- var tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';
- var button = document.createElement('button');
- button.className = className + '-reset';
- button.setAttribute('type', 'button');
- button.title = tipLabel;
- button.appendChild(_this.label_);
- button.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false);
- var cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
- var element = _this.element;
- element.className = cssClasses;
- element.appendChild(button);
- _this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
- /**
- * @type {number}
- * @private
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 250;
- /**
- * @type {boolean}
- * @private
- */
- _this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.rotation_ = undefined;
- if (_this.autoHide_) {
- _this.element.classList.add(CLASS_HIDDEN);
- }
- return _this;
- }
- /**
- * @param {MouseEvent} event The event to handle
- * @private
- */
- Rotate.prototype.handleClick_ = function (event) {
- event.preventDefault();
- if (this.callResetNorth_ !== undefined) {
- this.callResetNorth_();
- }
- else {
- this.resetNorth_();
- }
- };
- /**
- * @private
- */
- Rotate.prototype.resetNorth_ = function () {
- var map = this.getMap();
- var view = map.getView();
- if (!view) {
- // the map does not have a view, so we can't act
- // upon it
- return;
- }
- var rotation = view.getRotation();
- if (rotation !== undefined) {
- if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) {
- view.animate({
- rotation: 0,
- duration: this.duration_,
- easing: easeOut,
- });
- }
- else {
- view.setRotation(0);
- }
- }
- };
- /**
- * Update the rotate control element.
- * @param {import("../MapEvent.js").default} mapEvent Map event.
- * @override
- */
- Rotate.prototype.render = function (mapEvent) {
- var frameState = mapEvent.frameState;
- if (!frameState) {
- return;
- }
- var rotation = frameState.viewState.rotation;
- if (rotation != this.rotation_) {
- var transform = 'rotate(' + rotation + 'rad)';
- if (this.autoHide_) {
- var contains = this.element.classList.contains(CLASS_HIDDEN);
- if (!contains && rotation === 0) {
- this.element.classList.add(CLASS_HIDDEN);
- }
- else if (contains && rotation !== 0) {
- this.element.classList.remove(CLASS_HIDDEN);
- }
- }
- this.label_.style.transform = transform;
- }
- this.rotation_ = rotation;
- };
- return Rotate;
- }(control_Control));
- /* harmony default export */ var control_Rotate = (Rotate);
- //# sourceMappingURL=Rotate.js.map
- ;// ./node_modules/ol/control.js
- /**
- * @module ol/control
- */
- /**
- * @typedef {Object} DefaultsOptions
- * @property {boolean} [attribution=true] Include
- * {@link module:ol/control/Attribution~Attribution}.
- * @property {import("./control/Attribution.js").Options} [attributionOptions]
- * Options for {@link module:ol/control/Attribution~Attribution}.
- * @property {boolean} [rotate=true] Include
- * {@link module:ol/control/Rotate~Rotate}.
- * @property {import("./control/Rotate.js").Options} [rotateOptions] Options
- * for {@link module:ol/control/Rotate~Rotate}.
- * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.
- * @property {import("./control/Zoom.js").Options} [zoomOptions] Options for
- * {@link module:ol/control/Zoom~Zoom}.
- * @api
- */
- /**
- * Set of controls included in maps by default. Unless configured otherwise,
- * this returns a collection containing an instance of each of the following
- * controls:
- * * {@link module:ol/control/Zoom~Zoom}
- * * {@link module:ol/control/Rotate~Rotate}
- * * {@link module:ol/control/Attribution~Attribution}
- *
- * @param {DefaultsOptions} [opt_options]
- * Defaults options.
- * @return {Collection<import("./control/Control.js").default>}
- * Controls.
- * @api
- */
- function defaults(opt_options) {
- var options = opt_options ? opt_options : {};
- var controls = new ol_Collection();
- var zoomControl = options.zoom !== undefined ? options.zoom : true;
- if (zoomControl) {
- controls.push(new control_Zoom(options.zoomOptions));
- }
- var rotateControl = options.rotate !== undefined ? options.rotate : true;
- if (rotateControl) {
- controls.push(new control_Rotate(options.rotateOptions));
- }
- var attributionControl = options.attribution !== undefined ? options.attribution : true;
- if (attributionControl) {
- controls.push(new control_Attribution(options.attributionOptions));
- }
- return controls;
- }
- //# sourceMappingURL=control.js.map
- ;// ./node_modules/ol/interaction/Property.js
- /**
- * @module ol/interaction/Property
- */
- /**
- * @enum {string}
- */
- /* harmony default export */ var interaction_Property = ({
- ACTIVE: 'active',
- });
- //# sourceMappingURL=Property.js.map
- ;// ./node_modules/ol/interaction/Interaction.js
- var Interaction_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/Interaction
- */
- /***
- * @template Return
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
- * import("../Observable").OnSignature<import("../ObjectEventType").Types|
- * 'change:active', import("../Object").ObjectEvent, Return> &
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
- * 'change:active', Return>} InteractionOnSignature
- */
- /**
- * Object literal with config options for interactions.
- * @typedef {Object} InteractionOptions
- * @property {function(import("../MapBrowserEvent.js").default):boolean} handleEvent
- * Method called by the map to notify the interaction that a browser event was
- * dispatched to the map. If the function returns a falsy value, propagation of
- * the event to other interactions in the map's interactions chain will be
- * prevented (this includes functions with no explicit return). The interactions
- * are traversed in reverse order of the interactions collection of the map.
- */
- /**
- * @classdesc
- * Abstract base class; normally only used for creating subclasses and not
- * instantiated in apps.
- * User actions that change the state of the map. Some are similar to controls,
- * but are not associated with a DOM element.
- * For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is
- * functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered
- * by a keyboard event not a button element event.
- * Although interactions do not have a DOM element, some of them do render
- * vectors and so are visible on the screen.
- * @api
- */
- var Interaction = /** @class */ (function (_super) {
- Interaction_extends(Interaction, _super);
- /**
- * @param {InteractionOptions} [opt_options] Options.
- */
- function Interaction(opt_options) {
- var _this = _super.call(this) || this;
- /***
- * @type {InteractionOnSignature<import("../events").EventsKey>}
- */
- _this.on;
- /***
- * @type {InteractionOnSignature<import("../events").EventsKey>}
- */
- _this.once;
- /***
- * @type {InteractionOnSignature<void>}
- */
- _this.un;
- if (opt_options && opt_options.handleEvent) {
- _this.handleEvent = opt_options.handleEvent;
- }
- /**
- * @private
- * @type {import("../PluggableMap.js").default|null}
- */
- _this.map_ = null;
- _this.setActive(true);
- return _this;
- }
- /**
- * Return whether the interaction is currently active.
- * @return {boolean} `true` if the interaction is active, `false` otherwise.
- * @observable
- * @api
- */
- Interaction.prototype.getActive = function () {
- return /** @type {boolean} */ (this.get(interaction_Property.ACTIVE));
- };
- /**
- * Get the map associated with this interaction.
- * @return {import("../PluggableMap.js").default|null} Map.
- * @api
- */
- Interaction.prototype.getMap = function () {
- return this.map_;
- };
- /**
- * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event}.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} `false` to stop event propagation.
- * @api
- */
- Interaction.prototype.handleEvent = function (mapBrowserEvent) {
- return true;
- };
- /**
- * Activate or deactivate the interaction.
- * @param {boolean} active Active.
- * @observable
- * @api
- */
- Interaction.prototype.setActive = function (active) {
- this.set(interaction_Property.ACTIVE, active);
- };
- /**
- * Remove the interaction from its current map and attach it to the new map.
- * Subclasses may set up event handlers to get notified about changes to
- * the map here.
- * @param {import("../PluggableMap.js").default|null} map Map.
- */
- Interaction.prototype.setMap = function (map) {
- this.map_ = map;
- };
- return Interaction;
- }(ol_Object));
- /**
- * @param {import("../View.js").default} view View.
- * @param {import("../coordinate.js").Coordinate} delta Delta.
- * @param {number} [opt_duration] Duration.
- */
- function pan(view, delta, opt_duration) {
- var currentCenter = view.getCenterInternal();
- if (currentCenter) {
- var center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];
- view.animateInternal({
- duration: opt_duration !== undefined ? opt_duration : 250,
- easing: linear,
- center: view.getConstrainedCenter(center),
- });
- }
- }
- /**
- * @param {import("../View.js").default} view View.
- * @param {number} delta Delta from previous zoom level.
- * @param {import("../coordinate.js").Coordinate} [opt_anchor] Anchor coordinate in the user projection.
- * @param {number} [opt_duration] Duration.
- */
- function zoomByDelta(view, delta, opt_anchor, opt_duration) {
- var currentZoom = view.getZoom();
- if (currentZoom === undefined) {
- return;
- }
- var newZoom = view.getConstrainedZoom(currentZoom + delta);
- var newResolution = view.getResolutionForZoom(newZoom);
- if (view.getAnimating()) {
- view.cancelAnimations();
- }
- view.animate({
- resolution: newResolution,
- anchor: opt_anchor,
- duration: opt_duration !== undefined ? opt_duration : 250,
- easing: easeOut,
- });
- }
- /* harmony default export */ var interaction_Interaction = (Interaction);
- //# sourceMappingURL=Interaction.js.map
- ;// ./node_modules/ol/interaction/DoubleClickZoom.js
- var DoubleClickZoom_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/DoubleClickZoom
- */
- /**
- * @typedef {Object} Options
- * @property {number} [duration=250] Animation duration in milliseconds.
- * @property {number} [delta=1] The zoom delta applied on each double click.
- */
- /**
- * @classdesc
- * Allows the user to zoom by double-clicking on the map.
- * @api
- */
- var DoubleClickZoom = /** @class */ (function (_super) {
- DoubleClickZoom_extends(DoubleClickZoom, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function DoubleClickZoom(opt_options) {
- var _this = _super.call(this) || this;
- var options = opt_options ? opt_options : {};
- /**
- * @private
- * @type {number}
- */
- _this.delta_ = options.delta ? options.delta : 1;
- /**
- * @private
- * @type {number}
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 250;
- return _this;
- }
- /**
- * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a
- * doubleclick) and eventually zooms the map.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} `false` to stop event propagation.
- */
- DoubleClickZoom.prototype.handleEvent = function (mapBrowserEvent) {
- var stopEvent = false;
- if (mapBrowserEvent.type == ol_MapBrowserEventType.DBLCLICK) {
- var browserEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);
- var map = mapBrowserEvent.map;
- var anchor = mapBrowserEvent.coordinate;
- var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
- var view = map.getView();
- zoomByDelta(view, delta, anchor, this.duration_);
- browserEvent.preventDefault();
- stopEvent = true;
- }
- return !stopEvent;
- };
- return DoubleClickZoom;
- }(interaction_Interaction));
- /* harmony default export */ var interaction_DoubleClickZoom = (DoubleClickZoom);
- //# sourceMappingURL=DoubleClickZoom.js.map
- ;// ./node_modules/ol/interaction/Pointer.js
- var Pointer_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/Pointer
- */
- /**
- * @typedef {Object} Options
- * @property {function(import("../MapBrowserEvent.js").default):boolean} [handleDownEvent]
- * Function handling "down" events. If the function returns `true` then a drag
- * sequence is started.
- * @property {function(import("../MapBrowserEvent.js").default):void} [handleDragEvent]
- * Function handling "drag" events. This function is called on "move" events
- * during a drag sequence.
- * @property {function(import("../MapBrowserEvent.js").default):boolean} [handleEvent]
- * Method called by the map to notify the interaction that a browser event was
- * dispatched to the map. The function may return `false` to prevent the
- * propagation of the event to other interactions in the map's interactions
- * chain.
- * @property {function(import("../MapBrowserEvent.js").default):void} [handleMoveEvent]
- * Function handling "move" events. This function is called on "move" events.
- * This functions is also called during a drag sequence, so during a drag
- * sequence both the `handleDragEvent` function and this function are called.
- * If `handleDownEvent` is defined and it returns true this function will not
- * be called during a drag sequence.
- * @property {function(import("../MapBrowserEvent.js").default):boolean} [handleUpEvent]
- * Function handling "up" events. If the function returns `false` then the
- * current drag sequence is stopped.
- * @property {function(boolean):boolean} [stopDown]
- * Should the down event be propagated to other interactions, or should be
- * stopped?
- */
- /**
- * @classdesc
- * Base class that calls user-defined functions on `down`, `move` and `up`
- * events. This class also manages "drag sequences".
- *
- * When the `handleDownEvent` user function returns `true` a drag sequence is
- * started. During a drag sequence the `handleDragEvent` user function is
- * called on `move` events. The drag sequence ends when the `handleUpEvent`
- * user function is called and returns `false`.
- * @api
- */
- var PointerInteraction = /** @class */ (function (_super) {
- Pointer_extends(PointerInteraction, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function PointerInteraction(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- _this = _super.call(this,
- /** @type {import("./Interaction.js").InteractionOptions} */ (options)) || this;
- if (options.handleDownEvent) {
- _this.handleDownEvent = options.handleDownEvent;
- }
- if (options.handleDragEvent) {
- _this.handleDragEvent = options.handleDragEvent;
- }
- if (options.handleMoveEvent) {
- _this.handleMoveEvent = options.handleMoveEvent;
- }
- if (options.handleUpEvent) {
- _this.handleUpEvent = options.handleUpEvent;
- }
- if (options.stopDown) {
- _this.stopDown = options.stopDown;
- }
- /**
- * @type {boolean}
- * @protected
- */
- _this.handlingDownUpSequence = false;
- /**
- * @type {Array<PointerEvent>}
- * @protected
- */
- _this.targetPointers = [];
- return _this;
- }
- /**
- * Returns the current number of pointers involved in the interaction,
- * e.g. `2` when two fingers are used.
- * @return {number} The number of pointers.
- * @api
- */
- PointerInteraction.prototype.getPointerCount = function () {
- return this.targetPointers.length;
- };
- /**
- * Handle pointer down events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- * @protected
- */
- PointerInteraction.prototype.handleDownEvent = function (mapBrowserEvent) {
- return false;
- };
- /**
- * Handle pointer drag events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @protected
- */
- PointerInteraction.prototype.handleDragEvent = function (mapBrowserEvent) { };
- /**
- * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into
- * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
- * detected.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} `false` to stop event propagation.
- * @api
- */
- PointerInteraction.prototype.handleEvent = function (mapBrowserEvent) {
- if (!mapBrowserEvent.originalEvent) {
- return true;
- }
- var stopEvent = false;
- this.updateTrackedPointers_(mapBrowserEvent);
- if (this.handlingDownUpSequence) {
- if (mapBrowserEvent.type == ol_MapBrowserEventType.POINTERDRAG) {
- this.handleDragEvent(mapBrowserEvent);
- // prevent page scrolling during dragging
- mapBrowserEvent.originalEvent.preventDefault();
- }
- else if (mapBrowserEvent.type == ol_MapBrowserEventType.POINTERUP) {
- var handledUp = this.handleUpEvent(mapBrowserEvent);
- this.handlingDownUpSequence =
- handledUp && this.targetPointers.length > 0;
- }
- }
- else {
- if (mapBrowserEvent.type == ol_MapBrowserEventType.POINTERDOWN) {
- var handled = this.handleDownEvent(mapBrowserEvent);
- this.handlingDownUpSequence = handled;
- stopEvent = this.stopDown(handled);
- }
- else if (mapBrowserEvent.type == ol_MapBrowserEventType.POINTERMOVE) {
- this.handleMoveEvent(mapBrowserEvent);
- }
- }
- return !stopEvent;
- };
- /**
- * Handle pointer move events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @protected
- */
- PointerInteraction.prototype.handleMoveEvent = function (mapBrowserEvent) { };
- /**
- * Handle pointer up events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- * @protected
- */
- PointerInteraction.prototype.handleUpEvent = function (mapBrowserEvent) {
- return false;
- };
- /**
- * This function is used to determine if "down" events should be propagated
- * to other interactions or should be stopped.
- * @param {boolean} handled Was the event handled by the interaction?
- * @return {boolean} Should the `down` event be stopped?
- */
- PointerInteraction.prototype.stopDown = function (handled) {
- return handled;
- };
- /**
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @private
- */
- PointerInteraction.prototype.updateTrackedPointers_ = function (mapBrowserEvent) {
- if (mapBrowserEvent.activePointers) {
- this.targetPointers = mapBrowserEvent.activePointers;
- }
- };
- return PointerInteraction;
- }(interaction_Interaction));
- /**
- * @param {Array<PointerEvent>} pointerEvents List of events.
- * @return {import("../pixel.js").Pixel} Centroid pixel.
- */
- function Pointer_centroid(pointerEvents) {
- var length = pointerEvents.length;
- var clientX = 0;
- var clientY = 0;
- for (var i = 0; i < length; i++) {
- clientX += pointerEvents[i].clientX;
- clientY += pointerEvents[i].clientY;
- }
- return [clientX / length, clientY / length];
- }
- /* harmony default export */ var Pointer = (PointerInteraction);
- //# sourceMappingURL=Pointer.js.map
- ;// ./node_modules/ol/events/condition.js
- /**
- * @module ol/events/condition
- */
- /**
- * A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
- * `{boolean}`. If the condition is met, true should be returned.
- *
- * @typedef {function(this: ?, import("../MapBrowserEvent.js").default): boolean} Condition
- */
- /**
- * Creates a condition function that passes when all provided conditions pass.
- * @param {...Condition} var_args Conditions to check.
- * @return {Condition} Condition function.
- */
- function condition_all(var_args) {
- var conditions = arguments;
- /**
- * @param {import("../MapBrowserEvent.js").default} event Event.
- * @return {boolean} All conditions passed.
- */
- return function (event) {
- var pass = true;
- for (var i = 0, ii = conditions.length; i < ii; ++i) {
- pass = pass && conditions[i](event);
- if (!pass) {
- break;
- }
- }
- return pass;
- };
- }
- /**
- * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when
- * additionally the shift-key is pressed).
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if only the alt key is pressed.
- * @api
- */
- var altKeyOnly = function (mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return (originalEvent.altKey &&
- !(originalEvent.metaKey || originalEvent.ctrlKey) &&
- !originalEvent.shiftKey);
- };
- /**
- * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise
- * (e.g. when additionally the platform-modifier-key is pressed).
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if only the alt and shift keys are pressed.
- * @api
- */
- var altShiftKeysOnly = function (mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return (originalEvent.altKey &&
- !(originalEvent.metaKey || originalEvent.ctrlKey) &&
- originalEvent.shiftKey);
- };
- /**
- * Return `true` if the map has the focus. This condition requires a map target
- * element with a `tabindex` attribute, e.g. `<div id="map" tabindex="1">`.
- *
- * @param {import("../MapBrowserEvent.js").default} event Map browser event.
- * @return {boolean} The map has the focus.
- * @api
- */
- var condition_focus = function (event) {
- var targetElement = event.map.getTargetElement();
- var activeElement = event.map.getOwnerDocument().activeElement;
- return targetElement.contains(activeElement);
- };
- /**
- * Return `true` if the map has the focus or no 'tabindex' attribute set.
- *
- * @param {import("../MapBrowserEvent.js").default} event Map browser event.
- * @return {boolean} The map container has the focus or no 'tabindex' attribute.
- */
- var focusWithTabindex = function (event) {
- return event.map.getTargetElement().hasAttribute('tabindex')
- ? condition_focus(event)
- : true;
- };
- /**
- * Return always true.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True.
- * @api
- */
- var always = TRUE;
- /**
- * Return `true` if the event is a `click` event, `false` otherwise.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event is a map `click` event.
- * @api
- */
- var click = function (mapBrowserEvent) {
- return mapBrowserEvent.type == MapBrowserEventType.CLICK;
- };
- /**
- * Return `true` if the event has an "action"-producing mouse button.
- *
- * By definition, this includes left-click on windows/linux, and left-click
- * without the ctrl key on Macs.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} The result.
- */
- var mouseActionButton = function (mapBrowserEvent) {
- var originalEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);
- return originalEvent.button == 0 && !(WEBKIT && has_MAC && originalEvent.ctrlKey);
- };
- /**
- * Return always false.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} False.
- * @api
- */
- var never = (/* unused pure expression or super */ null && (FALSE));
- /**
- * Return `true` if the browser event is a `pointermove` event, `false`
- * otherwise.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the browser event is a `pointermove` event.
- * @api
- */
- var pointerMove = function (mapBrowserEvent) {
- return mapBrowserEvent.type == 'pointermove';
- };
- /**
- * Return `true` if the event is a map `singleclick` event, `false` otherwise.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event is a map `singleclick` event.
- * @api
- */
- var singleClick = function (mapBrowserEvent) {
- return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;
- };
- /**
- * Return `true` if the event is a map `dblclick` event, `false` otherwise.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event is a map `dblclick` event.
- * @api
- */
- var doubleClick = function (mapBrowserEvent) {
- return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;
- };
- /**
- * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is
- * pressed.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True only if there no modifier keys are pressed.
- * @api
- */
- var noModifierKeys = function (mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return (!originalEvent.altKey &&
- !(originalEvent.metaKey || originalEvent.ctrlKey) &&
- !originalEvent.shiftKey);
- };
- /**
- * Return `true` if only the platform-modifier-key (the meta-key on Mac,
- * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally
- * the shift-key is pressed).
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if only the platform modifier key is pressed.
- * @api
- */
- var platformModifierKeyOnly = function (mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return (!originalEvent.altKey &&
- (MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&
- !originalEvent.shiftKey);
- };
- /**
- * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when
- * additionally the alt-key is pressed).
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if only the shift key is pressed.
- * @api
- */
- var shiftKeyOnly = function (mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return (!originalEvent.altKey &&
- !(originalEvent.metaKey || originalEvent.ctrlKey) &&
- originalEvent.shiftKey);
- };
- /**
- * Return `true` if the target element is not editable, i.e. not an `input`,
- * `select`, or `textarea` element and no `contenteditable` attribute is
- * set or inherited, `false` otherwise.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True only if the target element is not editable.
- * @api
- */
- var targetNotEditable = function (mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- var tagName = /** @type {Element} */ (originalEvent.target).tagName;
- return (tagName !== 'INPUT' &&
- tagName !== 'SELECT' &&
- tagName !== 'TEXTAREA' &&
- // `isContentEditable` is only available on `HTMLElement`, but it may also be a
- // different type like `SVGElement`.
- // @ts-ignore
- !originalEvent.target.isContentEditable);
- };
- /**
- * Return `true` if the event originates from a mouse device.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event originates from a mouse device.
- * @api
- */
- var mouseOnly = function (mapBrowserEvent) {
- var pointerEvent = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent).originalEvent;
- asserts_assert(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event
- // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
- return pointerEvent.pointerType == 'mouse';
- };
- /**
- * Return `true` if the event originates from a touchable device.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event originates from a touchable device.
- * @api
- */
- var touchOnly = function (mapBrowserEvent) {
- var pointerEvt = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent).originalEvent;
- assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
- // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
- return pointerEvt.pointerType === 'touch';
- };
- /**
- * Return `true` if the event originates from a digital pen.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event originates from a digital pen.
- * @api
- */
- var penOnly = function (mapBrowserEvent) {
- var pointerEvt = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent).originalEvent;
- assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
- // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
- return pointerEvt.pointerType === 'pen';
- };
- /**
- * Return `true` if the event originates from a primary pointer in
- * contact with the surface or if the left mouse button is pressed.
- * See https://www.w3.org/TR/pointerevents/#button-states.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event originates from a primary pointer.
- * @api
- */
- var primaryAction = function (mapBrowserEvent) {
- var pointerEvent = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent).originalEvent;
- asserts_assert(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event
- return pointerEvent.isPrimary && pointerEvent.button === 0;
- };
- //# sourceMappingURL=condition.js.map
- ;// ./node_modules/ol/interaction/DragPan.js
- var DragPan_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/DragPan
- */
- /**
- * @typedef {Object} Options
- * @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
- * to indicate whether that event should be handled.
- * Default is {@link module:ol/events/condition.noModifierKeys} and {@link module:ol/events/condition.primaryAction}.
- * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,
- * the interaction will only handle events when the map has the focus.
- * @property {import("../Kinetic.js").default} [kinetic] Kinetic inertia to apply to the pan.
- */
- /**
- * @classdesc
- * Allows the user to pan the map by dragging the map.
- * @api
- */
- var DragPan = /** @class */ (function (_super) {
- DragPan_extends(DragPan, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function DragPan(opt_options) {
- var _this = _super.call(this, {
- stopDown: functions_FALSE,
- }) || this;
- var options = opt_options ? opt_options : {};
- /**
- * @private
- * @type {import("../Kinetic.js").default|undefined}
- */
- _this.kinetic_ = options.kinetic;
- /**
- * @type {import("../pixel.js").Pixel}
- */
- _this.lastCentroid = null;
- /**
- * @type {number}
- */
- _this.lastPointersCount_;
- /**
- * @type {boolean}
- */
- _this.panning_ = false;
- var condition = options.condition
- ? options.condition
- : condition_all(noModifierKeys, primaryAction);
- /**
- * @private
- * @type {import("../events/condition.js").Condition}
- */
- _this.condition_ = options.onFocusOnly
- ? condition_all(focusWithTabindex, condition)
- : condition;
- /**
- * @private
- * @type {boolean}
- */
- _this.noKinetic_ = false;
- return _this;
- }
- /**
- * Handle pointer drag events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- */
- DragPan.prototype.handleDragEvent = function (mapBrowserEvent) {
- if (!this.panning_) {
- this.panning_ = true;
- this.getMap().getView().beginInteraction();
- }
- var targetPointers = this.targetPointers;
- var centroid = Pointer_centroid(targetPointers);
- if (targetPointers.length == this.lastPointersCount_) {
- if (this.kinetic_) {
- this.kinetic_.update(centroid[0], centroid[1]);
- }
- if (this.lastCentroid) {
- var delta = [
- this.lastCentroid[0] - centroid[0],
- centroid[1] - this.lastCentroid[1],
- ];
- var map = mapBrowserEvent.map;
- var view = map.getView();
- scale(delta, view.getResolution());
- rotate(delta, view.getRotation());
- view.adjustCenterInternal(delta);
- }
- }
- else if (this.kinetic_) {
- // reset so we don't overestimate the kinetic energy after
- // after one finger down, tiny drag, second finger down
- this.kinetic_.begin();
- }
- this.lastCentroid = centroid;
- this.lastPointersCount_ = targetPointers.length;
- mapBrowserEvent.originalEvent.preventDefault();
- };
- /**
- * Handle pointer up events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- DragPan.prototype.handleUpEvent = function (mapBrowserEvent) {
- var map = mapBrowserEvent.map;
- var view = map.getView();
- if (this.targetPointers.length === 0) {
- if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {
- var distance = this.kinetic_.getDistance();
- var angle = this.kinetic_.getAngle();
- var center = view.getCenterInternal();
- var centerpx = map.getPixelFromCoordinateInternal(center);
- var dest = map.getCoordinateFromPixelInternal([
- centerpx[0] - distance * Math.cos(angle),
- centerpx[1] - distance * Math.sin(angle),
- ]);
- view.animateInternal({
- center: view.getConstrainedCenter(dest),
- duration: 500,
- easing: easeOut,
- });
- }
- if (this.panning_) {
- this.panning_ = false;
- view.endInteraction();
- }
- return false;
- }
- else {
- if (this.kinetic_) {
- // reset so we don't overestimate the kinetic energy after
- // after one finger up, tiny drag, second finger up
- this.kinetic_.begin();
- }
- this.lastCentroid = null;
- return true;
- }
- };
- /**
- * Handle pointer down events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- DragPan.prototype.handleDownEvent = function (mapBrowserEvent) {
- if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {
- var map = mapBrowserEvent.map;
- var view = map.getView();
- this.lastCentroid = null;
- // stop any current animation
- if (view.getAnimating()) {
- view.cancelAnimations();
- }
- if (this.kinetic_) {
- this.kinetic_.begin();
- }
- // No kinetic as soon as more than one pointer on the screen is
- // detected. This is to prevent nasty pans after pinch.
- this.noKinetic_ = this.targetPointers.length > 1;
- return true;
- }
- else {
- return false;
- }
- };
- return DragPan;
- }(Pointer));
- /* harmony default export */ var interaction_DragPan = (DragPan);
- //# sourceMappingURL=DragPan.js.map
- ;// ./node_modules/ol/interaction/DragRotate.js
- var DragRotate_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/DragRotate
- */
- /**
- * @typedef {Object} Options
- * @property {import("../events/condition.js").Condition} [condition] A function that takes an
- * {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
- * to indicate whether that event should be handled.
- * Default is {@link module:ol/events/condition.altShiftKeysOnly}.
- * @property {number} [duration=250] Animation duration in milliseconds.
- */
- /**
- * @classdesc
- * Allows the user to rotate the map by clicking and dragging on the map,
- * normally combined with an {@link module:ol/events/condition} that limits
- * it to when the alt and shift keys are held down.
- *
- * This interaction is only supported for mouse devices.
- * @api
- */
- var DragRotate = /** @class */ (function (_super) {
- DragRotate_extends(DragRotate, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function DragRotate(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- _this = _super.call(this, {
- stopDown: functions_FALSE,
- }) || this;
- /**
- * @private
- * @type {import("../events/condition.js").Condition}
- */
- _this.condition_ = options.condition ? options.condition : altShiftKeysOnly;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.lastAngle_ = undefined;
- /**
- * @private
- * @type {number}
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 250;
- return _this;
- }
- /**
- * Handle pointer drag events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- */
- DragRotate.prototype.handleDragEvent = function (mapBrowserEvent) {
- if (!mouseOnly(mapBrowserEvent)) {
- return;
- }
- var map = mapBrowserEvent.map;
- var view = map.getView();
- if (view.getConstraints().rotation === disable) {
- return;
- }
- var size = map.getSize();
- var offset = mapBrowserEvent.pixel;
- var theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);
- if (this.lastAngle_ !== undefined) {
- var delta = theta - this.lastAngle_;
- view.adjustRotationInternal(-delta);
- }
- this.lastAngle_ = theta;
- };
- /**
- * Handle pointer up events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- DragRotate.prototype.handleUpEvent = function (mapBrowserEvent) {
- if (!mouseOnly(mapBrowserEvent)) {
- return true;
- }
- var map = mapBrowserEvent.map;
- var view = map.getView();
- view.endInteraction(this.duration_);
- return false;
- };
- /**
- * Handle pointer down events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- DragRotate.prototype.handleDownEvent = function (mapBrowserEvent) {
- if (!mouseOnly(mapBrowserEvent)) {
- return false;
- }
- if (mouseActionButton(mapBrowserEvent) &&
- this.condition_(mapBrowserEvent)) {
- var map = mapBrowserEvent.map;
- map.getView().beginInteraction();
- this.lastAngle_ = undefined;
- return true;
- }
- else {
- return false;
- }
- };
- return DragRotate;
- }(Pointer));
- /* harmony default export */ var interaction_DragRotate = (DragRotate);
- //# sourceMappingURL=DragRotate.js.map
- ;// ./node_modules/ol/render/Box.js
- /**
- * @module ol/render/Box
- */
- var Box_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var RenderBox = /** @class */ (function (_super) {
- Box_extends(RenderBox, _super);
- /**
- * @param {string} className CSS class name.
- */
- function RenderBox(className) {
- var _this = _super.call(this) || this;
- /**
- * @type {import("../geom/Polygon.js").default}
- * @private
- */
- _this.geometry_ = null;
- /**
- * @type {HTMLDivElement}
- * @private
- */
- _this.element_ = document.createElement('div');
- _this.element_.style.position = 'absolute';
- _this.element_.style.pointerEvents = 'auto';
- _this.element_.className = 'ol-box ' + className;
- /**
- * @private
- * @type {import("../PluggableMap.js").default|null}
- */
- _this.map_ = null;
- /**
- * @private
- * @type {import("../pixel.js").Pixel}
- */
- _this.startPixel_ = null;
- /**
- * @private
- * @type {import("../pixel.js").Pixel}
- */
- _this.endPixel_ = null;
- return _this;
- }
- /**
- * Clean up.
- */
- RenderBox.prototype.disposeInternal = function () {
- this.setMap(null);
- };
- /**
- * @private
- */
- RenderBox.prototype.render_ = function () {
- var startPixel = this.startPixel_;
- var endPixel = this.endPixel_;
- var px = 'px';
- var style = this.element_.style;
- style.left = Math.min(startPixel[0], endPixel[0]) + px;
- style.top = Math.min(startPixel[1], endPixel[1]) + px;
- style.width = Math.abs(endPixel[0] - startPixel[0]) + px;
- style.height = Math.abs(endPixel[1] - startPixel[1]) + px;
- };
- /**
- * @param {import("../PluggableMap.js").default|null} map Map.
- */
- RenderBox.prototype.setMap = function (map) {
- if (this.map_) {
- this.map_.getOverlayContainer().removeChild(this.element_);
- var style = this.element_.style;
- style.left = 'inherit';
- style.top = 'inherit';
- style.width = 'inherit';
- style.height = 'inherit';
- }
- this.map_ = map;
- if (this.map_) {
- this.map_.getOverlayContainer().appendChild(this.element_);
- }
- };
- /**
- * @param {import("../pixel.js").Pixel} startPixel Start pixel.
- * @param {import("../pixel.js").Pixel} endPixel End pixel.
- */
- RenderBox.prototype.setPixels = function (startPixel, endPixel) {
- this.startPixel_ = startPixel;
- this.endPixel_ = endPixel;
- this.createOrUpdateGeometry();
- this.render_();
- };
- /**
- * Creates or updates the cached geometry.
- */
- RenderBox.prototype.createOrUpdateGeometry = function () {
- var startPixel = this.startPixel_;
- var endPixel = this.endPixel_;
- var pixels = [
- startPixel,
- [startPixel[0], endPixel[1]],
- endPixel,
- [endPixel[0], startPixel[1]],
- ];
- var coordinates = pixels.map(this.map_.getCoordinateFromPixelInternal, this.map_);
- // close the polygon
- coordinates[4] = coordinates[0].slice();
- if (!this.geometry_) {
- this.geometry_ = new geom_Polygon([coordinates]);
- }
- else {
- this.geometry_.setCoordinates([coordinates]);
- }
- };
- /**
- * @return {import("../geom/Polygon.js").default} Geometry.
- */
- RenderBox.prototype.getGeometry = function () {
- return this.geometry_;
- };
- return RenderBox;
- }(ol_Disposable));
- /* harmony default export */ var Box = (RenderBox);
- //# sourceMappingURL=Box.js.map
- ;// ./node_modules/ol/interaction/DragBox.js
- var DragBox_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/DragBox
- */
- // FIXME draw drag box
- /**
- * A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
- * {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,
- * true should be returned.
- * @typedef {function(this: ?, import("../MapBrowserEvent.js").default, import("../pixel.js").Pixel, import("../pixel.js").Pixel):boolean} EndCondition
- */
- /**
- * @typedef {Object} Options
- * @property {string} [className='ol-dragbox'] CSS class name for styling the box.
- * @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
- * to indicate whether that event should be handled.
- * Default is {@link ol/events/condition~mouseActionButton}.
- * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default
- * `boxEndCondition` function.
- * @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
- * {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.
- * Default is `true` if the area of the box is bigger than the `minArea` option.
- * @property {function(this:DragBox, import("../MapBrowserEvent.js").default):void} [onBoxEnd] Code to execute just
- * before `boxend` is fired.
- */
- /**
- * @enum {string}
- */
- var DragBoxEventType = {
- /**
- * Triggered upon drag box start.
- * @event DragBoxEvent#boxstart
- * @api
- */
- BOXSTART: 'boxstart',
- /**
- * Triggered on drag when box is active.
- * @event DragBoxEvent#boxdrag
- * @api
- */
- BOXDRAG: 'boxdrag',
- /**
- * Triggered upon drag box end.
- * @event DragBoxEvent#boxend
- * @api
- */
- BOXEND: 'boxend',
- /**
- * Triggered upon drag box canceled.
- * @event DragBoxEvent#boxcancel
- * @api
- */
- BOXCANCEL: 'boxcancel',
- };
- /**
- * @classdesc
- * Events emitted by {@link module:ol/interaction/DragBox~DragBox} instances are instances of
- * this type.
- */
- var DragBoxEvent = /** @class */ (function (_super) {
- DragBox_extends(DragBoxEvent, _super);
- /**
- * @param {string} type The event type.
- * @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Originating event.
- */
- function DragBoxEvent(type, coordinate, mapBrowserEvent) {
- var _this = _super.call(this, type) || this;
- /**
- * The coordinate of the drag event.
- * @const
- * @type {import("../coordinate.js").Coordinate}
- * @api
- */
- _this.coordinate = coordinate;
- /**
- * @const
- * @type {import("../MapBrowserEvent.js").default}
- * @api
- */
- _this.mapBrowserEvent = mapBrowserEvent;
- return _this;
- }
- return DragBoxEvent;
- }(Event));
- /***
- * @template Return
- * @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
- * import("../Observable").OnSignature<import("../ObjectEventType").Types|
- * 'change:active', import("../Object").ObjectEvent, Return> &
- * import("../Observable").OnSignature<'boxcancel'|'boxdrag'|'boxend'|'boxstart', DragBoxEvent, Return> &
- * import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
- * 'change:active'|'boxcancel'|'boxdrag'|'boxend', Return>} DragBoxOnSignature
- */
- /**
- * @classdesc
- * Allows the user to draw a vector box by clicking and dragging on the map,
- * normally combined with an {@link module:ol/events/condition} that limits
- * it to when the shift or other key is held down. This is used, for example,
- * for zooming to a specific area of the map
- * (see {@link module:ol/interaction/DragZoom~DragZoom} and
- * {@link module:ol/interaction/DragRotateAndZoom~DragRotateAndZoom}).
- *
- * @fires DragBoxEvent
- * @api
- */
- var DragBox = /** @class */ (function (_super) {
- DragBox_extends(DragBox, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function DragBox(opt_options) {
- var _this = _super.call(this) || this;
- /***
- * @type {DragBoxOnSignature<import("../events").EventsKey>}
- */
- _this.on;
- /***
- * @type {DragBoxOnSignature<import("../events").EventsKey>}
- */
- _this.once;
- /***
- * @type {DragBoxOnSignature<void>}
- */
- _this.un;
- var options = opt_options ? opt_options : {};
- /**
- * @type {import("../render/Box.js").default}
- * @private
- */
- _this.box_ = new Box(options.className || 'ol-dragbox');
- /**
- * @type {number}
- * @private
- */
- _this.minArea_ = options.minArea !== undefined ? options.minArea : 64;
- if (options.onBoxEnd) {
- _this.onBoxEnd = options.onBoxEnd;
- }
- /**
- * @type {import("../pixel.js").Pixel}
- * @private
- */
- _this.startPixel_ = null;
- /**
- * @private
- * @type {import("../events/condition.js").Condition}
- */
- _this.condition_ = options.condition ? options.condition : mouseActionButton;
- /**
- * @private
- * @type {EndCondition}
- */
- _this.boxEndCondition_ = options.boxEndCondition
- ? options.boxEndCondition
- : _this.defaultBoxEndCondition;
- return _this;
- }
- /**
- * The default condition for determining whether the boxend event
- * should fire.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent The originating MapBrowserEvent
- * leading to the box end.
- * @param {import("../pixel.js").Pixel} startPixel The starting pixel of the box.
- * @param {import("../pixel.js").Pixel} endPixel The end pixel of the box.
- * @return {boolean} Whether or not the boxend condition should be fired.
- */
- DragBox.prototype.defaultBoxEndCondition = function (mapBrowserEvent, startPixel, endPixel) {
- var width = endPixel[0] - startPixel[0];
- var height = endPixel[1] - startPixel[1];
- return width * width + height * height >= this.minArea_;
- };
- /**
- * Returns geometry of last drawn box.
- * @return {import("../geom/Polygon.js").default} Geometry.
- * @api
- */
- DragBox.prototype.getGeometry = function () {
- return this.box_.getGeometry();
- };
- /**
- * Handle pointer drag events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- */
- DragBox.prototype.handleDragEvent = function (mapBrowserEvent) {
- this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
- this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXDRAG, mapBrowserEvent.coordinate, mapBrowserEvent));
- };
- /**
- * Handle pointer up events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- DragBox.prototype.handleUpEvent = function (mapBrowserEvent) {
- this.box_.setMap(null);
- var completeBox = this.boxEndCondition_(mapBrowserEvent, this.startPixel_, mapBrowserEvent.pixel);
- if (completeBox) {
- this.onBoxEnd(mapBrowserEvent);
- }
- this.dispatchEvent(new DragBoxEvent(completeBox ? DragBoxEventType.BOXEND : DragBoxEventType.BOXCANCEL, mapBrowserEvent.coordinate, mapBrowserEvent));
- return false;
- };
- /**
- * Handle pointer down events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- DragBox.prototype.handleDownEvent = function (mapBrowserEvent) {
- if (this.condition_(mapBrowserEvent)) {
- this.startPixel_ = mapBrowserEvent.pixel;
- this.box_.setMap(mapBrowserEvent.map);
- this.box_.setPixels(this.startPixel_, this.startPixel_);
- this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXSTART, mapBrowserEvent.coordinate, mapBrowserEvent));
- return true;
- }
- else {
- return false;
- }
- };
- /**
- * Function to execute just before `onboxend` is fired
- * @param {import("../MapBrowserEvent.js").default} event Event.
- */
- DragBox.prototype.onBoxEnd = function (event) { };
- return DragBox;
- }(Pointer));
- /* harmony default export */ var interaction_DragBox = (DragBox);
- //# sourceMappingURL=DragBox.js.map
- ;// ./node_modules/ol/interaction/DragZoom.js
- var DragZoom_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/DragZoom
- */
- /**
- * @typedef {Object} Options
- * @property {string} [className='ol-dragzoom'] CSS class name for styling the
- * box.
- * @property {import("../events/condition.js").Condition} [condition] A function that
- * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
- * boolean to indicate whether that event should be handled.
- * Default is {@link module:ol/events/condition.shiftKeyOnly}.
- * @property {number} [duration=200] Animation duration in milliseconds.
- * @property {boolean} [out=false] Use interaction for zooming out.
- * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the parent default
- * `boxEndCondition` function.
- */
- /**
- * @classdesc
- * Allows the user to zoom the map by clicking and dragging on the map,
- * normally combined with an {@link module:ol/events/condition} that limits
- * it to when a key, shift by default, is held down.
- *
- * To change the style of the box, use CSS and the `.ol-dragzoom` selector, or
- * your custom one configured with `className`.
- * @api
- */
- var DragZoom = /** @class */ (function (_super) {
- DragZoom_extends(DragZoom, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function DragZoom(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- var condition = options.condition ? options.condition : shiftKeyOnly;
- _this = _super.call(this, {
- condition: condition,
- className: options.className || 'ol-dragzoom',
- minArea: options.minArea,
- }) || this;
- /**
- * @private
- * @type {number}
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 200;
- /**
- * @private
- * @type {boolean}
- */
- _this.out_ = options.out !== undefined ? options.out : false;
- return _this;
- }
- /**
- * Function to execute just before `onboxend` is fired
- * @param {import("../MapBrowserEvent.js").default} event Event.
- */
- DragZoom.prototype.onBoxEnd = function (event) {
- var map = this.getMap();
- var view = /** @type {!import("../View.js").default} */ (map.getView());
- var geometry = this.getGeometry();
- if (this.out_) {
- var rotatedExtent = view.rotatedExtentForGeometry(geometry);
- var resolution = view.getResolutionForExtentInternal(rotatedExtent);
- var factor = view.getResolution() / resolution;
- geometry = geometry.clone();
- geometry.scale(factor * factor);
- }
- view.fitInternal(geometry, {
- duration: this.duration_,
- easing: easeOut,
- });
- };
- return DragZoom;
- }(interaction_DragBox));
- /* harmony default export */ var interaction_DragZoom = (DragZoom);
- //# sourceMappingURL=DragZoom.js.map
- ;// ./node_modules/ol/events/KeyCode.js
- /**
- * @module ol/events/KeyCode
- */
- /**
- * @enum {number}
- * @const
- */
- /* harmony default export */ var KeyCode = ({
- LEFT: 37,
- UP: 38,
- RIGHT: 39,
- DOWN: 40,
- });
- //# sourceMappingURL=KeyCode.js.map
- ;// ./node_modules/ol/interaction/KeyboardPan.js
- var KeyboardPan_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/KeyboardPan
- */
- /**
- * @typedef {Object} Options
- * @property {import("../events/condition.js").Condition} [condition] A function that
- * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
- * boolean to indicate whether that event should be handled. Default is
- * {@link module:ol/events/condition.noModifierKeys} and
- * {@link module:ol/events/condition.targetNotEditable}.
- * @property {number} [duration=100] Animation duration in milliseconds.
- * @property {number} [pixelDelta=128] The amount of pixels to pan on each key
- * press.
- */
- /**
- * @classdesc
- * Allows the user to pan the map using keyboard arrows.
- * Note that, although this interaction is by default included in maps,
- * the keys can only be used when browser focus is on the element to which
- * the keyboard events are attached. By default, this is the map div,
- * though you can change this with the `keyboardEventTarget` in
- * {@link module:ol/Map~Map}. `document` never loses focus but, for any other
- * element, focus will have to be on, and returned to, this element if the keys
- * are to function.
- * See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}.
- * @api
- */
- var KeyboardPan = /** @class */ (function (_super) {
- KeyboardPan_extends(KeyboardPan, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function KeyboardPan(opt_options) {
- var _this = _super.call(this) || this;
- var options = opt_options || {};
- /**
- * @private
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event.
- * @return {boolean} Combined condition result.
- */
- _this.defaultCondition_ = function (mapBrowserEvent) {
- return (noModifierKeys(mapBrowserEvent) && targetNotEditable(mapBrowserEvent));
- };
- /**
- * @private
- * @type {import("../events/condition.js").Condition}
- */
- _this.condition_ =
- options.condition !== undefined
- ? options.condition
- : _this.defaultCondition_;
- /**
- * @private
- * @type {number}
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 100;
- /**
- * @private
- * @type {number}
- */
- _this.pixelDelta_ =
- options.pixelDelta !== undefined ? options.pixelDelta : 128;
- return _this;
- }
- /**
- * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a
- * `KeyEvent`, and decides the direction to pan to (if an arrow key was
- * pressed).
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} `false` to stop event propagation.
- * @this {KeyboardPan}
- */
- KeyboardPan.prototype.handleEvent = function (mapBrowserEvent) {
- var stopEvent = false;
- if (mapBrowserEvent.type == EventType.KEYDOWN) {
- var keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent);
- var keyCode = keyEvent.keyCode;
- if (this.condition_(mapBrowserEvent) &&
- (keyCode == KeyCode.DOWN ||
- keyCode == KeyCode.LEFT ||
- keyCode == KeyCode.RIGHT ||
- keyCode == KeyCode.UP)) {
- var map = mapBrowserEvent.map;
- var view = map.getView();
- var mapUnitsDelta = view.getResolution() * this.pixelDelta_;
- var deltaX = 0, deltaY = 0;
- if (keyCode == KeyCode.DOWN) {
- deltaY = -mapUnitsDelta;
- }
- else if (keyCode == KeyCode.LEFT) {
- deltaX = -mapUnitsDelta;
- }
- else if (keyCode == KeyCode.RIGHT) {
- deltaX = mapUnitsDelta;
- }
- else {
- deltaY = mapUnitsDelta;
- }
- var delta = [deltaX, deltaY];
- rotate(delta, view.getRotation());
- pan(view, delta, this.duration_);
- keyEvent.preventDefault();
- stopEvent = true;
- }
- }
- return !stopEvent;
- };
- return KeyboardPan;
- }(interaction_Interaction));
- /* harmony default export */ var interaction_KeyboardPan = (KeyboardPan);
- //# sourceMappingURL=KeyboardPan.js.map
- ;// ./node_modules/ol/interaction/KeyboardZoom.js
- var KeyboardZoom_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/KeyboardZoom
- */
- /**
- * @typedef {Object} Options
- * @property {number} [duration=100] Animation duration in milliseconds.
- * @property {import("../events/condition.js").Condition} [condition] A function that
- * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
- * boolean to indicate whether that event should be handled. Default is
- * {@link module:ol/events/condition.targetNotEditable}.
- * @property {number} [delta=1] The zoom level delta on each key press.
- */
- /**
- * @classdesc
- * Allows the user to zoom the map using keyboard + and -.
- * Note that, although this interaction is by default included in maps,
- * the keys can only be used when browser focus is on the element to which
- * the keyboard events are attached. By default, this is the map div,
- * though you can change this with the `keyboardEventTarget` in
- * {@link module:ol/Map~Map}. `document` never loses focus but, for any other
- * element, focus will have to be on, and returned to, this element if the keys
- * are to function.
- * See also {@link module:ol/interaction/KeyboardPan~KeyboardPan}.
- * @api
- */
- var KeyboardZoom = /** @class */ (function (_super) {
- KeyboardZoom_extends(KeyboardZoom, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function KeyboardZoom(opt_options) {
- var _this = _super.call(this) || this;
- var options = opt_options ? opt_options : {};
- /**
- * @private
- * @type {import("../events/condition.js").Condition}
- */
- _this.condition_ = options.condition ? options.condition : targetNotEditable;
- /**
- * @private
- * @type {number}
- */
- _this.delta_ = options.delta ? options.delta : 1;
- /**
- * @private
- * @type {number}
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 100;
- return _this;
- }
- /**
- * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a
- * `KeyEvent`, and decides whether to zoom in or out (depending on whether the
- * key pressed was '+' or '-').
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} `false` to stop event propagation.
- * @this {KeyboardZoom}
- */
- KeyboardZoom.prototype.handleEvent = function (mapBrowserEvent) {
- var stopEvent = false;
- if (mapBrowserEvent.type == EventType.KEYDOWN ||
- mapBrowserEvent.type == EventType.KEYPRESS) {
- var keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent);
- var charCode = keyEvent.charCode;
- if (this.condition_(mapBrowserEvent) &&
- (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) {
- var map = mapBrowserEvent.map;
- var delta = charCode == '+'.charCodeAt(0) ? this.delta_ : -this.delta_;
- var view = map.getView();
- zoomByDelta(view, delta, undefined, this.duration_);
- keyEvent.preventDefault();
- stopEvent = true;
- }
- }
- return !stopEvent;
- };
- return KeyboardZoom;
- }(interaction_Interaction));
- /* harmony default export */ var interaction_KeyboardZoom = (KeyboardZoom);
- //# sourceMappingURL=KeyboardZoom.js.map
- ;// ./node_modules/ol/Kinetic.js
- /**
- * @module ol/Kinetic
- */
- /**
- * @classdesc
- * Implementation of inertial deceleration for map movement.
- *
- * @api
- */
- var Kinetic = /** @class */ (function () {
- /**
- * @param {number} decay Rate of decay (must be negative).
- * @param {number} minVelocity Minimum velocity (pixels/millisecond).
- * @param {number} delay Delay to consider to calculate the kinetic
- * initial values (milliseconds).
- */
- function Kinetic(decay, minVelocity, delay) {
- /**
- * @private
- * @type {number}
- */
- this.decay_ = decay;
- /**
- * @private
- * @type {number}
- */
- this.minVelocity_ = minVelocity;
- /**
- * @private
- * @type {number}
- */
- this.delay_ = delay;
- /**
- * @private
- * @type {Array<number>}
- */
- this.points_ = [];
- /**
- * @private
- * @type {number}
- */
- this.angle_ = 0;
- /**
- * @private
- * @type {number}
- */
- this.initialVelocity_ = 0;
- }
- /**
- * FIXME empty description for jsdoc
- */
- Kinetic.prototype.begin = function () {
- this.points_.length = 0;
- this.angle_ = 0;
- this.initialVelocity_ = 0;
- };
- /**
- * @param {number} x X.
- * @param {number} y Y.
- */
- Kinetic.prototype.update = function (x, y) {
- this.points_.push(x, y, Date.now());
- };
- /**
- * @return {boolean} Whether we should do kinetic animation.
- */
- Kinetic.prototype.end = function () {
- if (this.points_.length < 6) {
- // at least 2 points are required (i.e. there must be at least 6 elements
- // in the array)
- return false;
- }
- var delay = Date.now() - this.delay_;
- var lastIndex = this.points_.length - 3;
- if (this.points_[lastIndex + 2] < delay) {
- // the last tracked point is too old, which means that the user stopped
- // panning before releasing the map
- return false;
- }
- // get the first point which still falls into the delay time
- var firstIndex = lastIndex - 3;
- while (firstIndex > 0 && this.points_[firstIndex + 2] > delay) {
- firstIndex -= 3;
- }
- var duration = this.points_[lastIndex + 2] - this.points_[firstIndex + 2];
- // we don't want a duration of 0 (divide by zero)
- // we also make sure the user panned for a duration of at least one frame
- // (1/60s) to compute sane displacement values
- if (duration < 1000 / 60) {
- return false;
- }
- var dx = this.points_[lastIndex] - this.points_[firstIndex];
- var dy = this.points_[lastIndex + 1] - this.points_[firstIndex + 1];
- this.angle_ = Math.atan2(dy, dx);
- this.initialVelocity_ = Math.sqrt(dx * dx + dy * dy) / duration;
- return this.initialVelocity_ > this.minVelocity_;
- };
- /**
- * @return {number} Total distance travelled (pixels).
- */
- Kinetic.prototype.getDistance = function () {
- return (this.minVelocity_ - this.initialVelocity_) / this.decay_;
- };
- /**
- * @return {number} Angle of the kinetic panning animation (radians).
- */
- Kinetic.prototype.getAngle = function () {
- return this.angle_;
- };
- return Kinetic;
- }());
- /* harmony default export */ var ol_Kinetic = (Kinetic);
- //# sourceMappingURL=Kinetic.js.map
- ;// ./node_modules/ol/interaction/MouseWheelZoom.js
- var MouseWheelZoom_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/MouseWheelZoom
- */
- /**
- * @enum {string}
- */
- var Mode = {
- TRACKPAD: 'trackpad',
- WHEEL: 'wheel',
- };
- /**
- * @typedef {Object} Options
- * @property {import("../events/condition.js").Condition} [condition] A function that
- * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
- * boolean to indicate whether that event should be handled. Default is
- * {@link module:ol/events/condition.always}.
- * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,
- * the interaction will only handle events when the map has the focus.
- * @property {number} [maxDelta=1] Maximum mouse wheel delta.
- * @property {number} [duration=250] Animation duration in milliseconds.
- * @property {number} [timeout=80] Mouse wheel timeout duration in milliseconds.
- * @property {boolean} [useAnchor=true] Enable zooming using the mouse's
- * location as the anchor. When set to `false`, zooming in and out will zoom to
- * the center of the screen instead of zooming on the mouse's location.
- * @property {boolean} [constrainResolution=false] If true, the mouse wheel zoom
- * event will always animate to the closest zoom level after an interaction;
- * false means intermediary zoom levels are allowed.
- */
- /**
- * @classdesc
- * Allows the user to zoom the map by scrolling the mouse wheel.
- * @api
- */
- var MouseWheelZoom = /** @class */ (function (_super) {
- MouseWheelZoom_extends(MouseWheelZoom, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function MouseWheelZoom(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- _this = _super.call(this,
- /** @type {import("./Interaction.js").InteractionOptions} */ (options)) || this;
- /**
- * @private
- * @type {number}
- */
- _this.totalDelta_ = 0;
- /**
- * @private
- * @type {number}
- */
- _this.lastDelta_ = 0;
- /**
- * @private
- * @type {number}
- */
- _this.maxDelta_ = options.maxDelta !== undefined ? options.maxDelta : 1;
- /**
- * @private
- * @type {number}
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 250;
- /**
- * @private
- * @type {number}
- */
- _this.timeout_ = options.timeout !== undefined ? options.timeout : 80;
- /**
- * @private
- * @type {boolean}
- */
- _this.useAnchor_ =
- options.useAnchor !== undefined ? options.useAnchor : true;
- /**
- * @private
- * @type {boolean}
- */
- _this.constrainResolution_ =
- options.constrainResolution !== undefined
- ? options.constrainResolution
- : false;
- var condition = options.condition ? options.condition : always;
- /**
- * @private
- * @type {import("../events/condition.js").Condition}
- */
- _this.condition_ = options.onFocusOnly
- ? condition_all(focusWithTabindex, condition)
- : condition;
- /**
- * @private
- * @type {?import("../coordinate.js").Coordinate}
- */
- _this.lastAnchor_ = null;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.startTime_ = undefined;
- /**
- * @private
- * @type {?}
- */
- _this.timeoutId_;
- /**
- * @private
- * @type {Mode|undefined}
- */
- _this.mode_ = undefined;
- /**
- * Trackpad events separated by this delay will be considered separate
- * interactions.
- * @type {number}
- */
- _this.trackpadEventGap_ = 400;
- /**
- * @type {?}
- */
- _this.trackpadTimeoutId_;
- /**
- * The number of delta values per zoom level
- * @private
- * @type {number}
- */
- _this.deltaPerZoom_ = 300;
- return _this;
- }
- /**
- * @private
- */
- MouseWheelZoom.prototype.endInteraction_ = function () {
- this.trackpadTimeoutId_ = undefined;
- var map = this.getMap();
- if (!map) {
- return;
- }
- var view = map.getView();
- view.endInteraction(undefined, this.lastDelta_ ? (this.lastDelta_ > 0 ? 1 : -1) : 0, this.lastAnchor_);
- };
- /**
- * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually
- * zooms the map.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} `false` to stop event propagation.
- */
- MouseWheelZoom.prototype.handleEvent = function (mapBrowserEvent) {
- if (!this.condition_(mapBrowserEvent)) {
- return true;
- }
- var type = mapBrowserEvent.type;
- if (type !== EventType.WHEEL) {
- return true;
- }
- var map = mapBrowserEvent.map;
- var wheelEvent = /** @type {WheelEvent} */ (mapBrowserEvent.originalEvent);
- wheelEvent.preventDefault();
- if (this.useAnchor_) {
- this.lastAnchor_ = mapBrowserEvent.coordinate;
- }
- // Delta normalisation inspired by
- // https://github.com/mapbox/mapbox-gl-js/blob/001c7b9/js/ui/handler/scroll_zoom.js
- var delta;
- if (mapBrowserEvent.type == EventType.WHEEL) {
- delta = wheelEvent.deltaY;
- if (FIREFOX && wheelEvent.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
- delta /= DEVICE_PIXEL_RATIO;
- }
- if (wheelEvent.deltaMode === WheelEvent.DOM_DELTA_LINE) {
- delta *= 40;
- }
- }
- if (delta === 0) {
- return false;
- }
- else {
- this.lastDelta_ = delta;
- }
- var now = Date.now();
- if (this.startTime_ === undefined) {
- this.startTime_ = now;
- }
- if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {
- this.mode_ = Math.abs(delta) < 4 ? Mode.TRACKPAD : Mode.WHEEL;
- }
- var view = map.getView();
- if (this.mode_ === Mode.TRACKPAD &&
- !(view.getConstrainResolution() || this.constrainResolution_)) {
- if (this.trackpadTimeoutId_) {
- clearTimeout(this.trackpadTimeoutId_);
- }
- else {
- if (view.getAnimating()) {
- view.cancelAnimations();
- }
- view.beginInteraction();
- }
- this.trackpadTimeoutId_ = setTimeout(this.endInteraction_.bind(this), this.timeout_);
- view.adjustZoom(-delta / this.deltaPerZoom_, this.lastAnchor_);
- this.startTime_ = now;
- return false;
- }
- this.totalDelta_ += delta;
- var timeLeft = Math.max(this.timeout_ - (now - this.startTime_), 0);
- clearTimeout(this.timeoutId_);
- this.timeoutId_ = setTimeout(this.handleWheelZoom_.bind(this, map), timeLeft);
- return false;
- };
- /**
- * @private
- * @param {import("../PluggableMap.js").default} map Map.
- */
- MouseWheelZoom.prototype.handleWheelZoom_ = function (map) {
- var view = map.getView();
- if (view.getAnimating()) {
- view.cancelAnimations();
- }
- var delta = -math_clamp(this.totalDelta_, -this.maxDelta_ * this.deltaPerZoom_, this.maxDelta_ * this.deltaPerZoom_) / this.deltaPerZoom_;
- if (view.getConstrainResolution() || this.constrainResolution_) {
- // view has a zoom constraint, zoom by 1
- delta = delta ? (delta > 0 ? 1 : -1) : 0;
- }
- zoomByDelta(view, delta, this.lastAnchor_, this.duration_);
- this.mode_ = undefined;
- this.totalDelta_ = 0;
- this.lastAnchor_ = null;
- this.startTime_ = undefined;
- this.timeoutId_ = undefined;
- };
- /**
- * Enable or disable using the mouse's location as an anchor when zooming
- * @param {boolean} useAnchor true to zoom to the mouse's location, false
- * to zoom to the center of the map
- * @api
- */
- MouseWheelZoom.prototype.setMouseAnchor = function (useAnchor) {
- this.useAnchor_ = useAnchor;
- if (!useAnchor) {
- this.lastAnchor_ = null;
- }
- };
- return MouseWheelZoom;
- }(interaction_Interaction));
- /* harmony default export */ var interaction_MouseWheelZoom = (MouseWheelZoom);
- //# sourceMappingURL=MouseWheelZoom.js.map
- ;// ./node_modules/ol/interaction/PinchRotate.js
- var PinchRotate_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/PinchRotate
- */
- /**
- * @typedef {Object} Options
- * @property {number} [duration=250] The duration of the animation in
- * milliseconds.
- * @property {number} [threshold=0.3] Minimal angle in radians to start a rotation.
- */
- /**
- * @classdesc
- * Allows the user to rotate the map by twisting with two fingers
- * on a touch screen.
- * @api
- */
- var PinchRotate = /** @class */ (function (_super) {
- PinchRotate_extends(PinchRotate, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function PinchRotate(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- var pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
- if (!pointerOptions.stopDown) {
- pointerOptions.stopDown = functions_FALSE;
- }
- _this = _super.call(this, pointerOptions) || this;
- /**
- * @private
- * @type {import("../coordinate.js").Coordinate}
- */
- _this.anchor_ = null;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.lastAngle_ = undefined;
- /**
- * @private
- * @type {boolean}
- */
- _this.rotating_ = false;
- /**
- * @private
- * @type {number}
- */
- _this.rotationDelta_ = 0.0;
- /**
- * @private
- * @type {number}
- */
- _this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3;
- /**
- * @private
- * @type {number}
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 250;
- return _this;
- }
- /**
- * Handle pointer drag events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- */
- PinchRotate.prototype.handleDragEvent = function (mapBrowserEvent) {
- var rotationDelta = 0.0;
- var touch0 = this.targetPointers[0];
- var touch1 = this.targetPointers[1];
- // angle between touches
- var angle = Math.atan2(touch1.clientY - touch0.clientY, touch1.clientX - touch0.clientX);
- if (this.lastAngle_ !== undefined) {
- var delta = angle - this.lastAngle_;
- this.rotationDelta_ += delta;
- if (!this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_) {
- this.rotating_ = true;
- }
- rotationDelta = delta;
- }
- this.lastAngle_ = angle;
- var map = mapBrowserEvent.map;
- var view = map.getView();
- if (view.getConstraints().rotation === disable) {
- return;
- }
- // rotate anchor point.
- // FIXME: should be the intersection point between the lines:
- // touch0,touch1 and previousTouch0,previousTouch1
- var viewportPosition = map.getViewport().getBoundingClientRect();
- var centroid = Pointer_centroid(this.targetPointers);
- centroid[0] -= viewportPosition.left;
- centroid[1] -= viewportPosition.top;
- this.anchor_ = map.getCoordinateFromPixelInternal(centroid);
- // rotate
- if (this.rotating_) {
- map.render();
- view.adjustRotationInternal(rotationDelta, this.anchor_);
- }
- };
- /**
- * Handle pointer up events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- PinchRotate.prototype.handleUpEvent = function (mapBrowserEvent) {
- if (this.targetPointers.length < 2) {
- var map = mapBrowserEvent.map;
- var view = map.getView();
- view.endInteraction(this.duration_);
- return false;
- }
- else {
- return true;
- }
- };
- /**
- * Handle pointer down events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- PinchRotate.prototype.handleDownEvent = function (mapBrowserEvent) {
- if (this.targetPointers.length >= 2) {
- var map = mapBrowserEvent.map;
- this.anchor_ = null;
- this.lastAngle_ = undefined;
- this.rotating_ = false;
- this.rotationDelta_ = 0.0;
- if (!this.handlingDownUpSequence) {
- map.getView().beginInteraction();
- }
- return true;
- }
- else {
- return false;
- }
- };
- return PinchRotate;
- }(Pointer));
- /* harmony default export */ var interaction_PinchRotate = (PinchRotate);
- //# sourceMappingURL=PinchRotate.js.map
- ;// ./node_modules/ol/interaction/PinchZoom.js
- var PinchZoom_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/interaction/PinchZoom
- */
- /**
- * @typedef {Object} Options
- * @property {number} [duration=400] Animation duration in milliseconds.
- */
- /**
- * @classdesc
- * Allows the user to zoom the map by pinching with two fingers
- * on a touch screen.
- * @api
- */
- var PinchZoom = /** @class */ (function (_super) {
- PinchZoom_extends(PinchZoom, _super);
- /**
- * @param {Options} [opt_options] Options.
- */
- function PinchZoom(opt_options) {
- var _this = this;
- var options = opt_options ? opt_options : {};
- var pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
- if (!pointerOptions.stopDown) {
- pointerOptions.stopDown = functions_FALSE;
- }
- _this = _super.call(this, pointerOptions) || this;
- /**
- * @private
- * @type {import("../coordinate.js").Coordinate}
- */
- _this.anchor_ = null;
- /**
- * @private
- * @type {number}
- */
- _this.duration_ = options.duration !== undefined ? options.duration : 400;
- /**
- * @private
- * @type {number|undefined}
- */
- _this.lastDistance_ = undefined;
- /**
- * @private
- * @type {number}
- */
- _this.lastScaleDelta_ = 1;
- return _this;
- }
- /**
- * Handle pointer drag events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- */
- PinchZoom.prototype.handleDragEvent = function (mapBrowserEvent) {
- var scaleDelta = 1.0;
- var touch0 = this.targetPointers[0];
- var touch1 = this.targetPointers[1];
- var dx = touch0.clientX - touch1.clientX;
- var dy = touch0.clientY - touch1.clientY;
- // distance between touches
- var distance = Math.sqrt(dx * dx + dy * dy);
- if (this.lastDistance_ !== undefined) {
- scaleDelta = this.lastDistance_ / distance;
- }
- this.lastDistance_ = distance;
- var map = mapBrowserEvent.map;
- var view = map.getView();
- if (scaleDelta != 1.0) {
- this.lastScaleDelta_ = scaleDelta;
- }
- // scale anchor point.
- var viewportPosition = map.getViewport().getBoundingClientRect();
- var centroid = Pointer_centroid(this.targetPointers);
- centroid[0] -= viewportPosition.left;
- centroid[1] -= viewportPosition.top;
- this.anchor_ = map.getCoordinateFromPixelInternal(centroid);
- // scale, bypass the resolution constraint
- map.render();
- view.adjustResolutionInternal(scaleDelta, this.anchor_);
- };
- /**
- * Handle pointer up events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- PinchZoom.prototype.handleUpEvent = function (mapBrowserEvent) {
- if (this.targetPointers.length < 2) {
- var map = mapBrowserEvent.map;
- var view = map.getView();
- var direction = this.lastScaleDelta_ > 1 ? 1 : -1;
- view.endInteraction(this.duration_, direction);
- return false;
- }
- else {
- return true;
- }
- };
- /**
- * Handle pointer down events.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
- * @return {boolean} If the event was consumed.
- */
- PinchZoom.prototype.handleDownEvent = function (mapBrowserEvent) {
- if (this.targetPointers.length >= 2) {
- var map = mapBrowserEvent.map;
- this.anchor_ = null;
- this.lastDistance_ = undefined;
- this.lastScaleDelta_ = 1;
- if (!this.handlingDownUpSequence) {
- map.getView().beginInteraction();
- }
- return true;
- }
- else {
- return false;
- }
- };
- return PinchZoom;
- }(Pointer));
- /* harmony default export */ var interaction_PinchZoom = (PinchZoom);
- //# sourceMappingURL=PinchZoom.js.map
- ;// ./node_modules/ol/interaction.js
- /**
- * @module ol/interaction
- */
- /**
- * @typedef {Object} DefaultsOptions
- * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is
- * desired.
- * @property {boolean} [onFocusOnly=false] Interact only when the map has the
- * focus. This affects the `MouseWheelZoom` and `DragPan` interactions and is
- * useful when page scroll is desired for maps that do not have the browser's
- * focus.
- * @property {boolean} [doubleClickZoom=true] Whether double click zoom is
- * desired.
- * @property {boolean} [keyboard=true] Whether keyboard interaction is desired.
- * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired.
- * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired.
- * @property {boolean} [dragPan=true] Whether drag pan is desired.
- * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired.
- * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired.
- * @property {number} [zoomDelta] Zoom level delta when using keyboard or double click zoom.
- * @property {number} [zoomDuration] Duration of the zoom animation in
- * milliseconds.
- */
- /**
- * Set of interactions included in maps by default. Specific interactions can be
- * excluded by setting the appropriate option to false in the constructor
- * options, but the order of the interactions is fixed. If you want to specify
- * a different order for interactions, you will need to create your own
- * {@link module:ol/interaction/Interaction~Interaction} instances and insert
- * them into a {@link module:ol/Collection~Collection} in the order you want
- * before creating your {@link module:ol/Map~Map} instance. Changing the order can
- * be of interest if the event propagation needs to be stopped at a point.
- * The default set of interactions, in sequence, is:
- * * {@link module:ol/interaction/DragRotate~DragRotate}
- * * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom}
- * * {@link module:ol/interaction/DragPan~DragPan}
- * * {@link module:ol/interaction/PinchRotate~PinchRotate}
- * * {@link module:ol/interaction/PinchZoom~PinchZoom}
- * * {@link module:ol/interaction/KeyboardPan~KeyboardPan}
- * * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}
- * * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom}
- * * {@link module:ol/interaction/DragZoom~DragZoom}
- *
- * @param {DefaultsOptions} [opt_options] Defaults options.
- * @return {import("./Collection.js").default<import("./interaction/Interaction.js").default>}
- * A collection of interactions to be used with the {@link module:ol/Map~Map}
- * constructor's `interactions` option.
- * @api
- */
- function interaction_defaults(opt_options) {
- var options = opt_options ? opt_options : {};
- var interactions = new ol_Collection();
- var kinetic = new ol_Kinetic(-0.005, 0.05, 100);
- var altShiftDragRotate = options.altShiftDragRotate !== undefined
- ? options.altShiftDragRotate
- : true;
- if (altShiftDragRotate) {
- interactions.push(new interaction_DragRotate());
- }
- var doubleClickZoom = options.doubleClickZoom !== undefined ? options.doubleClickZoom : true;
- if (doubleClickZoom) {
- interactions.push(new interaction_DoubleClickZoom({
- delta: options.zoomDelta,
- duration: options.zoomDuration,
- }));
- }
- var dragPan = options.dragPan !== undefined ? options.dragPan : true;
- if (dragPan) {
- interactions.push(new interaction_DragPan({
- onFocusOnly: options.onFocusOnly,
- kinetic: kinetic,
- }));
- }
- var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate : true;
- if (pinchRotate) {
- interactions.push(new interaction_PinchRotate());
- }
- var pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;
- if (pinchZoom) {
- interactions.push(new interaction_PinchZoom({
- duration: options.zoomDuration,
- }));
- }
- var keyboard = options.keyboard !== undefined ? options.keyboard : true;
- if (keyboard) {
- interactions.push(new interaction_KeyboardPan());
- interactions.push(new interaction_KeyboardZoom({
- delta: options.zoomDelta,
- duration: options.zoomDuration,
- }));
- }
- var mouseWheelZoom = options.mouseWheelZoom !== undefined ? options.mouseWheelZoom : true;
- if (mouseWheelZoom) {
- interactions.push(new interaction_MouseWheelZoom({
- onFocusOnly: options.onFocusOnly,
- duration: options.zoomDuration,
- }));
- }
- var shiftDragZoom = options.shiftDragZoom !== undefined ? options.shiftDragZoom : true;
- if (shiftDragZoom) {
- interactions.push(new interaction_DragZoom({
- duration: options.zoomDuration,
- }));
- }
- return interactions;
- }
- //# sourceMappingURL=interaction.js.map
- ;// ./node_modules/ol/Map.js
- var ol_Map_extends = (undefined && undefined.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- /**
- * @module ol/Map
- */
- /**
- * @classdesc
- * The map is the core component of OpenLayers. For a map to render, a view,
- * one or more layers, and a target container are needed:
- *
- * import Map from 'ol/Map';
- * import View from 'ol/View';
- * import TileLayer from 'ol/layer/Tile';
- * import OSM from 'ol/source/OSM';
- *
- * var map = new Map({
- * view: new View({
- * center: [0, 0],
- * zoom: 1
- * }),
- * layers: [
- * new TileLayer({
- * source: new OSM()
- * })
- * ],
- * target: 'map'
- * });
- *
- * The above snippet creates a map using a {@link module:ol/layer/Tile~TileLayer} to
- * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM
- * element with the id `map`.
- *
- * The constructor places a viewport container (with CSS class name
- * `ol-viewport`) in the target element (see `getViewport()`), and then two
- * further elements within the viewport: one with CSS class name
- * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with
- * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent`
- * option of {@link module:ol/Overlay~Overlay} for the difference). The map
- * itself is placed in a further element within the viewport.
- *
- * Layers are stored as a {@link module:ol/Collection~Collection} in
- * layerGroups. A top-level group is provided by the library. This is what is
- * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the
- * options are added to this group, and `addLayer` and `removeLayer` change the
- * layer collection in the group. `getLayers` is a convenience function for
- * `getLayerGroup().getLayers()`. Note that {@link module:ol/layer/Group~LayerGroup}
- * is a subclass of {@link module:ol/layer/Base~BaseLayer}, so layers entered in the
- * options or added with `addLayer` can be groups, which can contain further
- * groups, and so on.
- *
- * @api
- */
- var Map_Map = /** @class */ (function (_super) {
- ol_Map_extends(Map, _super);
- /**
- * @param {import("./PluggableMap.js").MapOptions} options Map options.
- */
- function Map(options) {
- options = obj_assign({}, options);
- if (!options.controls) {
- options.controls = defaults();
- }
- if (!options.interactions) {
- options.interactions = interaction_defaults({
- onFocusOnly: true,
- });
- }
- return _super.call(this, options) || this;
- }
- Map.prototype.createRenderer = function () {
- return new Composite(this);
- };
- return Map;
- }(ol_PluggableMap));
- /* harmony default export */ var ol_Map = (Map_Map);
- //# sourceMappingURL=Map.js.map
- ;// ./js/src/ol.mjs
- const ol = {
- control: {
- Attribution: control_Attribution, MousePosition: control_MousePosition, Zoom: control_Zoom
- },
- coordinate: {
- createStringXY: createStringXY
- },
- extent: {
- boundingExtent: boundingExtent
- },
- geom: {
- LineString: geom_LineString, LinearRing: geom_LinearRing, MultiLineString: geom_MultiLineString, MultiPoint: geom_MultiPoint, MultiPolygon: geom_MultiPolygon, Point: geom_Point, Polygon: geom_Polygon
- },
- layer: {
- Tile: layer_Tile, Vector: Vector
- },
- proj: {
- fromLonLat: fromLonLat, get: proj_get, transformExtent: transformExtent
- },
- source: {
- OSM: source_OSM, Vector: source_Vector
- },
- style: {
- Circle: Circle, Fill: style_Fill, Stroke: style_Stroke, Style: style_Style, Text: style_Text
- },
- Feature: ol_Feature, Map: ol_Map, View: ol_View
- }
- /* harmony default export */ var src_ol = (ol);
- }();
- __webpack_exports__ = __webpack_exports__["default"];
- /******/ return __webpack_exports__;
- /******/ })()
- ;
- });
- //# sourceMappingURL=OpenLayers.js.map
|