iclient-openlayers-es6.js 4.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238
  1. /*!
  2. *
  3. * iclient-openlayers
  4. * Copyright© 2000 - 2023 SuperMap Software Co.Ltd
  5. * license: Apache-2.0
  6. * version: v11.1.0
  7. *
  8. */
  9. /******/ (() => { // webpackBootstrap
  10. /******/ var __webpack_modules__ = ({
  11. /***/ 693:
  12. /***/ (function(module) {
  13. (function(self) {
  14. 'use strict';
  15. // if __disableNativeFetch is set to true, the it will always polyfill fetch
  16. // with Ajax.
  17. if (!self.__disableNativeFetch && self.fetch) {
  18. return
  19. }
  20. function normalizeName(name) {
  21. if (typeof name !== 'string') {
  22. name = String(name)
  23. }
  24. if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
  25. throw new TypeError('Invalid character in header field name')
  26. }
  27. return name.toLowerCase()
  28. }
  29. function normalizeValue(value) {
  30. if (typeof value !== 'string') {
  31. value = String(value)
  32. }
  33. return value
  34. }
  35. function Headers(headers) {
  36. this.map = {}
  37. if (headers instanceof Headers) {
  38. headers.forEach(function(value, name) {
  39. this.append(name, value)
  40. }, this)
  41. } else if (headers) {
  42. Object.getOwnPropertyNames(headers).forEach(function(name) {
  43. this.append(name, headers[name])
  44. }, this)
  45. }
  46. }
  47. Headers.prototype.append = function(name, value) {
  48. name = normalizeName(name)
  49. value = normalizeValue(value)
  50. var list = this.map[name]
  51. if (!list) {
  52. list = []
  53. this.map[name] = list
  54. }
  55. list.push(value)
  56. }
  57. Headers.prototype['delete'] = function(name) {
  58. delete this.map[normalizeName(name)]
  59. }
  60. Headers.prototype.get = function(name) {
  61. var values = this.map[normalizeName(name)]
  62. return values ? values[0] : null
  63. }
  64. Headers.prototype.getAll = function(name) {
  65. return this.map[normalizeName(name)] || []
  66. }
  67. Headers.prototype.has = function(name) {
  68. return this.map.hasOwnProperty(normalizeName(name))
  69. }
  70. Headers.prototype.set = function(name, value) {
  71. this.map[normalizeName(name)] = [normalizeValue(value)]
  72. }
  73. Headers.prototype.forEach = function(callback, thisArg) {
  74. Object.getOwnPropertyNames(this.map).forEach(function(name) {
  75. this.map[name].forEach(function(value) {
  76. callback.call(thisArg, value, name, this)
  77. }, this)
  78. }, this)
  79. }
  80. function consumed(body) {
  81. if (body.bodyUsed) {
  82. return Promise.reject(new TypeError('Already read'))
  83. }
  84. body.bodyUsed = true
  85. }
  86. function fileReaderReady(reader) {
  87. return new Promise(function(resolve, reject) {
  88. reader.onload = function() {
  89. resolve(reader.result)
  90. }
  91. reader.onerror = function() {
  92. reject(reader.error)
  93. }
  94. })
  95. }
  96. function readBlobAsArrayBuffer(blob) {
  97. var reader = new FileReader()
  98. reader.readAsArrayBuffer(blob)
  99. return fileReaderReady(reader)
  100. }
  101. function readBlobAsText(blob, options) {
  102. var reader = new FileReader()
  103. var contentType = options.headers.map['content-type'] ? options.headers.map['content-type'].toString() : ''
  104. var regex = /charset\=[0-9a-zA-Z\-\_]*;?/
  105. var _charset = blob.type.match(regex) || contentType.match(regex)
  106. var args = [blob]
  107. if(_charset) {
  108. args.push(_charset[0].replace(/^charset\=/, '').replace(/;$/, ''))
  109. }
  110. reader.readAsText.apply(reader, args)
  111. return fileReaderReady(reader)
  112. }
  113. var support = {
  114. blob: 'FileReader' in self && 'Blob' in self && (function() {
  115. try {
  116. new Blob();
  117. return true
  118. } catch(e) {
  119. return false
  120. }
  121. })(),
  122. formData: 'FormData' in self,
  123. arrayBuffer: 'ArrayBuffer' in self
  124. }
  125. function Body() {
  126. this.bodyUsed = false
  127. this._initBody = function(body, options) {
  128. this._bodyInit = body
  129. if (typeof body === 'string') {
  130. this._bodyText = body
  131. } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
  132. this._bodyBlob = body
  133. this._options = options
  134. } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
  135. this._bodyFormData = body
  136. } else if (!body) {
  137. this._bodyText = ''
  138. } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
  139. // Only support ArrayBuffers for POST method.
  140. // Receiving ArrayBuffers happens via Blobs, instead.
  141. } else {
  142. throw new Error('unsupported BodyInit type')
  143. }
  144. }
  145. if (support.blob) {
  146. this.blob = function() {
  147. var rejected = consumed(this)
  148. if (rejected) {
  149. return rejected
  150. }
  151. if (this._bodyBlob) {
  152. return Promise.resolve(this._bodyBlob)
  153. } else if (this._bodyFormData) {
  154. throw new Error('could not read FormData body as blob')
  155. } else {
  156. return Promise.resolve(new Blob([this._bodyText]))
  157. }
  158. }
  159. this.arrayBuffer = function() {
  160. return this.blob().then(readBlobAsArrayBuffer)
  161. }
  162. this.text = function() {
  163. var rejected = consumed(this)
  164. if (rejected) {
  165. return rejected
  166. }
  167. if (this._bodyBlob) {
  168. return readBlobAsText(this._bodyBlob, this._options)
  169. } else if (this._bodyFormData) {
  170. throw new Error('could not read FormData body as text')
  171. } else {
  172. return Promise.resolve(this._bodyText)
  173. }
  174. }
  175. } else {
  176. this.text = function() {
  177. var rejected = consumed(this)
  178. return rejected ? rejected : Promise.resolve(this._bodyText)
  179. }
  180. }
  181. if (support.formData) {
  182. this.formData = function() {
  183. return this.text().then(decode)
  184. }
  185. }
  186. this.json = function() {
  187. return this.text().then(JSON.parse)
  188. }
  189. return this
  190. }
  191. // HTTP methods whose capitalization should be normalized
  192. var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
  193. function normalizeMethod(method) {
  194. var upcased = method.toUpperCase()
  195. return (methods.indexOf(upcased) > -1) ? upcased : method
  196. }
  197. function Request(input, options) {
  198. options = options || {}
  199. var body = options.body
  200. if (Request.prototype.isPrototypeOf(input)) {
  201. if (input.bodyUsed) {
  202. throw new TypeError('Already read')
  203. }
  204. this.url = input.url
  205. this.credentials = input.credentials
  206. if (!options.headers) {
  207. this.headers = new Headers(input.headers)
  208. }
  209. this.method = input.method
  210. this.mode = input.mode
  211. if (!body) {
  212. body = input._bodyInit
  213. input.bodyUsed = true
  214. }
  215. } else {
  216. this.url = input
  217. }
  218. this.credentials = options.credentials || this.credentials || 'omit'
  219. if (options.headers || !this.headers) {
  220. this.headers = new Headers(options.headers)
  221. }
  222. this.method = normalizeMethod(options.method || this.method || 'GET')
  223. this.mode = options.mode || this.mode || null
  224. this.referrer = null
  225. if ((this.method === 'GET' || this.method === 'HEAD') && body) {
  226. throw new TypeError('Body not allowed for GET or HEAD requests')
  227. }
  228. this._initBody(body, options)
  229. }
  230. Request.prototype.clone = function() {
  231. return new Request(this)
  232. }
  233. function decode(body) {
  234. var form = new FormData()
  235. body.trim().split('&').forEach(function(bytes) {
  236. if (bytes) {
  237. var split = bytes.split('=')
  238. var name = split.shift().replace(/\+/g, ' ')
  239. var value = split.join('=').replace(/\+/g, ' ')
  240. form.append(decodeURIComponent(name), decodeURIComponent(value))
  241. }
  242. })
  243. return form
  244. }
  245. function headers(xhr) {
  246. var head = new Headers()
  247. var pairs = xhr.getAllResponseHeaders().trim().split('\n')
  248. pairs.forEach(function(header) {
  249. var split = header.trim().split(':')
  250. var key = split.shift().trim()
  251. var value = split.join(':').trim()
  252. head.append(key, value)
  253. })
  254. return head
  255. }
  256. Body.call(Request.prototype)
  257. function Response(bodyInit, options) {
  258. if (!options) {
  259. options = {}
  260. }
  261. this._initBody(bodyInit, options)
  262. this.type = 'default'
  263. this.status = options.status
  264. this.ok = this.status >= 200 && this.status < 300
  265. this.statusText = options.statusText
  266. this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
  267. this.url = options.url || ''
  268. }
  269. Body.call(Response.prototype)
  270. Response.prototype.clone = function() {
  271. return new Response(this._bodyInit, {
  272. status: this.status,
  273. statusText: this.statusText,
  274. headers: new Headers(this.headers),
  275. url: this.url
  276. })
  277. }
  278. Response.error = function() {
  279. var response = new Response(null, {status: 0, statusText: ''})
  280. response.type = 'error'
  281. return response
  282. }
  283. var redirectStatuses = [301, 302, 303, 307, 308]
  284. Response.redirect = function(url, status) {
  285. if (redirectStatuses.indexOf(status) === -1) {
  286. throw new RangeError('Invalid status code')
  287. }
  288. return new Response(null, {status: status, headers: {location: url}})
  289. }
  290. self.Headers = Headers;
  291. self.Request = Request;
  292. self.Response = Response;
  293. self.fetch = function(input, init) {
  294. return new Promise(function(resolve, reject) {
  295. var request
  296. if (Request.prototype.isPrototypeOf(input) && !init) {
  297. request = input
  298. } else {
  299. request = new Request(input, init)
  300. }
  301. var xhr = new XMLHttpRequest()
  302. function responseURL() {
  303. if ('responseURL' in xhr) {
  304. return xhr.responseURL
  305. }
  306. // Avoid security warnings on getResponseHeader when not allowed by CORS
  307. if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
  308. return xhr.getResponseHeader('X-Request-URL')
  309. }
  310. return;
  311. }
  312. var __onLoadHandled = false;
  313. function onload() {
  314. if (xhr.readyState !== 4) {
  315. return
  316. }
  317. var status = (xhr.status === 1223) ? 204 : xhr.status
  318. if (status < 100 || status > 599) {
  319. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  320. reject(new TypeError('Network request failed'))
  321. return
  322. }
  323. var options = {
  324. status: status,
  325. statusText: xhr.statusText,
  326. headers: headers(xhr),
  327. url: responseURL()
  328. }
  329. var body = 'response' in xhr ? xhr.response : xhr.responseText;
  330. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  331. resolve(new Response(body, options))
  332. }
  333. xhr.onreadystatechange = onload;
  334. xhr.onload = onload;
  335. xhr.onerror = function() {
  336. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  337. reject(new TypeError('Network request failed'))
  338. }
  339. xhr.open(request.method, request.url, true)
  340. // `withCredentials` should be setted after calling `.open` in IE10
  341. // http://stackoverflow.com/a/19667959/1219343
  342. try {
  343. if (request.credentials === 'include') {
  344. if ('withCredentials' in xhr) {
  345. xhr.withCredentials = true;
  346. } else {
  347. console && console.warn && console.warn('withCredentials is not supported, you can ignore this warning');
  348. }
  349. }
  350. } catch (e) {
  351. console && console.warn && console.warn('set withCredentials error:' + e);
  352. }
  353. if ('responseType' in xhr && support.blob) {
  354. xhr.responseType = 'blob'
  355. }
  356. request.headers.forEach(function(value, name) {
  357. xhr.setRequestHeader(name, value)
  358. })
  359. xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
  360. })
  361. }
  362. self.fetch.polyfill = true
  363. // Support CommonJS
  364. if ( true && module.exports) {
  365. module.exports = self.fetch;
  366. }
  367. })(typeof self !== 'undefined' ? self : this);
  368. /***/ }),
  369. /***/ 144:
  370. /***/ (function(module, exports) {
  371. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  372. if (true) {
  373. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  374. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  375. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  376. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  377. } else { var mod; }
  378. })(this, function (exports, module) {
  379. 'use strict';
  380. var defaultOptions = {
  381. timeout: 5000,
  382. jsonpCallback: 'callback',
  383. jsonpCallbackFunction: null
  384. };
  385. function generateCallbackFunction() {
  386. return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);
  387. }
  388. function clearFunction(functionName) {
  389. // IE8 throws an exception when you try to delete a property on window
  390. // http://stackoverflow.com/a/1824228/751089
  391. try {
  392. delete window[functionName];
  393. } catch (e) {
  394. window[functionName] = undefined;
  395. }
  396. }
  397. function removeScript(scriptId) {
  398. var script = document.getElementById(scriptId);
  399. if (script) {
  400. document.getElementsByTagName('head')[0].removeChild(script);
  401. }
  402. }
  403. function fetchJsonp(_url) {
  404. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  405. // to avoid param reassign
  406. var url = _url;
  407. var timeout = options.timeout || defaultOptions.timeout;
  408. var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
  409. var timeoutId = undefined;
  410. return new Promise(function (resolve, reject) {
  411. var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
  412. var scriptId = jsonpCallback + '_' + callbackFunction;
  413. window[callbackFunction] = function (response) {
  414. resolve({
  415. ok: true,
  416. // keep consistent with fetch API
  417. json: function json() {
  418. return Promise.resolve(response);
  419. }
  420. });
  421. if (timeoutId) clearTimeout(timeoutId);
  422. removeScript(scriptId);
  423. clearFunction(callbackFunction);
  424. };
  425. // Check if the user set their own params, and if not add a ? to start a list of params
  426. url += url.indexOf('?') === -1 ? '?' : '&';
  427. var jsonpScript = document.createElement('script');
  428. jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);
  429. if (options.charset) {
  430. jsonpScript.setAttribute('charset', options.charset);
  431. }
  432. jsonpScript.id = scriptId;
  433. document.getElementsByTagName('head')[0].appendChild(jsonpScript);
  434. timeoutId = setTimeout(function () {
  435. reject(new Error('JSONP request to ' + _url + ' timed out'));
  436. clearFunction(callbackFunction);
  437. removeScript(scriptId);
  438. window[callbackFunction] = function () {
  439. clearFunction(callbackFunction);
  440. };
  441. }, timeout);
  442. // Caught if got 404/500
  443. jsonpScript.onerror = function () {
  444. reject(new Error('JSONP request to ' + _url + ' failed'));
  445. clearFunction(callbackFunction);
  446. removeScript(scriptId);
  447. if (timeoutId) clearTimeout(timeoutId);
  448. };
  449. });
  450. }
  451. // export as global function
  452. /*
  453. let local;
  454. if (typeof global !== 'undefined') {
  455. local = global;
  456. } else if (typeof self !== 'undefined') {
  457. local = self;
  458. } else {
  459. try {
  460. local = Function('return this')();
  461. } catch (e) {
  462. throw new Error('polyfill failed because global object is unavailable in this environment');
  463. }
  464. }
  465. local.fetchJsonp = fetchJsonp;
  466. */
  467. module.exports = fetchJsonp;
  468. });
  469. /***/ }),
  470. /***/ 962:
  471. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  472. "use strict";
  473. Object.defineProperty(exports, "__esModule", ({ value: true }));
  474. exports.Builder = void 0;
  475. var byte_buffer_js_1 = __webpack_require__(505);
  476. var constants_js_1 = __webpack_require__(147);
  477. var Builder = /** @class */ (function () {
  478. /**
  479. * Create a FlatBufferBuilder.
  480. */
  481. function Builder(opt_initial_size) {
  482. /** Minimum alignment encountered so far. */
  483. this.minalign = 1;
  484. /** The vtable for the current table. */
  485. this.vtable = null;
  486. /** The amount of fields we're actually using. */
  487. this.vtable_in_use = 0;
  488. /** Whether we are currently serializing a table. */
  489. this.isNested = false;
  490. /** Starting offset of the current struct/table. */
  491. this.object_start = 0;
  492. /** List of offsets of all vtables. */
  493. this.vtables = [];
  494. /** For the current vector being built. */
  495. this.vector_num_elems = 0;
  496. /** False omits default values from the serialized data */
  497. this.force_defaults = false;
  498. this.string_maps = null;
  499. var initial_size;
  500. if (!opt_initial_size) {
  501. initial_size = 1024;
  502. }
  503. else {
  504. initial_size = opt_initial_size;
  505. }
  506. /**
  507. * @type {ByteBuffer}
  508. * @private
  509. */
  510. this.bb = byte_buffer_js_1.ByteBuffer.allocate(initial_size);
  511. this.space = initial_size;
  512. }
  513. Builder.prototype.clear = function () {
  514. this.bb.clear();
  515. this.space = this.bb.capacity();
  516. this.minalign = 1;
  517. this.vtable = null;
  518. this.vtable_in_use = 0;
  519. this.isNested = false;
  520. this.object_start = 0;
  521. this.vtables = [];
  522. this.vector_num_elems = 0;
  523. this.force_defaults = false;
  524. this.string_maps = null;
  525. };
  526. /**
  527. * In order to save space, fields that are set to their default value
  528. * don't get serialized into the buffer. Forcing defaults provides a
  529. * way to manually disable this optimization.
  530. *
  531. * @param forceDefaults true always serializes default values
  532. */
  533. Builder.prototype.forceDefaults = function (forceDefaults) {
  534. this.force_defaults = forceDefaults;
  535. };
  536. /**
  537. * Get the ByteBuffer representing the FlatBuffer. Only call this after you've
  538. * called finish(). The actual data starts at the ByteBuffer's current position,
  539. * not necessarily at 0.
  540. */
  541. Builder.prototype.dataBuffer = function () {
  542. return this.bb;
  543. };
  544. /**
  545. * Get the bytes representing the FlatBuffer. Only call this after you've
  546. * called finish().
  547. */
  548. Builder.prototype.asUint8Array = function () {
  549. return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
  550. };
  551. /**
  552. * Prepare to write an element of `size` after `additional_bytes` have been
  553. * written, e.g. if you write a string, you need to align such the int length
  554. * field is aligned to 4 bytes, and the string data follows it directly. If all
  555. * you need to do is alignment, `additional_bytes` will be 0.
  556. *
  557. * @param size This is the of the new element to write
  558. * @param additional_bytes The padding size
  559. */
  560. Builder.prototype.prep = function (size, additional_bytes) {
  561. // Track the biggest thing we've ever aligned to.
  562. if (size > this.minalign) {
  563. this.minalign = size;
  564. }
  565. // Find the amount of alignment needed such that `size` is properly
  566. // aligned after `additional_bytes`
  567. var align_size = ((~(this.bb.capacity() - this.space + additional_bytes)) + 1) & (size - 1);
  568. // Reallocate the buffer if needed.
  569. while (this.space < align_size + size + additional_bytes) {
  570. var old_buf_size = this.bb.capacity();
  571. this.bb = Builder.growByteBuffer(this.bb);
  572. this.space += this.bb.capacity() - old_buf_size;
  573. }
  574. this.pad(align_size);
  575. };
  576. Builder.prototype.pad = function (byte_size) {
  577. for (var i = 0; i < byte_size; i++) {
  578. this.bb.writeInt8(--this.space, 0);
  579. }
  580. };
  581. Builder.prototype.writeInt8 = function (value) {
  582. this.bb.writeInt8(this.space -= 1, value);
  583. };
  584. Builder.prototype.writeInt16 = function (value) {
  585. this.bb.writeInt16(this.space -= 2, value);
  586. };
  587. Builder.prototype.writeInt32 = function (value) {
  588. this.bb.writeInt32(this.space -= 4, value);
  589. };
  590. Builder.prototype.writeInt64 = function (value) {
  591. this.bb.writeInt64(this.space -= 8, value);
  592. };
  593. Builder.prototype.writeFloat32 = function (value) {
  594. this.bb.writeFloat32(this.space -= 4, value);
  595. };
  596. Builder.prototype.writeFloat64 = function (value) {
  597. this.bb.writeFloat64(this.space -= 8, value);
  598. };
  599. /**
  600. * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
  601. * @param value The `int8` to add the the buffer.
  602. */
  603. Builder.prototype.addInt8 = function (value) {
  604. this.prep(1, 0);
  605. this.writeInt8(value);
  606. };
  607. /**
  608. * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
  609. * @param value The `int16` to add the the buffer.
  610. */
  611. Builder.prototype.addInt16 = function (value) {
  612. this.prep(2, 0);
  613. this.writeInt16(value);
  614. };
  615. /**
  616. * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
  617. * @param value The `int32` to add the the buffer.
  618. */
  619. Builder.prototype.addInt32 = function (value) {
  620. this.prep(4, 0);
  621. this.writeInt32(value);
  622. };
  623. /**
  624. * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
  625. * @param value The `int64` to add the the buffer.
  626. */
  627. Builder.prototype.addInt64 = function (value) {
  628. this.prep(8, 0);
  629. this.writeInt64(value);
  630. };
  631. /**
  632. * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
  633. * @param value The `float32` to add the the buffer.
  634. */
  635. Builder.prototype.addFloat32 = function (value) {
  636. this.prep(4, 0);
  637. this.writeFloat32(value);
  638. };
  639. /**
  640. * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
  641. * @param value The `float64` to add the the buffer.
  642. */
  643. Builder.prototype.addFloat64 = function (value) {
  644. this.prep(8, 0);
  645. this.writeFloat64(value);
  646. };
  647. Builder.prototype.addFieldInt8 = function (voffset, value, defaultValue) {
  648. if (this.force_defaults || value != defaultValue) {
  649. this.addInt8(value);
  650. this.slot(voffset);
  651. }
  652. };
  653. Builder.prototype.addFieldInt16 = function (voffset, value, defaultValue) {
  654. if (this.force_defaults || value != defaultValue) {
  655. this.addInt16(value);
  656. this.slot(voffset);
  657. }
  658. };
  659. Builder.prototype.addFieldInt32 = function (voffset, value, defaultValue) {
  660. if (this.force_defaults || value != defaultValue) {
  661. this.addInt32(value);
  662. this.slot(voffset);
  663. }
  664. };
  665. Builder.prototype.addFieldInt64 = function (voffset, value, defaultValue) {
  666. if (this.force_defaults || value !== defaultValue) {
  667. this.addInt64(value);
  668. this.slot(voffset);
  669. }
  670. };
  671. Builder.prototype.addFieldFloat32 = function (voffset, value, defaultValue) {
  672. if (this.force_defaults || value != defaultValue) {
  673. this.addFloat32(value);
  674. this.slot(voffset);
  675. }
  676. };
  677. Builder.prototype.addFieldFloat64 = function (voffset, value, defaultValue) {
  678. if (this.force_defaults || value != defaultValue) {
  679. this.addFloat64(value);
  680. this.slot(voffset);
  681. }
  682. };
  683. Builder.prototype.addFieldOffset = function (voffset, value, defaultValue) {
  684. if (this.force_defaults || value != defaultValue) {
  685. this.addOffset(value);
  686. this.slot(voffset);
  687. }
  688. };
  689. /**
  690. * Structs are stored inline, so nothing additional is being added. `d` is always 0.
  691. */
  692. Builder.prototype.addFieldStruct = function (voffset, value, defaultValue) {
  693. if (value != defaultValue) {
  694. this.nested(value);
  695. this.slot(voffset);
  696. }
  697. };
  698. /**
  699. * Structures are always stored inline, they need to be created right
  700. * where they're used. You'll get this assertion failure if you
  701. * created it elsewhere.
  702. */
  703. Builder.prototype.nested = function (obj) {
  704. if (obj != this.offset()) {
  705. throw new Error('FlatBuffers: struct must be serialized inline.');
  706. }
  707. };
  708. /**
  709. * Should not be creating any other object, string or vector
  710. * while an object is being constructed
  711. */
  712. Builder.prototype.notNested = function () {
  713. if (this.isNested) {
  714. throw new Error('FlatBuffers: object serialization must not be nested.');
  715. }
  716. };
  717. /**
  718. * Set the current vtable at `voffset` to the current location in the buffer.
  719. */
  720. Builder.prototype.slot = function (voffset) {
  721. if (this.vtable !== null)
  722. this.vtable[voffset] = this.offset();
  723. };
  724. /**
  725. * @returns Offset relative to the end of the buffer.
  726. */
  727. Builder.prototype.offset = function () {
  728. return this.bb.capacity() - this.space;
  729. };
  730. /**
  731. * Doubles the size of the backing ByteBuffer and copies the old data towards
  732. * the end of the new buffer (since we build the buffer backwards).
  733. *
  734. * @param bb The current buffer with the existing data
  735. * @returns A new byte buffer with the old data copied
  736. * to it. The data is located at the end of the buffer.
  737. *
  738. * uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
  739. * it a uint8Array we need to suppress the type check:
  740. * @suppress {checkTypes}
  741. */
  742. Builder.growByteBuffer = function (bb) {
  743. var old_buf_size = bb.capacity();
  744. // Ensure we don't grow beyond what fits in an int.
  745. if (old_buf_size & 0xC0000000) {
  746. throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');
  747. }
  748. var new_buf_size = old_buf_size << 1;
  749. var nbb = byte_buffer_js_1.ByteBuffer.allocate(new_buf_size);
  750. nbb.setPosition(new_buf_size - old_buf_size);
  751. nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
  752. return nbb;
  753. };
  754. /**
  755. * Adds on offset, relative to where it will be written.
  756. *
  757. * @param offset The offset to add.
  758. */
  759. Builder.prototype.addOffset = function (offset) {
  760. this.prep(constants_js_1.SIZEOF_INT, 0); // Ensure alignment is already done.
  761. this.writeInt32(this.offset() - offset + constants_js_1.SIZEOF_INT);
  762. };
  763. /**
  764. * Start encoding a new object in the buffer. Users will not usually need to
  765. * call this directly. The FlatBuffers compiler will generate helper methods
  766. * that call this method internally.
  767. */
  768. Builder.prototype.startObject = function (numfields) {
  769. this.notNested();
  770. if (this.vtable == null) {
  771. this.vtable = [];
  772. }
  773. this.vtable_in_use = numfields;
  774. for (var i = 0; i < numfields; i++) {
  775. this.vtable[i] = 0; // This will push additional elements as needed
  776. }
  777. this.isNested = true;
  778. this.object_start = this.offset();
  779. };
  780. /**
  781. * Finish off writing the object that is under construction.
  782. *
  783. * @returns The offset to the object inside `dataBuffer`
  784. */
  785. Builder.prototype.endObject = function () {
  786. if (this.vtable == null || !this.isNested) {
  787. throw new Error('FlatBuffers: endObject called without startObject');
  788. }
  789. this.addInt32(0);
  790. var vtableloc = this.offset();
  791. // Trim trailing zeroes.
  792. var i = this.vtable_in_use - 1;
  793. // eslint-disable-next-line no-empty
  794. for (; i >= 0 && this.vtable[i] == 0; i--) { }
  795. var trimmed_size = i + 1;
  796. // Write out the current vtable.
  797. for (; i >= 0; i--) {
  798. // Offset relative to the start of the table.
  799. this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);
  800. }
  801. var standard_fields = 2; // The fields below:
  802. this.addInt16(vtableloc - this.object_start);
  803. var len = (trimmed_size + standard_fields) * constants_js_1.SIZEOF_SHORT;
  804. this.addInt16(len);
  805. // Search for an existing vtable that matches the current one.
  806. var existing_vtable = 0;
  807. var vt1 = this.space;
  808. outer_loop: for (i = 0; i < this.vtables.length; i++) {
  809. var vt2 = this.bb.capacity() - this.vtables[i];
  810. if (len == this.bb.readInt16(vt2)) {
  811. for (var j = constants_js_1.SIZEOF_SHORT; j < len; j += constants_js_1.SIZEOF_SHORT) {
  812. if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {
  813. continue outer_loop;
  814. }
  815. }
  816. existing_vtable = this.vtables[i];
  817. break;
  818. }
  819. }
  820. if (existing_vtable) {
  821. // Found a match:
  822. // Remove the current vtable.
  823. this.space = this.bb.capacity() - vtableloc;
  824. // Point table to existing vtable.
  825. this.bb.writeInt32(this.space, existing_vtable - vtableloc);
  826. }
  827. else {
  828. // No match:
  829. // Add the location of the current vtable to the list of vtables.
  830. this.vtables.push(this.offset());
  831. // Point table to current vtable.
  832. this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);
  833. }
  834. this.isNested = false;
  835. return vtableloc;
  836. };
  837. /**
  838. * Finalize a buffer, poiting to the given `root_table`.
  839. */
  840. Builder.prototype.finish = function (root_table, opt_file_identifier, opt_size_prefix) {
  841. var size_prefix = opt_size_prefix ? constants_js_1.SIZE_PREFIX_LENGTH : 0;
  842. if (opt_file_identifier) {
  843. var file_identifier = opt_file_identifier;
  844. this.prep(this.minalign, constants_js_1.SIZEOF_INT +
  845. constants_js_1.FILE_IDENTIFIER_LENGTH + size_prefix);
  846. if (file_identifier.length != constants_js_1.FILE_IDENTIFIER_LENGTH) {
  847. throw new Error('FlatBuffers: file identifier must be length ' +
  848. constants_js_1.FILE_IDENTIFIER_LENGTH);
  849. }
  850. for (var i = constants_js_1.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {
  851. this.writeInt8(file_identifier.charCodeAt(i));
  852. }
  853. }
  854. this.prep(this.minalign, constants_js_1.SIZEOF_INT + size_prefix);
  855. this.addOffset(root_table);
  856. if (size_prefix) {
  857. this.addInt32(this.bb.capacity() - this.space);
  858. }
  859. this.bb.setPosition(this.space);
  860. };
  861. /**
  862. * Finalize a size prefixed buffer, pointing to the given `root_table`.
  863. */
  864. Builder.prototype.finishSizePrefixed = function (root_table, opt_file_identifier) {
  865. this.finish(root_table, opt_file_identifier, true);
  866. };
  867. /**
  868. * This checks a required field has been set in a given table that has
  869. * just been constructed.
  870. */
  871. Builder.prototype.requiredField = function (table, field) {
  872. var table_start = this.bb.capacity() - table;
  873. var vtable_start = table_start - this.bb.readInt32(table_start);
  874. var ok = this.bb.readInt16(vtable_start + field) != 0;
  875. // If this fails, the caller will show what field needs to be set.
  876. if (!ok) {
  877. throw new Error('FlatBuffers: field ' + field + ' must be set');
  878. }
  879. };
  880. /**
  881. * Start a new array/vector of objects. Users usually will not call
  882. * this directly. The FlatBuffers compiler will create a start/end
  883. * method for vector types in generated code.
  884. *
  885. * @param elem_size The size of each element in the array
  886. * @param num_elems The number of elements in the array
  887. * @param alignment The alignment of the array
  888. */
  889. Builder.prototype.startVector = function (elem_size, num_elems, alignment) {
  890. this.notNested();
  891. this.vector_num_elems = num_elems;
  892. this.prep(constants_js_1.SIZEOF_INT, elem_size * num_elems);
  893. this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.
  894. };
  895. /**
  896. * Finish off the creation of an array and all its elements. The array must be
  897. * created with `startVector`.
  898. *
  899. * @returns The offset at which the newly created array
  900. * starts.
  901. */
  902. Builder.prototype.endVector = function () {
  903. this.writeInt32(this.vector_num_elems);
  904. return this.offset();
  905. };
  906. /**
  907. * Encode the string `s` in the buffer using UTF-8. If the string passed has
  908. * already been seen, we return the offset of the already written string
  909. *
  910. * @param s The string to encode
  911. * @return The offset in the buffer where the encoded string starts
  912. */
  913. Builder.prototype.createSharedString = function (s) {
  914. if (!s) {
  915. return 0;
  916. }
  917. if (!this.string_maps) {
  918. this.string_maps = new Map();
  919. }
  920. if (this.string_maps.has(s)) {
  921. return this.string_maps.get(s);
  922. }
  923. var offset = this.createString(s);
  924. this.string_maps.set(s, offset);
  925. return offset;
  926. };
  927. /**
  928. * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
  929. * instead of a string, it is assumed to contain valid UTF-8 encoded data.
  930. *
  931. * @param s The string to encode
  932. * @return The offset in the buffer where the encoded string starts
  933. */
  934. Builder.prototype.createString = function (s) {
  935. if (s === null || s === undefined) {
  936. return 0;
  937. }
  938. var utf8;
  939. if (s instanceof Uint8Array) {
  940. utf8 = s;
  941. }
  942. else {
  943. utf8 = [];
  944. var i = 0;
  945. while (i < s.length) {
  946. var codePoint = void 0;
  947. // Decode UTF-16
  948. var a = s.charCodeAt(i++);
  949. if (a < 0xD800 || a >= 0xDC00) {
  950. codePoint = a;
  951. }
  952. else {
  953. var b = s.charCodeAt(i++);
  954. codePoint = (a << 10) + b + (0x10000 - (0xD800 << 10) - 0xDC00);
  955. }
  956. // Encode UTF-8
  957. if (codePoint < 0x80) {
  958. utf8.push(codePoint);
  959. }
  960. else {
  961. if (codePoint < 0x800) {
  962. utf8.push(((codePoint >> 6) & 0x1F) | 0xC0);
  963. }
  964. else {
  965. if (codePoint < 0x10000) {
  966. utf8.push(((codePoint >> 12) & 0x0F) | 0xE0);
  967. }
  968. else {
  969. utf8.push(((codePoint >> 18) & 0x07) | 0xF0, ((codePoint >> 12) & 0x3F) | 0x80);
  970. }
  971. utf8.push(((codePoint >> 6) & 0x3F) | 0x80);
  972. }
  973. utf8.push((codePoint & 0x3F) | 0x80);
  974. }
  975. }
  976. }
  977. this.addInt8(0);
  978. this.startVector(1, utf8.length, 1);
  979. this.bb.setPosition(this.space -= utf8.length);
  980. for (var i = 0, offset = this.space, bytes = this.bb.bytes(); i < utf8.length; i++) {
  981. bytes[offset++] = utf8[i];
  982. }
  983. return this.endVector();
  984. };
  985. /**
  986. * A helper function to pack an object
  987. *
  988. * @returns offset of obj
  989. */
  990. Builder.prototype.createObjectOffset = function (obj) {
  991. if (obj === null) {
  992. return 0;
  993. }
  994. if (typeof obj === 'string') {
  995. return this.createString(obj);
  996. }
  997. else {
  998. return obj.pack(this);
  999. }
  1000. };
  1001. /**
  1002. * A helper function to pack a list of object
  1003. *
  1004. * @returns list of offsets of each non null object
  1005. */
  1006. Builder.prototype.createObjectOffsetList = function (list) {
  1007. var ret = [];
  1008. for (var i = 0; i < list.length; ++i) {
  1009. var val = list[i];
  1010. if (val !== null) {
  1011. ret.push(this.createObjectOffset(val));
  1012. }
  1013. else {
  1014. throw new Error('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
  1015. }
  1016. }
  1017. return ret;
  1018. };
  1019. Builder.prototype.createStructOffsetList = function (list, startFunc) {
  1020. startFunc(this, list.length);
  1021. this.createObjectOffsetList(list);
  1022. return this.endVector();
  1023. };
  1024. return Builder;
  1025. }());
  1026. exports.Builder = Builder;
  1027. /***/ }),
  1028. /***/ 505:
  1029. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1030. "use strict";
  1031. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1032. exports.ByteBuffer = void 0;
  1033. var constants_js_1 = __webpack_require__(147);
  1034. var utils_js_1 = __webpack_require__(766);
  1035. var encoding_js_1 = __webpack_require__(650);
  1036. var ByteBuffer = /** @class */ (function () {
  1037. /**
  1038. * Create a new ByteBuffer with a given array of bytes (`Uint8Array`)
  1039. */
  1040. function ByteBuffer(bytes_) {
  1041. this.bytes_ = bytes_;
  1042. this.position_ = 0;
  1043. }
  1044. /**
  1045. * Create and allocate a new ByteBuffer with a given size.
  1046. */
  1047. ByteBuffer.allocate = function (byte_size) {
  1048. return new ByteBuffer(new Uint8Array(byte_size));
  1049. };
  1050. ByteBuffer.prototype.clear = function () {
  1051. this.position_ = 0;
  1052. };
  1053. /**
  1054. * Get the underlying `Uint8Array`.
  1055. */
  1056. ByteBuffer.prototype.bytes = function () {
  1057. return this.bytes_;
  1058. };
  1059. /**
  1060. * Get the buffer's position.
  1061. */
  1062. ByteBuffer.prototype.position = function () {
  1063. return this.position_;
  1064. };
  1065. /**
  1066. * Set the buffer's position.
  1067. */
  1068. ByteBuffer.prototype.setPosition = function (position) {
  1069. this.position_ = position;
  1070. };
  1071. /**
  1072. * Get the buffer's capacity.
  1073. */
  1074. ByteBuffer.prototype.capacity = function () {
  1075. return this.bytes_.length;
  1076. };
  1077. ByteBuffer.prototype.readInt8 = function (offset) {
  1078. return this.readUint8(offset) << 24 >> 24;
  1079. };
  1080. ByteBuffer.prototype.readUint8 = function (offset) {
  1081. return this.bytes_[offset];
  1082. };
  1083. ByteBuffer.prototype.readInt16 = function (offset) {
  1084. return this.readUint16(offset) << 16 >> 16;
  1085. };
  1086. ByteBuffer.prototype.readUint16 = function (offset) {
  1087. return this.bytes_[offset] | this.bytes_[offset + 1] << 8;
  1088. };
  1089. ByteBuffer.prototype.readInt32 = function (offset) {
  1090. return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;
  1091. };
  1092. ByteBuffer.prototype.readUint32 = function (offset) {
  1093. return this.readInt32(offset) >>> 0;
  1094. };
  1095. ByteBuffer.prototype.readInt64 = function (offset) {
  1096. return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
  1097. };
  1098. ByteBuffer.prototype.readUint64 = function (offset) {
  1099. return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
  1100. };
  1101. ByteBuffer.prototype.readFloat32 = function (offset) {
  1102. utils_js_1.int32[0] = this.readInt32(offset);
  1103. return utils_js_1.float32[0];
  1104. };
  1105. ByteBuffer.prototype.readFloat64 = function (offset) {
  1106. utils_js_1.int32[utils_js_1.isLittleEndian ? 0 : 1] = this.readInt32(offset);
  1107. utils_js_1.int32[utils_js_1.isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);
  1108. return utils_js_1.float64[0];
  1109. };
  1110. ByteBuffer.prototype.writeInt8 = function (offset, value) {
  1111. this.bytes_[offset] = value;
  1112. };
  1113. ByteBuffer.prototype.writeUint8 = function (offset, value) {
  1114. this.bytes_[offset] = value;
  1115. };
  1116. ByteBuffer.prototype.writeInt16 = function (offset, value) {
  1117. this.bytes_[offset] = value;
  1118. this.bytes_[offset + 1] = value >> 8;
  1119. };
  1120. ByteBuffer.prototype.writeUint16 = function (offset, value) {
  1121. this.bytes_[offset] = value;
  1122. this.bytes_[offset + 1] = value >> 8;
  1123. };
  1124. ByteBuffer.prototype.writeInt32 = function (offset, value) {
  1125. this.bytes_[offset] = value;
  1126. this.bytes_[offset + 1] = value >> 8;
  1127. this.bytes_[offset + 2] = value >> 16;
  1128. this.bytes_[offset + 3] = value >> 24;
  1129. };
  1130. ByteBuffer.prototype.writeUint32 = function (offset, value) {
  1131. this.bytes_[offset] = value;
  1132. this.bytes_[offset + 1] = value >> 8;
  1133. this.bytes_[offset + 2] = value >> 16;
  1134. this.bytes_[offset + 3] = value >> 24;
  1135. };
  1136. ByteBuffer.prototype.writeInt64 = function (offset, value) {
  1137. this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
  1138. this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
  1139. };
  1140. ByteBuffer.prototype.writeUint64 = function (offset, value) {
  1141. this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
  1142. this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
  1143. };
  1144. ByteBuffer.prototype.writeFloat32 = function (offset, value) {
  1145. utils_js_1.float32[0] = value;
  1146. this.writeInt32(offset, utils_js_1.int32[0]);
  1147. };
  1148. ByteBuffer.prototype.writeFloat64 = function (offset, value) {
  1149. utils_js_1.float64[0] = value;
  1150. this.writeInt32(offset, utils_js_1.int32[utils_js_1.isLittleEndian ? 0 : 1]);
  1151. this.writeInt32(offset + 4, utils_js_1.int32[utils_js_1.isLittleEndian ? 1 : 0]);
  1152. };
  1153. /**
  1154. * Return the file identifier. Behavior is undefined for FlatBuffers whose
  1155. * schema does not include a file_identifier (likely points at padding or the
  1156. * start of a the root vtable).
  1157. */
  1158. ByteBuffer.prototype.getBufferIdentifier = function () {
  1159. if (this.bytes_.length < this.position_ + constants_js_1.SIZEOF_INT +
  1160. constants_js_1.FILE_IDENTIFIER_LENGTH) {
  1161. throw new Error('FlatBuffers: ByteBuffer is too short to contain an identifier.');
  1162. }
  1163. var result = "";
  1164. for (var i = 0; i < constants_js_1.FILE_IDENTIFIER_LENGTH; i++) {
  1165. result += String.fromCharCode(this.readInt8(this.position_ + constants_js_1.SIZEOF_INT + i));
  1166. }
  1167. return result;
  1168. };
  1169. /**
  1170. * Look up a field in the vtable, return an offset into the object, or 0 if the
  1171. * field is not present.
  1172. */
  1173. ByteBuffer.prototype.__offset = function (bb_pos, vtable_offset) {
  1174. var vtable = bb_pos - this.readInt32(bb_pos);
  1175. return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;
  1176. };
  1177. /**
  1178. * Initialize any Table-derived type to point to the union at the given offset.
  1179. */
  1180. ByteBuffer.prototype.__union = function (t, offset) {
  1181. t.bb_pos = offset + this.readInt32(offset);
  1182. t.bb = this;
  1183. return t;
  1184. };
  1185. /**
  1186. * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
  1187. * This allocates a new string and converts to wide chars upon each access.
  1188. *
  1189. * To avoid the conversion to UTF-16, pass Encoding.UTF8_BYTES as
  1190. * the "optionalEncoding" argument. This is useful for avoiding conversion to
  1191. * and from UTF-16 when the data will just be packaged back up in another
  1192. * FlatBuffer later on.
  1193. *
  1194. * @param offset
  1195. * @param opt_encoding Defaults to UTF16_STRING
  1196. */
  1197. ByteBuffer.prototype.__string = function (offset, opt_encoding) {
  1198. offset += this.readInt32(offset);
  1199. var length = this.readInt32(offset);
  1200. var result = '';
  1201. var i = 0;
  1202. offset += constants_js_1.SIZEOF_INT;
  1203. if (opt_encoding === encoding_js_1.Encoding.UTF8_BYTES) {
  1204. return this.bytes_.subarray(offset, offset + length);
  1205. }
  1206. while (i < length) {
  1207. var codePoint = void 0;
  1208. // Decode UTF-8
  1209. var a = this.readUint8(offset + i++);
  1210. if (a < 0xC0) {
  1211. codePoint = a;
  1212. }
  1213. else {
  1214. var b = this.readUint8(offset + i++);
  1215. if (a < 0xE0) {
  1216. codePoint =
  1217. ((a & 0x1F) << 6) |
  1218. (b & 0x3F);
  1219. }
  1220. else {
  1221. var c = this.readUint8(offset + i++);
  1222. if (a < 0xF0) {
  1223. codePoint =
  1224. ((a & 0x0F) << 12) |
  1225. ((b & 0x3F) << 6) |
  1226. (c & 0x3F);
  1227. }
  1228. else {
  1229. var d = this.readUint8(offset + i++);
  1230. codePoint =
  1231. ((a & 0x07) << 18) |
  1232. ((b & 0x3F) << 12) |
  1233. ((c & 0x3F) << 6) |
  1234. (d & 0x3F);
  1235. }
  1236. }
  1237. }
  1238. // Encode UTF-16
  1239. if (codePoint < 0x10000) {
  1240. result += String.fromCharCode(codePoint);
  1241. }
  1242. else {
  1243. codePoint -= 0x10000;
  1244. result += String.fromCharCode((codePoint >> 10) + 0xD800, (codePoint & ((1 << 10) - 1)) + 0xDC00);
  1245. }
  1246. }
  1247. return result;
  1248. };
  1249. /**
  1250. * Handle unions that can contain string as its member, if a Table-derived type then initialize it,
  1251. * if a string then return a new one
  1252. *
  1253. * WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
  1254. * makes the behaviour of __union_with_string different compared to __union
  1255. */
  1256. ByteBuffer.prototype.__union_with_string = function (o, offset) {
  1257. if (typeof o === 'string') {
  1258. return this.__string(offset);
  1259. }
  1260. return this.__union(o, offset);
  1261. };
  1262. /**
  1263. * Retrieve the relative offset stored at "offset"
  1264. */
  1265. ByteBuffer.prototype.__indirect = function (offset) {
  1266. return offset + this.readInt32(offset);
  1267. };
  1268. /**
  1269. * Get the start of data of a vector whose offset is stored at "offset" in this object.
  1270. */
  1271. ByteBuffer.prototype.__vector = function (offset) {
  1272. return offset + this.readInt32(offset) + constants_js_1.SIZEOF_INT; // data starts after the length
  1273. };
  1274. /**
  1275. * Get the length of a vector whose offset is stored at "offset" in this object.
  1276. */
  1277. ByteBuffer.prototype.__vector_len = function (offset) {
  1278. return this.readInt32(offset + this.readInt32(offset));
  1279. };
  1280. ByteBuffer.prototype.__has_identifier = function (ident) {
  1281. if (ident.length != constants_js_1.FILE_IDENTIFIER_LENGTH) {
  1282. throw new Error('FlatBuffers: file identifier must be length ' +
  1283. constants_js_1.FILE_IDENTIFIER_LENGTH);
  1284. }
  1285. for (var i = 0; i < constants_js_1.FILE_IDENTIFIER_LENGTH; i++) {
  1286. if (ident.charCodeAt(i) != this.readInt8(this.position() + constants_js_1.SIZEOF_INT + i)) {
  1287. return false;
  1288. }
  1289. }
  1290. return true;
  1291. };
  1292. /**
  1293. * A helper function for generating list for obj api
  1294. */
  1295. ByteBuffer.prototype.createScalarList = function (listAccessor, listLength) {
  1296. var ret = [];
  1297. for (var i = 0; i < listLength; ++i) {
  1298. if (listAccessor(i) !== null) {
  1299. ret.push(listAccessor(i));
  1300. }
  1301. }
  1302. return ret;
  1303. };
  1304. /**
  1305. * A helper function for generating list for obj api
  1306. * @param listAccessor function that accepts an index and return data at that index
  1307. * @param listLength listLength
  1308. * @param res result list
  1309. */
  1310. ByteBuffer.prototype.createObjList = function (listAccessor, listLength) {
  1311. var ret = [];
  1312. for (var i = 0; i < listLength; ++i) {
  1313. var val = listAccessor(i);
  1314. if (val !== null) {
  1315. ret.push(val.unpack());
  1316. }
  1317. }
  1318. return ret;
  1319. };
  1320. return ByteBuffer;
  1321. }());
  1322. exports.ByteBuffer = ByteBuffer;
  1323. /***/ }),
  1324. /***/ 147:
  1325. /***/ ((__unused_webpack_module, exports) => {
  1326. "use strict";
  1327. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1328. exports.SIZE_PREFIX_LENGTH = exports.FILE_IDENTIFIER_LENGTH = exports.SIZEOF_INT = exports.SIZEOF_SHORT = void 0;
  1329. exports.SIZEOF_SHORT = 2;
  1330. exports.SIZEOF_INT = 4;
  1331. exports.FILE_IDENTIFIER_LENGTH = 4;
  1332. exports.SIZE_PREFIX_LENGTH = 4;
  1333. /***/ }),
  1334. /***/ 650:
  1335. /***/ ((__unused_webpack_module, exports) => {
  1336. "use strict";
  1337. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1338. exports.Encoding = void 0;
  1339. var Encoding;
  1340. (function (Encoding) {
  1341. Encoding[Encoding["UTF8_BYTES"] = 1] = "UTF8_BYTES";
  1342. Encoding[Encoding["UTF16_STRING"] = 2] = "UTF16_STRING";
  1343. })(Encoding = exports.Encoding || (exports.Encoding = {}));
  1344. /***/ }),
  1345. /***/ 903:
  1346. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  1347. "use strict";
  1348. var __webpack_unused_export__;
  1349. __webpack_unused_export__ = ({ value: true });
  1350. exports.cZ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.XU = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = void 0;
  1351. var constants_js_1 = __webpack_require__(147);
  1352. __webpack_unused_export__ = ({ enumerable: true, get: function () { return constants_js_1.SIZEOF_SHORT; } });
  1353. var constants_js_2 = __webpack_require__(147);
  1354. __webpack_unused_export__ = ({ enumerable: true, get: function () { return constants_js_2.SIZEOF_INT; } });
  1355. var constants_js_3 = __webpack_require__(147);
  1356. __webpack_unused_export__ = ({ enumerable: true, get: function () { return constants_js_3.FILE_IDENTIFIER_LENGTH; } });
  1357. var constants_js_4 = __webpack_require__(147);
  1358. Object.defineProperty(exports, "XU", ({ enumerable: true, get: function () { return constants_js_4.SIZE_PREFIX_LENGTH; } }));
  1359. var utils_js_1 = __webpack_require__(766);
  1360. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.int32; } });
  1361. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.float32; } });
  1362. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.float64; } });
  1363. __webpack_unused_export__ = ({ enumerable: true, get: function () { return utils_js_1.isLittleEndian; } });
  1364. var encoding_js_1 = __webpack_require__(650);
  1365. __webpack_unused_export__ = ({ enumerable: true, get: function () { return encoding_js_1.Encoding; } });
  1366. var builder_js_1 = __webpack_require__(962);
  1367. __webpack_unused_export__ = ({ enumerable: true, get: function () { return builder_js_1.Builder; } });
  1368. var byte_buffer_js_1 = __webpack_require__(505);
  1369. Object.defineProperty(exports, "cZ", ({ enumerable: true, get: function () { return byte_buffer_js_1.ByteBuffer; } }));
  1370. /***/ }),
  1371. /***/ 766:
  1372. /***/ ((__unused_webpack_module, exports) => {
  1373. "use strict";
  1374. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1375. exports.isLittleEndian = exports.float64 = exports.float32 = exports.int32 = void 0;
  1376. exports.int32 = new Int32Array(2);
  1377. exports.float32 = new Float32Array(exports.int32.buffer);
  1378. exports.float64 = new Float64Array(exports.int32.buffer);
  1379. exports.isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;
  1380. /***/ }),
  1381. /***/ 186:
  1382. /***/ ((module) => {
  1383. var containers = []; // will store container HTMLElement references
  1384. var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
  1385. var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
  1386. function insertCss(css, options) {
  1387. options = options || {};
  1388. if (css === undefined) {
  1389. throw new Error(usage);
  1390. }
  1391. var position = options.prepend === true ? 'prepend' : 'append';
  1392. var container = options.container !== undefined ? options.container : document.querySelector('head');
  1393. var containerId = containers.indexOf(container);
  1394. // first time we see this container, create the necessary entries
  1395. if (containerId === -1) {
  1396. containerId = containers.push(container) - 1;
  1397. styleElements[containerId] = {};
  1398. }
  1399. // try to get the correponding container + position styleElement, create it otherwise
  1400. var styleElement;
  1401. if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
  1402. styleElement = styleElements[containerId][position];
  1403. } else {
  1404. styleElement = styleElements[containerId][position] = createStyleElement();
  1405. if (position === 'prepend') {
  1406. container.insertBefore(styleElement, container.childNodes[0]);
  1407. } else {
  1408. container.appendChild(styleElement);
  1409. }
  1410. }
  1411. // strip potential UTF-8 BOM if css was read from a file
  1412. if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }
  1413. // actually add the stylesheet
  1414. if (styleElement.styleSheet) {
  1415. styleElement.styleSheet.cssText += css
  1416. } else {
  1417. styleElement.textContent += css;
  1418. }
  1419. return styleElement;
  1420. };
  1421. function createStyleElement() {
  1422. var styleElement = document.createElement('style');
  1423. styleElement.setAttribute('type', 'text/css');
  1424. return styleElement;
  1425. }
  1426. module.exports = insertCss;
  1427. module.exports.insertCss = insertCss;
  1428. /***/ }),
  1429. /***/ 465:
  1430. /***/ ((module, exports, __webpack_require__) => {
  1431. /* module decorator */ module = __webpack_require__.nmd(module);
  1432. /**
  1433. * lodash (Custom Build) <https://lodash.com/>
  1434. * Build: `lodash modularize exports="npm" -o ./`
  1435. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  1436. * Released under MIT license <https://lodash.com/license>
  1437. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1438. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1439. */
  1440. /** Used as the size to enable large array optimizations. */
  1441. var LARGE_ARRAY_SIZE = 200;
  1442. /** Used to stand-in for `undefined` hash values. */
  1443. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1444. /** Used as references for various `Number` constants. */
  1445. var MAX_SAFE_INTEGER = 9007199254740991;
  1446. /** `Object#toString` result references. */
  1447. var argsTag = '[object Arguments]',
  1448. arrayTag = '[object Array]',
  1449. boolTag = '[object Boolean]',
  1450. dateTag = '[object Date]',
  1451. errorTag = '[object Error]',
  1452. funcTag = '[object Function]',
  1453. genTag = '[object GeneratorFunction]',
  1454. mapTag = '[object Map]',
  1455. numberTag = '[object Number]',
  1456. objectTag = '[object Object]',
  1457. promiseTag = '[object Promise]',
  1458. regexpTag = '[object RegExp]',
  1459. setTag = '[object Set]',
  1460. stringTag = '[object String]',
  1461. symbolTag = '[object Symbol]',
  1462. weakMapTag = '[object WeakMap]';
  1463. var arrayBufferTag = '[object ArrayBuffer]',
  1464. dataViewTag = '[object DataView]',
  1465. float32Tag = '[object Float32Array]',
  1466. float64Tag = '[object Float64Array]',
  1467. int8Tag = '[object Int8Array]',
  1468. int16Tag = '[object Int16Array]',
  1469. int32Tag = '[object Int32Array]',
  1470. uint8Tag = '[object Uint8Array]',
  1471. uint8ClampedTag = '[object Uint8ClampedArray]',
  1472. uint16Tag = '[object Uint16Array]',
  1473. uint32Tag = '[object Uint32Array]';
  1474. /**
  1475. * Used to match `RegExp`
  1476. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1477. */
  1478. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  1479. /** Used to match `RegExp` flags from their coerced string values. */
  1480. var reFlags = /\w*$/;
  1481. /** Used to detect host constructors (Safari). */
  1482. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1483. /** Used to detect unsigned integer values. */
  1484. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1485. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1486. var cloneableTags = {};
  1487. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1488. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1489. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1490. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1491. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1492. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1493. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1494. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1495. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1496. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1497. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1498. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1499. cloneableTags[weakMapTag] = false;
  1500. /** Detect free variable `global` from Node.js. */
  1501. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  1502. /** Detect free variable `self`. */
  1503. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1504. /** Used as a reference to the global object. */
  1505. var root = freeGlobal || freeSelf || Function('return this')();
  1506. /** Detect free variable `exports`. */
  1507. var freeExports = true && exports && !exports.nodeType && exports;
  1508. /** Detect free variable `module`. */
  1509. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  1510. /** Detect the popular CommonJS extension `module.exports`. */
  1511. var moduleExports = freeModule && freeModule.exports === freeExports;
  1512. /**
  1513. * Adds the key-value `pair` to `map`.
  1514. *
  1515. * @private
  1516. * @param {Object} map The map to modify.
  1517. * @param {Array} pair The key-value pair to add.
  1518. * @returns {Object} Returns `map`.
  1519. */
  1520. function addMapEntry(map, pair) {
  1521. // Don't return `map.set` because it's not chainable in IE 11.
  1522. map.set(pair[0], pair[1]);
  1523. return map;
  1524. }
  1525. /**
  1526. * Adds `value` to `set`.
  1527. *
  1528. * @private
  1529. * @param {Object} set The set to modify.
  1530. * @param {*} value The value to add.
  1531. * @returns {Object} Returns `set`.
  1532. */
  1533. function addSetEntry(set, value) {
  1534. // Don't return `set.add` because it's not chainable in IE 11.
  1535. set.add(value);
  1536. return set;
  1537. }
  1538. /**
  1539. * A specialized version of `_.forEach` for arrays without support for
  1540. * iteratee shorthands.
  1541. *
  1542. * @private
  1543. * @param {Array} [array] The array to iterate over.
  1544. * @param {Function} iteratee The function invoked per iteration.
  1545. * @returns {Array} Returns `array`.
  1546. */
  1547. function arrayEach(array, iteratee) {
  1548. var index = -1,
  1549. length = array ? array.length : 0;
  1550. while (++index < length) {
  1551. if (iteratee(array[index], index, array) === false) {
  1552. break;
  1553. }
  1554. }
  1555. return array;
  1556. }
  1557. /**
  1558. * Appends the elements of `values` to `array`.
  1559. *
  1560. * @private
  1561. * @param {Array} array The array to modify.
  1562. * @param {Array} values The values to append.
  1563. * @returns {Array} Returns `array`.
  1564. */
  1565. function arrayPush(array, values) {
  1566. var index = -1,
  1567. length = values.length,
  1568. offset = array.length;
  1569. while (++index < length) {
  1570. array[offset + index] = values[index];
  1571. }
  1572. return array;
  1573. }
  1574. /**
  1575. * A specialized version of `_.reduce` for arrays without support for
  1576. * iteratee shorthands.
  1577. *
  1578. * @private
  1579. * @param {Array} [array] The array to iterate over.
  1580. * @param {Function} iteratee The function invoked per iteration.
  1581. * @param {*} [accumulator] The initial value.
  1582. * @param {boolean} [initAccum] Specify using the first element of `array` as
  1583. * the initial value.
  1584. * @returns {*} Returns the accumulated value.
  1585. */
  1586. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1587. var index = -1,
  1588. length = array ? array.length : 0;
  1589. if (initAccum && length) {
  1590. accumulator = array[++index];
  1591. }
  1592. while (++index < length) {
  1593. accumulator = iteratee(accumulator, array[index], index, array);
  1594. }
  1595. return accumulator;
  1596. }
  1597. /**
  1598. * The base implementation of `_.times` without support for iteratee shorthands
  1599. * or max array length checks.
  1600. *
  1601. * @private
  1602. * @param {number} n The number of times to invoke `iteratee`.
  1603. * @param {Function} iteratee The function invoked per iteration.
  1604. * @returns {Array} Returns the array of results.
  1605. */
  1606. function baseTimes(n, iteratee) {
  1607. var index = -1,
  1608. result = Array(n);
  1609. while (++index < n) {
  1610. result[index] = iteratee(index);
  1611. }
  1612. return result;
  1613. }
  1614. /**
  1615. * Gets the value at `key` of `object`.
  1616. *
  1617. * @private
  1618. * @param {Object} [object] The object to query.
  1619. * @param {string} key The key of the property to get.
  1620. * @returns {*} Returns the property value.
  1621. */
  1622. function getValue(object, key) {
  1623. return object == null ? undefined : object[key];
  1624. }
  1625. /**
  1626. * Checks if `value` is a host object in IE < 9.
  1627. *
  1628. * @private
  1629. * @param {*} value The value to check.
  1630. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  1631. */
  1632. function isHostObject(value) {
  1633. // Many host objects are `Object` objects that can coerce to strings
  1634. // despite having improperly defined `toString` methods.
  1635. var result = false;
  1636. if (value != null && typeof value.toString != 'function') {
  1637. try {
  1638. result = !!(value + '');
  1639. } catch (e) {}
  1640. }
  1641. return result;
  1642. }
  1643. /**
  1644. * Converts `map` to its key-value pairs.
  1645. *
  1646. * @private
  1647. * @param {Object} map The map to convert.
  1648. * @returns {Array} Returns the key-value pairs.
  1649. */
  1650. function mapToArray(map) {
  1651. var index = -1,
  1652. result = Array(map.size);
  1653. map.forEach(function(value, key) {
  1654. result[++index] = [key, value];
  1655. });
  1656. return result;
  1657. }
  1658. /**
  1659. * Creates a unary function that invokes `func` with its argument transformed.
  1660. *
  1661. * @private
  1662. * @param {Function} func The function to wrap.
  1663. * @param {Function} transform The argument transform.
  1664. * @returns {Function} Returns the new function.
  1665. */
  1666. function overArg(func, transform) {
  1667. return function(arg) {
  1668. return func(transform(arg));
  1669. };
  1670. }
  1671. /**
  1672. * Converts `set` to an array of its values.
  1673. *
  1674. * @private
  1675. * @param {Object} set The set to convert.
  1676. * @returns {Array} Returns the values.
  1677. */
  1678. function setToArray(set) {
  1679. var index = -1,
  1680. result = Array(set.size);
  1681. set.forEach(function(value) {
  1682. result[++index] = value;
  1683. });
  1684. return result;
  1685. }
  1686. /** Used for built-in method references. */
  1687. var arrayProto = Array.prototype,
  1688. funcProto = Function.prototype,
  1689. objectProto = Object.prototype;
  1690. /** Used to detect overreaching core-js shims. */
  1691. var coreJsData = root['__core-js_shared__'];
  1692. /** Used to detect methods masquerading as native. */
  1693. var maskSrcKey = (function() {
  1694. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  1695. return uid ? ('Symbol(src)_1.' + uid) : '';
  1696. }());
  1697. /** Used to resolve the decompiled source of functions. */
  1698. var funcToString = funcProto.toString;
  1699. /** Used to check objects for own properties. */
  1700. var hasOwnProperty = objectProto.hasOwnProperty;
  1701. /**
  1702. * Used to resolve the
  1703. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1704. * of values.
  1705. */
  1706. var objectToString = objectProto.toString;
  1707. /** Used to detect if a method is native. */
  1708. var reIsNative = RegExp('^' +
  1709. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  1710. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  1711. );
  1712. /** Built-in value references. */
  1713. var Buffer = moduleExports ? root.Buffer : undefined,
  1714. Symbol = root.Symbol,
  1715. Uint8Array = root.Uint8Array,
  1716. getPrototype = overArg(Object.getPrototypeOf, Object),
  1717. objectCreate = Object.create,
  1718. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  1719. splice = arrayProto.splice;
  1720. /* Built-in method references for those with the same name as other `lodash` methods. */
  1721. var nativeGetSymbols = Object.getOwnPropertySymbols,
  1722. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  1723. nativeKeys = overArg(Object.keys, Object);
  1724. /* Built-in method references that are verified to be native. */
  1725. var DataView = getNative(root, 'DataView'),
  1726. Map = getNative(root, 'Map'),
  1727. Promise = getNative(root, 'Promise'),
  1728. Set = getNative(root, 'Set'),
  1729. WeakMap = getNative(root, 'WeakMap'),
  1730. nativeCreate = getNative(Object, 'create');
  1731. /** Used to detect maps, sets, and weakmaps. */
  1732. var dataViewCtorString = toSource(DataView),
  1733. mapCtorString = toSource(Map),
  1734. promiseCtorString = toSource(Promise),
  1735. setCtorString = toSource(Set),
  1736. weakMapCtorString = toSource(WeakMap);
  1737. /** Used to convert symbols to primitives and strings. */
  1738. var symbolProto = Symbol ? Symbol.prototype : undefined,
  1739. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  1740. /**
  1741. * Creates a hash object.
  1742. *
  1743. * @private
  1744. * @constructor
  1745. * @param {Array} [entries] The key-value pairs to cache.
  1746. */
  1747. function Hash(entries) {
  1748. var index = -1,
  1749. length = entries ? entries.length : 0;
  1750. this.clear();
  1751. while (++index < length) {
  1752. var entry = entries[index];
  1753. this.set(entry[0], entry[1]);
  1754. }
  1755. }
  1756. /**
  1757. * Removes all key-value entries from the hash.
  1758. *
  1759. * @private
  1760. * @name clear
  1761. * @memberOf Hash
  1762. */
  1763. function hashClear() {
  1764. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1765. }
  1766. /**
  1767. * Removes `key` and its value from the hash.
  1768. *
  1769. * @private
  1770. * @name delete
  1771. * @memberOf Hash
  1772. * @param {Object} hash The hash to modify.
  1773. * @param {string} key The key of the value to remove.
  1774. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1775. */
  1776. function hashDelete(key) {
  1777. return this.has(key) && delete this.__data__[key];
  1778. }
  1779. /**
  1780. * Gets the hash value for `key`.
  1781. *
  1782. * @private
  1783. * @name get
  1784. * @memberOf Hash
  1785. * @param {string} key The key of the value to get.
  1786. * @returns {*} Returns the entry value.
  1787. */
  1788. function hashGet(key) {
  1789. var data = this.__data__;
  1790. if (nativeCreate) {
  1791. var result = data[key];
  1792. return result === HASH_UNDEFINED ? undefined : result;
  1793. }
  1794. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  1795. }
  1796. /**
  1797. * Checks if a hash value for `key` exists.
  1798. *
  1799. * @private
  1800. * @name has
  1801. * @memberOf Hash
  1802. * @param {string} key The key of the entry to check.
  1803. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1804. */
  1805. function hashHas(key) {
  1806. var data = this.__data__;
  1807. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  1808. }
  1809. /**
  1810. * Sets the hash `key` to `value`.
  1811. *
  1812. * @private
  1813. * @name set
  1814. * @memberOf Hash
  1815. * @param {string} key The key of the value to set.
  1816. * @param {*} value The value to set.
  1817. * @returns {Object} Returns the hash instance.
  1818. */
  1819. function hashSet(key, value) {
  1820. var data = this.__data__;
  1821. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  1822. return this;
  1823. }
  1824. // Add methods to `Hash`.
  1825. Hash.prototype.clear = hashClear;
  1826. Hash.prototype['delete'] = hashDelete;
  1827. Hash.prototype.get = hashGet;
  1828. Hash.prototype.has = hashHas;
  1829. Hash.prototype.set = hashSet;
  1830. /**
  1831. * Creates an list cache object.
  1832. *
  1833. * @private
  1834. * @constructor
  1835. * @param {Array} [entries] The key-value pairs to cache.
  1836. */
  1837. function ListCache(entries) {
  1838. var index = -1,
  1839. length = entries ? entries.length : 0;
  1840. this.clear();
  1841. while (++index < length) {
  1842. var entry = entries[index];
  1843. this.set(entry[0], entry[1]);
  1844. }
  1845. }
  1846. /**
  1847. * Removes all key-value entries from the list cache.
  1848. *
  1849. * @private
  1850. * @name clear
  1851. * @memberOf ListCache
  1852. */
  1853. function listCacheClear() {
  1854. this.__data__ = [];
  1855. }
  1856. /**
  1857. * Removes `key` and its value from the list cache.
  1858. *
  1859. * @private
  1860. * @name delete
  1861. * @memberOf ListCache
  1862. * @param {string} key The key of the value to remove.
  1863. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1864. */
  1865. function listCacheDelete(key) {
  1866. var data = this.__data__,
  1867. index = assocIndexOf(data, key);
  1868. if (index < 0) {
  1869. return false;
  1870. }
  1871. var lastIndex = data.length - 1;
  1872. if (index == lastIndex) {
  1873. data.pop();
  1874. } else {
  1875. splice.call(data, index, 1);
  1876. }
  1877. return true;
  1878. }
  1879. /**
  1880. * Gets the list cache value for `key`.
  1881. *
  1882. * @private
  1883. * @name get
  1884. * @memberOf ListCache
  1885. * @param {string} key The key of the value to get.
  1886. * @returns {*} Returns the entry value.
  1887. */
  1888. function listCacheGet(key) {
  1889. var data = this.__data__,
  1890. index = assocIndexOf(data, key);
  1891. return index < 0 ? undefined : data[index][1];
  1892. }
  1893. /**
  1894. * Checks if a list cache value for `key` exists.
  1895. *
  1896. * @private
  1897. * @name has
  1898. * @memberOf ListCache
  1899. * @param {string} key The key of the entry to check.
  1900. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1901. */
  1902. function listCacheHas(key) {
  1903. return assocIndexOf(this.__data__, key) > -1;
  1904. }
  1905. /**
  1906. * Sets the list cache `key` to `value`.
  1907. *
  1908. * @private
  1909. * @name set
  1910. * @memberOf ListCache
  1911. * @param {string} key The key of the value to set.
  1912. * @param {*} value The value to set.
  1913. * @returns {Object} Returns the list cache instance.
  1914. */
  1915. function listCacheSet(key, value) {
  1916. var data = this.__data__,
  1917. index = assocIndexOf(data, key);
  1918. if (index < 0) {
  1919. data.push([key, value]);
  1920. } else {
  1921. data[index][1] = value;
  1922. }
  1923. return this;
  1924. }
  1925. // Add methods to `ListCache`.
  1926. ListCache.prototype.clear = listCacheClear;
  1927. ListCache.prototype['delete'] = listCacheDelete;
  1928. ListCache.prototype.get = listCacheGet;
  1929. ListCache.prototype.has = listCacheHas;
  1930. ListCache.prototype.set = listCacheSet;
  1931. /**
  1932. * Creates a map cache object to store key-value pairs.
  1933. *
  1934. * @private
  1935. * @constructor
  1936. * @param {Array} [entries] The key-value pairs to cache.
  1937. */
  1938. function MapCache(entries) {
  1939. var index = -1,
  1940. length = entries ? entries.length : 0;
  1941. this.clear();
  1942. while (++index < length) {
  1943. var entry = entries[index];
  1944. this.set(entry[0], entry[1]);
  1945. }
  1946. }
  1947. /**
  1948. * Removes all key-value entries from the map.
  1949. *
  1950. * @private
  1951. * @name clear
  1952. * @memberOf MapCache
  1953. */
  1954. function mapCacheClear() {
  1955. this.__data__ = {
  1956. 'hash': new Hash,
  1957. 'map': new (Map || ListCache),
  1958. 'string': new Hash
  1959. };
  1960. }
  1961. /**
  1962. * Removes `key` and its value from the map.
  1963. *
  1964. * @private
  1965. * @name delete
  1966. * @memberOf MapCache
  1967. * @param {string} key The key of the value to remove.
  1968. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1969. */
  1970. function mapCacheDelete(key) {
  1971. return getMapData(this, key)['delete'](key);
  1972. }
  1973. /**
  1974. * Gets the map value for `key`.
  1975. *
  1976. * @private
  1977. * @name get
  1978. * @memberOf MapCache
  1979. * @param {string} key The key of the value to get.
  1980. * @returns {*} Returns the entry value.
  1981. */
  1982. function mapCacheGet(key) {
  1983. return getMapData(this, key).get(key);
  1984. }
  1985. /**
  1986. * Checks if a map value for `key` exists.
  1987. *
  1988. * @private
  1989. * @name has
  1990. * @memberOf MapCache
  1991. * @param {string} key The key of the entry to check.
  1992. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1993. */
  1994. function mapCacheHas(key) {
  1995. return getMapData(this, key).has(key);
  1996. }
  1997. /**
  1998. * Sets the map `key` to `value`.
  1999. *
  2000. * @private
  2001. * @name set
  2002. * @memberOf MapCache
  2003. * @param {string} key The key of the value to set.
  2004. * @param {*} value The value to set.
  2005. * @returns {Object} Returns the map cache instance.
  2006. */
  2007. function mapCacheSet(key, value) {
  2008. getMapData(this, key).set(key, value);
  2009. return this;
  2010. }
  2011. // Add methods to `MapCache`.
  2012. MapCache.prototype.clear = mapCacheClear;
  2013. MapCache.prototype['delete'] = mapCacheDelete;
  2014. MapCache.prototype.get = mapCacheGet;
  2015. MapCache.prototype.has = mapCacheHas;
  2016. MapCache.prototype.set = mapCacheSet;
  2017. /**
  2018. * Creates a stack cache object to store key-value pairs.
  2019. *
  2020. * @private
  2021. * @constructor
  2022. * @param {Array} [entries] The key-value pairs to cache.
  2023. */
  2024. function Stack(entries) {
  2025. this.__data__ = new ListCache(entries);
  2026. }
  2027. /**
  2028. * Removes all key-value entries from the stack.
  2029. *
  2030. * @private
  2031. * @name clear
  2032. * @memberOf Stack
  2033. */
  2034. function stackClear() {
  2035. this.__data__ = new ListCache;
  2036. }
  2037. /**
  2038. * Removes `key` and its value from the stack.
  2039. *
  2040. * @private
  2041. * @name delete
  2042. * @memberOf Stack
  2043. * @param {string} key The key of the value to remove.
  2044. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2045. */
  2046. function stackDelete(key) {
  2047. return this.__data__['delete'](key);
  2048. }
  2049. /**
  2050. * Gets the stack value for `key`.
  2051. *
  2052. * @private
  2053. * @name get
  2054. * @memberOf Stack
  2055. * @param {string} key The key of the value to get.
  2056. * @returns {*} Returns the entry value.
  2057. */
  2058. function stackGet(key) {
  2059. return this.__data__.get(key);
  2060. }
  2061. /**
  2062. * Checks if a stack value for `key` exists.
  2063. *
  2064. * @private
  2065. * @name has
  2066. * @memberOf Stack
  2067. * @param {string} key The key of the entry to check.
  2068. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2069. */
  2070. function stackHas(key) {
  2071. return this.__data__.has(key);
  2072. }
  2073. /**
  2074. * Sets the stack `key` to `value`.
  2075. *
  2076. * @private
  2077. * @name set
  2078. * @memberOf Stack
  2079. * @param {string} key The key of the value to set.
  2080. * @param {*} value The value to set.
  2081. * @returns {Object} Returns the stack cache instance.
  2082. */
  2083. function stackSet(key, value) {
  2084. var cache = this.__data__;
  2085. if (cache instanceof ListCache) {
  2086. var pairs = cache.__data__;
  2087. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  2088. pairs.push([key, value]);
  2089. return this;
  2090. }
  2091. cache = this.__data__ = new MapCache(pairs);
  2092. }
  2093. cache.set(key, value);
  2094. return this;
  2095. }
  2096. // Add methods to `Stack`.
  2097. Stack.prototype.clear = stackClear;
  2098. Stack.prototype['delete'] = stackDelete;
  2099. Stack.prototype.get = stackGet;
  2100. Stack.prototype.has = stackHas;
  2101. Stack.prototype.set = stackSet;
  2102. /**
  2103. * Creates an array of the enumerable property names of the array-like `value`.
  2104. *
  2105. * @private
  2106. * @param {*} value The value to query.
  2107. * @param {boolean} inherited Specify returning inherited property names.
  2108. * @returns {Array} Returns the array of property names.
  2109. */
  2110. function arrayLikeKeys(value, inherited) {
  2111. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  2112. // Safari 9 makes `arguments.length` enumerable in strict mode.
  2113. var result = (isArray(value) || isArguments(value))
  2114. ? baseTimes(value.length, String)
  2115. : [];
  2116. var length = result.length,
  2117. skipIndexes = !!length;
  2118. for (var key in value) {
  2119. if ((inherited || hasOwnProperty.call(value, key)) &&
  2120. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  2121. result.push(key);
  2122. }
  2123. }
  2124. return result;
  2125. }
  2126. /**
  2127. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  2128. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2129. * for equality comparisons.
  2130. *
  2131. * @private
  2132. * @param {Object} object The object to modify.
  2133. * @param {string} key The key of the property to assign.
  2134. * @param {*} value The value to assign.
  2135. */
  2136. function assignValue(object, key, value) {
  2137. var objValue = object[key];
  2138. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  2139. (value === undefined && !(key in object))) {
  2140. object[key] = value;
  2141. }
  2142. }
  2143. /**
  2144. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2145. *
  2146. * @private
  2147. * @param {Array} array The array to inspect.
  2148. * @param {*} key The key to search for.
  2149. * @returns {number} Returns the index of the matched value, else `-1`.
  2150. */
  2151. function assocIndexOf(array, key) {
  2152. var length = array.length;
  2153. while (length--) {
  2154. if (eq(array[length][0], key)) {
  2155. return length;
  2156. }
  2157. }
  2158. return -1;
  2159. }
  2160. /**
  2161. * The base implementation of `_.assign` without support for multiple sources
  2162. * or `customizer` functions.
  2163. *
  2164. * @private
  2165. * @param {Object} object The destination object.
  2166. * @param {Object} source The source object.
  2167. * @returns {Object} Returns `object`.
  2168. */
  2169. function baseAssign(object, source) {
  2170. return object && copyObject(source, keys(source), object);
  2171. }
  2172. /**
  2173. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  2174. * traversed objects.
  2175. *
  2176. * @private
  2177. * @param {*} value The value to clone.
  2178. * @param {boolean} [isDeep] Specify a deep clone.
  2179. * @param {boolean} [isFull] Specify a clone including symbols.
  2180. * @param {Function} [customizer] The function to customize cloning.
  2181. * @param {string} [key] The key of `value`.
  2182. * @param {Object} [object] The parent object of `value`.
  2183. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  2184. * @returns {*} Returns the cloned value.
  2185. */
  2186. function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
  2187. var result;
  2188. if (customizer) {
  2189. result = object ? customizer(value, key, object, stack) : customizer(value);
  2190. }
  2191. if (result !== undefined) {
  2192. return result;
  2193. }
  2194. if (!isObject(value)) {
  2195. return value;
  2196. }
  2197. var isArr = isArray(value);
  2198. if (isArr) {
  2199. result = initCloneArray(value);
  2200. if (!isDeep) {
  2201. return copyArray(value, result);
  2202. }
  2203. } else {
  2204. var tag = getTag(value),
  2205. isFunc = tag == funcTag || tag == genTag;
  2206. if (isBuffer(value)) {
  2207. return cloneBuffer(value, isDeep);
  2208. }
  2209. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  2210. if (isHostObject(value)) {
  2211. return object ? value : {};
  2212. }
  2213. result = initCloneObject(isFunc ? {} : value);
  2214. if (!isDeep) {
  2215. return copySymbols(value, baseAssign(result, value));
  2216. }
  2217. } else {
  2218. if (!cloneableTags[tag]) {
  2219. return object ? value : {};
  2220. }
  2221. result = initCloneByTag(value, tag, baseClone, isDeep);
  2222. }
  2223. }
  2224. // Check for circular references and return its corresponding clone.
  2225. stack || (stack = new Stack);
  2226. var stacked = stack.get(value);
  2227. if (stacked) {
  2228. return stacked;
  2229. }
  2230. stack.set(value, result);
  2231. if (!isArr) {
  2232. var props = isFull ? getAllKeys(value) : keys(value);
  2233. }
  2234. arrayEach(props || value, function(subValue, key) {
  2235. if (props) {
  2236. key = subValue;
  2237. subValue = value[key];
  2238. }
  2239. // Recursively populate clone (susceptible to call stack limits).
  2240. assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
  2241. });
  2242. return result;
  2243. }
  2244. /**
  2245. * The base implementation of `_.create` without support for assigning
  2246. * properties to the created object.
  2247. *
  2248. * @private
  2249. * @param {Object} prototype The object to inherit from.
  2250. * @returns {Object} Returns the new object.
  2251. */
  2252. function baseCreate(proto) {
  2253. return isObject(proto) ? objectCreate(proto) : {};
  2254. }
  2255. /**
  2256. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  2257. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  2258. * symbols of `object`.
  2259. *
  2260. * @private
  2261. * @param {Object} object The object to query.
  2262. * @param {Function} keysFunc The function to get the keys of `object`.
  2263. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  2264. * @returns {Array} Returns the array of property names and symbols.
  2265. */
  2266. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  2267. var result = keysFunc(object);
  2268. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  2269. }
  2270. /**
  2271. * The base implementation of `getTag`.
  2272. *
  2273. * @private
  2274. * @param {*} value The value to query.
  2275. * @returns {string} Returns the `toStringTag`.
  2276. */
  2277. function baseGetTag(value) {
  2278. return objectToString.call(value);
  2279. }
  2280. /**
  2281. * The base implementation of `_.isNative` without bad shim checks.
  2282. *
  2283. * @private
  2284. * @param {*} value The value to check.
  2285. * @returns {boolean} Returns `true` if `value` is a native function,
  2286. * else `false`.
  2287. */
  2288. function baseIsNative(value) {
  2289. if (!isObject(value) || isMasked(value)) {
  2290. return false;
  2291. }
  2292. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  2293. return pattern.test(toSource(value));
  2294. }
  2295. /**
  2296. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  2297. *
  2298. * @private
  2299. * @param {Object} object The object to query.
  2300. * @returns {Array} Returns the array of property names.
  2301. */
  2302. function baseKeys(object) {
  2303. if (!isPrototype(object)) {
  2304. return nativeKeys(object);
  2305. }
  2306. var result = [];
  2307. for (var key in Object(object)) {
  2308. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  2309. result.push(key);
  2310. }
  2311. }
  2312. return result;
  2313. }
  2314. /**
  2315. * Creates a clone of `buffer`.
  2316. *
  2317. * @private
  2318. * @param {Buffer} buffer The buffer to clone.
  2319. * @param {boolean} [isDeep] Specify a deep clone.
  2320. * @returns {Buffer} Returns the cloned buffer.
  2321. */
  2322. function cloneBuffer(buffer, isDeep) {
  2323. if (isDeep) {
  2324. return buffer.slice();
  2325. }
  2326. var result = new buffer.constructor(buffer.length);
  2327. buffer.copy(result);
  2328. return result;
  2329. }
  2330. /**
  2331. * Creates a clone of `arrayBuffer`.
  2332. *
  2333. * @private
  2334. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  2335. * @returns {ArrayBuffer} Returns the cloned array buffer.
  2336. */
  2337. function cloneArrayBuffer(arrayBuffer) {
  2338. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2339. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2340. return result;
  2341. }
  2342. /**
  2343. * Creates a clone of `dataView`.
  2344. *
  2345. * @private
  2346. * @param {Object} dataView The data view to clone.
  2347. * @param {boolean} [isDeep] Specify a deep clone.
  2348. * @returns {Object} Returns the cloned data view.
  2349. */
  2350. function cloneDataView(dataView, isDeep) {
  2351. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2352. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2353. }
  2354. /**
  2355. * Creates a clone of `map`.
  2356. *
  2357. * @private
  2358. * @param {Object} map The map to clone.
  2359. * @param {Function} cloneFunc The function to clone values.
  2360. * @param {boolean} [isDeep] Specify a deep clone.
  2361. * @returns {Object} Returns the cloned map.
  2362. */
  2363. function cloneMap(map, isDeep, cloneFunc) {
  2364. var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
  2365. return arrayReduce(array, addMapEntry, new map.constructor);
  2366. }
  2367. /**
  2368. * Creates a clone of `regexp`.
  2369. *
  2370. * @private
  2371. * @param {Object} regexp The regexp to clone.
  2372. * @returns {Object} Returns the cloned regexp.
  2373. */
  2374. function cloneRegExp(regexp) {
  2375. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  2376. result.lastIndex = regexp.lastIndex;
  2377. return result;
  2378. }
  2379. /**
  2380. * Creates a clone of `set`.
  2381. *
  2382. * @private
  2383. * @param {Object} set The set to clone.
  2384. * @param {Function} cloneFunc The function to clone values.
  2385. * @param {boolean} [isDeep] Specify a deep clone.
  2386. * @returns {Object} Returns the cloned set.
  2387. */
  2388. function cloneSet(set, isDeep, cloneFunc) {
  2389. var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
  2390. return arrayReduce(array, addSetEntry, new set.constructor);
  2391. }
  2392. /**
  2393. * Creates a clone of the `symbol` object.
  2394. *
  2395. * @private
  2396. * @param {Object} symbol The symbol object to clone.
  2397. * @returns {Object} Returns the cloned symbol object.
  2398. */
  2399. function cloneSymbol(symbol) {
  2400. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  2401. }
  2402. /**
  2403. * Creates a clone of `typedArray`.
  2404. *
  2405. * @private
  2406. * @param {Object} typedArray The typed array to clone.
  2407. * @param {boolean} [isDeep] Specify a deep clone.
  2408. * @returns {Object} Returns the cloned typed array.
  2409. */
  2410. function cloneTypedArray(typedArray, isDeep) {
  2411. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2412. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2413. }
  2414. /**
  2415. * Copies the values of `source` to `array`.
  2416. *
  2417. * @private
  2418. * @param {Array} source The array to copy values from.
  2419. * @param {Array} [array=[]] The array to copy values to.
  2420. * @returns {Array} Returns `array`.
  2421. */
  2422. function copyArray(source, array) {
  2423. var index = -1,
  2424. length = source.length;
  2425. array || (array = Array(length));
  2426. while (++index < length) {
  2427. array[index] = source[index];
  2428. }
  2429. return array;
  2430. }
  2431. /**
  2432. * Copies properties of `source` to `object`.
  2433. *
  2434. * @private
  2435. * @param {Object} source The object to copy properties from.
  2436. * @param {Array} props The property identifiers to copy.
  2437. * @param {Object} [object={}] The object to copy properties to.
  2438. * @param {Function} [customizer] The function to customize copied values.
  2439. * @returns {Object} Returns `object`.
  2440. */
  2441. function copyObject(source, props, object, customizer) {
  2442. object || (object = {});
  2443. var index = -1,
  2444. length = props.length;
  2445. while (++index < length) {
  2446. var key = props[index];
  2447. var newValue = customizer
  2448. ? customizer(object[key], source[key], key, object, source)
  2449. : undefined;
  2450. assignValue(object, key, newValue === undefined ? source[key] : newValue);
  2451. }
  2452. return object;
  2453. }
  2454. /**
  2455. * Copies own symbol properties of `source` to `object`.
  2456. *
  2457. * @private
  2458. * @param {Object} source The object to copy symbols from.
  2459. * @param {Object} [object={}] The object to copy symbols to.
  2460. * @returns {Object} Returns `object`.
  2461. */
  2462. function copySymbols(source, object) {
  2463. return copyObject(source, getSymbols(source), object);
  2464. }
  2465. /**
  2466. * Creates an array of own enumerable property names and symbols of `object`.
  2467. *
  2468. * @private
  2469. * @param {Object} object The object to query.
  2470. * @returns {Array} Returns the array of property names and symbols.
  2471. */
  2472. function getAllKeys(object) {
  2473. return baseGetAllKeys(object, keys, getSymbols);
  2474. }
  2475. /**
  2476. * Gets the data for `map`.
  2477. *
  2478. * @private
  2479. * @param {Object} map The map to query.
  2480. * @param {string} key The reference key.
  2481. * @returns {*} Returns the map data.
  2482. */
  2483. function getMapData(map, key) {
  2484. var data = map.__data__;
  2485. return isKeyable(key)
  2486. ? data[typeof key == 'string' ? 'string' : 'hash']
  2487. : data.map;
  2488. }
  2489. /**
  2490. * Gets the native function at `key` of `object`.
  2491. *
  2492. * @private
  2493. * @param {Object} object The object to query.
  2494. * @param {string} key The key of the method to get.
  2495. * @returns {*} Returns the function if it's native, else `undefined`.
  2496. */
  2497. function getNative(object, key) {
  2498. var value = getValue(object, key);
  2499. return baseIsNative(value) ? value : undefined;
  2500. }
  2501. /**
  2502. * Creates an array of the own enumerable symbol properties of `object`.
  2503. *
  2504. * @private
  2505. * @param {Object} object The object to query.
  2506. * @returns {Array} Returns the array of symbols.
  2507. */
  2508. var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
  2509. /**
  2510. * Gets the `toStringTag` of `value`.
  2511. *
  2512. * @private
  2513. * @param {*} value The value to query.
  2514. * @returns {string} Returns the `toStringTag`.
  2515. */
  2516. var getTag = baseGetTag;
  2517. // Fallback for data views, maps, sets, and weak maps in IE 11,
  2518. // for data views in Edge < 14, and promises in Node.js.
  2519. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  2520. (Map && getTag(new Map) != mapTag) ||
  2521. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  2522. (Set && getTag(new Set) != setTag) ||
  2523. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  2524. getTag = function(value) {
  2525. var result = objectToString.call(value),
  2526. Ctor = result == objectTag ? value.constructor : undefined,
  2527. ctorString = Ctor ? toSource(Ctor) : undefined;
  2528. if (ctorString) {
  2529. switch (ctorString) {
  2530. case dataViewCtorString: return dataViewTag;
  2531. case mapCtorString: return mapTag;
  2532. case promiseCtorString: return promiseTag;
  2533. case setCtorString: return setTag;
  2534. case weakMapCtorString: return weakMapTag;
  2535. }
  2536. }
  2537. return result;
  2538. };
  2539. }
  2540. /**
  2541. * Initializes an array clone.
  2542. *
  2543. * @private
  2544. * @param {Array} array The array to clone.
  2545. * @returns {Array} Returns the initialized clone.
  2546. */
  2547. function initCloneArray(array) {
  2548. var length = array.length,
  2549. result = array.constructor(length);
  2550. // Add properties assigned by `RegExp#exec`.
  2551. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  2552. result.index = array.index;
  2553. result.input = array.input;
  2554. }
  2555. return result;
  2556. }
  2557. /**
  2558. * Initializes an object clone.
  2559. *
  2560. * @private
  2561. * @param {Object} object The object to clone.
  2562. * @returns {Object} Returns the initialized clone.
  2563. */
  2564. function initCloneObject(object) {
  2565. return (typeof object.constructor == 'function' && !isPrototype(object))
  2566. ? baseCreate(getPrototype(object))
  2567. : {};
  2568. }
  2569. /**
  2570. * Initializes an object clone based on its `toStringTag`.
  2571. *
  2572. * **Note:** This function only supports cloning values with tags of
  2573. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  2574. *
  2575. * @private
  2576. * @param {Object} object The object to clone.
  2577. * @param {string} tag The `toStringTag` of the object to clone.
  2578. * @param {Function} cloneFunc The function to clone values.
  2579. * @param {boolean} [isDeep] Specify a deep clone.
  2580. * @returns {Object} Returns the initialized clone.
  2581. */
  2582. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  2583. var Ctor = object.constructor;
  2584. switch (tag) {
  2585. case arrayBufferTag:
  2586. return cloneArrayBuffer(object);
  2587. case boolTag:
  2588. case dateTag:
  2589. return new Ctor(+object);
  2590. case dataViewTag:
  2591. return cloneDataView(object, isDeep);
  2592. case float32Tag: case float64Tag:
  2593. case int8Tag: case int16Tag: case int32Tag:
  2594. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  2595. return cloneTypedArray(object, isDeep);
  2596. case mapTag:
  2597. return cloneMap(object, isDeep, cloneFunc);
  2598. case numberTag:
  2599. case stringTag:
  2600. return new Ctor(object);
  2601. case regexpTag:
  2602. return cloneRegExp(object);
  2603. case setTag:
  2604. return cloneSet(object, isDeep, cloneFunc);
  2605. case symbolTag:
  2606. return cloneSymbol(object);
  2607. }
  2608. }
  2609. /**
  2610. * Checks if `value` is a valid array-like index.
  2611. *
  2612. * @private
  2613. * @param {*} value The value to check.
  2614. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  2615. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  2616. */
  2617. function isIndex(value, length) {
  2618. length = length == null ? MAX_SAFE_INTEGER : length;
  2619. return !!length &&
  2620. (typeof value == 'number' || reIsUint.test(value)) &&
  2621. (value > -1 && value % 1 == 0 && value < length);
  2622. }
  2623. /**
  2624. * Checks if `value` is suitable for use as unique object key.
  2625. *
  2626. * @private
  2627. * @param {*} value The value to check.
  2628. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  2629. */
  2630. function isKeyable(value) {
  2631. var type = typeof value;
  2632. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  2633. ? (value !== '__proto__')
  2634. : (value === null);
  2635. }
  2636. /**
  2637. * Checks if `func` has its source masked.
  2638. *
  2639. * @private
  2640. * @param {Function} func The function to check.
  2641. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  2642. */
  2643. function isMasked(func) {
  2644. return !!maskSrcKey && (maskSrcKey in func);
  2645. }
  2646. /**
  2647. * Checks if `value` is likely a prototype object.
  2648. *
  2649. * @private
  2650. * @param {*} value The value to check.
  2651. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  2652. */
  2653. function isPrototype(value) {
  2654. var Ctor = value && value.constructor,
  2655. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  2656. return value === proto;
  2657. }
  2658. /**
  2659. * Converts `func` to its source code.
  2660. *
  2661. * @private
  2662. * @param {Function} func The function to process.
  2663. * @returns {string} Returns the source code.
  2664. */
  2665. function toSource(func) {
  2666. if (func != null) {
  2667. try {
  2668. return funcToString.call(func);
  2669. } catch (e) {}
  2670. try {
  2671. return (func + '');
  2672. } catch (e) {}
  2673. }
  2674. return '';
  2675. }
  2676. /**
  2677. * This method is like `_.clone` except that it recursively clones `value`.
  2678. *
  2679. * @static
  2680. * @memberOf _
  2681. * @since 1.0.0
  2682. * @category Lang
  2683. * @param {*} value The value to recursively clone.
  2684. * @returns {*} Returns the deep cloned value.
  2685. * @see _.clone
  2686. * @example
  2687. *
  2688. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  2689. *
  2690. * var deep = _.cloneDeep(objects);
  2691. * console.log(deep[0] === objects[0]);
  2692. * // => false
  2693. */
  2694. function cloneDeep(value) {
  2695. return baseClone(value, true, true);
  2696. }
  2697. /**
  2698. * Performs a
  2699. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2700. * comparison between two values to determine if they are equivalent.
  2701. *
  2702. * @static
  2703. * @memberOf _
  2704. * @since 4.0.0
  2705. * @category Lang
  2706. * @param {*} value The value to compare.
  2707. * @param {*} other The other value to compare.
  2708. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  2709. * @example
  2710. *
  2711. * var object = { 'a': 1 };
  2712. * var other = { 'a': 1 };
  2713. *
  2714. * _.eq(object, object);
  2715. * // => true
  2716. *
  2717. * _.eq(object, other);
  2718. * // => false
  2719. *
  2720. * _.eq('a', 'a');
  2721. * // => true
  2722. *
  2723. * _.eq('a', Object('a'));
  2724. * // => false
  2725. *
  2726. * _.eq(NaN, NaN);
  2727. * // => true
  2728. */
  2729. function eq(value, other) {
  2730. return value === other || (value !== value && other !== other);
  2731. }
  2732. /**
  2733. * Checks if `value` is likely an `arguments` object.
  2734. *
  2735. * @static
  2736. * @memberOf _
  2737. * @since 0.1.0
  2738. * @category Lang
  2739. * @param {*} value The value to check.
  2740. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  2741. * else `false`.
  2742. * @example
  2743. *
  2744. * _.isArguments(function() { return arguments; }());
  2745. * // => true
  2746. *
  2747. * _.isArguments([1, 2, 3]);
  2748. * // => false
  2749. */
  2750. function isArguments(value) {
  2751. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  2752. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  2753. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  2754. }
  2755. /**
  2756. * Checks if `value` is classified as an `Array` object.
  2757. *
  2758. * @static
  2759. * @memberOf _
  2760. * @since 0.1.0
  2761. * @category Lang
  2762. * @param {*} value The value to check.
  2763. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  2764. * @example
  2765. *
  2766. * _.isArray([1, 2, 3]);
  2767. * // => true
  2768. *
  2769. * _.isArray(document.body.children);
  2770. * // => false
  2771. *
  2772. * _.isArray('abc');
  2773. * // => false
  2774. *
  2775. * _.isArray(_.noop);
  2776. * // => false
  2777. */
  2778. var isArray = Array.isArray;
  2779. /**
  2780. * Checks if `value` is array-like. A value is considered array-like if it's
  2781. * not a function and has a `value.length` that's an integer greater than or
  2782. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  2783. *
  2784. * @static
  2785. * @memberOf _
  2786. * @since 4.0.0
  2787. * @category Lang
  2788. * @param {*} value The value to check.
  2789. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  2790. * @example
  2791. *
  2792. * _.isArrayLike([1, 2, 3]);
  2793. * // => true
  2794. *
  2795. * _.isArrayLike(document.body.children);
  2796. * // => true
  2797. *
  2798. * _.isArrayLike('abc');
  2799. * // => true
  2800. *
  2801. * _.isArrayLike(_.noop);
  2802. * // => false
  2803. */
  2804. function isArrayLike(value) {
  2805. return value != null && isLength(value.length) && !isFunction(value);
  2806. }
  2807. /**
  2808. * This method is like `_.isArrayLike` except that it also checks if `value`
  2809. * is an object.
  2810. *
  2811. * @static
  2812. * @memberOf _
  2813. * @since 4.0.0
  2814. * @category Lang
  2815. * @param {*} value The value to check.
  2816. * @returns {boolean} Returns `true` if `value` is an array-like object,
  2817. * else `false`.
  2818. * @example
  2819. *
  2820. * _.isArrayLikeObject([1, 2, 3]);
  2821. * // => true
  2822. *
  2823. * _.isArrayLikeObject(document.body.children);
  2824. * // => true
  2825. *
  2826. * _.isArrayLikeObject('abc');
  2827. * // => false
  2828. *
  2829. * _.isArrayLikeObject(_.noop);
  2830. * // => false
  2831. */
  2832. function isArrayLikeObject(value) {
  2833. return isObjectLike(value) && isArrayLike(value);
  2834. }
  2835. /**
  2836. * Checks if `value` is a buffer.
  2837. *
  2838. * @static
  2839. * @memberOf _
  2840. * @since 4.3.0
  2841. * @category Lang
  2842. * @param {*} value The value to check.
  2843. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  2844. * @example
  2845. *
  2846. * _.isBuffer(new Buffer(2));
  2847. * // => true
  2848. *
  2849. * _.isBuffer(new Uint8Array(2));
  2850. * // => false
  2851. */
  2852. var isBuffer = nativeIsBuffer || stubFalse;
  2853. /**
  2854. * Checks if `value` is classified as a `Function` object.
  2855. *
  2856. * @static
  2857. * @memberOf _
  2858. * @since 0.1.0
  2859. * @category Lang
  2860. * @param {*} value The value to check.
  2861. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  2862. * @example
  2863. *
  2864. * _.isFunction(_);
  2865. * // => true
  2866. *
  2867. * _.isFunction(/abc/);
  2868. * // => false
  2869. */
  2870. function isFunction(value) {
  2871. // The use of `Object#toString` avoids issues with the `typeof` operator
  2872. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  2873. var tag = isObject(value) ? objectToString.call(value) : '';
  2874. return tag == funcTag || tag == genTag;
  2875. }
  2876. /**
  2877. * Checks if `value` is a valid array-like length.
  2878. *
  2879. * **Note:** This method is loosely based on
  2880. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  2881. *
  2882. * @static
  2883. * @memberOf _
  2884. * @since 4.0.0
  2885. * @category Lang
  2886. * @param {*} value The value to check.
  2887. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  2888. * @example
  2889. *
  2890. * _.isLength(3);
  2891. * // => true
  2892. *
  2893. * _.isLength(Number.MIN_VALUE);
  2894. * // => false
  2895. *
  2896. * _.isLength(Infinity);
  2897. * // => false
  2898. *
  2899. * _.isLength('3');
  2900. * // => false
  2901. */
  2902. function isLength(value) {
  2903. return typeof value == 'number' &&
  2904. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  2905. }
  2906. /**
  2907. * Checks if `value` is the
  2908. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  2909. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  2910. *
  2911. * @static
  2912. * @memberOf _
  2913. * @since 0.1.0
  2914. * @category Lang
  2915. * @param {*} value The value to check.
  2916. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  2917. * @example
  2918. *
  2919. * _.isObject({});
  2920. * // => true
  2921. *
  2922. * _.isObject([1, 2, 3]);
  2923. * // => true
  2924. *
  2925. * _.isObject(_.noop);
  2926. * // => true
  2927. *
  2928. * _.isObject(null);
  2929. * // => false
  2930. */
  2931. function isObject(value) {
  2932. var type = typeof value;
  2933. return !!value && (type == 'object' || type == 'function');
  2934. }
  2935. /**
  2936. * Checks if `value` is object-like. A value is object-like if it's not `null`
  2937. * and has a `typeof` result of "object".
  2938. *
  2939. * @static
  2940. * @memberOf _
  2941. * @since 4.0.0
  2942. * @category Lang
  2943. * @param {*} value The value to check.
  2944. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  2945. * @example
  2946. *
  2947. * _.isObjectLike({});
  2948. * // => true
  2949. *
  2950. * _.isObjectLike([1, 2, 3]);
  2951. * // => true
  2952. *
  2953. * _.isObjectLike(_.noop);
  2954. * // => false
  2955. *
  2956. * _.isObjectLike(null);
  2957. * // => false
  2958. */
  2959. function isObjectLike(value) {
  2960. return !!value && typeof value == 'object';
  2961. }
  2962. /**
  2963. * Creates an array of the own enumerable property names of `object`.
  2964. *
  2965. * **Note:** Non-object values are coerced to objects. See the
  2966. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  2967. * for more details.
  2968. *
  2969. * @static
  2970. * @since 0.1.0
  2971. * @memberOf _
  2972. * @category Object
  2973. * @param {Object} object The object to query.
  2974. * @returns {Array} Returns the array of property names.
  2975. * @example
  2976. *
  2977. * function Foo() {
  2978. * this.a = 1;
  2979. * this.b = 2;
  2980. * }
  2981. *
  2982. * Foo.prototype.c = 3;
  2983. *
  2984. * _.keys(new Foo);
  2985. * // => ['a', 'b'] (iteration order is not guaranteed)
  2986. *
  2987. * _.keys('hi');
  2988. * // => ['0', '1']
  2989. */
  2990. function keys(object) {
  2991. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  2992. }
  2993. /**
  2994. * This method returns a new empty array.
  2995. *
  2996. * @static
  2997. * @memberOf _
  2998. * @since 4.13.0
  2999. * @category Util
  3000. * @returns {Array} Returns the new empty array.
  3001. * @example
  3002. *
  3003. * var arrays = _.times(2, _.stubArray);
  3004. *
  3005. * console.log(arrays);
  3006. * // => [[], []]
  3007. *
  3008. * console.log(arrays[0] === arrays[1]);
  3009. * // => false
  3010. */
  3011. function stubArray() {
  3012. return [];
  3013. }
  3014. /**
  3015. * This method returns `false`.
  3016. *
  3017. * @static
  3018. * @memberOf _
  3019. * @since 4.13.0
  3020. * @category Util
  3021. * @returns {boolean} Returns `false`.
  3022. * @example
  3023. *
  3024. * _.times(2, _.stubFalse);
  3025. * // => [false, false]
  3026. */
  3027. function stubFalse() {
  3028. return false;
  3029. }
  3030. module.exports = cloneDeep;
  3031. /***/ }),
  3032. /***/ 478:
  3033. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  3034. /**
  3035. * lodash (Custom Build) <https://lodash.com/>
  3036. * Build: `lodash modularize exports="npm" -o ./`
  3037. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  3038. * Released under MIT license <https://lodash.com/license>
  3039. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  3040. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  3041. */
  3042. /** Used as the size to enable large array optimizations. */
  3043. var LARGE_ARRAY_SIZE = 200;
  3044. /** Used to stand-in for `undefined` hash values. */
  3045. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  3046. /** Used as references for various `Number` constants. */
  3047. var MAX_SAFE_INTEGER = 9007199254740991;
  3048. /** `Object#toString` result references. */
  3049. var argsTag = '[object Arguments]',
  3050. funcTag = '[object Function]',
  3051. genTag = '[object GeneratorFunction]';
  3052. /**
  3053. * Used to match `RegExp`
  3054. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  3055. */
  3056. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3057. /** Used to detect host constructors (Safari). */
  3058. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  3059. /** Detect free variable `global` from Node.js. */
  3060. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  3061. /** Detect free variable `self`. */
  3062. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  3063. /** Used as a reference to the global object. */
  3064. var root = freeGlobal || freeSelf || Function('return this')();
  3065. /**
  3066. * A faster alternative to `Function#apply`, this function invokes `func`
  3067. * with the `this` binding of `thisArg` and the arguments of `args`.
  3068. *
  3069. * @private
  3070. * @param {Function} func The function to invoke.
  3071. * @param {*} thisArg The `this` binding of `func`.
  3072. * @param {Array} args The arguments to invoke `func` with.
  3073. * @returns {*} Returns the result of `func`.
  3074. */
  3075. function apply(func, thisArg, args) {
  3076. switch (args.length) {
  3077. case 0: return func.call(thisArg);
  3078. case 1: return func.call(thisArg, args[0]);
  3079. case 2: return func.call(thisArg, args[0], args[1]);
  3080. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  3081. }
  3082. return func.apply(thisArg, args);
  3083. }
  3084. /**
  3085. * A specialized version of `_.includes` for arrays without support for
  3086. * specifying an index to search from.
  3087. *
  3088. * @private
  3089. * @param {Array} [array] The array to inspect.
  3090. * @param {*} target The value to search for.
  3091. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  3092. */
  3093. function arrayIncludes(array, value) {
  3094. var length = array ? array.length : 0;
  3095. return !!length && baseIndexOf(array, value, 0) > -1;
  3096. }
  3097. /**
  3098. * This function is like `arrayIncludes` except that it accepts a comparator.
  3099. *
  3100. * @private
  3101. * @param {Array} [array] The array to inspect.
  3102. * @param {*} target The value to search for.
  3103. * @param {Function} comparator The comparator invoked per element.
  3104. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  3105. */
  3106. function arrayIncludesWith(array, value, comparator) {
  3107. var index = -1,
  3108. length = array ? array.length : 0;
  3109. while (++index < length) {
  3110. if (comparator(value, array[index])) {
  3111. return true;
  3112. }
  3113. }
  3114. return false;
  3115. }
  3116. /**
  3117. * A specialized version of `_.map` for arrays without support for iteratee
  3118. * shorthands.
  3119. *
  3120. * @private
  3121. * @param {Array} [array] The array to iterate over.
  3122. * @param {Function} iteratee The function invoked per iteration.
  3123. * @returns {Array} Returns the new mapped array.
  3124. */
  3125. function arrayMap(array, iteratee) {
  3126. var index = -1,
  3127. length = array ? array.length : 0,
  3128. result = Array(length);
  3129. while (++index < length) {
  3130. result[index] = iteratee(array[index], index, array);
  3131. }
  3132. return result;
  3133. }
  3134. /**
  3135. * Appends the elements of `values` to `array`.
  3136. *
  3137. * @private
  3138. * @param {Array} array The array to modify.
  3139. * @param {Array} values The values to append.
  3140. * @returns {Array} Returns `array`.
  3141. */
  3142. function arrayPush(array, values) {
  3143. var index = -1,
  3144. length = values.length,
  3145. offset = array.length;
  3146. while (++index < length) {
  3147. array[offset + index] = values[index];
  3148. }
  3149. return array;
  3150. }
  3151. /**
  3152. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  3153. * support for iteratee shorthands.
  3154. *
  3155. * @private
  3156. * @param {Array} array The array to inspect.
  3157. * @param {Function} predicate The function invoked per iteration.
  3158. * @param {number} fromIndex The index to search from.
  3159. * @param {boolean} [fromRight] Specify iterating from right to left.
  3160. * @returns {number} Returns the index of the matched value, else `-1`.
  3161. */
  3162. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  3163. var length = array.length,
  3164. index = fromIndex + (fromRight ? 1 : -1);
  3165. while ((fromRight ? index-- : ++index < length)) {
  3166. if (predicate(array[index], index, array)) {
  3167. return index;
  3168. }
  3169. }
  3170. return -1;
  3171. }
  3172. /**
  3173. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  3174. *
  3175. * @private
  3176. * @param {Array} array The array to inspect.
  3177. * @param {*} value The value to search for.
  3178. * @param {number} fromIndex The index to search from.
  3179. * @returns {number} Returns the index of the matched value, else `-1`.
  3180. */
  3181. function baseIndexOf(array, value, fromIndex) {
  3182. if (value !== value) {
  3183. return baseFindIndex(array, baseIsNaN, fromIndex);
  3184. }
  3185. var index = fromIndex - 1,
  3186. length = array.length;
  3187. while (++index < length) {
  3188. if (array[index] === value) {
  3189. return index;
  3190. }
  3191. }
  3192. return -1;
  3193. }
  3194. /**
  3195. * The base implementation of `_.isNaN` without support for number objects.
  3196. *
  3197. * @private
  3198. * @param {*} value The value to check.
  3199. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  3200. */
  3201. function baseIsNaN(value) {
  3202. return value !== value;
  3203. }
  3204. /**
  3205. * The base implementation of `_.unary` without support for storing metadata.
  3206. *
  3207. * @private
  3208. * @param {Function} func The function to cap arguments for.
  3209. * @returns {Function} Returns the new capped function.
  3210. */
  3211. function baseUnary(func) {
  3212. return function(value) {
  3213. return func(value);
  3214. };
  3215. }
  3216. /**
  3217. * Checks if a cache value for `key` exists.
  3218. *
  3219. * @private
  3220. * @param {Object} cache The cache to query.
  3221. * @param {string} key The key of the entry to check.
  3222. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3223. */
  3224. function cacheHas(cache, key) {
  3225. return cache.has(key);
  3226. }
  3227. /**
  3228. * Gets the value at `key` of `object`.
  3229. *
  3230. * @private
  3231. * @param {Object} [object] The object to query.
  3232. * @param {string} key The key of the property to get.
  3233. * @returns {*} Returns the property value.
  3234. */
  3235. function getValue(object, key) {
  3236. return object == null ? undefined : object[key];
  3237. }
  3238. /**
  3239. * Checks if `value` is a host object in IE < 9.
  3240. *
  3241. * @private
  3242. * @param {*} value The value to check.
  3243. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  3244. */
  3245. function isHostObject(value) {
  3246. // Many host objects are `Object` objects that can coerce to strings
  3247. // despite having improperly defined `toString` methods.
  3248. var result = false;
  3249. if (value != null && typeof value.toString != 'function') {
  3250. try {
  3251. result = !!(value + '');
  3252. } catch (e) {}
  3253. }
  3254. return result;
  3255. }
  3256. /** Used for built-in method references. */
  3257. var arrayProto = Array.prototype,
  3258. funcProto = Function.prototype,
  3259. objectProto = Object.prototype;
  3260. /** Used to detect overreaching core-js shims. */
  3261. var coreJsData = root['__core-js_shared__'];
  3262. /** Used to detect methods masquerading as native. */
  3263. var maskSrcKey = (function() {
  3264. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  3265. return uid ? ('Symbol(src)_1.' + uid) : '';
  3266. }());
  3267. /** Used to resolve the decompiled source of functions. */
  3268. var funcToString = funcProto.toString;
  3269. /** Used to check objects for own properties. */
  3270. var hasOwnProperty = objectProto.hasOwnProperty;
  3271. /**
  3272. * Used to resolve the
  3273. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3274. * of values.
  3275. */
  3276. var objectToString = objectProto.toString;
  3277. /** Used to detect if a method is native. */
  3278. var reIsNative = RegExp('^' +
  3279. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  3280. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  3281. );
  3282. /** Built-in value references. */
  3283. var Symbol = root.Symbol,
  3284. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  3285. splice = arrayProto.splice,
  3286. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
  3287. /* Built-in method references for those with the same name as other `lodash` methods. */
  3288. var nativeMax = Math.max;
  3289. /* Built-in method references that are verified to be native. */
  3290. var Map = getNative(root, 'Map'),
  3291. nativeCreate = getNative(Object, 'create');
  3292. /**
  3293. * Creates a hash object.
  3294. *
  3295. * @private
  3296. * @constructor
  3297. * @param {Array} [entries] The key-value pairs to cache.
  3298. */
  3299. function Hash(entries) {
  3300. var index = -1,
  3301. length = entries ? entries.length : 0;
  3302. this.clear();
  3303. while (++index < length) {
  3304. var entry = entries[index];
  3305. this.set(entry[0], entry[1]);
  3306. }
  3307. }
  3308. /**
  3309. * Removes all key-value entries from the hash.
  3310. *
  3311. * @private
  3312. * @name clear
  3313. * @memberOf Hash
  3314. */
  3315. function hashClear() {
  3316. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  3317. }
  3318. /**
  3319. * Removes `key` and its value from the hash.
  3320. *
  3321. * @private
  3322. * @name delete
  3323. * @memberOf Hash
  3324. * @param {Object} hash The hash to modify.
  3325. * @param {string} key The key of the value to remove.
  3326. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3327. */
  3328. function hashDelete(key) {
  3329. return this.has(key) && delete this.__data__[key];
  3330. }
  3331. /**
  3332. * Gets the hash value for `key`.
  3333. *
  3334. * @private
  3335. * @name get
  3336. * @memberOf Hash
  3337. * @param {string} key The key of the value to get.
  3338. * @returns {*} Returns the entry value.
  3339. */
  3340. function hashGet(key) {
  3341. var data = this.__data__;
  3342. if (nativeCreate) {
  3343. var result = data[key];
  3344. return result === HASH_UNDEFINED ? undefined : result;
  3345. }
  3346. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  3347. }
  3348. /**
  3349. * Checks if a hash value for `key` exists.
  3350. *
  3351. * @private
  3352. * @name has
  3353. * @memberOf Hash
  3354. * @param {string} key The key of the entry to check.
  3355. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3356. */
  3357. function hashHas(key) {
  3358. var data = this.__data__;
  3359. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  3360. }
  3361. /**
  3362. * Sets the hash `key` to `value`.
  3363. *
  3364. * @private
  3365. * @name set
  3366. * @memberOf Hash
  3367. * @param {string} key The key of the value to set.
  3368. * @param {*} value The value to set.
  3369. * @returns {Object} Returns the hash instance.
  3370. */
  3371. function hashSet(key, value) {
  3372. var data = this.__data__;
  3373. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  3374. return this;
  3375. }
  3376. // Add methods to `Hash`.
  3377. Hash.prototype.clear = hashClear;
  3378. Hash.prototype['delete'] = hashDelete;
  3379. Hash.prototype.get = hashGet;
  3380. Hash.prototype.has = hashHas;
  3381. Hash.prototype.set = hashSet;
  3382. /**
  3383. * Creates an list cache object.
  3384. *
  3385. * @private
  3386. * @constructor
  3387. * @param {Array} [entries] The key-value pairs to cache.
  3388. */
  3389. function ListCache(entries) {
  3390. var index = -1,
  3391. length = entries ? entries.length : 0;
  3392. this.clear();
  3393. while (++index < length) {
  3394. var entry = entries[index];
  3395. this.set(entry[0], entry[1]);
  3396. }
  3397. }
  3398. /**
  3399. * Removes all key-value entries from the list cache.
  3400. *
  3401. * @private
  3402. * @name clear
  3403. * @memberOf ListCache
  3404. */
  3405. function listCacheClear() {
  3406. this.__data__ = [];
  3407. }
  3408. /**
  3409. * Removes `key` and its value from the list cache.
  3410. *
  3411. * @private
  3412. * @name delete
  3413. * @memberOf ListCache
  3414. * @param {string} key The key of the value to remove.
  3415. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3416. */
  3417. function listCacheDelete(key) {
  3418. var data = this.__data__,
  3419. index = assocIndexOf(data, key);
  3420. if (index < 0) {
  3421. return false;
  3422. }
  3423. var lastIndex = data.length - 1;
  3424. if (index == lastIndex) {
  3425. data.pop();
  3426. } else {
  3427. splice.call(data, index, 1);
  3428. }
  3429. return true;
  3430. }
  3431. /**
  3432. * Gets the list cache value for `key`.
  3433. *
  3434. * @private
  3435. * @name get
  3436. * @memberOf ListCache
  3437. * @param {string} key The key of the value to get.
  3438. * @returns {*} Returns the entry value.
  3439. */
  3440. function listCacheGet(key) {
  3441. var data = this.__data__,
  3442. index = assocIndexOf(data, key);
  3443. return index < 0 ? undefined : data[index][1];
  3444. }
  3445. /**
  3446. * Checks if a list cache value for `key` exists.
  3447. *
  3448. * @private
  3449. * @name has
  3450. * @memberOf ListCache
  3451. * @param {string} key The key of the entry to check.
  3452. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3453. */
  3454. function listCacheHas(key) {
  3455. return assocIndexOf(this.__data__, key) > -1;
  3456. }
  3457. /**
  3458. * Sets the list cache `key` to `value`.
  3459. *
  3460. * @private
  3461. * @name set
  3462. * @memberOf ListCache
  3463. * @param {string} key The key of the value to set.
  3464. * @param {*} value The value to set.
  3465. * @returns {Object} Returns the list cache instance.
  3466. */
  3467. function listCacheSet(key, value) {
  3468. var data = this.__data__,
  3469. index = assocIndexOf(data, key);
  3470. if (index < 0) {
  3471. data.push([key, value]);
  3472. } else {
  3473. data[index][1] = value;
  3474. }
  3475. return this;
  3476. }
  3477. // Add methods to `ListCache`.
  3478. ListCache.prototype.clear = listCacheClear;
  3479. ListCache.prototype['delete'] = listCacheDelete;
  3480. ListCache.prototype.get = listCacheGet;
  3481. ListCache.prototype.has = listCacheHas;
  3482. ListCache.prototype.set = listCacheSet;
  3483. /**
  3484. * Creates a map cache object to store key-value pairs.
  3485. *
  3486. * @private
  3487. * @constructor
  3488. * @param {Array} [entries] The key-value pairs to cache.
  3489. */
  3490. function MapCache(entries) {
  3491. var index = -1,
  3492. length = entries ? entries.length : 0;
  3493. this.clear();
  3494. while (++index < length) {
  3495. var entry = entries[index];
  3496. this.set(entry[0], entry[1]);
  3497. }
  3498. }
  3499. /**
  3500. * Removes all key-value entries from the map.
  3501. *
  3502. * @private
  3503. * @name clear
  3504. * @memberOf MapCache
  3505. */
  3506. function mapCacheClear() {
  3507. this.__data__ = {
  3508. 'hash': new Hash,
  3509. 'map': new (Map || ListCache),
  3510. 'string': new Hash
  3511. };
  3512. }
  3513. /**
  3514. * Removes `key` and its value from the map.
  3515. *
  3516. * @private
  3517. * @name delete
  3518. * @memberOf MapCache
  3519. * @param {string} key The key of the value to remove.
  3520. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3521. */
  3522. function mapCacheDelete(key) {
  3523. return getMapData(this, key)['delete'](key);
  3524. }
  3525. /**
  3526. * Gets the map value for `key`.
  3527. *
  3528. * @private
  3529. * @name get
  3530. * @memberOf MapCache
  3531. * @param {string} key The key of the value to get.
  3532. * @returns {*} Returns the entry value.
  3533. */
  3534. function mapCacheGet(key) {
  3535. return getMapData(this, key).get(key);
  3536. }
  3537. /**
  3538. * Checks if a map value for `key` exists.
  3539. *
  3540. * @private
  3541. * @name has
  3542. * @memberOf MapCache
  3543. * @param {string} key The key of the entry to check.
  3544. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3545. */
  3546. function mapCacheHas(key) {
  3547. return getMapData(this, key).has(key);
  3548. }
  3549. /**
  3550. * Sets the map `key` to `value`.
  3551. *
  3552. * @private
  3553. * @name set
  3554. * @memberOf MapCache
  3555. * @param {string} key The key of the value to set.
  3556. * @param {*} value The value to set.
  3557. * @returns {Object} Returns the map cache instance.
  3558. */
  3559. function mapCacheSet(key, value) {
  3560. getMapData(this, key).set(key, value);
  3561. return this;
  3562. }
  3563. // Add methods to `MapCache`.
  3564. MapCache.prototype.clear = mapCacheClear;
  3565. MapCache.prototype['delete'] = mapCacheDelete;
  3566. MapCache.prototype.get = mapCacheGet;
  3567. MapCache.prototype.has = mapCacheHas;
  3568. MapCache.prototype.set = mapCacheSet;
  3569. /**
  3570. *
  3571. * Creates an array cache object to store unique values.
  3572. *
  3573. * @private
  3574. * @constructor
  3575. * @param {Array} [values] The values to cache.
  3576. */
  3577. function SetCache(values) {
  3578. var index = -1,
  3579. length = values ? values.length : 0;
  3580. this.__data__ = new MapCache;
  3581. while (++index < length) {
  3582. this.add(values[index]);
  3583. }
  3584. }
  3585. /**
  3586. * Adds `value` to the array cache.
  3587. *
  3588. * @private
  3589. * @name add
  3590. * @memberOf SetCache
  3591. * @alias push
  3592. * @param {*} value The value to cache.
  3593. * @returns {Object} Returns the cache instance.
  3594. */
  3595. function setCacheAdd(value) {
  3596. this.__data__.set(value, HASH_UNDEFINED);
  3597. return this;
  3598. }
  3599. /**
  3600. * Checks if `value` is in the array cache.
  3601. *
  3602. * @private
  3603. * @name has
  3604. * @memberOf SetCache
  3605. * @param {*} value The value to search for.
  3606. * @returns {number} Returns `true` if `value` is found, else `false`.
  3607. */
  3608. function setCacheHas(value) {
  3609. return this.__data__.has(value);
  3610. }
  3611. // Add methods to `SetCache`.
  3612. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3613. SetCache.prototype.has = setCacheHas;
  3614. /**
  3615. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3616. *
  3617. * @private
  3618. * @param {Array} array The array to inspect.
  3619. * @param {*} key The key to search for.
  3620. * @returns {number} Returns the index of the matched value, else `-1`.
  3621. */
  3622. function assocIndexOf(array, key) {
  3623. var length = array.length;
  3624. while (length--) {
  3625. if (eq(array[length][0], key)) {
  3626. return length;
  3627. }
  3628. }
  3629. return -1;
  3630. }
  3631. /**
  3632. * The base implementation of methods like `_.difference` without support
  3633. * for excluding multiple arrays or iteratee shorthands.
  3634. *
  3635. * @private
  3636. * @param {Array} array The array to inspect.
  3637. * @param {Array} values The values to exclude.
  3638. * @param {Function} [iteratee] The iteratee invoked per element.
  3639. * @param {Function} [comparator] The comparator invoked per element.
  3640. * @returns {Array} Returns the new array of filtered values.
  3641. */
  3642. function baseDifference(array, values, iteratee, comparator) {
  3643. var index = -1,
  3644. includes = arrayIncludes,
  3645. isCommon = true,
  3646. length = array.length,
  3647. result = [],
  3648. valuesLength = values.length;
  3649. if (!length) {
  3650. return result;
  3651. }
  3652. if (iteratee) {
  3653. values = arrayMap(values, baseUnary(iteratee));
  3654. }
  3655. if (comparator) {
  3656. includes = arrayIncludesWith;
  3657. isCommon = false;
  3658. }
  3659. else if (values.length >= LARGE_ARRAY_SIZE) {
  3660. includes = cacheHas;
  3661. isCommon = false;
  3662. values = new SetCache(values);
  3663. }
  3664. outer:
  3665. while (++index < length) {
  3666. var value = array[index],
  3667. computed = iteratee ? iteratee(value) : value;
  3668. value = (comparator || value !== 0) ? value : 0;
  3669. if (isCommon && computed === computed) {
  3670. var valuesIndex = valuesLength;
  3671. while (valuesIndex--) {
  3672. if (values[valuesIndex] === computed) {
  3673. continue outer;
  3674. }
  3675. }
  3676. result.push(value);
  3677. }
  3678. else if (!includes(values, computed, comparator)) {
  3679. result.push(value);
  3680. }
  3681. }
  3682. return result;
  3683. }
  3684. /**
  3685. * The base implementation of `_.flatten` with support for restricting flattening.
  3686. *
  3687. * @private
  3688. * @param {Array} array The array to flatten.
  3689. * @param {number} depth The maximum recursion depth.
  3690. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  3691. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  3692. * @param {Array} [result=[]] The initial result value.
  3693. * @returns {Array} Returns the new flattened array.
  3694. */
  3695. function baseFlatten(array, depth, predicate, isStrict, result) {
  3696. var index = -1,
  3697. length = array.length;
  3698. predicate || (predicate = isFlattenable);
  3699. result || (result = []);
  3700. while (++index < length) {
  3701. var value = array[index];
  3702. if (depth > 0 && predicate(value)) {
  3703. if (depth > 1) {
  3704. // Recursively flatten arrays (susceptible to call stack limits).
  3705. baseFlatten(value, depth - 1, predicate, isStrict, result);
  3706. } else {
  3707. arrayPush(result, value);
  3708. }
  3709. } else if (!isStrict) {
  3710. result[result.length] = value;
  3711. }
  3712. }
  3713. return result;
  3714. }
  3715. /**
  3716. * The base implementation of `_.isNative` without bad shim checks.
  3717. *
  3718. * @private
  3719. * @param {*} value The value to check.
  3720. * @returns {boolean} Returns `true` if `value` is a native function,
  3721. * else `false`.
  3722. */
  3723. function baseIsNative(value) {
  3724. if (!isObject(value) || isMasked(value)) {
  3725. return false;
  3726. }
  3727. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  3728. return pattern.test(toSource(value));
  3729. }
  3730. /**
  3731. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  3732. *
  3733. * @private
  3734. * @param {Function} func The function to apply a rest parameter to.
  3735. * @param {number} [start=func.length-1] The start position of the rest parameter.
  3736. * @returns {Function} Returns the new function.
  3737. */
  3738. function baseRest(func, start) {
  3739. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  3740. return function() {
  3741. var args = arguments,
  3742. index = -1,
  3743. length = nativeMax(args.length - start, 0),
  3744. array = Array(length);
  3745. while (++index < length) {
  3746. array[index] = args[start + index];
  3747. }
  3748. index = -1;
  3749. var otherArgs = Array(start + 1);
  3750. while (++index < start) {
  3751. otherArgs[index] = args[index];
  3752. }
  3753. otherArgs[start] = array;
  3754. return apply(func, this, otherArgs);
  3755. };
  3756. }
  3757. /**
  3758. * Gets the data for `map`.
  3759. *
  3760. * @private
  3761. * @param {Object} map The map to query.
  3762. * @param {string} key The reference key.
  3763. * @returns {*} Returns the map data.
  3764. */
  3765. function getMapData(map, key) {
  3766. var data = map.__data__;
  3767. return isKeyable(key)
  3768. ? data[typeof key == 'string' ? 'string' : 'hash']
  3769. : data.map;
  3770. }
  3771. /**
  3772. * Gets the native function at `key` of `object`.
  3773. *
  3774. * @private
  3775. * @param {Object} object The object to query.
  3776. * @param {string} key The key of the method to get.
  3777. * @returns {*} Returns the function if it's native, else `undefined`.
  3778. */
  3779. function getNative(object, key) {
  3780. var value = getValue(object, key);
  3781. return baseIsNative(value) ? value : undefined;
  3782. }
  3783. /**
  3784. * Checks if `value` is a flattenable `arguments` object or array.
  3785. *
  3786. * @private
  3787. * @param {*} value The value to check.
  3788. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  3789. */
  3790. function isFlattenable(value) {
  3791. return isArray(value) || isArguments(value) ||
  3792. !!(spreadableSymbol && value && value[spreadableSymbol]);
  3793. }
  3794. /**
  3795. * Checks if `value` is suitable for use as unique object key.
  3796. *
  3797. * @private
  3798. * @param {*} value The value to check.
  3799. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  3800. */
  3801. function isKeyable(value) {
  3802. var type = typeof value;
  3803. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  3804. ? (value !== '__proto__')
  3805. : (value === null);
  3806. }
  3807. /**
  3808. * Checks if `func` has its source masked.
  3809. *
  3810. * @private
  3811. * @param {Function} func The function to check.
  3812. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  3813. */
  3814. function isMasked(func) {
  3815. return !!maskSrcKey && (maskSrcKey in func);
  3816. }
  3817. /**
  3818. * Converts `func` to its source code.
  3819. *
  3820. * @private
  3821. * @param {Function} func The function to process.
  3822. * @returns {string} Returns the source code.
  3823. */
  3824. function toSource(func) {
  3825. if (func != null) {
  3826. try {
  3827. return funcToString.call(func);
  3828. } catch (e) {}
  3829. try {
  3830. return (func + '');
  3831. } catch (e) {}
  3832. }
  3833. return '';
  3834. }
  3835. /**
  3836. * Creates an array of `array` values not included in the other given arrays
  3837. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3838. * for equality comparisons. The order of result values is determined by the
  3839. * order they occur in the first array.
  3840. *
  3841. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  3842. *
  3843. * @static
  3844. * @memberOf _
  3845. * @since 0.1.0
  3846. * @category Array
  3847. * @param {Array} array The array to inspect.
  3848. * @param {...Array} [values] The values to exclude.
  3849. * @returns {Array} Returns the new array of filtered values.
  3850. * @see _.without, _.xor
  3851. * @example
  3852. *
  3853. * _.difference([2, 1], [2, 3]);
  3854. * // => [1]
  3855. */
  3856. var difference = baseRest(function(array, values) {
  3857. return isArrayLikeObject(array)
  3858. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  3859. : [];
  3860. });
  3861. /**
  3862. * Performs a
  3863. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3864. * comparison between two values to determine if they are equivalent.
  3865. *
  3866. * @static
  3867. * @memberOf _
  3868. * @since 4.0.0
  3869. * @category Lang
  3870. * @param {*} value The value to compare.
  3871. * @param {*} other The other value to compare.
  3872. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3873. * @example
  3874. *
  3875. * var object = { 'a': 1 };
  3876. * var other = { 'a': 1 };
  3877. *
  3878. * _.eq(object, object);
  3879. * // => true
  3880. *
  3881. * _.eq(object, other);
  3882. * // => false
  3883. *
  3884. * _.eq('a', 'a');
  3885. * // => true
  3886. *
  3887. * _.eq('a', Object('a'));
  3888. * // => false
  3889. *
  3890. * _.eq(NaN, NaN);
  3891. * // => true
  3892. */
  3893. function eq(value, other) {
  3894. return value === other || (value !== value && other !== other);
  3895. }
  3896. /**
  3897. * Checks if `value` is likely an `arguments` object.
  3898. *
  3899. * @static
  3900. * @memberOf _
  3901. * @since 0.1.0
  3902. * @category Lang
  3903. * @param {*} value The value to check.
  3904. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3905. * else `false`.
  3906. * @example
  3907. *
  3908. * _.isArguments(function() { return arguments; }());
  3909. * // => true
  3910. *
  3911. * _.isArguments([1, 2, 3]);
  3912. * // => false
  3913. */
  3914. function isArguments(value) {
  3915. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  3916. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  3917. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  3918. }
  3919. /**
  3920. * Checks if `value` is classified as an `Array` object.
  3921. *
  3922. * @static
  3923. * @memberOf _
  3924. * @since 0.1.0
  3925. * @category Lang
  3926. * @param {*} value The value to check.
  3927. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  3928. * @example
  3929. *
  3930. * _.isArray([1, 2, 3]);
  3931. * // => true
  3932. *
  3933. * _.isArray(document.body.children);
  3934. * // => false
  3935. *
  3936. * _.isArray('abc');
  3937. * // => false
  3938. *
  3939. * _.isArray(_.noop);
  3940. * // => false
  3941. */
  3942. var isArray = Array.isArray;
  3943. /**
  3944. * Checks if `value` is array-like. A value is considered array-like if it's
  3945. * not a function and has a `value.length` that's an integer greater than or
  3946. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  3947. *
  3948. * @static
  3949. * @memberOf _
  3950. * @since 4.0.0
  3951. * @category Lang
  3952. * @param {*} value The value to check.
  3953. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  3954. * @example
  3955. *
  3956. * _.isArrayLike([1, 2, 3]);
  3957. * // => true
  3958. *
  3959. * _.isArrayLike(document.body.children);
  3960. * // => true
  3961. *
  3962. * _.isArrayLike('abc');
  3963. * // => true
  3964. *
  3965. * _.isArrayLike(_.noop);
  3966. * // => false
  3967. */
  3968. function isArrayLike(value) {
  3969. return value != null && isLength(value.length) && !isFunction(value);
  3970. }
  3971. /**
  3972. * This method is like `_.isArrayLike` except that it also checks if `value`
  3973. * is an object.
  3974. *
  3975. * @static
  3976. * @memberOf _
  3977. * @since 4.0.0
  3978. * @category Lang
  3979. * @param {*} value The value to check.
  3980. * @returns {boolean} Returns `true` if `value` is an array-like object,
  3981. * else `false`.
  3982. * @example
  3983. *
  3984. * _.isArrayLikeObject([1, 2, 3]);
  3985. * // => true
  3986. *
  3987. * _.isArrayLikeObject(document.body.children);
  3988. * // => true
  3989. *
  3990. * _.isArrayLikeObject('abc');
  3991. * // => false
  3992. *
  3993. * _.isArrayLikeObject(_.noop);
  3994. * // => false
  3995. */
  3996. function isArrayLikeObject(value) {
  3997. return isObjectLike(value) && isArrayLike(value);
  3998. }
  3999. /**
  4000. * Checks if `value` is classified as a `Function` object.
  4001. *
  4002. * @static
  4003. * @memberOf _
  4004. * @since 0.1.0
  4005. * @category Lang
  4006. * @param {*} value The value to check.
  4007. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  4008. * @example
  4009. *
  4010. * _.isFunction(_);
  4011. * // => true
  4012. *
  4013. * _.isFunction(/abc/);
  4014. * // => false
  4015. */
  4016. function isFunction(value) {
  4017. // The use of `Object#toString` avoids issues with the `typeof` operator
  4018. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  4019. var tag = isObject(value) ? objectToString.call(value) : '';
  4020. return tag == funcTag || tag == genTag;
  4021. }
  4022. /**
  4023. * Checks if `value` is a valid array-like length.
  4024. *
  4025. * **Note:** This method is loosely based on
  4026. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  4027. *
  4028. * @static
  4029. * @memberOf _
  4030. * @since 4.0.0
  4031. * @category Lang
  4032. * @param {*} value The value to check.
  4033. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  4034. * @example
  4035. *
  4036. * _.isLength(3);
  4037. * // => true
  4038. *
  4039. * _.isLength(Number.MIN_VALUE);
  4040. * // => false
  4041. *
  4042. * _.isLength(Infinity);
  4043. * // => false
  4044. *
  4045. * _.isLength('3');
  4046. * // => false
  4047. */
  4048. function isLength(value) {
  4049. return typeof value == 'number' &&
  4050. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  4051. }
  4052. /**
  4053. * Checks if `value` is the
  4054. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  4055. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  4056. *
  4057. * @static
  4058. * @memberOf _
  4059. * @since 0.1.0
  4060. * @category Lang
  4061. * @param {*} value The value to check.
  4062. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  4063. * @example
  4064. *
  4065. * _.isObject({});
  4066. * // => true
  4067. *
  4068. * _.isObject([1, 2, 3]);
  4069. * // => true
  4070. *
  4071. * _.isObject(_.noop);
  4072. * // => true
  4073. *
  4074. * _.isObject(null);
  4075. * // => false
  4076. */
  4077. function isObject(value) {
  4078. var type = typeof value;
  4079. return !!value && (type == 'object' || type == 'function');
  4080. }
  4081. /**
  4082. * Checks if `value` is object-like. A value is object-like if it's not `null`
  4083. * and has a `typeof` result of "object".
  4084. *
  4085. * @static
  4086. * @memberOf _
  4087. * @since 4.0.0
  4088. * @category Lang
  4089. * @param {*} value The value to check.
  4090. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  4091. * @example
  4092. *
  4093. * _.isObjectLike({});
  4094. * // => true
  4095. *
  4096. * _.isObjectLike([1, 2, 3]);
  4097. * // => true
  4098. *
  4099. * _.isObjectLike(_.noop);
  4100. * // => false
  4101. *
  4102. * _.isObjectLike(null);
  4103. * // => false
  4104. */
  4105. function isObjectLike(value) {
  4106. return !!value && typeof value == 'object';
  4107. }
  4108. module.exports = difference;
  4109. /***/ }),
  4110. /***/ 794:
  4111. /***/ ((module, exports, __webpack_require__) => {
  4112. /* module decorator */ module = __webpack_require__.nmd(module);
  4113. /**
  4114. * lodash (Custom Build) <https://lodash.com/>
  4115. * Build: `lodash modularize exports="npm" -o ./`
  4116. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  4117. * Released under MIT license <https://lodash.com/license>
  4118. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  4119. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  4120. */
  4121. /** Used as the size to enable large array optimizations. */
  4122. var LARGE_ARRAY_SIZE = 200;
  4123. /** Used as the `TypeError` message for "Functions" methods. */
  4124. var FUNC_ERROR_TEXT = 'Expected a function';
  4125. /** Used to stand-in for `undefined` hash values. */
  4126. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  4127. /** Used to compose bitmasks for comparison styles. */
  4128. var UNORDERED_COMPARE_FLAG = 1,
  4129. PARTIAL_COMPARE_FLAG = 2;
  4130. /** Used as references for various `Number` constants. */
  4131. var INFINITY = 1 / 0,
  4132. MAX_SAFE_INTEGER = 9007199254740991;
  4133. /** `Object#toString` result references. */
  4134. var argsTag = '[object Arguments]',
  4135. arrayTag = '[object Array]',
  4136. boolTag = '[object Boolean]',
  4137. dateTag = '[object Date]',
  4138. errorTag = '[object Error]',
  4139. funcTag = '[object Function]',
  4140. genTag = '[object GeneratorFunction]',
  4141. mapTag = '[object Map]',
  4142. numberTag = '[object Number]',
  4143. objectTag = '[object Object]',
  4144. promiseTag = '[object Promise]',
  4145. regexpTag = '[object RegExp]',
  4146. setTag = '[object Set]',
  4147. stringTag = '[object String]',
  4148. symbolTag = '[object Symbol]',
  4149. weakMapTag = '[object WeakMap]';
  4150. var arrayBufferTag = '[object ArrayBuffer]',
  4151. dataViewTag = '[object DataView]',
  4152. float32Tag = '[object Float32Array]',
  4153. float64Tag = '[object Float64Array]',
  4154. int8Tag = '[object Int8Array]',
  4155. int16Tag = '[object Int16Array]',
  4156. int32Tag = '[object Int32Array]',
  4157. uint8Tag = '[object Uint8Array]',
  4158. uint8ClampedTag = '[object Uint8ClampedArray]',
  4159. uint16Tag = '[object Uint16Array]',
  4160. uint32Tag = '[object Uint32Array]';
  4161. /** Used to match property names within property paths. */
  4162. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  4163. reIsPlainProp = /^\w*$/,
  4164. reLeadingDot = /^\./,
  4165. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  4166. /**
  4167. * Used to match `RegExp`
  4168. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  4169. */
  4170. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  4171. /** Used to match backslashes in property paths. */
  4172. var reEscapeChar = /\\(\\)?/g;
  4173. /** Used to detect host constructors (Safari). */
  4174. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  4175. /** Used to detect unsigned integer values. */
  4176. var reIsUint = /^(?:0|[1-9]\d*)$/;
  4177. /** Used to identify `toStringTag` values of typed arrays. */
  4178. var typedArrayTags = {};
  4179. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  4180. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  4181. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  4182. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  4183. typedArrayTags[uint32Tag] = true;
  4184. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  4185. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  4186. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  4187. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  4188. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  4189. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  4190. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  4191. typedArrayTags[weakMapTag] = false;
  4192. /** Detect free variable `global` from Node.js. */
  4193. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  4194. /** Detect free variable `self`. */
  4195. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  4196. /** Used as a reference to the global object. */
  4197. var root = freeGlobal || freeSelf || Function('return this')();
  4198. /** Detect free variable `exports`. */
  4199. var freeExports = true && exports && !exports.nodeType && exports;
  4200. /** Detect free variable `module`. */
  4201. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  4202. /** Detect the popular CommonJS extension `module.exports`. */
  4203. var moduleExports = freeModule && freeModule.exports === freeExports;
  4204. /** Detect free variable `process` from Node.js. */
  4205. var freeProcess = moduleExports && freeGlobal.process;
  4206. /** Used to access faster Node.js helpers. */
  4207. var nodeUtil = (function() {
  4208. try {
  4209. return freeProcess && freeProcess.binding('util');
  4210. } catch (e) {}
  4211. }());
  4212. /* Node.js helper references. */
  4213. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  4214. /**
  4215. * A specialized version of `_.some` for arrays without support for iteratee
  4216. * shorthands.
  4217. *
  4218. * @private
  4219. * @param {Array} [array] The array to iterate over.
  4220. * @param {Function} predicate The function invoked per iteration.
  4221. * @returns {boolean} Returns `true` if any element passes the predicate check,
  4222. * else `false`.
  4223. */
  4224. function arraySome(array, predicate) {
  4225. var index = -1,
  4226. length = array ? array.length : 0;
  4227. while (++index < length) {
  4228. if (predicate(array[index], index, array)) {
  4229. return true;
  4230. }
  4231. }
  4232. return false;
  4233. }
  4234. /**
  4235. * The base implementation of `_.property` without support for deep paths.
  4236. *
  4237. * @private
  4238. * @param {string} key The key of the property to get.
  4239. * @returns {Function} Returns the new accessor function.
  4240. */
  4241. function baseProperty(key) {
  4242. return function(object) {
  4243. return object == null ? undefined : object[key];
  4244. };
  4245. }
  4246. /**
  4247. * The base implementation of `_.times` without support for iteratee shorthands
  4248. * or max array length checks.
  4249. *
  4250. * @private
  4251. * @param {number} n The number of times to invoke `iteratee`.
  4252. * @param {Function} iteratee The function invoked per iteration.
  4253. * @returns {Array} Returns the array of results.
  4254. */
  4255. function baseTimes(n, iteratee) {
  4256. var index = -1,
  4257. result = Array(n);
  4258. while (++index < n) {
  4259. result[index] = iteratee(index);
  4260. }
  4261. return result;
  4262. }
  4263. /**
  4264. * The base implementation of `_.unary` without support for storing metadata.
  4265. *
  4266. * @private
  4267. * @param {Function} func The function to cap arguments for.
  4268. * @returns {Function} Returns the new capped function.
  4269. */
  4270. function baseUnary(func) {
  4271. return function(value) {
  4272. return func(value);
  4273. };
  4274. }
  4275. /**
  4276. * Gets the value at `key` of `object`.
  4277. *
  4278. * @private
  4279. * @param {Object} [object] The object to query.
  4280. * @param {string} key The key of the property to get.
  4281. * @returns {*} Returns the property value.
  4282. */
  4283. function getValue(object, key) {
  4284. return object == null ? undefined : object[key];
  4285. }
  4286. /**
  4287. * Checks if `value` is a host object in IE < 9.
  4288. *
  4289. * @private
  4290. * @param {*} value The value to check.
  4291. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  4292. */
  4293. function isHostObject(value) {
  4294. // Many host objects are `Object` objects that can coerce to strings
  4295. // despite having improperly defined `toString` methods.
  4296. var result = false;
  4297. if (value != null && typeof value.toString != 'function') {
  4298. try {
  4299. result = !!(value + '');
  4300. } catch (e) {}
  4301. }
  4302. return result;
  4303. }
  4304. /**
  4305. * Converts `map` to its key-value pairs.
  4306. *
  4307. * @private
  4308. * @param {Object} map The map to convert.
  4309. * @returns {Array} Returns the key-value pairs.
  4310. */
  4311. function mapToArray(map) {
  4312. var index = -1,
  4313. result = Array(map.size);
  4314. map.forEach(function(value, key) {
  4315. result[++index] = [key, value];
  4316. });
  4317. return result;
  4318. }
  4319. /**
  4320. * Creates a unary function that invokes `func` with its argument transformed.
  4321. *
  4322. * @private
  4323. * @param {Function} func The function to wrap.
  4324. * @param {Function} transform The argument transform.
  4325. * @returns {Function} Returns the new function.
  4326. */
  4327. function overArg(func, transform) {
  4328. return function(arg) {
  4329. return func(transform(arg));
  4330. };
  4331. }
  4332. /**
  4333. * Converts `set` to an array of its values.
  4334. *
  4335. * @private
  4336. * @param {Object} set The set to convert.
  4337. * @returns {Array} Returns the values.
  4338. */
  4339. function setToArray(set) {
  4340. var index = -1,
  4341. result = Array(set.size);
  4342. set.forEach(function(value) {
  4343. result[++index] = value;
  4344. });
  4345. return result;
  4346. }
  4347. /** Used for built-in method references. */
  4348. var arrayProto = Array.prototype,
  4349. funcProto = Function.prototype,
  4350. objectProto = Object.prototype;
  4351. /** Used to detect overreaching core-js shims. */
  4352. var coreJsData = root['__core-js_shared__'];
  4353. /** Used to detect methods masquerading as native. */
  4354. var maskSrcKey = (function() {
  4355. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  4356. return uid ? ('Symbol(src)_1.' + uid) : '';
  4357. }());
  4358. /** Used to resolve the decompiled source of functions. */
  4359. var funcToString = funcProto.toString;
  4360. /** Used to check objects for own properties. */
  4361. var hasOwnProperty = objectProto.hasOwnProperty;
  4362. /**
  4363. * Used to resolve the
  4364. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  4365. * of values.
  4366. */
  4367. var objectToString = objectProto.toString;
  4368. /** Used to detect if a method is native. */
  4369. var reIsNative = RegExp('^' +
  4370. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  4371. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  4372. );
  4373. /** Built-in value references. */
  4374. var Symbol = root.Symbol,
  4375. Uint8Array = root.Uint8Array,
  4376. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  4377. splice = arrayProto.splice;
  4378. /* Built-in method references for those with the same name as other `lodash` methods. */
  4379. var nativeKeys = overArg(Object.keys, Object);
  4380. /* Built-in method references that are verified to be native. */
  4381. var DataView = getNative(root, 'DataView'),
  4382. Map = getNative(root, 'Map'),
  4383. Promise = getNative(root, 'Promise'),
  4384. Set = getNative(root, 'Set'),
  4385. WeakMap = getNative(root, 'WeakMap'),
  4386. nativeCreate = getNative(Object, 'create');
  4387. /** Used to detect maps, sets, and weakmaps. */
  4388. var dataViewCtorString = toSource(DataView),
  4389. mapCtorString = toSource(Map),
  4390. promiseCtorString = toSource(Promise),
  4391. setCtorString = toSource(Set),
  4392. weakMapCtorString = toSource(WeakMap);
  4393. /** Used to convert symbols to primitives and strings. */
  4394. var symbolProto = Symbol ? Symbol.prototype : undefined,
  4395. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  4396. symbolToString = symbolProto ? symbolProto.toString : undefined;
  4397. /**
  4398. * Creates a hash object.
  4399. *
  4400. * @private
  4401. * @constructor
  4402. * @param {Array} [entries] The key-value pairs to cache.
  4403. */
  4404. function Hash(entries) {
  4405. var index = -1,
  4406. length = entries ? entries.length : 0;
  4407. this.clear();
  4408. while (++index < length) {
  4409. var entry = entries[index];
  4410. this.set(entry[0], entry[1]);
  4411. }
  4412. }
  4413. /**
  4414. * Removes all key-value entries from the hash.
  4415. *
  4416. * @private
  4417. * @name clear
  4418. * @memberOf Hash
  4419. */
  4420. function hashClear() {
  4421. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  4422. }
  4423. /**
  4424. * Removes `key` and its value from the hash.
  4425. *
  4426. * @private
  4427. * @name delete
  4428. * @memberOf Hash
  4429. * @param {Object} hash The hash to modify.
  4430. * @param {string} key The key of the value to remove.
  4431. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4432. */
  4433. function hashDelete(key) {
  4434. return this.has(key) && delete this.__data__[key];
  4435. }
  4436. /**
  4437. * Gets the hash value for `key`.
  4438. *
  4439. * @private
  4440. * @name get
  4441. * @memberOf Hash
  4442. * @param {string} key The key of the value to get.
  4443. * @returns {*} Returns the entry value.
  4444. */
  4445. function hashGet(key) {
  4446. var data = this.__data__;
  4447. if (nativeCreate) {
  4448. var result = data[key];
  4449. return result === HASH_UNDEFINED ? undefined : result;
  4450. }
  4451. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  4452. }
  4453. /**
  4454. * Checks if a hash value for `key` exists.
  4455. *
  4456. * @private
  4457. * @name has
  4458. * @memberOf Hash
  4459. * @param {string} key The key of the entry to check.
  4460. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4461. */
  4462. function hashHas(key) {
  4463. var data = this.__data__;
  4464. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  4465. }
  4466. /**
  4467. * Sets the hash `key` to `value`.
  4468. *
  4469. * @private
  4470. * @name set
  4471. * @memberOf Hash
  4472. * @param {string} key The key of the value to set.
  4473. * @param {*} value The value to set.
  4474. * @returns {Object} Returns the hash instance.
  4475. */
  4476. function hashSet(key, value) {
  4477. var data = this.__data__;
  4478. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  4479. return this;
  4480. }
  4481. // Add methods to `Hash`.
  4482. Hash.prototype.clear = hashClear;
  4483. Hash.prototype['delete'] = hashDelete;
  4484. Hash.prototype.get = hashGet;
  4485. Hash.prototype.has = hashHas;
  4486. Hash.prototype.set = hashSet;
  4487. /**
  4488. * Creates an list cache object.
  4489. *
  4490. * @private
  4491. * @constructor
  4492. * @param {Array} [entries] The key-value pairs to cache.
  4493. */
  4494. function ListCache(entries) {
  4495. var index = -1,
  4496. length = entries ? entries.length : 0;
  4497. this.clear();
  4498. while (++index < length) {
  4499. var entry = entries[index];
  4500. this.set(entry[0], entry[1]);
  4501. }
  4502. }
  4503. /**
  4504. * Removes all key-value entries from the list cache.
  4505. *
  4506. * @private
  4507. * @name clear
  4508. * @memberOf ListCache
  4509. */
  4510. function listCacheClear() {
  4511. this.__data__ = [];
  4512. }
  4513. /**
  4514. * Removes `key` and its value from the list cache.
  4515. *
  4516. * @private
  4517. * @name delete
  4518. * @memberOf ListCache
  4519. * @param {string} key The key of the value to remove.
  4520. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4521. */
  4522. function listCacheDelete(key) {
  4523. var data = this.__data__,
  4524. index = assocIndexOf(data, key);
  4525. if (index < 0) {
  4526. return false;
  4527. }
  4528. var lastIndex = data.length - 1;
  4529. if (index == lastIndex) {
  4530. data.pop();
  4531. } else {
  4532. splice.call(data, index, 1);
  4533. }
  4534. return true;
  4535. }
  4536. /**
  4537. * Gets the list cache value for `key`.
  4538. *
  4539. * @private
  4540. * @name get
  4541. * @memberOf ListCache
  4542. * @param {string} key The key of the value to get.
  4543. * @returns {*} Returns the entry value.
  4544. */
  4545. function listCacheGet(key) {
  4546. var data = this.__data__,
  4547. index = assocIndexOf(data, key);
  4548. return index < 0 ? undefined : data[index][1];
  4549. }
  4550. /**
  4551. * Checks if a list cache value for `key` exists.
  4552. *
  4553. * @private
  4554. * @name has
  4555. * @memberOf ListCache
  4556. * @param {string} key The key of the entry to check.
  4557. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4558. */
  4559. function listCacheHas(key) {
  4560. return assocIndexOf(this.__data__, key) > -1;
  4561. }
  4562. /**
  4563. * Sets the list cache `key` to `value`.
  4564. *
  4565. * @private
  4566. * @name set
  4567. * @memberOf ListCache
  4568. * @param {string} key The key of the value to set.
  4569. * @param {*} value The value to set.
  4570. * @returns {Object} Returns the list cache instance.
  4571. */
  4572. function listCacheSet(key, value) {
  4573. var data = this.__data__,
  4574. index = assocIndexOf(data, key);
  4575. if (index < 0) {
  4576. data.push([key, value]);
  4577. } else {
  4578. data[index][1] = value;
  4579. }
  4580. return this;
  4581. }
  4582. // Add methods to `ListCache`.
  4583. ListCache.prototype.clear = listCacheClear;
  4584. ListCache.prototype['delete'] = listCacheDelete;
  4585. ListCache.prototype.get = listCacheGet;
  4586. ListCache.prototype.has = listCacheHas;
  4587. ListCache.prototype.set = listCacheSet;
  4588. /**
  4589. * Creates a map cache object to store key-value pairs.
  4590. *
  4591. * @private
  4592. * @constructor
  4593. * @param {Array} [entries] The key-value pairs to cache.
  4594. */
  4595. function MapCache(entries) {
  4596. var index = -1,
  4597. length = entries ? entries.length : 0;
  4598. this.clear();
  4599. while (++index < length) {
  4600. var entry = entries[index];
  4601. this.set(entry[0], entry[1]);
  4602. }
  4603. }
  4604. /**
  4605. * Removes all key-value entries from the map.
  4606. *
  4607. * @private
  4608. * @name clear
  4609. * @memberOf MapCache
  4610. */
  4611. function mapCacheClear() {
  4612. this.__data__ = {
  4613. 'hash': new Hash,
  4614. 'map': new (Map || ListCache),
  4615. 'string': new Hash
  4616. };
  4617. }
  4618. /**
  4619. * Removes `key` and its value from the map.
  4620. *
  4621. * @private
  4622. * @name delete
  4623. * @memberOf MapCache
  4624. * @param {string} key The key of the value to remove.
  4625. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4626. */
  4627. function mapCacheDelete(key) {
  4628. return getMapData(this, key)['delete'](key);
  4629. }
  4630. /**
  4631. * Gets the map value for `key`.
  4632. *
  4633. * @private
  4634. * @name get
  4635. * @memberOf MapCache
  4636. * @param {string} key The key of the value to get.
  4637. * @returns {*} Returns the entry value.
  4638. */
  4639. function mapCacheGet(key) {
  4640. return getMapData(this, key).get(key);
  4641. }
  4642. /**
  4643. * Checks if a map value for `key` exists.
  4644. *
  4645. * @private
  4646. * @name has
  4647. * @memberOf MapCache
  4648. * @param {string} key The key of the entry to check.
  4649. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4650. */
  4651. function mapCacheHas(key) {
  4652. return getMapData(this, key).has(key);
  4653. }
  4654. /**
  4655. * Sets the map `key` to `value`.
  4656. *
  4657. * @private
  4658. * @name set
  4659. * @memberOf MapCache
  4660. * @param {string} key The key of the value to set.
  4661. * @param {*} value The value to set.
  4662. * @returns {Object} Returns the map cache instance.
  4663. */
  4664. function mapCacheSet(key, value) {
  4665. getMapData(this, key).set(key, value);
  4666. return this;
  4667. }
  4668. // Add methods to `MapCache`.
  4669. MapCache.prototype.clear = mapCacheClear;
  4670. MapCache.prototype['delete'] = mapCacheDelete;
  4671. MapCache.prototype.get = mapCacheGet;
  4672. MapCache.prototype.has = mapCacheHas;
  4673. MapCache.prototype.set = mapCacheSet;
  4674. /**
  4675. *
  4676. * Creates an array cache object to store unique values.
  4677. *
  4678. * @private
  4679. * @constructor
  4680. * @param {Array} [values] The values to cache.
  4681. */
  4682. function SetCache(values) {
  4683. var index = -1,
  4684. length = values ? values.length : 0;
  4685. this.__data__ = new MapCache;
  4686. while (++index < length) {
  4687. this.add(values[index]);
  4688. }
  4689. }
  4690. /**
  4691. * Adds `value` to the array cache.
  4692. *
  4693. * @private
  4694. * @name add
  4695. * @memberOf SetCache
  4696. * @alias push
  4697. * @param {*} value The value to cache.
  4698. * @returns {Object} Returns the cache instance.
  4699. */
  4700. function setCacheAdd(value) {
  4701. this.__data__.set(value, HASH_UNDEFINED);
  4702. return this;
  4703. }
  4704. /**
  4705. * Checks if `value` is in the array cache.
  4706. *
  4707. * @private
  4708. * @name has
  4709. * @memberOf SetCache
  4710. * @param {*} value The value to search for.
  4711. * @returns {number} Returns `true` if `value` is found, else `false`.
  4712. */
  4713. function setCacheHas(value) {
  4714. return this.__data__.has(value);
  4715. }
  4716. // Add methods to `SetCache`.
  4717. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  4718. SetCache.prototype.has = setCacheHas;
  4719. /**
  4720. * Creates a stack cache object to store key-value pairs.
  4721. *
  4722. * @private
  4723. * @constructor
  4724. * @param {Array} [entries] The key-value pairs to cache.
  4725. */
  4726. function Stack(entries) {
  4727. this.__data__ = new ListCache(entries);
  4728. }
  4729. /**
  4730. * Removes all key-value entries from the stack.
  4731. *
  4732. * @private
  4733. * @name clear
  4734. * @memberOf Stack
  4735. */
  4736. function stackClear() {
  4737. this.__data__ = new ListCache;
  4738. }
  4739. /**
  4740. * Removes `key` and its value from the stack.
  4741. *
  4742. * @private
  4743. * @name delete
  4744. * @memberOf Stack
  4745. * @param {string} key The key of the value to remove.
  4746. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4747. */
  4748. function stackDelete(key) {
  4749. return this.__data__['delete'](key);
  4750. }
  4751. /**
  4752. * Gets the stack value for `key`.
  4753. *
  4754. * @private
  4755. * @name get
  4756. * @memberOf Stack
  4757. * @param {string} key The key of the value to get.
  4758. * @returns {*} Returns the entry value.
  4759. */
  4760. function stackGet(key) {
  4761. return this.__data__.get(key);
  4762. }
  4763. /**
  4764. * Checks if a stack value for `key` exists.
  4765. *
  4766. * @private
  4767. * @name has
  4768. * @memberOf Stack
  4769. * @param {string} key The key of the entry to check.
  4770. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4771. */
  4772. function stackHas(key) {
  4773. return this.__data__.has(key);
  4774. }
  4775. /**
  4776. * Sets the stack `key` to `value`.
  4777. *
  4778. * @private
  4779. * @name set
  4780. * @memberOf Stack
  4781. * @param {string} key The key of the value to set.
  4782. * @param {*} value The value to set.
  4783. * @returns {Object} Returns the stack cache instance.
  4784. */
  4785. function stackSet(key, value) {
  4786. var cache = this.__data__;
  4787. if (cache instanceof ListCache) {
  4788. var pairs = cache.__data__;
  4789. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  4790. pairs.push([key, value]);
  4791. return this;
  4792. }
  4793. cache = this.__data__ = new MapCache(pairs);
  4794. }
  4795. cache.set(key, value);
  4796. return this;
  4797. }
  4798. // Add methods to `Stack`.
  4799. Stack.prototype.clear = stackClear;
  4800. Stack.prototype['delete'] = stackDelete;
  4801. Stack.prototype.get = stackGet;
  4802. Stack.prototype.has = stackHas;
  4803. Stack.prototype.set = stackSet;
  4804. /**
  4805. * Creates an array of the enumerable property names of the array-like `value`.
  4806. *
  4807. * @private
  4808. * @param {*} value The value to query.
  4809. * @param {boolean} inherited Specify returning inherited property names.
  4810. * @returns {Array} Returns the array of property names.
  4811. */
  4812. function arrayLikeKeys(value, inherited) {
  4813. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  4814. // Safari 9 makes `arguments.length` enumerable in strict mode.
  4815. var result = (isArray(value) || isArguments(value))
  4816. ? baseTimes(value.length, String)
  4817. : [];
  4818. var length = result.length,
  4819. skipIndexes = !!length;
  4820. for (var key in value) {
  4821. if ((inherited || hasOwnProperty.call(value, key)) &&
  4822. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  4823. result.push(key);
  4824. }
  4825. }
  4826. return result;
  4827. }
  4828. /**
  4829. * Gets the index at which the `key` is found in `array` of key-value pairs.
  4830. *
  4831. * @private
  4832. * @param {Array} array The array to inspect.
  4833. * @param {*} key The key to search for.
  4834. * @returns {number} Returns the index of the matched value, else `-1`.
  4835. */
  4836. function assocIndexOf(array, key) {
  4837. var length = array.length;
  4838. while (length--) {
  4839. if (eq(array[length][0], key)) {
  4840. return length;
  4841. }
  4842. }
  4843. return -1;
  4844. }
  4845. /**
  4846. * The base implementation of `_.get` without support for default values.
  4847. *
  4848. * @private
  4849. * @param {Object} object The object to query.
  4850. * @param {Array|string} path The path of the property to get.
  4851. * @returns {*} Returns the resolved value.
  4852. */
  4853. function baseGet(object, path) {
  4854. path = isKey(path, object) ? [path] : castPath(path);
  4855. var index = 0,
  4856. length = path.length;
  4857. while (object != null && index < length) {
  4858. object = object[toKey(path[index++])];
  4859. }
  4860. return (index && index == length) ? object : undefined;
  4861. }
  4862. /**
  4863. * The base implementation of `getTag`.
  4864. *
  4865. * @private
  4866. * @param {*} value The value to query.
  4867. * @returns {string} Returns the `toStringTag`.
  4868. */
  4869. function baseGetTag(value) {
  4870. return objectToString.call(value);
  4871. }
  4872. /**
  4873. * The base implementation of `_.hasIn` without support for deep paths.
  4874. *
  4875. * @private
  4876. * @param {Object} [object] The object to query.
  4877. * @param {Array|string} key The key to check.
  4878. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4879. */
  4880. function baseHasIn(object, key) {
  4881. return object != null && key in Object(object);
  4882. }
  4883. /**
  4884. * The base implementation of `_.isEqual` which supports partial comparisons
  4885. * and tracks traversed objects.
  4886. *
  4887. * @private
  4888. * @param {*} value The value to compare.
  4889. * @param {*} other The other value to compare.
  4890. * @param {Function} [customizer] The function to customize comparisons.
  4891. * @param {boolean} [bitmask] The bitmask of comparison flags.
  4892. * The bitmask may be composed of the following flags:
  4893. * 1 - Unordered comparison
  4894. * 2 - Partial comparison
  4895. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  4896. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4897. */
  4898. function baseIsEqual(value, other, customizer, bitmask, stack) {
  4899. if (value === other) {
  4900. return true;
  4901. }
  4902. if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
  4903. return value !== value && other !== other;
  4904. }
  4905. return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
  4906. }
  4907. /**
  4908. * A specialized version of `baseIsEqual` for arrays and objects which performs
  4909. * deep comparisons and tracks traversed objects enabling objects with circular
  4910. * references to be compared.
  4911. *
  4912. * @private
  4913. * @param {Object} object The object to compare.
  4914. * @param {Object} other The other object to compare.
  4915. * @param {Function} equalFunc The function to determine equivalents of values.
  4916. * @param {Function} [customizer] The function to customize comparisons.
  4917. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
  4918. * for more details.
  4919. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  4920. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4921. */
  4922. function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
  4923. var objIsArr = isArray(object),
  4924. othIsArr = isArray(other),
  4925. objTag = arrayTag,
  4926. othTag = arrayTag;
  4927. if (!objIsArr) {
  4928. objTag = getTag(object);
  4929. objTag = objTag == argsTag ? objectTag : objTag;
  4930. }
  4931. if (!othIsArr) {
  4932. othTag = getTag(other);
  4933. othTag = othTag == argsTag ? objectTag : othTag;
  4934. }
  4935. var objIsObj = objTag == objectTag && !isHostObject(object),
  4936. othIsObj = othTag == objectTag && !isHostObject(other),
  4937. isSameTag = objTag == othTag;
  4938. if (isSameTag && !objIsObj) {
  4939. stack || (stack = new Stack);
  4940. return (objIsArr || isTypedArray(object))
  4941. ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
  4942. : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
  4943. }
  4944. if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
  4945. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  4946. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  4947. if (objIsWrapped || othIsWrapped) {
  4948. var objUnwrapped = objIsWrapped ? object.value() : object,
  4949. othUnwrapped = othIsWrapped ? other.value() : other;
  4950. stack || (stack = new Stack);
  4951. return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
  4952. }
  4953. }
  4954. if (!isSameTag) {
  4955. return false;
  4956. }
  4957. stack || (stack = new Stack);
  4958. return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
  4959. }
  4960. /**
  4961. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  4962. *
  4963. * @private
  4964. * @param {Object} object The object to inspect.
  4965. * @param {Object} source The object of property values to match.
  4966. * @param {Array} matchData The property names, values, and compare flags to match.
  4967. * @param {Function} [customizer] The function to customize comparisons.
  4968. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  4969. */
  4970. function baseIsMatch(object, source, matchData, customizer) {
  4971. var index = matchData.length,
  4972. length = index,
  4973. noCustomizer = !customizer;
  4974. if (object == null) {
  4975. return !length;
  4976. }
  4977. object = Object(object);
  4978. while (index--) {
  4979. var data = matchData[index];
  4980. if ((noCustomizer && data[2])
  4981. ? data[1] !== object[data[0]]
  4982. : !(data[0] in object)
  4983. ) {
  4984. return false;
  4985. }
  4986. }
  4987. while (++index < length) {
  4988. data = matchData[index];
  4989. var key = data[0],
  4990. objValue = object[key],
  4991. srcValue = data[1];
  4992. if (noCustomizer && data[2]) {
  4993. if (objValue === undefined && !(key in object)) {
  4994. return false;
  4995. }
  4996. } else {
  4997. var stack = new Stack;
  4998. if (customizer) {
  4999. var result = customizer(objValue, srcValue, key, object, source, stack);
  5000. }
  5001. if (!(result === undefined
  5002. ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
  5003. : result
  5004. )) {
  5005. return false;
  5006. }
  5007. }
  5008. }
  5009. return true;
  5010. }
  5011. /**
  5012. * The base implementation of `_.isNative` without bad shim checks.
  5013. *
  5014. * @private
  5015. * @param {*} value The value to check.
  5016. * @returns {boolean} Returns `true` if `value` is a native function,
  5017. * else `false`.
  5018. */
  5019. function baseIsNative(value) {
  5020. if (!isObject(value) || isMasked(value)) {
  5021. return false;
  5022. }
  5023. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  5024. return pattern.test(toSource(value));
  5025. }
  5026. /**
  5027. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  5028. *
  5029. * @private
  5030. * @param {*} value The value to check.
  5031. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  5032. */
  5033. function baseIsTypedArray(value) {
  5034. return isObjectLike(value) &&
  5035. isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
  5036. }
  5037. /**
  5038. * The base implementation of `_.iteratee`.
  5039. *
  5040. * @private
  5041. * @param {*} [value=_.identity] The value to convert to an iteratee.
  5042. * @returns {Function} Returns the iteratee.
  5043. */
  5044. function baseIteratee(value) {
  5045. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  5046. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  5047. if (typeof value == 'function') {
  5048. return value;
  5049. }
  5050. if (value == null) {
  5051. return identity;
  5052. }
  5053. if (typeof value == 'object') {
  5054. return isArray(value)
  5055. ? baseMatchesProperty(value[0], value[1])
  5056. : baseMatches(value);
  5057. }
  5058. return property(value);
  5059. }
  5060. /**
  5061. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  5062. *
  5063. * @private
  5064. * @param {Object} object The object to query.
  5065. * @returns {Array} Returns the array of property names.
  5066. */
  5067. function baseKeys(object) {
  5068. if (!isPrototype(object)) {
  5069. return nativeKeys(object);
  5070. }
  5071. var result = [];
  5072. for (var key in Object(object)) {
  5073. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  5074. result.push(key);
  5075. }
  5076. }
  5077. return result;
  5078. }
  5079. /**
  5080. * The base implementation of `_.matches` which doesn't clone `source`.
  5081. *
  5082. * @private
  5083. * @param {Object} source The object of property values to match.
  5084. * @returns {Function} Returns the new spec function.
  5085. */
  5086. function baseMatches(source) {
  5087. var matchData = getMatchData(source);
  5088. if (matchData.length == 1 && matchData[0][2]) {
  5089. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  5090. }
  5091. return function(object) {
  5092. return object === source || baseIsMatch(object, source, matchData);
  5093. };
  5094. }
  5095. /**
  5096. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  5097. *
  5098. * @private
  5099. * @param {string} path The path of the property to get.
  5100. * @param {*} srcValue The value to match.
  5101. * @returns {Function} Returns the new spec function.
  5102. */
  5103. function baseMatchesProperty(path, srcValue) {
  5104. if (isKey(path) && isStrictComparable(srcValue)) {
  5105. return matchesStrictComparable(toKey(path), srcValue);
  5106. }
  5107. return function(object) {
  5108. var objValue = get(object, path);
  5109. return (objValue === undefined && objValue === srcValue)
  5110. ? hasIn(object, path)
  5111. : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
  5112. };
  5113. }
  5114. /**
  5115. * A specialized version of `baseProperty` which supports deep paths.
  5116. *
  5117. * @private
  5118. * @param {Array|string} path The path of the property to get.
  5119. * @returns {Function} Returns the new accessor function.
  5120. */
  5121. function basePropertyDeep(path) {
  5122. return function(object) {
  5123. return baseGet(object, path);
  5124. };
  5125. }
  5126. /**
  5127. * The base implementation of `_.pullAt` without support for individual
  5128. * indexes or capturing the removed elements.
  5129. *
  5130. * @private
  5131. * @param {Array} array The array to modify.
  5132. * @param {number[]} indexes The indexes of elements to remove.
  5133. * @returns {Array} Returns `array`.
  5134. */
  5135. function basePullAt(array, indexes) {
  5136. var length = array ? indexes.length : 0,
  5137. lastIndex = length - 1;
  5138. while (length--) {
  5139. var index = indexes[length];
  5140. if (length == lastIndex || index !== previous) {
  5141. var previous = index;
  5142. if (isIndex(index)) {
  5143. splice.call(array, index, 1);
  5144. }
  5145. else if (!isKey(index, array)) {
  5146. var path = castPath(index),
  5147. object = parent(array, path);
  5148. if (object != null) {
  5149. delete object[toKey(last(path))];
  5150. }
  5151. }
  5152. else {
  5153. delete array[toKey(index)];
  5154. }
  5155. }
  5156. }
  5157. return array;
  5158. }
  5159. /**
  5160. * The base implementation of `_.slice` without an iteratee call guard.
  5161. *
  5162. * @private
  5163. * @param {Array} array The array to slice.
  5164. * @param {number} [start=0] The start position.
  5165. * @param {number} [end=array.length] The end position.
  5166. * @returns {Array} Returns the slice of `array`.
  5167. */
  5168. function baseSlice(array, start, end) {
  5169. var index = -1,
  5170. length = array.length;
  5171. if (start < 0) {
  5172. start = -start > length ? 0 : (length + start);
  5173. }
  5174. end = end > length ? length : end;
  5175. if (end < 0) {
  5176. end += length;
  5177. }
  5178. length = start > end ? 0 : ((end - start) >>> 0);
  5179. start >>>= 0;
  5180. var result = Array(length);
  5181. while (++index < length) {
  5182. result[index] = array[index + start];
  5183. }
  5184. return result;
  5185. }
  5186. /**
  5187. * The base implementation of `_.toString` which doesn't convert nullish
  5188. * values to empty strings.
  5189. *
  5190. * @private
  5191. * @param {*} value The value to process.
  5192. * @returns {string} Returns the string.
  5193. */
  5194. function baseToString(value) {
  5195. // Exit early for strings to avoid a performance hit in some environments.
  5196. if (typeof value == 'string') {
  5197. return value;
  5198. }
  5199. if (isSymbol(value)) {
  5200. return symbolToString ? symbolToString.call(value) : '';
  5201. }
  5202. var result = (value + '');
  5203. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5204. }
  5205. /**
  5206. * Casts `value` to a path array if it's not one.
  5207. *
  5208. * @private
  5209. * @param {*} value The value to inspect.
  5210. * @returns {Array} Returns the cast property path array.
  5211. */
  5212. function castPath(value) {
  5213. return isArray(value) ? value : stringToPath(value);
  5214. }
  5215. /**
  5216. * A specialized version of `baseIsEqualDeep` for arrays with support for
  5217. * partial deep comparisons.
  5218. *
  5219. * @private
  5220. * @param {Array} array The array to compare.
  5221. * @param {Array} other The other array to compare.
  5222. * @param {Function} equalFunc The function to determine equivalents of values.
  5223. * @param {Function} customizer The function to customize comparisons.
  5224. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  5225. * for more details.
  5226. * @param {Object} stack Tracks traversed `array` and `other` objects.
  5227. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  5228. */
  5229. function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
  5230. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  5231. arrLength = array.length,
  5232. othLength = other.length;
  5233. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  5234. return false;
  5235. }
  5236. // Assume cyclic values are equal.
  5237. var stacked = stack.get(array);
  5238. if (stacked && stack.get(other)) {
  5239. return stacked == other;
  5240. }
  5241. var index = -1,
  5242. result = true,
  5243. seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
  5244. stack.set(array, other);
  5245. stack.set(other, array);
  5246. // Ignore non-index properties.
  5247. while (++index < arrLength) {
  5248. var arrValue = array[index],
  5249. othValue = other[index];
  5250. if (customizer) {
  5251. var compared = isPartial
  5252. ? customizer(othValue, arrValue, index, other, array, stack)
  5253. : customizer(arrValue, othValue, index, array, other, stack);
  5254. }
  5255. if (compared !== undefined) {
  5256. if (compared) {
  5257. continue;
  5258. }
  5259. result = false;
  5260. break;
  5261. }
  5262. // Recursively compare arrays (susceptible to call stack limits).
  5263. if (seen) {
  5264. if (!arraySome(other, function(othValue, othIndex) {
  5265. if (!seen.has(othIndex) &&
  5266. (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
  5267. return seen.add(othIndex);
  5268. }
  5269. })) {
  5270. result = false;
  5271. break;
  5272. }
  5273. } else if (!(
  5274. arrValue === othValue ||
  5275. equalFunc(arrValue, othValue, customizer, bitmask, stack)
  5276. )) {
  5277. result = false;
  5278. break;
  5279. }
  5280. }
  5281. stack['delete'](array);
  5282. stack['delete'](other);
  5283. return result;
  5284. }
  5285. /**
  5286. * A specialized version of `baseIsEqualDeep` for comparing objects of
  5287. * the same `toStringTag`.
  5288. *
  5289. * **Note:** This function only supports comparing values with tags of
  5290. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  5291. *
  5292. * @private
  5293. * @param {Object} object The object to compare.
  5294. * @param {Object} other The other object to compare.
  5295. * @param {string} tag The `toStringTag` of the objects to compare.
  5296. * @param {Function} equalFunc The function to determine equivalents of values.
  5297. * @param {Function} customizer The function to customize comparisons.
  5298. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  5299. * for more details.
  5300. * @param {Object} stack Tracks traversed `object` and `other` objects.
  5301. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5302. */
  5303. function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
  5304. switch (tag) {
  5305. case dataViewTag:
  5306. if ((object.byteLength != other.byteLength) ||
  5307. (object.byteOffset != other.byteOffset)) {
  5308. return false;
  5309. }
  5310. object = object.buffer;
  5311. other = other.buffer;
  5312. case arrayBufferTag:
  5313. if ((object.byteLength != other.byteLength) ||
  5314. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  5315. return false;
  5316. }
  5317. return true;
  5318. case boolTag:
  5319. case dateTag:
  5320. case numberTag:
  5321. // Coerce booleans to `1` or `0` and dates to milliseconds.
  5322. // Invalid dates are coerced to `NaN`.
  5323. return eq(+object, +other);
  5324. case errorTag:
  5325. return object.name == other.name && object.message == other.message;
  5326. case regexpTag:
  5327. case stringTag:
  5328. // Coerce regexes to strings and treat strings, primitives and objects,
  5329. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  5330. // for more details.
  5331. return object == (other + '');
  5332. case mapTag:
  5333. var convert = mapToArray;
  5334. case setTag:
  5335. var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
  5336. convert || (convert = setToArray);
  5337. if (object.size != other.size && !isPartial) {
  5338. return false;
  5339. }
  5340. // Assume cyclic values are equal.
  5341. var stacked = stack.get(object);
  5342. if (stacked) {
  5343. return stacked == other;
  5344. }
  5345. bitmask |= UNORDERED_COMPARE_FLAG;
  5346. // Recursively compare objects (susceptible to call stack limits).
  5347. stack.set(object, other);
  5348. var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
  5349. stack['delete'](object);
  5350. return result;
  5351. case symbolTag:
  5352. if (symbolValueOf) {
  5353. return symbolValueOf.call(object) == symbolValueOf.call(other);
  5354. }
  5355. }
  5356. return false;
  5357. }
  5358. /**
  5359. * A specialized version of `baseIsEqualDeep` for objects with support for
  5360. * partial deep comparisons.
  5361. *
  5362. * @private
  5363. * @param {Object} object The object to compare.
  5364. * @param {Object} other The other object to compare.
  5365. * @param {Function} equalFunc The function to determine equivalents of values.
  5366. * @param {Function} customizer The function to customize comparisons.
  5367. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  5368. * for more details.
  5369. * @param {Object} stack Tracks traversed `object` and `other` objects.
  5370. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5371. */
  5372. function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
  5373. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  5374. objProps = keys(object),
  5375. objLength = objProps.length,
  5376. othProps = keys(other),
  5377. othLength = othProps.length;
  5378. if (objLength != othLength && !isPartial) {
  5379. return false;
  5380. }
  5381. var index = objLength;
  5382. while (index--) {
  5383. var key = objProps[index];
  5384. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  5385. return false;
  5386. }
  5387. }
  5388. // Assume cyclic values are equal.
  5389. var stacked = stack.get(object);
  5390. if (stacked && stack.get(other)) {
  5391. return stacked == other;
  5392. }
  5393. var result = true;
  5394. stack.set(object, other);
  5395. stack.set(other, object);
  5396. var skipCtor = isPartial;
  5397. while (++index < objLength) {
  5398. key = objProps[index];
  5399. var objValue = object[key],
  5400. othValue = other[key];
  5401. if (customizer) {
  5402. var compared = isPartial
  5403. ? customizer(othValue, objValue, key, other, object, stack)
  5404. : customizer(objValue, othValue, key, object, other, stack);
  5405. }
  5406. // Recursively compare objects (susceptible to call stack limits).
  5407. if (!(compared === undefined
  5408. ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
  5409. : compared
  5410. )) {
  5411. result = false;
  5412. break;
  5413. }
  5414. skipCtor || (skipCtor = key == 'constructor');
  5415. }
  5416. if (result && !skipCtor) {
  5417. var objCtor = object.constructor,
  5418. othCtor = other.constructor;
  5419. // Non `Object` object instances with different constructors are not equal.
  5420. if (objCtor != othCtor &&
  5421. ('constructor' in object && 'constructor' in other) &&
  5422. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  5423. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  5424. result = false;
  5425. }
  5426. }
  5427. stack['delete'](object);
  5428. stack['delete'](other);
  5429. return result;
  5430. }
  5431. /**
  5432. * Gets the data for `map`.
  5433. *
  5434. * @private
  5435. * @param {Object} map The map to query.
  5436. * @param {string} key The reference key.
  5437. * @returns {*} Returns the map data.
  5438. */
  5439. function getMapData(map, key) {
  5440. var data = map.__data__;
  5441. return isKeyable(key)
  5442. ? data[typeof key == 'string' ? 'string' : 'hash']
  5443. : data.map;
  5444. }
  5445. /**
  5446. * Gets the property names, values, and compare flags of `object`.
  5447. *
  5448. * @private
  5449. * @param {Object} object The object to query.
  5450. * @returns {Array} Returns the match data of `object`.
  5451. */
  5452. function getMatchData(object) {
  5453. var result = keys(object),
  5454. length = result.length;
  5455. while (length--) {
  5456. var key = result[length],
  5457. value = object[key];
  5458. result[length] = [key, value, isStrictComparable(value)];
  5459. }
  5460. return result;
  5461. }
  5462. /**
  5463. * Gets the native function at `key` of `object`.
  5464. *
  5465. * @private
  5466. * @param {Object} object The object to query.
  5467. * @param {string} key The key of the method to get.
  5468. * @returns {*} Returns the function if it's native, else `undefined`.
  5469. */
  5470. function getNative(object, key) {
  5471. var value = getValue(object, key);
  5472. return baseIsNative(value) ? value : undefined;
  5473. }
  5474. /**
  5475. * Gets the `toStringTag` of `value`.
  5476. *
  5477. * @private
  5478. * @param {*} value The value to query.
  5479. * @returns {string} Returns the `toStringTag`.
  5480. */
  5481. var getTag = baseGetTag;
  5482. // Fallback for data views, maps, sets, and weak maps in IE 11,
  5483. // for data views in Edge < 14, and promises in Node.js.
  5484. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  5485. (Map && getTag(new Map) != mapTag) ||
  5486. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  5487. (Set && getTag(new Set) != setTag) ||
  5488. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  5489. getTag = function(value) {
  5490. var result = objectToString.call(value),
  5491. Ctor = result == objectTag ? value.constructor : undefined,
  5492. ctorString = Ctor ? toSource(Ctor) : undefined;
  5493. if (ctorString) {
  5494. switch (ctorString) {
  5495. case dataViewCtorString: return dataViewTag;
  5496. case mapCtorString: return mapTag;
  5497. case promiseCtorString: return promiseTag;
  5498. case setCtorString: return setTag;
  5499. case weakMapCtorString: return weakMapTag;
  5500. }
  5501. }
  5502. return result;
  5503. };
  5504. }
  5505. /**
  5506. * Checks if `path` exists on `object`.
  5507. *
  5508. * @private
  5509. * @param {Object} object The object to query.
  5510. * @param {Array|string} path The path to check.
  5511. * @param {Function} hasFunc The function to check properties.
  5512. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  5513. */
  5514. function hasPath(object, path, hasFunc) {
  5515. path = isKey(path, object) ? [path] : castPath(path);
  5516. var result,
  5517. index = -1,
  5518. length = path.length;
  5519. while (++index < length) {
  5520. var key = toKey(path[index]);
  5521. if (!(result = object != null && hasFunc(object, key))) {
  5522. break;
  5523. }
  5524. object = object[key];
  5525. }
  5526. if (result) {
  5527. return result;
  5528. }
  5529. var length = object ? object.length : 0;
  5530. return !!length && isLength(length) && isIndex(key, length) &&
  5531. (isArray(object) || isArguments(object));
  5532. }
  5533. /**
  5534. * Checks if `value` is a valid array-like index.
  5535. *
  5536. * @private
  5537. * @param {*} value The value to check.
  5538. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  5539. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  5540. */
  5541. function isIndex(value, length) {
  5542. length = length == null ? MAX_SAFE_INTEGER : length;
  5543. return !!length &&
  5544. (typeof value == 'number' || reIsUint.test(value)) &&
  5545. (value > -1 && value % 1 == 0 && value < length);
  5546. }
  5547. /**
  5548. * Checks if `value` is a property name and not a property path.
  5549. *
  5550. * @private
  5551. * @param {*} value The value to check.
  5552. * @param {Object} [object] The object to query keys on.
  5553. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  5554. */
  5555. function isKey(value, object) {
  5556. if (isArray(value)) {
  5557. return false;
  5558. }
  5559. var type = typeof value;
  5560. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  5561. value == null || isSymbol(value)) {
  5562. return true;
  5563. }
  5564. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  5565. (object != null && value in Object(object));
  5566. }
  5567. /**
  5568. * Checks if `value` is suitable for use as unique object key.
  5569. *
  5570. * @private
  5571. * @param {*} value The value to check.
  5572. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  5573. */
  5574. function isKeyable(value) {
  5575. var type = typeof value;
  5576. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  5577. ? (value !== '__proto__')
  5578. : (value === null);
  5579. }
  5580. /**
  5581. * Checks if `func` has its source masked.
  5582. *
  5583. * @private
  5584. * @param {Function} func The function to check.
  5585. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  5586. */
  5587. function isMasked(func) {
  5588. return !!maskSrcKey && (maskSrcKey in func);
  5589. }
  5590. /**
  5591. * Checks if `value` is likely a prototype object.
  5592. *
  5593. * @private
  5594. * @param {*} value The value to check.
  5595. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  5596. */
  5597. function isPrototype(value) {
  5598. var Ctor = value && value.constructor,
  5599. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  5600. return value === proto;
  5601. }
  5602. /**
  5603. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  5604. *
  5605. * @private
  5606. * @param {*} value The value to check.
  5607. * @returns {boolean} Returns `true` if `value` if suitable for strict
  5608. * equality comparisons, else `false`.
  5609. */
  5610. function isStrictComparable(value) {
  5611. return value === value && !isObject(value);
  5612. }
  5613. /**
  5614. * A specialized version of `matchesProperty` for source values suitable
  5615. * for strict equality comparisons, i.e. `===`.
  5616. *
  5617. * @private
  5618. * @param {string} key The key of the property to get.
  5619. * @param {*} srcValue The value to match.
  5620. * @returns {Function} Returns the new spec function.
  5621. */
  5622. function matchesStrictComparable(key, srcValue) {
  5623. return function(object) {
  5624. if (object == null) {
  5625. return false;
  5626. }
  5627. return object[key] === srcValue &&
  5628. (srcValue !== undefined || (key in Object(object)));
  5629. };
  5630. }
  5631. /**
  5632. * Gets the parent value at `path` of `object`.
  5633. *
  5634. * @private
  5635. * @param {Object} object The object to query.
  5636. * @param {Array} path The path to get the parent value of.
  5637. * @returns {*} Returns the parent value.
  5638. */
  5639. function parent(object, path) {
  5640. return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
  5641. }
  5642. /**
  5643. * Converts `string` to a property path array.
  5644. *
  5645. * @private
  5646. * @param {string} string The string to convert.
  5647. * @returns {Array} Returns the property path array.
  5648. */
  5649. var stringToPath = memoize(function(string) {
  5650. string = toString(string);
  5651. var result = [];
  5652. if (reLeadingDot.test(string)) {
  5653. result.push('');
  5654. }
  5655. string.replace(rePropName, function(match, number, quote, string) {
  5656. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  5657. });
  5658. return result;
  5659. });
  5660. /**
  5661. * Converts `value` to a string key if it's not a string or symbol.
  5662. *
  5663. * @private
  5664. * @param {*} value The value to inspect.
  5665. * @returns {string|symbol} Returns the key.
  5666. */
  5667. function toKey(value) {
  5668. if (typeof value == 'string' || isSymbol(value)) {
  5669. return value;
  5670. }
  5671. var result = (value + '');
  5672. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5673. }
  5674. /**
  5675. * Converts `func` to its source code.
  5676. *
  5677. * @private
  5678. * @param {Function} func The function to process.
  5679. * @returns {string} Returns the source code.
  5680. */
  5681. function toSource(func) {
  5682. if (func != null) {
  5683. try {
  5684. return funcToString.call(func);
  5685. } catch (e) {}
  5686. try {
  5687. return (func + '');
  5688. } catch (e) {}
  5689. }
  5690. return '';
  5691. }
  5692. /**
  5693. * Gets the last element of `array`.
  5694. *
  5695. * @static
  5696. * @memberOf _
  5697. * @since 0.1.0
  5698. * @category Array
  5699. * @param {Array} array The array to query.
  5700. * @returns {*} Returns the last element of `array`.
  5701. * @example
  5702. *
  5703. * _.last([1, 2, 3]);
  5704. * // => 3
  5705. */
  5706. function last(array) {
  5707. var length = array ? array.length : 0;
  5708. return length ? array[length - 1] : undefined;
  5709. }
  5710. /**
  5711. * Removes all elements from `array` that `predicate` returns truthy for
  5712. * and returns an array of the removed elements. The predicate is invoked
  5713. * with three arguments: (value, index, array).
  5714. *
  5715. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  5716. * to pull elements from an array by value.
  5717. *
  5718. * @static
  5719. * @memberOf _
  5720. * @since 2.0.0
  5721. * @category Array
  5722. * @param {Array} array The array to modify.
  5723. * @param {Function} [predicate=_.identity]
  5724. * The function invoked per iteration.
  5725. * @returns {Array} Returns the new array of removed elements.
  5726. * @example
  5727. *
  5728. * var array = [1, 2, 3, 4];
  5729. * var evens = _.remove(array, function(n) {
  5730. * return n % 2 == 0;
  5731. * });
  5732. *
  5733. * console.log(array);
  5734. * // => [1, 3]
  5735. *
  5736. * console.log(evens);
  5737. * // => [2, 4]
  5738. */
  5739. function remove(array, predicate) {
  5740. var result = [];
  5741. if (!(array && array.length)) {
  5742. return result;
  5743. }
  5744. var index = -1,
  5745. indexes = [],
  5746. length = array.length;
  5747. predicate = baseIteratee(predicate, 3);
  5748. while (++index < length) {
  5749. var value = array[index];
  5750. if (predicate(value, index, array)) {
  5751. result.push(value);
  5752. indexes.push(index);
  5753. }
  5754. }
  5755. basePullAt(array, indexes);
  5756. return result;
  5757. }
  5758. /**
  5759. * Creates a function that memoizes the result of `func`. If `resolver` is
  5760. * provided, it determines the cache key for storing the result based on the
  5761. * arguments provided to the memoized function. By default, the first argument
  5762. * provided to the memoized function is used as the map cache key. The `func`
  5763. * is invoked with the `this` binding of the memoized function.
  5764. *
  5765. * **Note:** The cache is exposed as the `cache` property on the memoized
  5766. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  5767. * constructor with one whose instances implement the
  5768. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  5769. * method interface of `delete`, `get`, `has`, and `set`.
  5770. *
  5771. * @static
  5772. * @memberOf _
  5773. * @since 0.1.0
  5774. * @category Function
  5775. * @param {Function} func The function to have its output memoized.
  5776. * @param {Function} [resolver] The function to resolve the cache key.
  5777. * @returns {Function} Returns the new memoized function.
  5778. * @example
  5779. *
  5780. * var object = { 'a': 1, 'b': 2 };
  5781. * var other = { 'c': 3, 'd': 4 };
  5782. *
  5783. * var values = _.memoize(_.values);
  5784. * values(object);
  5785. * // => [1, 2]
  5786. *
  5787. * values(other);
  5788. * // => [3, 4]
  5789. *
  5790. * object.a = 2;
  5791. * values(object);
  5792. * // => [1, 2]
  5793. *
  5794. * // Modify the result cache.
  5795. * values.cache.set(object, ['a', 'b']);
  5796. * values(object);
  5797. * // => ['a', 'b']
  5798. *
  5799. * // Replace `_.memoize.Cache`.
  5800. * _.memoize.Cache = WeakMap;
  5801. */
  5802. function memoize(func, resolver) {
  5803. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  5804. throw new TypeError(FUNC_ERROR_TEXT);
  5805. }
  5806. var memoized = function() {
  5807. var args = arguments,
  5808. key = resolver ? resolver.apply(this, args) : args[0],
  5809. cache = memoized.cache;
  5810. if (cache.has(key)) {
  5811. return cache.get(key);
  5812. }
  5813. var result = func.apply(this, args);
  5814. memoized.cache = cache.set(key, result);
  5815. return result;
  5816. };
  5817. memoized.cache = new (memoize.Cache || MapCache);
  5818. return memoized;
  5819. }
  5820. // Assign cache to `_.memoize`.
  5821. memoize.Cache = MapCache;
  5822. /**
  5823. * Performs a
  5824. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  5825. * comparison between two values to determine if they are equivalent.
  5826. *
  5827. * @static
  5828. * @memberOf _
  5829. * @since 4.0.0
  5830. * @category Lang
  5831. * @param {*} value The value to compare.
  5832. * @param {*} other The other value to compare.
  5833. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  5834. * @example
  5835. *
  5836. * var object = { 'a': 1 };
  5837. * var other = { 'a': 1 };
  5838. *
  5839. * _.eq(object, object);
  5840. * // => true
  5841. *
  5842. * _.eq(object, other);
  5843. * // => false
  5844. *
  5845. * _.eq('a', 'a');
  5846. * // => true
  5847. *
  5848. * _.eq('a', Object('a'));
  5849. * // => false
  5850. *
  5851. * _.eq(NaN, NaN);
  5852. * // => true
  5853. */
  5854. function eq(value, other) {
  5855. return value === other || (value !== value && other !== other);
  5856. }
  5857. /**
  5858. * Checks if `value` is likely an `arguments` object.
  5859. *
  5860. * @static
  5861. * @memberOf _
  5862. * @since 0.1.0
  5863. * @category Lang
  5864. * @param {*} value The value to check.
  5865. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  5866. * else `false`.
  5867. * @example
  5868. *
  5869. * _.isArguments(function() { return arguments; }());
  5870. * // => true
  5871. *
  5872. * _.isArguments([1, 2, 3]);
  5873. * // => false
  5874. */
  5875. function isArguments(value) {
  5876. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  5877. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  5878. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  5879. }
  5880. /**
  5881. * Checks if `value` is classified as an `Array` object.
  5882. *
  5883. * @static
  5884. * @memberOf _
  5885. * @since 0.1.0
  5886. * @category Lang
  5887. * @param {*} value The value to check.
  5888. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  5889. * @example
  5890. *
  5891. * _.isArray([1, 2, 3]);
  5892. * // => true
  5893. *
  5894. * _.isArray(document.body.children);
  5895. * // => false
  5896. *
  5897. * _.isArray('abc');
  5898. * // => false
  5899. *
  5900. * _.isArray(_.noop);
  5901. * // => false
  5902. */
  5903. var isArray = Array.isArray;
  5904. /**
  5905. * Checks if `value` is array-like. A value is considered array-like if it's
  5906. * not a function and has a `value.length` that's an integer greater than or
  5907. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  5908. *
  5909. * @static
  5910. * @memberOf _
  5911. * @since 4.0.0
  5912. * @category Lang
  5913. * @param {*} value The value to check.
  5914. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  5915. * @example
  5916. *
  5917. * _.isArrayLike([1, 2, 3]);
  5918. * // => true
  5919. *
  5920. * _.isArrayLike(document.body.children);
  5921. * // => true
  5922. *
  5923. * _.isArrayLike('abc');
  5924. * // => true
  5925. *
  5926. * _.isArrayLike(_.noop);
  5927. * // => false
  5928. */
  5929. function isArrayLike(value) {
  5930. return value != null && isLength(value.length) && !isFunction(value);
  5931. }
  5932. /**
  5933. * This method is like `_.isArrayLike` except that it also checks if `value`
  5934. * is an object.
  5935. *
  5936. * @static
  5937. * @memberOf _
  5938. * @since 4.0.0
  5939. * @category Lang
  5940. * @param {*} value The value to check.
  5941. * @returns {boolean} Returns `true` if `value` is an array-like object,
  5942. * else `false`.
  5943. * @example
  5944. *
  5945. * _.isArrayLikeObject([1, 2, 3]);
  5946. * // => true
  5947. *
  5948. * _.isArrayLikeObject(document.body.children);
  5949. * // => true
  5950. *
  5951. * _.isArrayLikeObject('abc');
  5952. * // => false
  5953. *
  5954. * _.isArrayLikeObject(_.noop);
  5955. * // => false
  5956. */
  5957. function isArrayLikeObject(value) {
  5958. return isObjectLike(value) && isArrayLike(value);
  5959. }
  5960. /**
  5961. * Checks if `value` is classified as a `Function` object.
  5962. *
  5963. * @static
  5964. * @memberOf _
  5965. * @since 0.1.0
  5966. * @category Lang
  5967. * @param {*} value The value to check.
  5968. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  5969. * @example
  5970. *
  5971. * _.isFunction(_);
  5972. * // => true
  5973. *
  5974. * _.isFunction(/abc/);
  5975. * // => false
  5976. */
  5977. function isFunction(value) {
  5978. // The use of `Object#toString` avoids issues with the `typeof` operator
  5979. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  5980. var tag = isObject(value) ? objectToString.call(value) : '';
  5981. return tag == funcTag || tag == genTag;
  5982. }
  5983. /**
  5984. * Checks if `value` is a valid array-like length.
  5985. *
  5986. * **Note:** This method is loosely based on
  5987. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  5988. *
  5989. * @static
  5990. * @memberOf _
  5991. * @since 4.0.0
  5992. * @category Lang
  5993. * @param {*} value The value to check.
  5994. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  5995. * @example
  5996. *
  5997. * _.isLength(3);
  5998. * // => true
  5999. *
  6000. * _.isLength(Number.MIN_VALUE);
  6001. * // => false
  6002. *
  6003. * _.isLength(Infinity);
  6004. * // => false
  6005. *
  6006. * _.isLength('3');
  6007. * // => false
  6008. */
  6009. function isLength(value) {
  6010. return typeof value == 'number' &&
  6011. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  6012. }
  6013. /**
  6014. * Checks if `value` is the
  6015. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  6016. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  6017. *
  6018. * @static
  6019. * @memberOf _
  6020. * @since 0.1.0
  6021. * @category Lang
  6022. * @param {*} value The value to check.
  6023. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  6024. * @example
  6025. *
  6026. * _.isObject({});
  6027. * // => true
  6028. *
  6029. * _.isObject([1, 2, 3]);
  6030. * // => true
  6031. *
  6032. * _.isObject(_.noop);
  6033. * // => true
  6034. *
  6035. * _.isObject(null);
  6036. * // => false
  6037. */
  6038. function isObject(value) {
  6039. var type = typeof value;
  6040. return !!value && (type == 'object' || type == 'function');
  6041. }
  6042. /**
  6043. * Checks if `value` is object-like. A value is object-like if it's not `null`
  6044. * and has a `typeof` result of "object".
  6045. *
  6046. * @static
  6047. * @memberOf _
  6048. * @since 4.0.0
  6049. * @category Lang
  6050. * @param {*} value The value to check.
  6051. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  6052. * @example
  6053. *
  6054. * _.isObjectLike({});
  6055. * // => true
  6056. *
  6057. * _.isObjectLike([1, 2, 3]);
  6058. * // => true
  6059. *
  6060. * _.isObjectLike(_.noop);
  6061. * // => false
  6062. *
  6063. * _.isObjectLike(null);
  6064. * // => false
  6065. */
  6066. function isObjectLike(value) {
  6067. return !!value && typeof value == 'object';
  6068. }
  6069. /**
  6070. * Checks if `value` is classified as a `Symbol` primitive or object.
  6071. *
  6072. * @static
  6073. * @memberOf _
  6074. * @since 4.0.0
  6075. * @category Lang
  6076. * @param {*} value The value to check.
  6077. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  6078. * @example
  6079. *
  6080. * _.isSymbol(Symbol.iterator);
  6081. * // => true
  6082. *
  6083. * _.isSymbol('abc');
  6084. * // => false
  6085. */
  6086. function isSymbol(value) {
  6087. return typeof value == 'symbol' ||
  6088. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  6089. }
  6090. /**
  6091. * Checks if `value` is classified as a typed array.
  6092. *
  6093. * @static
  6094. * @memberOf _
  6095. * @since 3.0.0
  6096. * @category Lang
  6097. * @param {*} value The value to check.
  6098. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  6099. * @example
  6100. *
  6101. * _.isTypedArray(new Uint8Array);
  6102. * // => true
  6103. *
  6104. * _.isTypedArray([]);
  6105. * // => false
  6106. */
  6107. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  6108. /**
  6109. * Converts `value` to a string. An empty string is returned for `null`
  6110. * and `undefined` values. The sign of `-0` is preserved.
  6111. *
  6112. * @static
  6113. * @memberOf _
  6114. * @since 4.0.0
  6115. * @category Lang
  6116. * @param {*} value The value to process.
  6117. * @returns {string} Returns the string.
  6118. * @example
  6119. *
  6120. * _.toString(null);
  6121. * // => ''
  6122. *
  6123. * _.toString(-0);
  6124. * // => '-0'
  6125. *
  6126. * _.toString([1, 2, 3]);
  6127. * // => '1,2,3'
  6128. */
  6129. function toString(value) {
  6130. return value == null ? '' : baseToString(value);
  6131. }
  6132. /**
  6133. * Gets the value at `path` of `object`. If the resolved value is
  6134. * `undefined`, the `defaultValue` is returned in its place.
  6135. *
  6136. * @static
  6137. * @memberOf _
  6138. * @since 3.7.0
  6139. * @category Object
  6140. * @param {Object} object The object to query.
  6141. * @param {Array|string} path The path of the property to get.
  6142. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  6143. * @returns {*} Returns the resolved value.
  6144. * @example
  6145. *
  6146. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  6147. *
  6148. * _.get(object, 'a[0].b.c');
  6149. * // => 3
  6150. *
  6151. * _.get(object, ['a', '0', 'b', 'c']);
  6152. * // => 3
  6153. *
  6154. * _.get(object, 'a.b.c', 'default');
  6155. * // => 'default'
  6156. */
  6157. function get(object, path, defaultValue) {
  6158. var result = object == null ? undefined : baseGet(object, path);
  6159. return result === undefined ? defaultValue : result;
  6160. }
  6161. /**
  6162. * Checks if `path` is a direct or inherited property of `object`.
  6163. *
  6164. * @static
  6165. * @memberOf _
  6166. * @since 4.0.0
  6167. * @category Object
  6168. * @param {Object} object The object to query.
  6169. * @param {Array|string} path The path to check.
  6170. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6171. * @example
  6172. *
  6173. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  6174. *
  6175. * _.hasIn(object, 'a');
  6176. * // => true
  6177. *
  6178. * _.hasIn(object, 'a.b');
  6179. * // => true
  6180. *
  6181. * _.hasIn(object, ['a', 'b']);
  6182. * // => true
  6183. *
  6184. * _.hasIn(object, 'b');
  6185. * // => false
  6186. */
  6187. function hasIn(object, path) {
  6188. return object != null && hasPath(object, path, baseHasIn);
  6189. }
  6190. /**
  6191. * Creates an array of the own enumerable property names of `object`.
  6192. *
  6193. * **Note:** Non-object values are coerced to objects. See the
  6194. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  6195. * for more details.
  6196. *
  6197. * @static
  6198. * @since 0.1.0
  6199. * @memberOf _
  6200. * @category Object
  6201. * @param {Object} object The object to query.
  6202. * @returns {Array} Returns the array of property names.
  6203. * @example
  6204. *
  6205. * function Foo() {
  6206. * this.a = 1;
  6207. * this.b = 2;
  6208. * }
  6209. *
  6210. * Foo.prototype.c = 3;
  6211. *
  6212. * _.keys(new Foo);
  6213. * // => ['a', 'b'] (iteration order is not guaranteed)
  6214. *
  6215. * _.keys('hi');
  6216. * // => ['0', '1']
  6217. */
  6218. function keys(object) {
  6219. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  6220. }
  6221. /**
  6222. * This method returns the first argument it receives.
  6223. *
  6224. * @static
  6225. * @since 0.1.0
  6226. * @memberOf _
  6227. * @category Util
  6228. * @param {*} value Any value.
  6229. * @returns {*} Returns `value`.
  6230. * @example
  6231. *
  6232. * var object = { 'a': 1 };
  6233. *
  6234. * console.log(_.identity(object) === object);
  6235. * // => true
  6236. */
  6237. function identity(value) {
  6238. return value;
  6239. }
  6240. /**
  6241. * Creates a function that returns the value at `path` of a given object.
  6242. *
  6243. * @static
  6244. * @memberOf _
  6245. * @since 2.4.0
  6246. * @category Util
  6247. * @param {Array|string} path The path of the property to get.
  6248. * @returns {Function} Returns the new accessor function.
  6249. * @example
  6250. *
  6251. * var objects = [
  6252. * { 'a': { 'b': 2 } },
  6253. * { 'a': { 'b': 1 } }
  6254. * ];
  6255. *
  6256. * _.map(objects, _.property('a.b'));
  6257. * // => [2, 1]
  6258. *
  6259. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  6260. * // => [1, 2]
  6261. */
  6262. function property(path) {
  6263. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  6264. }
  6265. module.exports = remove;
  6266. /***/ }),
  6267. /***/ 52:
  6268. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6269. /**
  6270. * lodash (Custom Build) <https://lodash.com/>
  6271. * Build: `lodash modularize exports="npm" -o ./`
  6272. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  6273. * Released under MIT license <https://lodash.com/license>
  6274. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6275. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  6276. */
  6277. /** Used as references for various `Number` constants. */
  6278. var MAX_SAFE_INTEGER = 9007199254740991;
  6279. /** `Object#toString` result references. */
  6280. var argsTag = '[object Arguments]',
  6281. funcTag = '[object Function]',
  6282. genTag = '[object GeneratorFunction]',
  6283. mapTag = '[object Map]',
  6284. objectTag = '[object Object]',
  6285. promiseTag = '[object Promise]',
  6286. setTag = '[object Set]',
  6287. weakMapTag = '[object WeakMap]';
  6288. var dataViewTag = '[object DataView]';
  6289. /**
  6290. * Used to match `RegExp`
  6291. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  6292. */
  6293. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  6294. /** Used to detect host constructors (Safari). */
  6295. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  6296. /** Used to detect unsigned integer values. */
  6297. var reIsUint = /^(?:0|[1-9]\d*)$/;
  6298. /** Detect free variable `global` from Node.js. */
  6299. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  6300. /** Detect free variable `self`. */
  6301. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  6302. /** Used as a reference to the global object. */
  6303. var root = freeGlobal || freeSelf || Function('return this')();
  6304. /**
  6305. * A specialized version of `_.map` for arrays without support for iteratee
  6306. * shorthands.
  6307. *
  6308. * @private
  6309. * @param {Array} [array] The array to iterate over.
  6310. * @param {Function} iteratee The function invoked per iteration.
  6311. * @returns {Array} Returns the new mapped array.
  6312. */
  6313. function arrayMap(array, iteratee) {
  6314. var index = -1,
  6315. length = array ? array.length : 0,
  6316. result = Array(length);
  6317. while (++index < length) {
  6318. result[index] = iteratee(array[index], index, array);
  6319. }
  6320. return result;
  6321. }
  6322. /**
  6323. * The base implementation of `_.times` without support for iteratee shorthands
  6324. * or max array length checks.
  6325. *
  6326. * @private
  6327. * @param {number} n The number of times to invoke `iteratee`.
  6328. * @param {Function} iteratee The function invoked per iteration.
  6329. * @returns {Array} Returns the array of results.
  6330. */
  6331. function baseTimes(n, iteratee) {
  6332. var index = -1,
  6333. result = Array(n);
  6334. while (++index < n) {
  6335. result[index] = iteratee(index);
  6336. }
  6337. return result;
  6338. }
  6339. /**
  6340. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  6341. * of key-value pairs for `object` corresponding to the property names of `props`.
  6342. *
  6343. * @private
  6344. * @param {Object} object The object to query.
  6345. * @param {Array} props The property names to get values for.
  6346. * @returns {Object} Returns the key-value pairs.
  6347. */
  6348. function baseToPairs(object, props) {
  6349. return arrayMap(props, function(key) {
  6350. return [key, object[key]];
  6351. });
  6352. }
  6353. /**
  6354. * Gets the value at `key` of `object`.
  6355. *
  6356. * @private
  6357. * @param {Object} [object] The object to query.
  6358. * @param {string} key The key of the property to get.
  6359. * @returns {*} Returns the property value.
  6360. */
  6361. function getValue(object, key) {
  6362. return object == null ? undefined : object[key];
  6363. }
  6364. /**
  6365. * Checks if `value` is a host object in IE < 9.
  6366. *
  6367. * @private
  6368. * @param {*} value The value to check.
  6369. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  6370. */
  6371. function isHostObject(value) {
  6372. // Many host objects are `Object` objects that can coerce to strings
  6373. // despite having improperly defined `toString` methods.
  6374. var result = false;
  6375. if (value != null && typeof value.toString != 'function') {
  6376. try {
  6377. result = !!(value + '');
  6378. } catch (e) {}
  6379. }
  6380. return result;
  6381. }
  6382. /**
  6383. * Converts `map` to its key-value pairs.
  6384. *
  6385. * @private
  6386. * @param {Object} map The map to convert.
  6387. * @returns {Array} Returns the key-value pairs.
  6388. */
  6389. function mapToArray(map) {
  6390. var index = -1,
  6391. result = Array(map.size);
  6392. map.forEach(function(value, key) {
  6393. result[++index] = [key, value];
  6394. });
  6395. return result;
  6396. }
  6397. /**
  6398. * Creates a unary function that invokes `func` with its argument transformed.
  6399. *
  6400. * @private
  6401. * @param {Function} func The function to wrap.
  6402. * @param {Function} transform The argument transform.
  6403. * @returns {Function} Returns the new function.
  6404. */
  6405. function overArg(func, transform) {
  6406. return function(arg) {
  6407. return func(transform(arg));
  6408. };
  6409. }
  6410. /**
  6411. * Converts `set` to its value-value pairs.
  6412. *
  6413. * @private
  6414. * @param {Object} set The set to convert.
  6415. * @returns {Array} Returns the value-value pairs.
  6416. */
  6417. function setToPairs(set) {
  6418. var index = -1,
  6419. result = Array(set.size);
  6420. set.forEach(function(value) {
  6421. result[++index] = [value, value];
  6422. });
  6423. return result;
  6424. }
  6425. /** Used for built-in method references. */
  6426. var funcProto = Function.prototype,
  6427. objectProto = Object.prototype;
  6428. /** Used to detect overreaching core-js shims. */
  6429. var coreJsData = root['__core-js_shared__'];
  6430. /** Used to detect methods masquerading as native. */
  6431. var maskSrcKey = (function() {
  6432. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  6433. return uid ? ('Symbol(src)_1.' + uid) : '';
  6434. }());
  6435. /** Used to resolve the decompiled source of functions. */
  6436. var funcToString = funcProto.toString;
  6437. /** Used to check objects for own properties. */
  6438. var hasOwnProperty = objectProto.hasOwnProperty;
  6439. /**
  6440. * Used to resolve the
  6441. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  6442. * of values.
  6443. */
  6444. var objectToString = objectProto.toString;
  6445. /** Used to detect if a method is native. */
  6446. var reIsNative = RegExp('^' +
  6447. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  6448. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  6449. );
  6450. /** Built-in value references. */
  6451. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  6452. /* Built-in method references for those with the same name as other `lodash` methods. */
  6453. var nativeKeys = overArg(Object.keys, Object);
  6454. /* Built-in method references that are verified to be native. */
  6455. var DataView = getNative(root, 'DataView'),
  6456. Map = getNative(root, 'Map'),
  6457. Promise = getNative(root, 'Promise'),
  6458. Set = getNative(root, 'Set'),
  6459. WeakMap = getNative(root, 'WeakMap');
  6460. /** Used to detect maps, sets, and weakmaps. */
  6461. var dataViewCtorString = toSource(DataView),
  6462. mapCtorString = toSource(Map),
  6463. promiseCtorString = toSource(Promise),
  6464. setCtorString = toSource(Set),
  6465. weakMapCtorString = toSource(WeakMap);
  6466. /**
  6467. * Creates an array of the enumerable property names of the array-like `value`.
  6468. *
  6469. * @private
  6470. * @param {*} value The value to query.
  6471. * @param {boolean} inherited Specify returning inherited property names.
  6472. * @returns {Array} Returns the array of property names.
  6473. */
  6474. function arrayLikeKeys(value, inherited) {
  6475. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  6476. // Safari 9 makes `arguments.length` enumerable in strict mode.
  6477. var result = (isArray(value) || isArguments(value))
  6478. ? baseTimes(value.length, String)
  6479. : [];
  6480. var length = result.length,
  6481. skipIndexes = !!length;
  6482. for (var key in value) {
  6483. if ((inherited || hasOwnProperty.call(value, key)) &&
  6484. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  6485. result.push(key);
  6486. }
  6487. }
  6488. return result;
  6489. }
  6490. /**
  6491. * The base implementation of `getTag`.
  6492. *
  6493. * @private
  6494. * @param {*} value The value to query.
  6495. * @returns {string} Returns the `toStringTag`.
  6496. */
  6497. function baseGetTag(value) {
  6498. return objectToString.call(value);
  6499. }
  6500. /**
  6501. * The base implementation of `_.isNative` without bad shim checks.
  6502. *
  6503. * @private
  6504. * @param {*} value The value to check.
  6505. * @returns {boolean} Returns `true` if `value` is a native function,
  6506. * else `false`.
  6507. */
  6508. function baseIsNative(value) {
  6509. if (!isObject(value) || isMasked(value)) {
  6510. return false;
  6511. }
  6512. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  6513. return pattern.test(toSource(value));
  6514. }
  6515. /**
  6516. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  6517. *
  6518. * @private
  6519. * @param {Object} object The object to query.
  6520. * @returns {Array} Returns the array of property names.
  6521. */
  6522. function baseKeys(object) {
  6523. if (!isPrototype(object)) {
  6524. return nativeKeys(object);
  6525. }
  6526. var result = [];
  6527. for (var key in Object(object)) {
  6528. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  6529. result.push(key);
  6530. }
  6531. }
  6532. return result;
  6533. }
  6534. /**
  6535. * Creates a `_.toPairs` or `_.toPairsIn` function.
  6536. *
  6537. * @private
  6538. * @param {Function} keysFunc The function to get the keys of a given object.
  6539. * @returns {Function} Returns the new pairs function.
  6540. */
  6541. function createToPairs(keysFunc) {
  6542. return function(object) {
  6543. var tag = getTag(object);
  6544. if (tag == mapTag) {
  6545. return mapToArray(object);
  6546. }
  6547. if (tag == setTag) {
  6548. return setToPairs(object);
  6549. }
  6550. return baseToPairs(object, keysFunc(object));
  6551. };
  6552. }
  6553. /**
  6554. * Gets the native function at `key` of `object`.
  6555. *
  6556. * @private
  6557. * @param {Object} object The object to query.
  6558. * @param {string} key The key of the method to get.
  6559. * @returns {*} Returns the function if it's native, else `undefined`.
  6560. */
  6561. function getNative(object, key) {
  6562. var value = getValue(object, key);
  6563. return baseIsNative(value) ? value : undefined;
  6564. }
  6565. /**
  6566. * Gets the `toStringTag` of `value`.
  6567. *
  6568. * @private
  6569. * @param {*} value The value to query.
  6570. * @returns {string} Returns the `toStringTag`.
  6571. */
  6572. var getTag = baseGetTag;
  6573. // Fallback for data views, maps, sets, and weak maps in IE 11,
  6574. // for data views in Edge < 14, and promises in Node.js.
  6575. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  6576. (Map && getTag(new Map) != mapTag) ||
  6577. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  6578. (Set && getTag(new Set) != setTag) ||
  6579. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  6580. getTag = function(value) {
  6581. var result = objectToString.call(value),
  6582. Ctor = result == objectTag ? value.constructor : undefined,
  6583. ctorString = Ctor ? toSource(Ctor) : undefined;
  6584. if (ctorString) {
  6585. switch (ctorString) {
  6586. case dataViewCtorString: return dataViewTag;
  6587. case mapCtorString: return mapTag;
  6588. case promiseCtorString: return promiseTag;
  6589. case setCtorString: return setTag;
  6590. case weakMapCtorString: return weakMapTag;
  6591. }
  6592. }
  6593. return result;
  6594. };
  6595. }
  6596. /**
  6597. * Checks if `value` is a valid array-like index.
  6598. *
  6599. * @private
  6600. * @param {*} value The value to check.
  6601. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  6602. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  6603. */
  6604. function isIndex(value, length) {
  6605. length = length == null ? MAX_SAFE_INTEGER : length;
  6606. return !!length &&
  6607. (typeof value == 'number' || reIsUint.test(value)) &&
  6608. (value > -1 && value % 1 == 0 && value < length);
  6609. }
  6610. /**
  6611. * Checks if `func` has its source masked.
  6612. *
  6613. * @private
  6614. * @param {Function} func The function to check.
  6615. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  6616. */
  6617. function isMasked(func) {
  6618. return !!maskSrcKey && (maskSrcKey in func);
  6619. }
  6620. /**
  6621. * Checks if `value` is likely a prototype object.
  6622. *
  6623. * @private
  6624. * @param {*} value The value to check.
  6625. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  6626. */
  6627. function isPrototype(value) {
  6628. var Ctor = value && value.constructor,
  6629. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  6630. return value === proto;
  6631. }
  6632. /**
  6633. * Converts `func` to its source code.
  6634. *
  6635. * @private
  6636. * @param {Function} func The function to process.
  6637. * @returns {string} Returns the source code.
  6638. */
  6639. function toSource(func) {
  6640. if (func != null) {
  6641. try {
  6642. return funcToString.call(func);
  6643. } catch (e) {}
  6644. try {
  6645. return (func + '');
  6646. } catch (e) {}
  6647. }
  6648. return '';
  6649. }
  6650. /**
  6651. * Checks if `value` is likely an `arguments` object.
  6652. *
  6653. * @static
  6654. * @memberOf _
  6655. * @since 0.1.0
  6656. * @category Lang
  6657. * @param {*} value The value to check.
  6658. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  6659. * else `false`.
  6660. * @example
  6661. *
  6662. * _.isArguments(function() { return arguments; }());
  6663. * // => true
  6664. *
  6665. * _.isArguments([1, 2, 3]);
  6666. * // => false
  6667. */
  6668. function isArguments(value) {
  6669. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  6670. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  6671. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  6672. }
  6673. /**
  6674. * Checks if `value` is classified as an `Array` object.
  6675. *
  6676. * @static
  6677. * @memberOf _
  6678. * @since 0.1.0
  6679. * @category Lang
  6680. * @param {*} value The value to check.
  6681. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  6682. * @example
  6683. *
  6684. * _.isArray([1, 2, 3]);
  6685. * // => true
  6686. *
  6687. * _.isArray(document.body.children);
  6688. * // => false
  6689. *
  6690. * _.isArray('abc');
  6691. * // => false
  6692. *
  6693. * _.isArray(_.noop);
  6694. * // => false
  6695. */
  6696. var isArray = Array.isArray;
  6697. /**
  6698. * Checks if `value` is array-like. A value is considered array-like if it's
  6699. * not a function and has a `value.length` that's an integer greater than or
  6700. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  6701. *
  6702. * @static
  6703. * @memberOf _
  6704. * @since 4.0.0
  6705. * @category Lang
  6706. * @param {*} value The value to check.
  6707. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  6708. * @example
  6709. *
  6710. * _.isArrayLike([1, 2, 3]);
  6711. * // => true
  6712. *
  6713. * _.isArrayLike(document.body.children);
  6714. * // => true
  6715. *
  6716. * _.isArrayLike('abc');
  6717. * // => true
  6718. *
  6719. * _.isArrayLike(_.noop);
  6720. * // => false
  6721. */
  6722. function isArrayLike(value) {
  6723. return value != null && isLength(value.length) && !isFunction(value);
  6724. }
  6725. /**
  6726. * This method is like `_.isArrayLike` except that it also checks if `value`
  6727. * is an object.
  6728. *
  6729. * @static
  6730. * @memberOf _
  6731. * @since 4.0.0
  6732. * @category Lang
  6733. * @param {*} value The value to check.
  6734. * @returns {boolean} Returns `true` if `value` is an array-like object,
  6735. * else `false`.
  6736. * @example
  6737. *
  6738. * _.isArrayLikeObject([1, 2, 3]);
  6739. * // => true
  6740. *
  6741. * _.isArrayLikeObject(document.body.children);
  6742. * // => true
  6743. *
  6744. * _.isArrayLikeObject('abc');
  6745. * // => false
  6746. *
  6747. * _.isArrayLikeObject(_.noop);
  6748. * // => false
  6749. */
  6750. function isArrayLikeObject(value) {
  6751. return isObjectLike(value) && isArrayLike(value);
  6752. }
  6753. /**
  6754. * Checks if `value` is classified as a `Function` object.
  6755. *
  6756. * @static
  6757. * @memberOf _
  6758. * @since 0.1.0
  6759. * @category Lang
  6760. * @param {*} value The value to check.
  6761. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  6762. * @example
  6763. *
  6764. * _.isFunction(_);
  6765. * // => true
  6766. *
  6767. * _.isFunction(/abc/);
  6768. * // => false
  6769. */
  6770. function isFunction(value) {
  6771. // The use of `Object#toString` avoids issues with the `typeof` operator
  6772. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  6773. var tag = isObject(value) ? objectToString.call(value) : '';
  6774. return tag == funcTag || tag == genTag;
  6775. }
  6776. /**
  6777. * Checks if `value` is a valid array-like length.
  6778. *
  6779. * **Note:** This method is loosely based on
  6780. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  6781. *
  6782. * @static
  6783. * @memberOf _
  6784. * @since 4.0.0
  6785. * @category Lang
  6786. * @param {*} value The value to check.
  6787. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  6788. * @example
  6789. *
  6790. * _.isLength(3);
  6791. * // => true
  6792. *
  6793. * _.isLength(Number.MIN_VALUE);
  6794. * // => false
  6795. *
  6796. * _.isLength(Infinity);
  6797. * // => false
  6798. *
  6799. * _.isLength('3');
  6800. * // => false
  6801. */
  6802. function isLength(value) {
  6803. return typeof value == 'number' &&
  6804. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  6805. }
  6806. /**
  6807. * Checks if `value` is the
  6808. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  6809. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  6810. *
  6811. * @static
  6812. * @memberOf _
  6813. * @since 0.1.0
  6814. * @category Lang
  6815. * @param {*} value The value to check.
  6816. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  6817. * @example
  6818. *
  6819. * _.isObject({});
  6820. * // => true
  6821. *
  6822. * _.isObject([1, 2, 3]);
  6823. * // => true
  6824. *
  6825. * _.isObject(_.noop);
  6826. * // => true
  6827. *
  6828. * _.isObject(null);
  6829. * // => false
  6830. */
  6831. function isObject(value) {
  6832. var type = typeof value;
  6833. return !!value && (type == 'object' || type == 'function');
  6834. }
  6835. /**
  6836. * Checks if `value` is object-like. A value is object-like if it's not `null`
  6837. * and has a `typeof` result of "object".
  6838. *
  6839. * @static
  6840. * @memberOf _
  6841. * @since 4.0.0
  6842. * @category Lang
  6843. * @param {*} value The value to check.
  6844. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  6845. * @example
  6846. *
  6847. * _.isObjectLike({});
  6848. * // => true
  6849. *
  6850. * _.isObjectLike([1, 2, 3]);
  6851. * // => true
  6852. *
  6853. * _.isObjectLike(_.noop);
  6854. * // => false
  6855. *
  6856. * _.isObjectLike(null);
  6857. * // => false
  6858. */
  6859. function isObjectLike(value) {
  6860. return !!value && typeof value == 'object';
  6861. }
  6862. /**
  6863. * Creates an array of the own enumerable property names of `object`.
  6864. *
  6865. * **Note:** Non-object values are coerced to objects. See the
  6866. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  6867. * for more details.
  6868. *
  6869. * @static
  6870. * @since 0.1.0
  6871. * @memberOf _
  6872. * @category Object
  6873. * @param {Object} object The object to query.
  6874. * @returns {Array} Returns the array of property names.
  6875. * @example
  6876. *
  6877. * function Foo() {
  6878. * this.a = 1;
  6879. * this.b = 2;
  6880. * }
  6881. *
  6882. * Foo.prototype.c = 3;
  6883. *
  6884. * _.keys(new Foo);
  6885. * // => ['a', 'b'] (iteration order is not guaranteed)
  6886. *
  6887. * _.keys('hi');
  6888. * // => ['0', '1']
  6889. */
  6890. function keys(object) {
  6891. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  6892. }
  6893. /**
  6894. * Creates an array of own enumerable string keyed-value pairs for `object`
  6895. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  6896. * entries are returned.
  6897. *
  6898. * @static
  6899. * @memberOf _
  6900. * @since 4.0.0
  6901. * @alias entries
  6902. * @category Object
  6903. * @param {Object} object The object to query.
  6904. * @returns {Array} Returns the key-value pairs.
  6905. * @example
  6906. *
  6907. * function Foo() {
  6908. * this.a = 1;
  6909. * this.b = 2;
  6910. * }
  6911. *
  6912. * Foo.prototype.c = 3;
  6913. *
  6914. * _.toPairs(new Foo);
  6915. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  6916. */
  6917. var toPairs = createToPairs(keys);
  6918. module.exports = toPairs;
  6919. /***/ }),
  6920. /***/ 618:
  6921. /***/ ((module, exports, __webpack_require__) => {
  6922. /* module decorator */ module = __webpack_require__.nmd(module);
  6923. /**
  6924. * lodash (Custom Build) <https://lodash.com/>
  6925. * Build: `lodash modularize exports="npm" -o ./`
  6926. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  6927. * Released under MIT license <https://lodash.com/license>
  6928. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6929. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  6930. */
  6931. /** Used as the size to enable large array optimizations. */
  6932. var LARGE_ARRAY_SIZE = 200;
  6933. /** Used as the `TypeError` message for "Functions" methods. */
  6934. var FUNC_ERROR_TEXT = 'Expected a function';
  6935. /** Used to stand-in for `undefined` hash values. */
  6936. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  6937. /** Used to compose bitmasks for comparison styles. */
  6938. var UNORDERED_COMPARE_FLAG = 1,
  6939. PARTIAL_COMPARE_FLAG = 2;
  6940. /** Used as references for various `Number` constants. */
  6941. var INFINITY = 1 / 0,
  6942. MAX_SAFE_INTEGER = 9007199254740991;
  6943. /** `Object#toString` result references. */
  6944. var argsTag = '[object Arguments]',
  6945. arrayTag = '[object Array]',
  6946. boolTag = '[object Boolean]',
  6947. dateTag = '[object Date]',
  6948. errorTag = '[object Error]',
  6949. funcTag = '[object Function]',
  6950. genTag = '[object GeneratorFunction]',
  6951. mapTag = '[object Map]',
  6952. numberTag = '[object Number]',
  6953. objectTag = '[object Object]',
  6954. promiseTag = '[object Promise]',
  6955. regexpTag = '[object RegExp]',
  6956. setTag = '[object Set]',
  6957. stringTag = '[object String]',
  6958. symbolTag = '[object Symbol]',
  6959. weakMapTag = '[object WeakMap]';
  6960. var arrayBufferTag = '[object ArrayBuffer]',
  6961. dataViewTag = '[object DataView]',
  6962. float32Tag = '[object Float32Array]',
  6963. float64Tag = '[object Float64Array]',
  6964. int8Tag = '[object Int8Array]',
  6965. int16Tag = '[object Int16Array]',
  6966. int32Tag = '[object Int32Array]',
  6967. uint8Tag = '[object Uint8Array]',
  6968. uint8ClampedTag = '[object Uint8ClampedArray]',
  6969. uint16Tag = '[object Uint16Array]',
  6970. uint32Tag = '[object Uint32Array]';
  6971. /** Used to match property names within property paths. */
  6972. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  6973. reIsPlainProp = /^\w*$/,
  6974. reLeadingDot = /^\./,
  6975. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  6976. /**
  6977. * Used to match `RegExp`
  6978. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  6979. */
  6980. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  6981. /** Used to match backslashes in property paths. */
  6982. var reEscapeChar = /\\(\\)?/g;
  6983. /** Used to detect host constructors (Safari). */
  6984. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  6985. /** Used to detect unsigned integer values. */
  6986. var reIsUint = /^(?:0|[1-9]\d*)$/;
  6987. /** Used to identify `toStringTag` values of typed arrays. */
  6988. var typedArrayTags = {};
  6989. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  6990. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  6991. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  6992. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  6993. typedArrayTags[uint32Tag] = true;
  6994. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  6995. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  6996. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  6997. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  6998. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  6999. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  7000. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  7001. typedArrayTags[weakMapTag] = false;
  7002. /** Detect free variable `global` from Node.js. */
  7003. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  7004. /** Detect free variable `self`. */
  7005. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  7006. /** Used as a reference to the global object. */
  7007. var root = freeGlobal || freeSelf || Function('return this')();
  7008. /** Detect free variable `exports`. */
  7009. var freeExports = true && exports && !exports.nodeType && exports;
  7010. /** Detect free variable `module`. */
  7011. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  7012. /** Detect the popular CommonJS extension `module.exports`. */
  7013. var moduleExports = freeModule && freeModule.exports === freeExports;
  7014. /** Detect free variable `process` from Node.js. */
  7015. var freeProcess = moduleExports && freeGlobal.process;
  7016. /** Used to access faster Node.js helpers. */
  7017. var nodeUtil = (function() {
  7018. try {
  7019. return freeProcess && freeProcess.binding('util');
  7020. } catch (e) {}
  7021. }());
  7022. /* Node.js helper references. */
  7023. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  7024. /**
  7025. * A specialized version of `_.includes` for arrays without support for
  7026. * specifying an index to search from.
  7027. *
  7028. * @private
  7029. * @param {Array} [array] The array to inspect.
  7030. * @param {*} target The value to search for.
  7031. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  7032. */
  7033. function arrayIncludes(array, value) {
  7034. var length = array ? array.length : 0;
  7035. return !!length && baseIndexOf(array, value, 0) > -1;
  7036. }
  7037. /**
  7038. * This function is like `arrayIncludes` except that it accepts a comparator.
  7039. *
  7040. * @private
  7041. * @param {Array} [array] The array to inspect.
  7042. * @param {*} target The value to search for.
  7043. * @param {Function} comparator The comparator invoked per element.
  7044. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  7045. */
  7046. function arrayIncludesWith(array, value, comparator) {
  7047. var index = -1,
  7048. length = array ? array.length : 0;
  7049. while (++index < length) {
  7050. if (comparator(value, array[index])) {
  7051. return true;
  7052. }
  7053. }
  7054. return false;
  7055. }
  7056. /**
  7057. * A specialized version of `_.some` for arrays without support for iteratee
  7058. * shorthands.
  7059. *
  7060. * @private
  7061. * @param {Array} [array] The array to iterate over.
  7062. * @param {Function} predicate The function invoked per iteration.
  7063. * @returns {boolean} Returns `true` if any element passes the predicate check,
  7064. * else `false`.
  7065. */
  7066. function arraySome(array, predicate) {
  7067. var index = -1,
  7068. length = array ? array.length : 0;
  7069. while (++index < length) {
  7070. if (predicate(array[index], index, array)) {
  7071. return true;
  7072. }
  7073. }
  7074. return false;
  7075. }
  7076. /**
  7077. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  7078. * support for iteratee shorthands.
  7079. *
  7080. * @private
  7081. * @param {Array} array The array to inspect.
  7082. * @param {Function} predicate The function invoked per iteration.
  7083. * @param {number} fromIndex The index to search from.
  7084. * @param {boolean} [fromRight] Specify iterating from right to left.
  7085. * @returns {number} Returns the index of the matched value, else `-1`.
  7086. */
  7087. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  7088. var length = array.length,
  7089. index = fromIndex + (fromRight ? 1 : -1);
  7090. while ((fromRight ? index-- : ++index < length)) {
  7091. if (predicate(array[index], index, array)) {
  7092. return index;
  7093. }
  7094. }
  7095. return -1;
  7096. }
  7097. /**
  7098. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  7099. *
  7100. * @private
  7101. * @param {Array} array The array to inspect.
  7102. * @param {*} value The value to search for.
  7103. * @param {number} fromIndex The index to search from.
  7104. * @returns {number} Returns the index of the matched value, else `-1`.
  7105. */
  7106. function baseIndexOf(array, value, fromIndex) {
  7107. if (value !== value) {
  7108. return baseFindIndex(array, baseIsNaN, fromIndex);
  7109. }
  7110. var index = fromIndex - 1,
  7111. length = array.length;
  7112. while (++index < length) {
  7113. if (array[index] === value) {
  7114. return index;
  7115. }
  7116. }
  7117. return -1;
  7118. }
  7119. /**
  7120. * The base implementation of `_.isNaN` without support for number objects.
  7121. *
  7122. * @private
  7123. * @param {*} value The value to check.
  7124. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  7125. */
  7126. function baseIsNaN(value) {
  7127. return value !== value;
  7128. }
  7129. /**
  7130. * The base implementation of `_.property` without support for deep paths.
  7131. *
  7132. * @private
  7133. * @param {string} key The key of the property to get.
  7134. * @returns {Function} Returns the new accessor function.
  7135. */
  7136. function baseProperty(key) {
  7137. return function(object) {
  7138. return object == null ? undefined : object[key];
  7139. };
  7140. }
  7141. /**
  7142. * The base implementation of `_.times` without support for iteratee shorthands
  7143. * or max array length checks.
  7144. *
  7145. * @private
  7146. * @param {number} n The number of times to invoke `iteratee`.
  7147. * @param {Function} iteratee The function invoked per iteration.
  7148. * @returns {Array} Returns the array of results.
  7149. */
  7150. function baseTimes(n, iteratee) {
  7151. var index = -1,
  7152. result = Array(n);
  7153. while (++index < n) {
  7154. result[index] = iteratee(index);
  7155. }
  7156. return result;
  7157. }
  7158. /**
  7159. * The base implementation of `_.unary` without support for storing metadata.
  7160. *
  7161. * @private
  7162. * @param {Function} func The function to cap arguments for.
  7163. * @returns {Function} Returns the new capped function.
  7164. */
  7165. function baseUnary(func) {
  7166. return function(value) {
  7167. return func(value);
  7168. };
  7169. }
  7170. /**
  7171. * Checks if a cache value for `key` exists.
  7172. *
  7173. * @private
  7174. * @param {Object} cache The cache to query.
  7175. * @param {string} key The key of the entry to check.
  7176. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  7177. */
  7178. function cacheHas(cache, key) {
  7179. return cache.has(key);
  7180. }
  7181. /**
  7182. * Gets the value at `key` of `object`.
  7183. *
  7184. * @private
  7185. * @param {Object} [object] The object to query.
  7186. * @param {string} key The key of the property to get.
  7187. * @returns {*} Returns the property value.
  7188. */
  7189. function getValue(object, key) {
  7190. return object == null ? undefined : object[key];
  7191. }
  7192. /**
  7193. * Checks if `value` is a host object in IE < 9.
  7194. *
  7195. * @private
  7196. * @param {*} value The value to check.
  7197. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  7198. */
  7199. function isHostObject(value) {
  7200. // Many host objects are `Object` objects that can coerce to strings
  7201. // despite having improperly defined `toString` methods.
  7202. var result = false;
  7203. if (value != null && typeof value.toString != 'function') {
  7204. try {
  7205. result = !!(value + '');
  7206. } catch (e) {}
  7207. }
  7208. return result;
  7209. }
  7210. /**
  7211. * Converts `map` to its key-value pairs.
  7212. *
  7213. * @private
  7214. * @param {Object} map The map to convert.
  7215. * @returns {Array} Returns the key-value pairs.
  7216. */
  7217. function mapToArray(map) {
  7218. var index = -1,
  7219. result = Array(map.size);
  7220. map.forEach(function(value, key) {
  7221. result[++index] = [key, value];
  7222. });
  7223. return result;
  7224. }
  7225. /**
  7226. * Creates a unary function that invokes `func` with its argument transformed.
  7227. *
  7228. * @private
  7229. * @param {Function} func The function to wrap.
  7230. * @param {Function} transform The argument transform.
  7231. * @returns {Function} Returns the new function.
  7232. */
  7233. function overArg(func, transform) {
  7234. return function(arg) {
  7235. return func(transform(arg));
  7236. };
  7237. }
  7238. /**
  7239. * Converts `set` to an array of its values.
  7240. *
  7241. * @private
  7242. * @param {Object} set The set to convert.
  7243. * @returns {Array} Returns the values.
  7244. */
  7245. function setToArray(set) {
  7246. var index = -1,
  7247. result = Array(set.size);
  7248. set.forEach(function(value) {
  7249. result[++index] = value;
  7250. });
  7251. return result;
  7252. }
  7253. /** Used for built-in method references. */
  7254. var arrayProto = Array.prototype,
  7255. funcProto = Function.prototype,
  7256. objectProto = Object.prototype;
  7257. /** Used to detect overreaching core-js shims. */
  7258. var coreJsData = root['__core-js_shared__'];
  7259. /** Used to detect methods masquerading as native. */
  7260. var maskSrcKey = (function() {
  7261. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  7262. return uid ? ('Symbol(src)_1.' + uid) : '';
  7263. }());
  7264. /** Used to resolve the decompiled source of functions. */
  7265. var funcToString = funcProto.toString;
  7266. /** Used to check objects for own properties. */
  7267. var hasOwnProperty = objectProto.hasOwnProperty;
  7268. /**
  7269. * Used to resolve the
  7270. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  7271. * of values.
  7272. */
  7273. var objectToString = objectProto.toString;
  7274. /** Used to detect if a method is native. */
  7275. var reIsNative = RegExp('^' +
  7276. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  7277. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  7278. );
  7279. /** Built-in value references. */
  7280. var Symbol = root.Symbol,
  7281. Uint8Array = root.Uint8Array,
  7282. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  7283. splice = arrayProto.splice;
  7284. /* Built-in method references for those with the same name as other `lodash` methods. */
  7285. var nativeKeys = overArg(Object.keys, Object);
  7286. /* Built-in method references that are verified to be native. */
  7287. var DataView = getNative(root, 'DataView'),
  7288. Map = getNative(root, 'Map'),
  7289. Promise = getNative(root, 'Promise'),
  7290. Set = getNative(root, 'Set'),
  7291. WeakMap = getNative(root, 'WeakMap'),
  7292. nativeCreate = getNative(Object, 'create');
  7293. /** Used to detect maps, sets, and weakmaps. */
  7294. var dataViewCtorString = toSource(DataView),
  7295. mapCtorString = toSource(Map),
  7296. promiseCtorString = toSource(Promise),
  7297. setCtorString = toSource(Set),
  7298. weakMapCtorString = toSource(WeakMap);
  7299. /** Used to convert symbols to primitives and strings. */
  7300. var symbolProto = Symbol ? Symbol.prototype : undefined,
  7301. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  7302. symbolToString = symbolProto ? symbolProto.toString : undefined;
  7303. /**
  7304. * Creates a hash object.
  7305. *
  7306. * @private
  7307. * @constructor
  7308. * @param {Array} [entries] The key-value pairs to cache.
  7309. */
  7310. function Hash(entries) {
  7311. var index = -1,
  7312. length = entries ? entries.length : 0;
  7313. this.clear();
  7314. while (++index < length) {
  7315. var entry = entries[index];
  7316. this.set(entry[0], entry[1]);
  7317. }
  7318. }
  7319. /**
  7320. * Removes all key-value entries from the hash.
  7321. *
  7322. * @private
  7323. * @name clear
  7324. * @memberOf Hash
  7325. */
  7326. function hashClear() {
  7327. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  7328. }
  7329. /**
  7330. * Removes `key` and its value from the hash.
  7331. *
  7332. * @private
  7333. * @name delete
  7334. * @memberOf Hash
  7335. * @param {Object} hash The hash to modify.
  7336. * @param {string} key The key of the value to remove.
  7337. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  7338. */
  7339. function hashDelete(key) {
  7340. return this.has(key) && delete this.__data__[key];
  7341. }
  7342. /**
  7343. * Gets the hash value for `key`.
  7344. *
  7345. * @private
  7346. * @name get
  7347. * @memberOf Hash
  7348. * @param {string} key The key of the value to get.
  7349. * @returns {*} Returns the entry value.
  7350. */
  7351. function hashGet(key) {
  7352. var data = this.__data__;
  7353. if (nativeCreate) {
  7354. var result = data[key];
  7355. return result === HASH_UNDEFINED ? undefined : result;
  7356. }
  7357. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  7358. }
  7359. /**
  7360. * Checks if a hash value for `key` exists.
  7361. *
  7362. * @private
  7363. * @name has
  7364. * @memberOf Hash
  7365. * @param {string} key The key of the entry to check.
  7366. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  7367. */
  7368. function hashHas(key) {
  7369. var data = this.__data__;
  7370. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  7371. }
  7372. /**
  7373. * Sets the hash `key` to `value`.
  7374. *
  7375. * @private
  7376. * @name set
  7377. * @memberOf Hash
  7378. * @param {string} key The key of the value to set.
  7379. * @param {*} value The value to set.
  7380. * @returns {Object} Returns the hash instance.
  7381. */
  7382. function hashSet(key, value) {
  7383. var data = this.__data__;
  7384. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  7385. return this;
  7386. }
  7387. // Add methods to `Hash`.
  7388. Hash.prototype.clear = hashClear;
  7389. Hash.prototype['delete'] = hashDelete;
  7390. Hash.prototype.get = hashGet;
  7391. Hash.prototype.has = hashHas;
  7392. Hash.prototype.set = hashSet;
  7393. /**
  7394. * Creates an list cache object.
  7395. *
  7396. * @private
  7397. * @constructor
  7398. * @param {Array} [entries] The key-value pairs to cache.
  7399. */
  7400. function ListCache(entries) {
  7401. var index = -1,
  7402. length = entries ? entries.length : 0;
  7403. this.clear();
  7404. while (++index < length) {
  7405. var entry = entries[index];
  7406. this.set(entry[0], entry[1]);
  7407. }
  7408. }
  7409. /**
  7410. * Removes all key-value entries from the list cache.
  7411. *
  7412. * @private
  7413. * @name clear
  7414. * @memberOf ListCache
  7415. */
  7416. function listCacheClear() {
  7417. this.__data__ = [];
  7418. }
  7419. /**
  7420. * Removes `key` and its value from the list cache.
  7421. *
  7422. * @private
  7423. * @name delete
  7424. * @memberOf ListCache
  7425. * @param {string} key The key of the value to remove.
  7426. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  7427. */
  7428. function listCacheDelete(key) {
  7429. var data = this.__data__,
  7430. index = assocIndexOf(data, key);
  7431. if (index < 0) {
  7432. return false;
  7433. }
  7434. var lastIndex = data.length - 1;
  7435. if (index == lastIndex) {
  7436. data.pop();
  7437. } else {
  7438. splice.call(data, index, 1);
  7439. }
  7440. return true;
  7441. }
  7442. /**
  7443. * Gets the list cache value for `key`.
  7444. *
  7445. * @private
  7446. * @name get
  7447. * @memberOf ListCache
  7448. * @param {string} key The key of the value to get.
  7449. * @returns {*} Returns the entry value.
  7450. */
  7451. function listCacheGet(key) {
  7452. var data = this.__data__,
  7453. index = assocIndexOf(data, key);
  7454. return index < 0 ? undefined : data[index][1];
  7455. }
  7456. /**
  7457. * Checks if a list cache value for `key` exists.
  7458. *
  7459. * @private
  7460. * @name has
  7461. * @memberOf ListCache
  7462. * @param {string} key The key of the entry to check.
  7463. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  7464. */
  7465. function listCacheHas(key) {
  7466. return assocIndexOf(this.__data__, key) > -1;
  7467. }
  7468. /**
  7469. * Sets the list cache `key` to `value`.
  7470. *
  7471. * @private
  7472. * @name set
  7473. * @memberOf ListCache
  7474. * @param {string} key The key of the value to set.
  7475. * @param {*} value The value to set.
  7476. * @returns {Object} Returns the list cache instance.
  7477. */
  7478. function listCacheSet(key, value) {
  7479. var data = this.__data__,
  7480. index = assocIndexOf(data, key);
  7481. if (index < 0) {
  7482. data.push([key, value]);
  7483. } else {
  7484. data[index][1] = value;
  7485. }
  7486. return this;
  7487. }
  7488. // Add methods to `ListCache`.
  7489. ListCache.prototype.clear = listCacheClear;
  7490. ListCache.prototype['delete'] = listCacheDelete;
  7491. ListCache.prototype.get = listCacheGet;
  7492. ListCache.prototype.has = listCacheHas;
  7493. ListCache.prototype.set = listCacheSet;
  7494. /**
  7495. * Creates a map cache object to store key-value pairs.
  7496. *
  7497. * @private
  7498. * @constructor
  7499. * @param {Array} [entries] The key-value pairs to cache.
  7500. */
  7501. function MapCache(entries) {
  7502. var index = -1,
  7503. length = entries ? entries.length : 0;
  7504. this.clear();
  7505. while (++index < length) {
  7506. var entry = entries[index];
  7507. this.set(entry[0], entry[1]);
  7508. }
  7509. }
  7510. /**
  7511. * Removes all key-value entries from the map.
  7512. *
  7513. * @private
  7514. * @name clear
  7515. * @memberOf MapCache
  7516. */
  7517. function mapCacheClear() {
  7518. this.__data__ = {
  7519. 'hash': new Hash,
  7520. 'map': new (Map || ListCache),
  7521. 'string': new Hash
  7522. };
  7523. }
  7524. /**
  7525. * Removes `key` and its value from the map.
  7526. *
  7527. * @private
  7528. * @name delete
  7529. * @memberOf MapCache
  7530. * @param {string} key The key of the value to remove.
  7531. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  7532. */
  7533. function mapCacheDelete(key) {
  7534. return getMapData(this, key)['delete'](key);
  7535. }
  7536. /**
  7537. * Gets the map value for `key`.
  7538. *
  7539. * @private
  7540. * @name get
  7541. * @memberOf MapCache
  7542. * @param {string} key The key of the value to get.
  7543. * @returns {*} Returns the entry value.
  7544. */
  7545. function mapCacheGet(key) {
  7546. return getMapData(this, key).get(key);
  7547. }
  7548. /**
  7549. * Checks if a map value for `key` exists.
  7550. *
  7551. * @private
  7552. * @name has
  7553. * @memberOf MapCache
  7554. * @param {string} key The key of the entry to check.
  7555. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  7556. */
  7557. function mapCacheHas(key) {
  7558. return getMapData(this, key).has(key);
  7559. }
  7560. /**
  7561. * Sets the map `key` to `value`.
  7562. *
  7563. * @private
  7564. * @name set
  7565. * @memberOf MapCache
  7566. * @param {string} key The key of the value to set.
  7567. * @param {*} value The value to set.
  7568. * @returns {Object} Returns the map cache instance.
  7569. */
  7570. function mapCacheSet(key, value) {
  7571. getMapData(this, key).set(key, value);
  7572. return this;
  7573. }
  7574. // Add methods to `MapCache`.
  7575. MapCache.prototype.clear = mapCacheClear;
  7576. MapCache.prototype['delete'] = mapCacheDelete;
  7577. MapCache.prototype.get = mapCacheGet;
  7578. MapCache.prototype.has = mapCacheHas;
  7579. MapCache.prototype.set = mapCacheSet;
  7580. /**
  7581. *
  7582. * Creates an array cache object to store unique values.
  7583. *
  7584. * @private
  7585. * @constructor
  7586. * @param {Array} [values] The values to cache.
  7587. */
  7588. function SetCache(values) {
  7589. var index = -1,
  7590. length = values ? values.length : 0;
  7591. this.__data__ = new MapCache;
  7592. while (++index < length) {
  7593. this.add(values[index]);
  7594. }
  7595. }
  7596. /**
  7597. * Adds `value` to the array cache.
  7598. *
  7599. * @private
  7600. * @name add
  7601. * @memberOf SetCache
  7602. * @alias push
  7603. * @param {*} value The value to cache.
  7604. * @returns {Object} Returns the cache instance.
  7605. */
  7606. function setCacheAdd(value) {
  7607. this.__data__.set(value, HASH_UNDEFINED);
  7608. return this;
  7609. }
  7610. /**
  7611. * Checks if `value` is in the array cache.
  7612. *
  7613. * @private
  7614. * @name has
  7615. * @memberOf SetCache
  7616. * @param {*} value The value to search for.
  7617. * @returns {number} Returns `true` if `value` is found, else `false`.
  7618. */
  7619. function setCacheHas(value) {
  7620. return this.__data__.has(value);
  7621. }
  7622. // Add methods to `SetCache`.
  7623. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  7624. SetCache.prototype.has = setCacheHas;
  7625. /**
  7626. * Creates a stack cache object to store key-value pairs.
  7627. *
  7628. * @private
  7629. * @constructor
  7630. * @param {Array} [entries] The key-value pairs to cache.
  7631. */
  7632. function Stack(entries) {
  7633. this.__data__ = new ListCache(entries);
  7634. }
  7635. /**
  7636. * Removes all key-value entries from the stack.
  7637. *
  7638. * @private
  7639. * @name clear
  7640. * @memberOf Stack
  7641. */
  7642. function stackClear() {
  7643. this.__data__ = new ListCache;
  7644. }
  7645. /**
  7646. * Removes `key` and its value from the stack.
  7647. *
  7648. * @private
  7649. * @name delete
  7650. * @memberOf Stack
  7651. * @param {string} key The key of the value to remove.
  7652. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  7653. */
  7654. function stackDelete(key) {
  7655. return this.__data__['delete'](key);
  7656. }
  7657. /**
  7658. * Gets the stack value for `key`.
  7659. *
  7660. * @private
  7661. * @name get
  7662. * @memberOf Stack
  7663. * @param {string} key The key of the value to get.
  7664. * @returns {*} Returns the entry value.
  7665. */
  7666. function stackGet(key) {
  7667. return this.__data__.get(key);
  7668. }
  7669. /**
  7670. * Checks if a stack value for `key` exists.
  7671. *
  7672. * @private
  7673. * @name has
  7674. * @memberOf Stack
  7675. * @param {string} key The key of the entry to check.
  7676. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  7677. */
  7678. function stackHas(key) {
  7679. return this.__data__.has(key);
  7680. }
  7681. /**
  7682. * Sets the stack `key` to `value`.
  7683. *
  7684. * @private
  7685. * @name set
  7686. * @memberOf Stack
  7687. * @param {string} key The key of the value to set.
  7688. * @param {*} value The value to set.
  7689. * @returns {Object} Returns the stack cache instance.
  7690. */
  7691. function stackSet(key, value) {
  7692. var cache = this.__data__;
  7693. if (cache instanceof ListCache) {
  7694. var pairs = cache.__data__;
  7695. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  7696. pairs.push([key, value]);
  7697. return this;
  7698. }
  7699. cache = this.__data__ = new MapCache(pairs);
  7700. }
  7701. cache.set(key, value);
  7702. return this;
  7703. }
  7704. // Add methods to `Stack`.
  7705. Stack.prototype.clear = stackClear;
  7706. Stack.prototype['delete'] = stackDelete;
  7707. Stack.prototype.get = stackGet;
  7708. Stack.prototype.has = stackHas;
  7709. Stack.prototype.set = stackSet;
  7710. /**
  7711. * Creates an array of the enumerable property names of the array-like `value`.
  7712. *
  7713. * @private
  7714. * @param {*} value The value to query.
  7715. * @param {boolean} inherited Specify returning inherited property names.
  7716. * @returns {Array} Returns the array of property names.
  7717. */
  7718. function arrayLikeKeys(value, inherited) {
  7719. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  7720. // Safari 9 makes `arguments.length` enumerable in strict mode.
  7721. var result = (isArray(value) || isArguments(value))
  7722. ? baseTimes(value.length, String)
  7723. : [];
  7724. var length = result.length,
  7725. skipIndexes = !!length;
  7726. for (var key in value) {
  7727. if ((inherited || hasOwnProperty.call(value, key)) &&
  7728. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  7729. result.push(key);
  7730. }
  7731. }
  7732. return result;
  7733. }
  7734. /**
  7735. * Gets the index at which the `key` is found in `array` of key-value pairs.
  7736. *
  7737. * @private
  7738. * @param {Array} array The array to inspect.
  7739. * @param {*} key The key to search for.
  7740. * @returns {number} Returns the index of the matched value, else `-1`.
  7741. */
  7742. function assocIndexOf(array, key) {
  7743. var length = array.length;
  7744. while (length--) {
  7745. if (eq(array[length][0], key)) {
  7746. return length;
  7747. }
  7748. }
  7749. return -1;
  7750. }
  7751. /**
  7752. * The base implementation of `_.get` without support for default values.
  7753. *
  7754. * @private
  7755. * @param {Object} object The object to query.
  7756. * @param {Array|string} path The path of the property to get.
  7757. * @returns {*} Returns the resolved value.
  7758. */
  7759. function baseGet(object, path) {
  7760. path = isKey(path, object) ? [path] : castPath(path);
  7761. var index = 0,
  7762. length = path.length;
  7763. while (object != null && index < length) {
  7764. object = object[toKey(path[index++])];
  7765. }
  7766. return (index && index == length) ? object : undefined;
  7767. }
  7768. /**
  7769. * The base implementation of `getTag`.
  7770. *
  7771. * @private
  7772. * @param {*} value The value to query.
  7773. * @returns {string} Returns the `toStringTag`.
  7774. */
  7775. function baseGetTag(value) {
  7776. return objectToString.call(value);
  7777. }
  7778. /**
  7779. * The base implementation of `_.hasIn` without support for deep paths.
  7780. *
  7781. * @private
  7782. * @param {Object} [object] The object to query.
  7783. * @param {Array|string} key The key to check.
  7784. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  7785. */
  7786. function baseHasIn(object, key) {
  7787. return object != null && key in Object(object);
  7788. }
  7789. /**
  7790. * The base implementation of `_.isEqual` which supports partial comparisons
  7791. * and tracks traversed objects.
  7792. *
  7793. * @private
  7794. * @param {*} value The value to compare.
  7795. * @param {*} other The other value to compare.
  7796. * @param {Function} [customizer] The function to customize comparisons.
  7797. * @param {boolean} [bitmask] The bitmask of comparison flags.
  7798. * The bitmask may be composed of the following flags:
  7799. * 1 - Unordered comparison
  7800. * 2 - Partial comparison
  7801. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  7802. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  7803. */
  7804. function baseIsEqual(value, other, customizer, bitmask, stack) {
  7805. if (value === other) {
  7806. return true;
  7807. }
  7808. if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
  7809. return value !== value && other !== other;
  7810. }
  7811. return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
  7812. }
  7813. /**
  7814. * A specialized version of `baseIsEqual` for arrays and objects which performs
  7815. * deep comparisons and tracks traversed objects enabling objects with circular
  7816. * references to be compared.
  7817. *
  7818. * @private
  7819. * @param {Object} object The object to compare.
  7820. * @param {Object} other The other object to compare.
  7821. * @param {Function} equalFunc The function to determine equivalents of values.
  7822. * @param {Function} [customizer] The function to customize comparisons.
  7823. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
  7824. * for more details.
  7825. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  7826. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  7827. */
  7828. function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
  7829. var objIsArr = isArray(object),
  7830. othIsArr = isArray(other),
  7831. objTag = arrayTag,
  7832. othTag = arrayTag;
  7833. if (!objIsArr) {
  7834. objTag = getTag(object);
  7835. objTag = objTag == argsTag ? objectTag : objTag;
  7836. }
  7837. if (!othIsArr) {
  7838. othTag = getTag(other);
  7839. othTag = othTag == argsTag ? objectTag : othTag;
  7840. }
  7841. var objIsObj = objTag == objectTag && !isHostObject(object),
  7842. othIsObj = othTag == objectTag && !isHostObject(other),
  7843. isSameTag = objTag == othTag;
  7844. if (isSameTag && !objIsObj) {
  7845. stack || (stack = new Stack);
  7846. return (objIsArr || isTypedArray(object))
  7847. ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
  7848. : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
  7849. }
  7850. if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
  7851. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  7852. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  7853. if (objIsWrapped || othIsWrapped) {
  7854. var objUnwrapped = objIsWrapped ? object.value() : object,
  7855. othUnwrapped = othIsWrapped ? other.value() : other;
  7856. stack || (stack = new Stack);
  7857. return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
  7858. }
  7859. }
  7860. if (!isSameTag) {
  7861. return false;
  7862. }
  7863. stack || (stack = new Stack);
  7864. return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
  7865. }
  7866. /**
  7867. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  7868. *
  7869. * @private
  7870. * @param {Object} object The object to inspect.
  7871. * @param {Object} source The object of property values to match.
  7872. * @param {Array} matchData The property names, values, and compare flags to match.
  7873. * @param {Function} [customizer] The function to customize comparisons.
  7874. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  7875. */
  7876. function baseIsMatch(object, source, matchData, customizer) {
  7877. var index = matchData.length,
  7878. length = index,
  7879. noCustomizer = !customizer;
  7880. if (object == null) {
  7881. return !length;
  7882. }
  7883. object = Object(object);
  7884. while (index--) {
  7885. var data = matchData[index];
  7886. if ((noCustomizer && data[2])
  7887. ? data[1] !== object[data[0]]
  7888. : !(data[0] in object)
  7889. ) {
  7890. return false;
  7891. }
  7892. }
  7893. while (++index < length) {
  7894. data = matchData[index];
  7895. var key = data[0],
  7896. objValue = object[key],
  7897. srcValue = data[1];
  7898. if (noCustomizer && data[2]) {
  7899. if (objValue === undefined && !(key in object)) {
  7900. return false;
  7901. }
  7902. } else {
  7903. var stack = new Stack;
  7904. if (customizer) {
  7905. var result = customizer(objValue, srcValue, key, object, source, stack);
  7906. }
  7907. if (!(result === undefined
  7908. ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
  7909. : result
  7910. )) {
  7911. return false;
  7912. }
  7913. }
  7914. }
  7915. return true;
  7916. }
  7917. /**
  7918. * The base implementation of `_.isNative` without bad shim checks.
  7919. *
  7920. * @private
  7921. * @param {*} value The value to check.
  7922. * @returns {boolean} Returns `true` if `value` is a native function,
  7923. * else `false`.
  7924. */
  7925. function baseIsNative(value) {
  7926. if (!isObject(value) || isMasked(value)) {
  7927. return false;
  7928. }
  7929. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  7930. return pattern.test(toSource(value));
  7931. }
  7932. /**
  7933. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  7934. *
  7935. * @private
  7936. * @param {*} value The value to check.
  7937. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  7938. */
  7939. function baseIsTypedArray(value) {
  7940. return isObjectLike(value) &&
  7941. isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
  7942. }
  7943. /**
  7944. * The base implementation of `_.iteratee`.
  7945. *
  7946. * @private
  7947. * @param {*} [value=_.identity] The value to convert to an iteratee.
  7948. * @returns {Function} Returns the iteratee.
  7949. */
  7950. function baseIteratee(value) {
  7951. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  7952. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  7953. if (typeof value == 'function') {
  7954. return value;
  7955. }
  7956. if (value == null) {
  7957. return identity;
  7958. }
  7959. if (typeof value == 'object') {
  7960. return isArray(value)
  7961. ? baseMatchesProperty(value[0], value[1])
  7962. : baseMatches(value);
  7963. }
  7964. return property(value);
  7965. }
  7966. /**
  7967. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  7968. *
  7969. * @private
  7970. * @param {Object} object The object to query.
  7971. * @returns {Array} Returns the array of property names.
  7972. */
  7973. function baseKeys(object) {
  7974. if (!isPrototype(object)) {
  7975. return nativeKeys(object);
  7976. }
  7977. var result = [];
  7978. for (var key in Object(object)) {
  7979. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  7980. result.push(key);
  7981. }
  7982. }
  7983. return result;
  7984. }
  7985. /**
  7986. * The base implementation of `_.matches` which doesn't clone `source`.
  7987. *
  7988. * @private
  7989. * @param {Object} source The object of property values to match.
  7990. * @returns {Function} Returns the new spec function.
  7991. */
  7992. function baseMatches(source) {
  7993. var matchData = getMatchData(source);
  7994. if (matchData.length == 1 && matchData[0][2]) {
  7995. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  7996. }
  7997. return function(object) {
  7998. return object === source || baseIsMatch(object, source, matchData);
  7999. };
  8000. }
  8001. /**
  8002. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  8003. *
  8004. * @private
  8005. * @param {string} path The path of the property to get.
  8006. * @param {*} srcValue The value to match.
  8007. * @returns {Function} Returns the new spec function.
  8008. */
  8009. function baseMatchesProperty(path, srcValue) {
  8010. if (isKey(path) && isStrictComparable(srcValue)) {
  8011. return matchesStrictComparable(toKey(path), srcValue);
  8012. }
  8013. return function(object) {
  8014. var objValue = get(object, path);
  8015. return (objValue === undefined && objValue === srcValue)
  8016. ? hasIn(object, path)
  8017. : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
  8018. };
  8019. }
  8020. /**
  8021. * A specialized version of `baseProperty` which supports deep paths.
  8022. *
  8023. * @private
  8024. * @param {Array|string} path The path of the property to get.
  8025. * @returns {Function} Returns the new accessor function.
  8026. */
  8027. function basePropertyDeep(path) {
  8028. return function(object) {
  8029. return baseGet(object, path);
  8030. };
  8031. }
  8032. /**
  8033. * The base implementation of `_.toString` which doesn't convert nullish
  8034. * values to empty strings.
  8035. *
  8036. * @private
  8037. * @param {*} value The value to process.
  8038. * @returns {string} Returns the string.
  8039. */
  8040. function baseToString(value) {
  8041. // Exit early for strings to avoid a performance hit in some environments.
  8042. if (typeof value == 'string') {
  8043. return value;
  8044. }
  8045. if (isSymbol(value)) {
  8046. return symbolToString ? symbolToString.call(value) : '';
  8047. }
  8048. var result = (value + '');
  8049. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  8050. }
  8051. /**
  8052. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  8053. *
  8054. * @private
  8055. * @param {Array} array The array to inspect.
  8056. * @param {Function} [iteratee] The iteratee invoked per element.
  8057. * @param {Function} [comparator] The comparator invoked per element.
  8058. * @returns {Array} Returns the new duplicate free array.
  8059. */
  8060. function baseUniq(array, iteratee, comparator) {
  8061. var index = -1,
  8062. includes = arrayIncludes,
  8063. length = array.length,
  8064. isCommon = true,
  8065. result = [],
  8066. seen = result;
  8067. if (comparator) {
  8068. isCommon = false;
  8069. includes = arrayIncludesWith;
  8070. }
  8071. else if (length >= LARGE_ARRAY_SIZE) {
  8072. var set = iteratee ? null : createSet(array);
  8073. if (set) {
  8074. return setToArray(set);
  8075. }
  8076. isCommon = false;
  8077. includes = cacheHas;
  8078. seen = new SetCache;
  8079. }
  8080. else {
  8081. seen = iteratee ? [] : result;
  8082. }
  8083. outer:
  8084. while (++index < length) {
  8085. var value = array[index],
  8086. computed = iteratee ? iteratee(value) : value;
  8087. value = (comparator || value !== 0) ? value : 0;
  8088. if (isCommon && computed === computed) {
  8089. var seenIndex = seen.length;
  8090. while (seenIndex--) {
  8091. if (seen[seenIndex] === computed) {
  8092. continue outer;
  8093. }
  8094. }
  8095. if (iteratee) {
  8096. seen.push(computed);
  8097. }
  8098. result.push(value);
  8099. }
  8100. else if (!includes(seen, computed, comparator)) {
  8101. if (seen !== result) {
  8102. seen.push(computed);
  8103. }
  8104. result.push(value);
  8105. }
  8106. }
  8107. return result;
  8108. }
  8109. /**
  8110. * Casts `value` to a path array if it's not one.
  8111. *
  8112. * @private
  8113. * @param {*} value The value to inspect.
  8114. * @returns {Array} Returns the cast property path array.
  8115. */
  8116. function castPath(value) {
  8117. return isArray(value) ? value : stringToPath(value);
  8118. }
  8119. /**
  8120. * Creates a set object of `values`.
  8121. *
  8122. * @private
  8123. * @param {Array} values The values to add to the set.
  8124. * @returns {Object} Returns the new set.
  8125. */
  8126. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  8127. return new Set(values);
  8128. };
  8129. /**
  8130. * A specialized version of `baseIsEqualDeep` for arrays with support for
  8131. * partial deep comparisons.
  8132. *
  8133. * @private
  8134. * @param {Array} array The array to compare.
  8135. * @param {Array} other The other array to compare.
  8136. * @param {Function} equalFunc The function to determine equivalents of values.
  8137. * @param {Function} customizer The function to customize comparisons.
  8138. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  8139. * for more details.
  8140. * @param {Object} stack Tracks traversed `array` and `other` objects.
  8141. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  8142. */
  8143. function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
  8144. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  8145. arrLength = array.length,
  8146. othLength = other.length;
  8147. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  8148. return false;
  8149. }
  8150. // Assume cyclic values are equal.
  8151. var stacked = stack.get(array);
  8152. if (stacked && stack.get(other)) {
  8153. return stacked == other;
  8154. }
  8155. var index = -1,
  8156. result = true,
  8157. seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
  8158. stack.set(array, other);
  8159. stack.set(other, array);
  8160. // Ignore non-index properties.
  8161. while (++index < arrLength) {
  8162. var arrValue = array[index],
  8163. othValue = other[index];
  8164. if (customizer) {
  8165. var compared = isPartial
  8166. ? customizer(othValue, arrValue, index, other, array, stack)
  8167. : customizer(arrValue, othValue, index, array, other, stack);
  8168. }
  8169. if (compared !== undefined) {
  8170. if (compared) {
  8171. continue;
  8172. }
  8173. result = false;
  8174. break;
  8175. }
  8176. // Recursively compare arrays (susceptible to call stack limits).
  8177. if (seen) {
  8178. if (!arraySome(other, function(othValue, othIndex) {
  8179. if (!seen.has(othIndex) &&
  8180. (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
  8181. return seen.add(othIndex);
  8182. }
  8183. })) {
  8184. result = false;
  8185. break;
  8186. }
  8187. } else if (!(
  8188. arrValue === othValue ||
  8189. equalFunc(arrValue, othValue, customizer, bitmask, stack)
  8190. )) {
  8191. result = false;
  8192. break;
  8193. }
  8194. }
  8195. stack['delete'](array);
  8196. stack['delete'](other);
  8197. return result;
  8198. }
  8199. /**
  8200. * A specialized version of `baseIsEqualDeep` for comparing objects of
  8201. * the same `toStringTag`.
  8202. *
  8203. * **Note:** This function only supports comparing values with tags of
  8204. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  8205. *
  8206. * @private
  8207. * @param {Object} object The object to compare.
  8208. * @param {Object} other The other object to compare.
  8209. * @param {string} tag The `toStringTag` of the objects to compare.
  8210. * @param {Function} equalFunc The function to determine equivalents of values.
  8211. * @param {Function} customizer The function to customize comparisons.
  8212. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  8213. * for more details.
  8214. * @param {Object} stack Tracks traversed `object` and `other` objects.
  8215. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  8216. */
  8217. function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
  8218. switch (tag) {
  8219. case dataViewTag:
  8220. if ((object.byteLength != other.byteLength) ||
  8221. (object.byteOffset != other.byteOffset)) {
  8222. return false;
  8223. }
  8224. object = object.buffer;
  8225. other = other.buffer;
  8226. case arrayBufferTag:
  8227. if ((object.byteLength != other.byteLength) ||
  8228. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  8229. return false;
  8230. }
  8231. return true;
  8232. case boolTag:
  8233. case dateTag:
  8234. case numberTag:
  8235. // Coerce booleans to `1` or `0` and dates to milliseconds.
  8236. // Invalid dates are coerced to `NaN`.
  8237. return eq(+object, +other);
  8238. case errorTag:
  8239. return object.name == other.name && object.message == other.message;
  8240. case regexpTag:
  8241. case stringTag:
  8242. // Coerce regexes to strings and treat strings, primitives and objects,
  8243. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  8244. // for more details.
  8245. return object == (other + '');
  8246. case mapTag:
  8247. var convert = mapToArray;
  8248. case setTag:
  8249. var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
  8250. convert || (convert = setToArray);
  8251. if (object.size != other.size && !isPartial) {
  8252. return false;
  8253. }
  8254. // Assume cyclic values are equal.
  8255. var stacked = stack.get(object);
  8256. if (stacked) {
  8257. return stacked == other;
  8258. }
  8259. bitmask |= UNORDERED_COMPARE_FLAG;
  8260. // Recursively compare objects (susceptible to call stack limits).
  8261. stack.set(object, other);
  8262. var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
  8263. stack['delete'](object);
  8264. return result;
  8265. case symbolTag:
  8266. if (symbolValueOf) {
  8267. return symbolValueOf.call(object) == symbolValueOf.call(other);
  8268. }
  8269. }
  8270. return false;
  8271. }
  8272. /**
  8273. * A specialized version of `baseIsEqualDeep` for objects with support for
  8274. * partial deep comparisons.
  8275. *
  8276. * @private
  8277. * @param {Object} object The object to compare.
  8278. * @param {Object} other The other object to compare.
  8279. * @param {Function} equalFunc The function to determine equivalents of values.
  8280. * @param {Function} customizer The function to customize comparisons.
  8281. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  8282. * for more details.
  8283. * @param {Object} stack Tracks traversed `object` and `other` objects.
  8284. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  8285. */
  8286. function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
  8287. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  8288. objProps = keys(object),
  8289. objLength = objProps.length,
  8290. othProps = keys(other),
  8291. othLength = othProps.length;
  8292. if (objLength != othLength && !isPartial) {
  8293. return false;
  8294. }
  8295. var index = objLength;
  8296. while (index--) {
  8297. var key = objProps[index];
  8298. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  8299. return false;
  8300. }
  8301. }
  8302. // Assume cyclic values are equal.
  8303. var stacked = stack.get(object);
  8304. if (stacked && stack.get(other)) {
  8305. return stacked == other;
  8306. }
  8307. var result = true;
  8308. stack.set(object, other);
  8309. stack.set(other, object);
  8310. var skipCtor = isPartial;
  8311. while (++index < objLength) {
  8312. key = objProps[index];
  8313. var objValue = object[key],
  8314. othValue = other[key];
  8315. if (customizer) {
  8316. var compared = isPartial
  8317. ? customizer(othValue, objValue, key, other, object, stack)
  8318. : customizer(objValue, othValue, key, object, other, stack);
  8319. }
  8320. // Recursively compare objects (susceptible to call stack limits).
  8321. if (!(compared === undefined
  8322. ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
  8323. : compared
  8324. )) {
  8325. result = false;
  8326. break;
  8327. }
  8328. skipCtor || (skipCtor = key == 'constructor');
  8329. }
  8330. if (result && !skipCtor) {
  8331. var objCtor = object.constructor,
  8332. othCtor = other.constructor;
  8333. // Non `Object` object instances with different constructors are not equal.
  8334. if (objCtor != othCtor &&
  8335. ('constructor' in object && 'constructor' in other) &&
  8336. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  8337. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  8338. result = false;
  8339. }
  8340. }
  8341. stack['delete'](object);
  8342. stack['delete'](other);
  8343. return result;
  8344. }
  8345. /**
  8346. * Gets the data for `map`.
  8347. *
  8348. * @private
  8349. * @param {Object} map The map to query.
  8350. * @param {string} key The reference key.
  8351. * @returns {*} Returns the map data.
  8352. */
  8353. function getMapData(map, key) {
  8354. var data = map.__data__;
  8355. return isKeyable(key)
  8356. ? data[typeof key == 'string' ? 'string' : 'hash']
  8357. : data.map;
  8358. }
  8359. /**
  8360. * Gets the property names, values, and compare flags of `object`.
  8361. *
  8362. * @private
  8363. * @param {Object} object The object to query.
  8364. * @returns {Array} Returns the match data of `object`.
  8365. */
  8366. function getMatchData(object) {
  8367. var result = keys(object),
  8368. length = result.length;
  8369. while (length--) {
  8370. var key = result[length],
  8371. value = object[key];
  8372. result[length] = [key, value, isStrictComparable(value)];
  8373. }
  8374. return result;
  8375. }
  8376. /**
  8377. * Gets the native function at `key` of `object`.
  8378. *
  8379. * @private
  8380. * @param {Object} object The object to query.
  8381. * @param {string} key The key of the method to get.
  8382. * @returns {*} Returns the function if it's native, else `undefined`.
  8383. */
  8384. function getNative(object, key) {
  8385. var value = getValue(object, key);
  8386. return baseIsNative(value) ? value : undefined;
  8387. }
  8388. /**
  8389. * Gets the `toStringTag` of `value`.
  8390. *
  8391. * @private
  8392. * @param {*} value The value to query.
  8393. * @returns {string} Returns the `toStringTag`.
  8394. */
  8395. var getTag = baseGetTag;
  8396. // Fallback for data views, maps, sets, and weak maps in IE 11,
  8397. // for data views in Edge < 14, and promises in Node.js.
  8398. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  8399. (Map && getTag(new Map) != mapTag) ||
  8400. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  8401. (Set && getTag(new Set) != setTag) ||
  8402. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  8403. getTag = function(value) {
  8404. var result = objectToString.call(value),
  8405. Ctor = result == objectTag ? value.constructor : undefined,
  8406. ctorString = Ctor ? toSource(Ctor) : undefined;
  8407. if (ctorString) {
  8408. switch (ctorString) {
  8409. case dataViewCtorString: return dataViewTag;
  8410. case mapCtorString: return mapTag;
  8411. case promiseCtorString: return promiseTag;
  8412. case setCtorString: return setTag;
  8413. case weakMapCtorString: return weakMapTag;
  8414. }
  8415. }
  8416. return result;
  8417. };
  8418. }
  8419. /**
  8420. * Checks if `path` exists on `object`.
  8421. *
  8422. * @private
  8423. * @param {Object} object The object to query.
  8424. * @param {Array|string} path The path to check.
  8425. * @param {Function} hasFunc The function to check properties.
  8426. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  8427. */
  8428. function hasPath(object, path, hasFunc) {
  8429. path = isKey(path, object) ? [path] : castPath(path);
  8430. var result,
  8431. index = -1,
  8432. length = path.length;
  8433. while (++index < length) {
  8434. var key = toKey(path[index]);
  8435. if (!(result = object != null && hasFunc(object, key))) {
  8436. break;
  8437. }
  8438. object = object[key];
  8439. }
  8440. if (result) {
  8441. return result;
  8442. }
  8443. var length = object ? object.length : 0;
  8444. return !!length && isLength(length) && isIndex(key, length) &&
  8445. (isArray(object) || isArguments(object));
  8446. }
  8447. /**
  8448. * Checks if `value` is a valid array-like index.
  8449. *
  8450. * @private
  8451. * @param {*} value The value to check.
  8452. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  8453. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  8454. */
  8455. function isIndex(value, length) {
  8456. length = length == null ? MAX_SAFE_INTEGER : length;
  8457. return !!length &&
  8458. (typeof value == 'number' || reIsUint.test(value)) &&
  8459. (value > -1 && value % 1 == 0 && value < length);
  8460. }
  8461. /**
  8462. * Checks if `value` is a property name and not a property path.
  8463. *
  8464. * @private
  8465. * @param {*} value The value to check.
  8466. * @param {Object} [object] The object to query keys on.
  8467. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  8468. */
  8469. function isKey(value, object) {
  8470. if (isArray(value)) {
  8471. return false;
  8472. }
  8473. var type = typeof value;
  8474. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  8475. value == null || isSymbol(value)) {
  8476. return true;
  8477. }
  8478. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  8479. (object != null && value in Object(object));
  8480. }
  8481. /**
  8482. * Checks if `value` is suitable for use as unique object key.
  8483. *
  8484. * @private
  8485. * @param {*} value The value to check.
  8486. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  8487. */
  8488. function isKeyable(value) {
  8489. var type = typeof value;
  8490. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  8491. ? (value !== '__proto__')
  8492. : (value === null);
  8493. }
  8494. /**
  8495. * Checks if `func` has its source masked.
  8496. *
  8497. * @private
  8498. * @param {Function} func The function to check.
  8499. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  8500. */
  8501. function isMasked(func) {
  8502. return !!maskSrcKey && (maskSrcKey in func);
  8503. }
  8504. /**
  8505. * Checks if `value` is likely a prototype object.
  8506. *
  8507. * @private
  8508. * @param {*} value The value to check.
  8509. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  8510. */
  8511. function isPrototype(value) {
  8512. var Ctor = value && value.constructor,
  8513. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  8514. return value === proto;
  8515. }
  8516. /**
  8517. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  8518. *
  8519. * @private
  8520. * @param {*} value The value to check.
  8521. * @returns {boolean} Returns `true` if `value` if suitable for strict
  8522. * equality comparisons, else `false`.
  8523. */
  8524. function isStrictComparable(value) {
  8525. return value === value && !isObject(value);
  8526. }
  8527. /**
  8528. * A specialized version of `matchesProperty` for source values suitable
  8529. * for strict equality comparisons, i.e. `===`.
  8530. *
  8531. * @private
  8532. * @param {string} key The key of the property to get.
  8533. * @param {*} srcValue The value to match.
  8534. * @returns {Function} Returns the new spec function.
  8535. */
  8536. function matchesStrictComparable(key, srcValue) {
  8537. return function(object) {
  8538. if (object == null) {
  8539. return false;
  8540. }
  8541. return object[key] === srcValue &&
  8542. (srcValue !== undefined || (key in Object(object)));
  8543. };
  8544. }
  8545. /**
  8546. * Converts `string` to a property path array.
  8547. *
  8548. * @private
  8549. * @param {string} string The string to convert.
  8550. * @returns {Array} Returns the property path array.
  8551. */
  8552. var stringToPath = memoize(function(string) {
  8553. string = toString(string);
  8554. var result = [];
  8555. if (reLeadingDot.test(string)) {
  8556. result.push('');
  8557. }
  8558. string.replace(rePropName, function(match, number, quote, string) {
  8559. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  8560. });
  8561. return result;
  8562. });
  8563. /**
  8564. * Converts `value` to a string key if it's not a string or symbol.
  8565. *
  8566. * @private
  8567. * @param {*} value The value to inspect.
  8568. * @returns {string|symbol} Returns the key.
  8569. */
  8570. function toKey(value) {
  8571. if (typeof value == 'string' || isSymbol(value)) {
  8572. return value;
  8573. }
  8574. var result = (value + '');
  8575. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  8576. }
  8577. /**
  8578. * Converts `func` to its source code.
  8579. *
  8580. * @private
  8581. * @param {Function} func The function to process.
  8582. * @returns {string} Returns the source code.
  8583. */
  8584. function toSource(func) {
  8585. if (func != null) {
  8586. try {
  8587. return funcToString.call(func);
  8588. } catch (e) {}
  8589. try {
  8590. return (func + '');
  8591. } catch (e) {}
  8592. }
  8593. return '';
  8594. }
  8595. /**
  8596. * This method is like `_.uniq` except that it accepts `iteratee` which is
  8597. * invoked for each element in `array` to generate the criterion by which
  8598. * uniqueness is computed. The iteratee is invoked with one argument: (value).
  8599. *
  8600. * @static
  8601. * @memberOf _
  8602. * @since 4.0.0
  8603. * @category Array
  8604. * @param {Array} array The array to inspect.
  8605. * @param {Function} [iteratee=_.identity]
  8606. * The iteratee invoked per element.
  8607. * @returns {Array} Returns the new duplicate free array.
  8608. * @example
  8609. *
  8610. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  8611. * // => [2.1, 1.2]
  8612. *
  8613. * // The `_.property` iteratee shorthand.
  8614. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  8615. * // => [{ 'x': 1 }, { 'x': 2 }]
  8616. */
  8617. function uniqBy(array, iteratee) {
  8618. return (array && array.length)
  8619. ? baseUniq(array, baseIteratee(iteratee, 2))
  8620. : [];
  8621. }
  8622. /**
  8623. * Creates a function that memoizes the result of `func`. If `resolver` is
  8624. * provided, it determines the cache key for storing the result based on the
  8625. * arguments provided to the memoized function. By default, the first argument
  8626. * provided to the memoized function is used as the map cache key. The `func`
  8627. * is invoked with the `this` binding of the memoized function.
  8628. *
  8629. * **Note:** The cache is exposed as the `cache` property on the memoized
  8630. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  8631. * constructor with one whose instances implement the
  8632. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  8633. * method interface of `delete`, `get`, `has`, and `set`.
  8634. *
  8635. * @static
  8636. * @memberOf _
  8637. * @since 0.1.0
  8638. * @category Function
  8639. * @param {Function} func The function to have its output memoized.
  8640. * @param {Function} [resolver] The function to resolve the cache key.
  8641. * @returns {Function} Returns the new memoized function.
  8642. * @example
  8643. *
  8644. * var object = { 'a': 1, 'b': 2 };
  8645. * var other = { 'c': 3, 'd': 4 };
  8646. *
  8647. * var values = _.memoize(_.values);
  8648. * values(object);
  8649. * // => [1, 2]
  8650. *
  8651. * values(other);
  8652. * // => [3, 4]
  8653. *
  8654. * object.a = 2;
  8655. * values(object);
  8656. * // => [1, 2]
  8657. *
  8658. * // Modify the result cache.
  8659. * values.cache.set(object, ['a', 'b']);
  8660. * values(object);
  8661. * // => ['a', 'b']
  8662. *
  8663. * // Replace `_.memoize.Cache`.
  8664. * _.memoize.Cache = WeakMap;
  8665. */
  8666. function memoize(func, resolver) {
  8667. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  8668. throw new TypeError(FUNC_ERROR_TEXT);
  8669. }
  8670. var memoized = function() {
  8671. var args = arguments,
  8672. key = resolver ? resolver.apply(this, args) : args[0],
  8673. cache = memoized.cache;
  8674. if (cache.has(key)) {
  8675. return cache.get(key);
  8676. }
  8677. var result = func.apply(this, args);
  8678. memoized.cache = cache.set(key, result);
  8679. return result;
  8680. };
  8681. memoized.cache = new (memoize.Cache || MapCache);
  8682. return memoized;
  8683. }
  8684. // Assign cache to `_.memoize`.
  8685. memoize.Cache = MapCache;
  8686. /**
  8687. * Performs a
  8688. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8689. * comparison between two values to determine if they are equivalent.
  8690. *
  8691. * @static
  8692. * @memberOf _
  8693. * @since 4.0.0
  8694. * @category Lang
  8695. * @param {*} value The value to compare.
  8696. * @param {*} other The other value to compare.
  8697. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  8698. * @example
  8699. *
  8700. * var object = { 'a': 1 };
  8701. * var other = { 'a': 1 };
  8702. *
  8703. * _.eq(object, object);
  8704. * // => true
  8705. *
  8706. * _.eq(object, other);
  8707. * // => false
  8708. *
  8709. * _.eq('a', 'a');
  8710. * // => true
  8711. *
  8712. * _.eq('a', Object('a'));
  8713. * // => false
  8714. *
  8715. * _.eq(NaN, NaN);
  8716. * // => true
  8717. */
  8718. function eq(value, other) {
  8719. return value === other || (value !== value && other !== other);
  8720. }
  8721. /**
  8722. * Checks if `value` is likely an `arguments` object.
  8723. *
  8724. * @static
  8725. * @memberOf _
  8726. * @since 0.1.0
  8727. * @category Lang
  8728. * @param {*} value The value to check.
  8729. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  8730. * else `false`.
  8731. * @example
  8732. *
  8733. * _.isArguments(function() { return arguments; }());
  8734. * // => true
  8735. *
  8736. * _.isArguments([1, 2, 3]);
  8737. * // => false
  8738. */
  8739. function isArguments(value) {
  8740. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  8741. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  8742. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  8743. }
  8744. /**
  8745. * Checks if `value` is classified as an `Array` object.
  8746. *
  8747. * @static
  8748. * @memberOf _
  8749. * @since 0.1.0
  8750. * @category Lang
  8751. * @param {*} value The value to check.
  8752. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  8753. * @example
  8754. *
  8755. * _.isArray([1, 2, 3]);
  8756. * // => true
  8757. *
  8758. * _.isArray(document.body.children);
  8759. * // => false
  8760. *
  8761. * _.isArray('abc');
  8762. * // => false
  8763. *
  8764. * _.isArray(_.noop);
  8765. * // => false
  8766. */
  8767. var isArray = Array.isArray;
  8768. /**
  8769. * Checks if `value` is array-like. A value is considered array-like if it's
  8770. * not a function and has a `value.length` that's an integer greater than or
  8771. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  8772. *
  8773. * @static
  8774. * @memberOf _
  8775. * @since 4.0.0
  8776. * @category Lang
  8777. * @param {*} value The value to check.
  8778. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  8779. * @example
  8780. *
  8781. * _.isArrayLike([1, 2, 3]);
  8782. * // => true
  8783. *
  8784. * _.isArrayLike(document.body.children);
  8785. * // => true
  8786. *
  8787. * _.isArrayLike('abc');
  8788. * // => true
  8789. *
  8790. * _.isArrayLike(_.noop);
  8791. * // => false
  8792. */
  8793. function isArrayLike(value) {
  8794. return value != null && isLength(value.length) && !isFunction(value);
  8795. }
  8796. /**
  8797. * This method is like `_.isArrayLike` except that it also checks if `value`
  8798. * is an object.
  8799. *
  8800. * @static
  8801. * @memberOf _
  8802. * @since 4.0.0
  8803. * @category Lang
  8804. * @param {*} value The value to check.
  8805. * @returns {boolean} Returns `true` if `value` is an array-like object,
  8806. * else `false`.
  8807. * @example
  8808. *
  8809. * _.isArrayLikeObject([1, 2, 3]);
  8810. * // => true
  8811. *
  8812. * _.isArrayLikeObject(document.body.children);
  8813. * // => true
  8814. *
  8815. * _.isArrayLikeObject('abc');
  8816. * // => false
  8817. *
  8818. * _.isArrayLikeObject(_.noop);
  8819. * // => false
  8820. */
  8821. function isArrayLikeObject(value) {
  8822. return isObjectLike(value) && isArrayLike(value);
  8823. }
  8824. /**
  8825. * Checks if `value` is classified as a `Function` object.
  8826. *
  8827. * @static
  8828. * @memberOf _
  8829. * @since 0.1.0
  8830. * @category Lang
  8831. * @param {*} value The value to check.
  8832. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  8833. * @example
  8834. *
  8835. * _.isFunction(_);
  8836. * // => true
  8837. *
  8838. * _.isFunction(/abc/);
  8839. * // => false
  8840. */
  8841. function isFunction(value) {
  8842. // The use of `Object#toString` avoids issues with the `typeof` operator
  8843. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  8844. var tag = isObject(value) ? objectToString.call(value) : '';
  8845. return tag == funcTag || tag == genTag;
  8846. }
  8847. /**
  8848. * Checks if `value` is a valid array-like length.
  8849. *
  8850. * **Note:** This method is loosely based on
  8851. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  8852. *
  8853. * @static
  8854. * @memberOf _
  8855. * @since 4.0.0
  8856. * @category Lang
  8857. * @param {*} value The value to check.
  8858. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  8859. * @example
  8860. *
  8861. * _.isLength(3);
  8862. * // => true
  8863. *
  8864. * _.isLength(Number.MIN_VALUE);
  8865. * // => false
  8866. *
  8867. * _.isLength(Infinity);
  8868. * // => false
  8869. *
  8870. * _.isLength('3');
  8871. * // => false
  8872. */
  8873. function isLength(value) {
  8874. return typeof value == 'number' &&
  8875. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  8876. }
  8877. /**
  8878. * Checks if `value` is the
  8879. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  8880. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  8881. *
  8882. * @static
  8883. * @memberOf _
  8884. * @since 0.1.0
  8885. * @category Lang
  8886. * @param {*} value The value to check.
  8887. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  8888. * @example
  8889. *
  8890. * _.isObject({});
  8891. * // => true
  8892. *
  8893. * _.isObject([1, 2, 3]);
  8894. * // => true
  8895. *
  8896. * _.isObject(_.noop);
  8897. * // => true
  8898. *
  8899. * _.isObject(null);
  8900. * // => false
  8901. */
  8902. function isObject(value) {
  8903. var type = typeof value;
  8904. return !!value && (type == 'object' || type == 'function');
  8905. }
  8906. /**
  8907. * Checks if `value` is object-like. A value is object-like if it's not `null`
  8908. * and has a `typeof` result of "object".
  8909. *
  8910. * @static
  8911. * @memberOf _
  8912. * @since 4.0.0
  8913. * @category Lang
  8914. * @param {*} value The value to check.
  8915. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  8916. * @example
  8917. *
  8918. * _.isObjectLike({});
  8919. * // => true
  8920. *
  8921. * _.isObjectLike([1, 2, 3]);
  8922. * // => true
  8923. *
  8924. * _.isObjectLike(_.noop);
  8925. * // => false
  8926. *
  8927. * _.isObjectLike(null);
  8928. * // => false
  8929. */
  8930. function isObjectLike(value) {
  8931. return !!value && typeof value == 'object';
  8932. }
  8933. /**
  8934. * Checks if `value` is classified as a `Symbol` primitive or object.
  8935. *
  8936. * @static
  8937. * @memberOf _
  8938. * @since 4.0.0
  8939. * @category Lang
  8940. * @param {*} value The value to check.
  8941. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  8942. * @example
  8943. *
  8944. * _.isSymbol(Symbol.iterator);
  8945. * // => true
  8946. *
  8947. * _.isSymbol('abc');
  8948. * // => false
  8949. */
  8950. function isSymbol(value) {
  8951. return typeof value == 'symbol' ||
  8952. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  8953. }
  8954. /**
  8955. * Checks if `value` is classified as a typed array.
  8956. *
  8957. * @static
  8958. * @memberOf _
  8959. * @since 3.0.0
  8960. * @category Lang
  8961. * @param {*} value The value to check.
  8962. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  8963. * @example
  8964. *
  8965. * _.isTypedArray(new Uint8Array);
  8966. * // => true
  8967. *
  8968. * _.isTypedArray([]);
  8969. * // => false
  8970. */
  8971. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  8972. /**
  8973. * Converts `value` to a string. An empty string is returned for `null`
  8974. * and `undefined` values. The sign of `-0` is preserved.
  8975. *
  8976. * @static
  8977. * @memberOf _
  8978. * @since 4.0.0
  8979. * @category Lang
  8980. * @param {*} value The value to process.
  8981. * @returns {string} Returns the string.
  8982. * @example
  8983. *
  8984. * _.toString(null);
  8985. * // => ''
  8986. *
  8987. * _.toString(-0);
  8988. * // => '-0'
  8989. *
  8990. * _.toString([1, 2, 3]);
  8991. * // => '1,2,3'
  8992. */
  8993. function toString(value) {
  8994. return value == null ? '' : baseToString(value);
  8995. }
  8996. /**
  8997. * Gets the value at `path` of `object`. If the resolved value is
  8998. * `undefined`, the `defaultValue` is returned in its place.
  8999. *
  9000. * @static
  9001. * @memberOf _
  9002. * @since 3.7.0
  9003. * @category Object
  9004. * @param {Object} object The object to query.
  9005. * @param {Array|string} path The path of the property to get.
  9006. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  9007. * @returns {*} Returns the resolved value.
  9008. * @example
  9009. *
  9010. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  9011. *
  9012. * _.get(object, 'a[0].b.c');
  9013. * // => 3
  9014. *
  9015. * _.get(object, ['a', '0', 'b', 'c']);
  9016. * // => 3
  9017. *
  9018. * _.get(object, 'a.b.c', 'default');
  9019. * // => 'default'
  9020. */
  9021. function get(object, path, defaultValue) {
  9022. var result = object == null ? undefined : baseGet(object, path);
  9023. return result === undefined ? defaultValue : result;
  9024. }
  9025. /**
  9026. * Checks if `path` is a direct or inherited property of `object`.
  9027. *
  9028. * @static
  9029. * @memberOf _
  9030. * @since 4.0.0
  9031. * @category Object
  9032. * @param {Object} object The object to query.
  9033. * @param {Array|string} path The path to check.
  9034. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  9035. * @example
  9036. *
  9037. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  9038. *
  9039. * _.hasIn(object, 'a');
  9040. * // => true
  9041. *
  9042. * _.hasIn(object, 'a.b');
  9043. * // => true
  9044. *
  9045. * _.hasIn(object, ['a', 'b']);
  9046. * // => true
  9047. *
  9048. * _.hasIn(object, 'b');
  9049. * // => false
  9050. */
  9051. function hasIn(object, path) {
  9052. return object != null && hasPath(object, path, baseHasIn);
  9053. }
  9054. /**
  9055. * Creates an array of the own enumerable property names of `object`.
  9056. *
  9057. * **Note:** Non-object values are coerced to objects. See the
  9058. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  9059. * for more details.
  9060. *
  9061. * @static
  9062. * @since 0.1.0
  9063. * @memberOf _
  9064. * @category Object
  9065. * @param {Object} object The object to query.
  9066. * @returns {Array} Returns the array of property names.
  9067. * @example
  9068. *
  9069. * function Foo() {
  9070. * this.a = 1;
  9071. * this.b = 2;
  9072. * }
  9073. *
  9074. * Foo.prototype.c = 3;
  9075. *
  9076. * _.keys(new Foo);
  9077. * // => ['a', 'b'] (iteration order is not guaranteed)
  9078. *
  9079. * _.keys('hi');
  9080. * // => ['0', '1']
  9081. */
  9082. function keys(object) {
  9083. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  9084. }
  9085. /**
  9086. * This method returns the first argument it receives.
  9087. *
  9088. * @static
  9089. * @since 0.1.0
  9090. * @memberOf _
  9091. * @category Util
  9092. * @param {*} value Any value.
  9093. * @returns {*} Returns `value`.
  9094. * @example
  9095. *
  9096. * var object = { 'a': 1 };
  9097. *
  9098. * console.log(_.identity(object) === object);
  9099. * // => true
  9100. */
  9101. function identity(value) {
  9102. return value;
  9103. }
  9104. /**
  9105. * This method returns `undefined`.
  9106. *
  9107. * @static
  9108. * @memberOf _
  9109. * @since 2.3.0
  9110. * @category Util
  9111. * @example
  9112. *
  9113. * _.times(2, _.noop);
  9114. * // => [undefined, undefined]
  9115. */
  9116. function noop() {
  9117. // No operation performed.
  9118. }
  9119. /**
  9120. * Creates a function that returns the value at `path` of a given object.
  9121. *
  9122. * @static
  9123. * @memberOf _
  9124. * @since 2.4.0
  9125. * @category Util
  9126. * @param {Array|string} path The path of the property to get.
  9127. * @returns {Function} Returns the new accessor function.
  9128. * @example
  9129. *
  9130. * var objects = [
  9131. * { 'a': { 'b': 2 } },
  9132. * { 'a': { 'b': 1 } }
  9133. * ];
  9134. *
  9135. * _.map(objects, _.property('a.b'));
  9136. * // => [2, 1]
  9137. *
  9138. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  9139. * // => [1, 2]
  9140. */
  9141. function property(path) {
  9142. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  9143. }
  9144. module.exports = uniqBy;
  9145. /***/ }),
  9146. /***/ 785:
  9147. /***/ (function(module) {
  9148. (function (global, factory) {
  9149. true ? module.exports = factory() :
  9150. 0;
  9151. }(this, (function () { 'use strict';
  9152. var globals = function(defs) {
  9153. defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
  9154. defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");
  9155. defs('EPSG:3857', "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
  9156. defs.WGS84 = defs['EPSG:4326'];
  9157. defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857
  9158. defs.GOOGLE = defs['EPSG:3857'];
  9159. defs['EPSG:900913'] = defs['EPSG:3857'];
  9160. defs['EPSG:102113'] = defs['EPSG:3857'];
  9161. };
  9162. var PJD_3PARAM = 1;
  9163. var PJD_7PARAM = 2;
  9164. var PJD_GRIDSHIFT = 3;
  9165. var PJD_WGS84 = 4; // WGS84 or equivalent
  9166. var PJD_NODATUM = 5; // WGS84 or equivalent
  9167. var SRS_WGS84_SEMIMAJOR = 6378137.0; // only used in grid shift transforms
  9168. var SRS_WGS84_SEMIMINOR = 6356752.314; // only used in grid shift transforms
  9169. var SRS_WGS84_ESQUARED = 0.0066943799901413165; // only used in grid shift transforms
  9170. var SEC_TO_RAD = 4.84813681109535993589914102357e-6;
  9171. var HALF_PI = Math.PI/2;
  9172. // ellipoid pj_set_ell.c
  9173. var SIXTH = 0.1666666666666666667;
  9174. /* 1/6 */
  9175. var RA4 = 0.04722222222222222222;
  9176. /* 17/360 */
  9177. var RA6 = 0.02215608465608465608;
  9178. var EPSLN = 1.0e-10;
  9179. // you'd think you could use Number.EPSILON above but that makes
  9180. // Mollweide get into an infinate loop.
  9181. var D2R = 0.01745329251994329577;
  9182. var R2D = 57.29577951308232088;
  9183. var FORTPI = Math.PI/4;
  9184. var TWO_PI = Math.PI * 2;
  9185. // SPI is slightly greater than Math.PI, so values that exceed the -180..180
  9186. // degree range by a tiny amount don't get wrapped. This prevents points that
  9187. // have drifted from their original location along the 180th meridian (due to
  9188. // floating point error) from changing their sign.
  9189. var SPI = 3.14159265359;
  9190. var exports$1 = {};
  9191. exports$1.greenwich = 0.0; //"0dE",
  9192. exports$1.lisbon = -9.131906111111; //"9d07'54.862\"W",
  9193. exports$1.paris = 2.337229166667; //"2d20'14.025\"E",
  9194. exports$1.bogota = -74.080916666667; //"74d04'51.3\"W",
  9195. exports$1.madrid = -3.687938888889; //"3d41'16.58\"W",
  9196. exports$1.rome = 12.452333333333; //"12d27'8.4\"E",
  9197. exports$1.bern = 7.439583333333; //"7d26'22.5\"E",
  9198. exports$1.jakarta = 106.807719444444; //"106d48'27.79\"E",
  9199. exports$1.ferro = -17.666666666667; //"17d40'W",
  9200. exports$1.brussels = 4.367975; //"4d22'4.71\"E",
  9201. exports$1.stockholm = 18.058277777778; //"18d3'29.8\"E",
  9202. exports$1.athens = 23.7163375; //"23d42'58.815\"E",
  9203. exports$1.oslo = 10.722916666667; //"10d43'22.5\"E"
  9204. var units = {
  9205. ft: {to_meter: 0.3048},
  9206. 'us-ft': {to_meter: 1200 / 3937}
  9207. };
  9208. var ignoredChar = /[\s_\-\/\(\)]/g;
  9209. function match(obj, key) {
  9210. if (obj[key]) {
  9211. return obj[key];
  9212. }
  9213. var keys = Object.keys(obj);
  9214. var lkey = key.toLowerCase().replace(ignoredChar, '');
  9215. var i = -1;
  9216. var testkey, processedKey;
  9217. while (++i < keys.length) {
  9218. testkey = keys[i];
  9219. processedKey = testkey.toLowerCase().replace(ignoredChar, '');
  9220. if (processedKey === lkey) {
  9221. return obj[testkey];
  9222. }
  9223. }
  9224. }
  9225. var parseProj = function(defData) {
  9226. var self = {};
  9227. var paramObj = defData.split('+').map(function(v) {
  9228. return v.trim();
  9229. }).filter(function(a) {
  9230. return a;
  9231. }).reduce(function(p, a) {
  9232. var split = a.split('=');
  9233. split.push(true);
  9234. p[split[0].toLowerCase()] = split[1];
  9235. return p;
  9236. }, {});
  9237. var paramName, paramVal, paramOutname;
  9238. var params = {
  9239. proj: 'projName',
  9240. datum: 'datumCode',
  9241. rf: function(v) {
  9242. self.rf = parseFloat(v);
  9243. },
  9244. lat_0: function(v) {
  9245. self.lat0 = v * D2R;
  9246. },
  9247. lat_1: function(v) {
  9248. self.lat1 = v * D2R;
  9249. },
  9250. lat_2: function(v) {
  9251. self.lat2 = v * D2R;
  9252. },
  9253. lat_ts: function(v) {
  9254. self.lat_ts = v * D2R;
  9255. },
  9256. lon_0: function(v) {
  9257. self.long0 = v * D2R;
  9258. },
  9259. lon_1: function(v) {
  9260. self.long1 = v * D2R;
  9261. },
  9262. lon_2: function(v) {
  9263. self.long2 = v * D2R;
  9264. },
  9265. alpha: function(v) {
  9266. self.alpha = parseFloat(v) * D2R;
  9267. },
  9268. gamma: function(v) {
  9269. self.rectified_grid_angle = parseFloat(v);
  9270. },
  9271. lonc: function(v) {
  9272. self.longc = v * D2R;
  9273. },
  9274. x_0: function(v) {
  9275. self.x0 = parseFloat(v);
  9276. },
  9277. y_0: function(v) {
  9278. self.y0 = parseFloat(v);
  9279. },
  9280. k_0: function(v) {
  9281. self.k0 = parseFloat(v);
  9282. },
  9283. k: function(v) {
  9284. self.k0 = parseFloat(v);
  9285. },
  9286. a: function(v) {
  9287. self.a = parseFloat(v);
  9288. },
  9289. b: function(v) {
  9290. self.b = parseFloat(v);
  9291. },
  9292. r_a: function() {
  9293. self.R_A = true;
  9294. },
  9295. zone: function(v) {
  9296. self.zone = parseInt(v, 10);
  9297. },
  9298. south: function() {
  9299. self.utmSouth = true;
  9300. },
  9301. towgs84: function(v) {
  9302. self.datum_params = v.split(",").map(function(a) {
  9303. return parseFloat(a);
  9304. });
  9305. },
  9306. to_meter: function(v) {
  9307. self.to_meter = parseFloat(v);
  9308. },
  9309. units: function(v) {
  9310. self.units = v;
  9311. var unit = match(units, v);
  9312. if (unit) {
  9313. self.to_meter = unit.to_meter;
  9314. }
  9315. },
  9316. from_greenwich: function(v) {
  9317. self.from_greenwich = v * D2R;
  9318. },
  9319. pm: function(v) {
  9320. var pm = match(exports$1, v);
  9321. self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;
  9322. },
  9323. nadgrids: function(v) {
  9324. if (v === '@null') {
  9325. self.datumCode = 'none';
  9326. }
  9327. else {
  9328. self.nadgrids = v;
  9329. }
  9330. },
  9331. axis: function(v) {
  9332. var legalAxis = "ewnsud";
  9333. if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {
  9334. self.axis = v;
  9335. }
  9336. },
  9337. approx: function() {
  9338. self.approx = true;
  9339. }
  9340. };
  9341. for (paramName in paramObj) {
  9342. paramVal = paramObj[paramName];
  9343. if (paramName in params) {
  9344. paramOutname = params[paramName];
  9345. if (typeof paramOutname === 'function') {
  9346. paramOutname(paramVal);
  9347. }
  9348. else {
  9349. self[paramOutname] = paramVal;
  9350. }
  9351. }
  9352. else {
  9353. self[paramName] = paramVal;
  9354. }
  9355. }
  9356. if(typeof self.datumCode === 'string' && self.datumCode !== "WGS84"){
  9357. self.datumCode = self.datumCode.toLowerCase();
  9358. }
  9359. return self;
  9360. };
  9361. var NEUTRAL = 1;
  9362. var KEYWORD = 2;
  9363. var NUMBER = 3;
  9364. var QUOTED = 4;
  9365. var AFTERQUOTE = 5;
  9366. var ENDED = -1;
  9367. var whitespace = /\s/;
  9368. var latin = /[A-Za-z]/;
  9369. var keyword = /[A-Za-z84_]/;
  9370. var endThings = /[,\]]/;
  9371. var digets = /[\d\.E\-\+]/;
  9372. // const ignoredChar = /[\s_\-\/\(\)]/g;
  9373. function Parser(text) {
  9374. if (typeof text !== 'string') {
  9375. throw new Error('not a string');
  9376. }
  9377. this.text = text.trim();
  9378. this.level = 0;
  9379. this.place = 0;
  9380. this.root = null;
  9381. this.stack = [];
  9382. this.currentObject = null;
  9383. this.state = NEUTRAL;
  9384. }
  9385. Parser.prototype.readCharicter = function() {
  9386. var char = this.text[this.place++];
  9387. if (this.state !== QUOTED) {
  9388. while (whitespace.test(char)) {
  9389. if (this.place >= this.text.length) {
  9390. return;
  9391. }
  9392. char = this.text[this.place++];
  9393. }
  9394. }
  9395. switch (this.state) {
  9396. case NEUTRAL:
  9397. return this.neutral(char);
  9398. case KEYWORD:
  9399. return this.keyword(char)
  9400. case QUOTED:
  9401. return this.quoted(char);
  9402. case AFTERQUOTE:
  9403. return this.afterquote(char);
  9404. case NUMBER:
  9405. return this.number(char);
  9406. case ENDED:
  9407. return;
  9408. }
  9409. };
  9410. Parser.prototype.afterquote = function(char) {
  9411. if (char === '"') {
  9412. this.word += '"';
  9413. this.state = QUOTED;
  9414. return;
  9415. }
  9416. if (endThings.test(char)) {
  9417. this.word = this.word.trim();
  9418. this.afterItem(char);
  9419. return;
  9420. }
  9421. throw new Error('havn\'t handled "' +char + '" in afterquote yet, index ' + this.place);
  9422. };
  9423. Parser.prototype.afterItem = function(char) {
  9424. if (char === ',') {
  9425. if (this.word !== null) {
  9426. this.currentObject.push(this.word);
  9427. }
  9428. this.word = null;
  9429. this.state = NEUTRAL;
  9430. return;
  9431. }
  9432. if (char === ']') {
  9433. this.level--;
  9434. if (this.word !== null) {
  9435. this.currentObject.push(this.word);
  9436. this.word = null;
  9437. }
  9438. this.state = NEUTRAL;
  9439. this.currentObject = this.stack.pop();
  9440. if (!this.currentObject) {
  9441. this.state = ENDED;
  9442. }
  9443. return;
  9444. }
  9445. };
  9446. Parser.prototype.number = function(char) {
  9447. if (digets.test(char)) {
  9448. this.word += char;
  9449. return;
  9450. }
  9451. if (endThings.test(char)) {
  9452. this.word = parseFloat(this.word);
  9453. this.afterItem(char);
  9454. return;
  9455. }
  9456. throw new Error('havn\'t handled "' +char + '" in number yet, index ' + this.place);
  9457. };
  9458. Parser.prototype.quoted = function(char) {
  9459. if (char === '"') {
  9460. this.state = AFTERQUOTE;
  9461. return;
  9462. }
  9463. this.word += char;
  9464. return;
  9465. };
  9466. Parser.prototype.keyword = function(char) {
  9467. if (keyword.test(char)) {
  9468. this.word += char;
  9469. return;
  9470. }
  9471. if (char === '[') {
  9472. var newObjects = [];
  9473. newObjects.push(this.word);
  9474. this.level++;
  9475. if (this.root === null) {
  9476. this.root = newObjects;
  9477. } else {
  9478. this.currentObject.push(newObjects);
  9479. }
  9480. this.stack.push(this.currentObject);
  9481. this.currentObject = newObjects;
  9482. this.state = NEUTRAL;
  9483. return;
  9484. }
  9485. if (endThings.test(char)) {
  9486. this.afterItem(char);
  9487. return;
  9488. }
  9489. throw new Error('havn\'t handled "' +char + '" in keyword yet, index ' + this.place);
  9490. };
  9491. Parser.prototype.neutral = function(char) {
  9492. if (latin.test(char)) {
  9493. this.word = char;
  9494. this.state = KEYWORD;
  9495. return;
  9496. }
  9497. if (char === '"') {
  9498. this.word = '';
  9499. this.state = QUOTED;
  9500. return;
  9501. }
  9502. if (digets.test(char)) {
  9503. this.word = char;
  9504. this.state = NUMBER;
  9505. return;
  9506. }
  9507. if (endThings.test(char)) {
  9508. this.afterItem(char);
  9509. return;
  9510. }
  9511. throw new Error('havn\'t handled "' +char + '" in neutral yet, index ' + this.place);
  9512. };
  9513. Parser.prototype.output = function() {
  9514. while (this.place < this.text.length) {
  9515. this.readCharicter();
  9516. }
  9517. if (this.state === ENDED) {
  9518. return this.root;
  9519. }
  9520. throw new Error('unable to parse string "' +this.text + '". State is ' + this.state);
  9521. };
  9522. function parseString(txt) {
  9523. var parser = new Parser(txt);
  9524. return parser.output();
  9525. }
  9526. function mapit(obj, key, value) {
  9527. if (Array.isArray(key)) {
  9528. value.unshift(key);
  9529. key = null;
  9530. }
  9531. var thing = key ? {} : obj;
  9532. var out = value.reduce(function(newObj, item) {
  9533. sExpr(item, newObj);
  9534. return newObj
  9535. }, thing);
  9536. if (key) {
  9537. obj[key] = out;
  9538. }
  9539. }
  9540. function sExpr(v, obj) {
  9541. if (!Array.isArray(v)) {
  9542. obj[v] = true;
  9543. return;
  9544. }
  9545. var key = v.shift();
  9546. if (key === 'PARAMETER') {
  9547. key = v.shift();
  9548. }
  9549. if (v.length === 1) {
  9550. if (Array.isArray(v[0])) {
  9551. obj[key] = {};
  9552. sExpr(v[0], obj[key]);
  9553. return;
  9554. }
  9555. obj[key] = v[0];
  9556. return;
  9557. }
  9558. if (!v.length) {
  9559. obj[key] = true;
  9560. return;
  9561. }
  9562. if (key === 'TOWGS84') {
  9563. obj[key] = v;
  9564. return;
  9565. }
  9566. if (key === 'AXIS') {
  9567. if (!(key in obj)) {
  9568. obj[key] = [];
  9569. }
  9570. obj[key].push(v);
  9571. return;
  9572. }
  9573. if (!Array.isArray(key)) {
  9574. obj[key] = {};
  9575. }
  9576. var i;
  9577. switch (key) {
  9578. case 'UNIT':
  9579. case 'PRIMEM':
  9580. case 'VERT_DATUM':
  9581. obj[key] = {
  9582. name: v[0].toLowerCase(),
  9583. convert: v[1]
  9584. };
  9585. if (v.length === 3) {
  9586. sExpr(v[2], obj[key]);
  9587. }
  9588. return;
  9589. case 'SPHEROID':
  9590. case 'ELLIPSOID':
  9591. obj[key] = {
  9592. name: v[0],
  9593. a: v[1],
  9594. rf: v[2]
  9595. };
  9596. if (v.length === 4) {
  9597. sExpr(v[3], obj[key]);
  9598. }
  9599. return;
  9600. case 'PROJECTEDCRS':
  9601. case 'PROJCRS':
  9602. case 'GEOGCS':
  9603. case 'GEOCCS':
  9604. case 'PROJCS':
  9605. case 'LOCAL_CS':
  9606. case 'GEODCRS':
  9607. case 'GEODETICCRS':
  9608. case 'GEODETICDATUM':
  9609. case 'EDATUM':
  9610. case 'ENGINEERINGDATUM':
  9611. case 'VERT_CS':
  9612. case 'VERTCRS':
  9613. case 'VERTICALCRS':
  9614. case 'COMPD_CS':
  9615. case 'COMPOUNDCRS':
  9616. case 'ENGINEERINGCRS':
  9617. case 'ENGCRS':
  9618. case 'FITTED_CS':
  9619. case 'LOCAL_DATUM':
  9620. case 'DATUM':
  9621. v[0] = ['name', v[0]];
  9622. mapit(obj, key, v);
  9623. return;
  9624. default:
  9625. i = -1;
  9626. while (++i < v.length) {
  9627. if (!Array.isArray(v[i])) {
  9628. return sExpr(v, obj[key]);
  9629. }
  9630. }
  9631. return mapit(obj, key, v);
  9632. }
  9633. }
  9634. var D2R$1 = 0.01745329251994329577;
  9635. function rename(obj, params) {
  9636. var outName = params[0];
  9637. var inName = params[1];
  9638. if (!(outName in obj) && (inName in obj)) {
  9639. obj[outName] = obj[inName];
  9640. if (params.length === 3) {
  9641. obj[outName] = params[2](obj[outName]);
  9642. }
  9643. }
  9644. }
  9645. function d2r(input) {
  9646. return input * D2R$1;
  9647. }
  9648. function cleanWKT(wkt) {
  9649. if (wkt.type === 'GEOGCS') {
  9650. wkt.projName = 'longlat';
  9651. } else if (wkt.type === 'LOCAL_CS') {
  9652. wkt.projName = 'identity';
  9653. wkt.local = true;
  9654. } else {
  9655. if (typeof wkt.PROJECTION === 'object') {
  9656. wkt.projName = Object.keys(wkt.PROJECTION)[0];
  9657. } else {
  9658. wkt.projName = wkt.PROJECTION;
  9659. }
  9660. }
  9661. if (wkt.AXIS) {
  9662. var axisOrder = '';
  9663. for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {
  9664. var axis = [wkt.AXIS[i][0].toLowerCase(), wkt.AXIS[i][1].toLowerCase()];
  9665. if (axis[0].indexOf('north') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'north')) {
  9666. axisOrder += 'n';
  9667. } else if (axis[0].indexOf('south') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'south')) {
  9668. axisOrder += 's';
  9669. } else if (axis[0].indexOf('east') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'east')) {
  9670. axisOrder += 'e';
  9671. } else if (axis[0].indexOf('west') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'west')) {
  9672. axisOrder += 'w';
  9673. }
  9674. }
  9675. if (axisOrder.length === 2) {
  9676. axisOrder += 'u';
  9677. }
  9678. if (axisOrder.length === 3) {
  9679. wkt.axis = axisOrder;
  9680. }
  9681. }
  9682. if (wkt.UNIT) {
  9683. wkt.units = wkt.UNIT.name.toLowerCase();
  9684. if (wkt.units === 'metre') {
  9685. wkt.units = 'meter';
  9686. }
  9687. if (wkt.UNIT.convert) {
  9688. if (wkt.type === 'GEOGCS') {
  9689. if (wkt.DATUM && wkt.DATUM.SPHEROID) {
  9690. wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a;
  9691. }
  9692. } else {
  9693. wkt.to_meter = wkt.UNIT.convert;
  9694. }
  9695. }
  9696. }
  9697. var geogcs = wkt.GEOGCS;
  9698. if (wkt.type === 'GEOGCS') {
  9699. geogcs = wkt;
  9700. }
  9701. if (geogcs) {
  9702. //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){
  9703. // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;
  9704. //}
  9705. if (geogcs.DATUM) {
  9706. wkt.datumCode = geogcs.DATUM.name.toLowerCase();
  9707. } else {
  9708. wkt.datumCode = geogcs.name.toLowerCase();
  9709. }
  9710. if (wkt.datumCode.slice(0, 2) === 'd_') {
  9711. wkt.datumCode = wkt.datumCode.slice(2);
  9712. }
  9713. if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {
  9714. wkt.datumCode = 'nzgd49';
  9715. }
  9716. if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {
  9717. if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {
  9718. wkt.sphere = true;
  9719. }
  9720. wkt.datumCode = 'wgs84';
  9721. }
  9722. if (wkt.datumCode.slice(-6) === '_ferro') {
  9723. wkt.datumCode = wkt.datumCode.slice(0, - 6);
  9724. }
  9725. if (wkt.datumCode.slice(-8) === '_jakarta') {
  9726. wkt.datumCode = wkt.datumCode.slice(0, - 8);
  9727. }
  9728. if (~wkt.datumCode.indexOf('belge')) {
  9729. wkt.datumCode = 'rnb72';
  9730. }
  9731. if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
  9732. wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\_18/, 'clrk');
  9733. if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {
  9734. wkt.ellps = 'intl';
  9735. }
  9736. wkt.a = geogcs.DATUM.SPHEROID.a;
  9737. wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);
  9738. }
  9739. if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {
  9740. wkt.datum_params = geogcs.DATUM.TOWGS84;
  9741. }
  9742. if (~wkt.datumCode.indexOf('osgb_1936')) {
  9743. wkt.datumCode = 'osgb36';
  9744. }
  9745. if (~wkt.datumCode.indexOf('osni_1952')) {
  9746. wkt.datumCode = 'osni52';
  9747. }
  9748. if (~wkt.datumCode.indexOf('tm65')
  9749. || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {
  9750. wkt.datumCode = 'ire65';
  9751. }
  9752. if (wkt.datumCode === 'ch1903+') {
  9753. wkt.datumCode = 'ch1903';
  9754. }
  9755. if (~wkt.datumCode.indexOf('israel')) {
  9756. wkt.datumCode = 'isr93';
  9757. }
  9758. }
  9759. if (wkt.b && !isFinite(wkt.b)) {
  9760. wkt.b = wkt.a;
  9761. }
  9762. function toMeter(input) {
  9763. var ratio = wkt.to_meter || 1;
  9764. return input * ratio;
  9765. }
  9766. var renamer = function(a) {
  9767. return rename(wkt, a);
  9768. };
  9769. var list = [
  9770. ['standard_parallel_1', 'Standard_Parallel_1'],
  9771. ['standard_parallel_1', 'Latitude of 1st standard parallel'],
  9772. ['standard_parallel_2', 'Standard_Parallel_2'],
  9773. ['standard_parallel_2', 'Latitude of 2nd standard parallel'],
  9774. ['false_easting', 'False_Easting'],
  9775. ['false_easting', 'False easting'],
  9776. ['false-easting', 'Easting at false origin'],
  9777. ['false_northing', 'False_Northing'],
  9778. ['false_northing', 'False northing'],
  9779. ['false_northing', 'Northing at false origin'],
  9780. ['central_meridian', 'Central_Meridian'],
  9781. ['central_meridian', 'Longitude of natural origin'],
  9782. ['central_meridian', 'Longitude of false origin'],
  9783. ['latitude_of_origin', 'Latitude_Of_Origin'],
  9784. ['latitude_of_origin', 'Central_Parallel'],
  9785. ['latitude_of_origin', 'Latitude of natural origin'],
  9786. ['latitude_of_origin', 'Latitude of false origin'],
  9787. ['scale_factor', 'Scale_Factor'],
  9788. ['k0', 'scale_factor'],
  9789. ['latitude_of_center', 'Latitude_Of_Center'],
  9790. ['latitude_of_center', 'Latitude_of_center'],
  9791. ['lat0', 'latitude_of_center', d2r],
  9792. ['longitude_of_center', 'Longitude_Of_Center'],
  9793. ['longitude_of_center', 'Longitude_of_center'],
  9794. ['longc', 'longitude_of_center', d2r],
  9795. ['x0', 'false_easting', toMeter],
  9796. ['y0', 'false_northing', toMeter],
  9797. ['long0', 'central_meridian', d2r],
  9798. ['lat0', 'latitude_of_origin', d2r],
  9799. ['lat0', 'standard_parallel_1', d2r],
  9800. ['lat1', 'standard_parallel_1', d2r],
  9801. ['lat2', 'standard_parallel_2', d2r],
  9802. ['azimuth', 'Azimuth'],
  9803. ['alpha', 'azimuth', d2r],
  9804. ['srsCode', 'name']
  9805. ];
  9806. list.forEach(renamer);
  9807. if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {
  9808. wkt.long0 = wkt.longc;
  9809. }
  9810. if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {
  9811. wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
  9812. wkt.lat_ts = wkt.lat1;
  9813. }
  9814. }
  9815. var wkt = function(wkt) {
  9816. var lisp = parseString(wkt);
  9817. var type = lisp.shift();
  9818. var name = lisp.shift();
  9819. lisp.unshift(['name', name]);
  9820. lisp.unshift(['type', type]);
  9821. var obj = {};
  9822. sExpr(lisp, obj);
  9823. cleanWKT(obj);
  9824. return obj;
  9825. };
  9826. function defs(name) {
  9827. /*global console*/
  9828. var that = this;
  9829. if (arguments.length === 2) {
  9830. var def = arguments[1];
  9831. if (typeof def === 'string') {
  9832. if (def.charAt(0) === '+') {
  9833. defs[name] = parseProj(arguments[1]);
  9834. }
  9835. else {
  9836. defs[name] = wkt(arguments[1]);
  9837. }
  9838. } else {
  9839. defs[name] = def;
  9840. }
  9841. }
  9842. else if (arguments.length === 1) {
  9843. if (Array.isArray(name)) {
  9844. return name.map(function(v) {
  9845. if (Array.isArray(v)) {
  9846. defs.apply(that, v);
  9847. }
  9848. else {
  9849. defs(v);
  9850. }
  9851. });
  9852. }
  9853. else if (typeof name === 'string') {
  9854. if (name in defs) {
  9855. return defs[name];
  9856. }
  9857. }
  9858. else if ('EPSG' in name) {
  9859. defs['EPSG:' + name.EPSG] = name;
  9860. }
  9861. else if ('ESRI' in name) {
  9862. defs['ESRI:' + name.ESRI] = name;
  9863. }
  9864. else if ('IAU2000' in name) {
  9865. defs['IAU2000:' + name.IAU2000] = name;
  9866. }
  9867. else {
  9868. console.log(name);
  9869. }
  9870. return;
  9871. }
  9872. }
  9873. globals(defs);
  9874. function testObj(code){
  9875. return typeof code === 'string';
  9876. }
  9877. function testDef(code){
  9878. return code in defs;
  9879. }
  9880. var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];
  9881. function testWKT(code){
  9882. return codeWords.some(function (word) {
  9883. return code.indexOf(word) > -1;
  9884. });
  9885. }
  9886. var codes = ['3857', '900913', '3785', '102113'];
  9887. function checkMercator(item) {
  9888. var auth = match(item, 'authority');
  9889. if (!auth) {
  9890. return;
  9891. }
  9892. var code = match(auth, 'epsg');
  9893. return code && codes.indexOf(code) > -1;
  9894. }
  9895. function checkProjStr(item) {
  9896. var ext = match(item, 'extension');
  9897. if (!ext) {
  9898. return;
  9899. }
  9900. return match(ext, 'proj4');
  9901. }
  9902. function testProj(code){
  9903. return code[0] === '+';
  9904. }
  9905. function parse(code){
  9906. if (testObj(code)) {
  9907. //check to see if this is a WKT string
  9908. if (testDef(code)) {
  9909. return defs[code];
  9910. }
  9911. if (testWKT(code)) {
  9912. var out = wkt(code);
  9913. // test of spetial case, due to this being a very common and often malformed
  9914. if (checkMercator(out)) {
  9915. return defs['EPSG:3857'];
  9916. }
  9917. var maybeProjStr = checkProjStr(out);
  9918. if (maybeProjStr) {
  9919. return parseProj(maybeProjStr);
  9920. }
  9921. return out;
  9922. }
  9923. if (testProj(code)) {
  9924. return parseProj(code);
  9925. }
  9926. }else{
  9927. return code;
  9928. }
  9929. }
  9930. var extend = function(destination, source) {
  9931. destination = destination || {};
  9932. var value, property;
  9933. if (!source) {
  9934. return destination;
  9935. }
  9936. for (property in source) {
  9937. value = source[property];
  9938. if (value !== undefined) {
  9939. destination[property] = value;
  9940. }
  9941. }
  9942. return destination;
  9943. };
  9944. var msfnz = function(eccent, sinphi, cosphi) {
  9945. var con = eccent * sinphi;
  9946. return cosphi / (Math.sqrt(1 - con * con));
  9947. };
  9948. var sign = function(x) {
  9949. return x<0 ? -1 : 1;
  9950. };
  9951. var adjust_lon = function(x) {
  9952. return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
  9953. };
  9954. var tsfnz = function(eccent, phi, sinphi) {
  9955. var con = eccent * sinphi;
  9956. var com = 0.5 * eccent;
  9957. con = Math.pow(((1 - con) / (1 + con)), com);
  9958. return (Math.tan(0.5 * (HALF_PI - phi)) / con);
  9959. };
  9960. var phi2z = function(eccent, ts) {
  9961. var eccnth = 0.5 * eccent;
  9962. var con, dphi;
  9963. var phi = HALF_PI - 2 * Math.atan(ts);
  9964. for (var i = 0; i <= 15; i++) {
  9965. con = eccent * Math.sin(phi);
  9966. dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;
  9967. phi += dphi;
  9968. if (Math.abs(dphi) <= 0.0000000001) {
  9969. return phi;
  9970. }
  9971. }
  9972. //console.log("phi2z has NoConvergence");
  9973. return -9999;
  9974. };
  9975. function init() {
  9976. var con = this.b / this.a;
  9977. this.es = 1 - con * con;
  9978. if(!('x0' in this)){
  9979. this.x0 = 0;
  9980. }
  9981. if(!('y0' in this)){
  9982. this.y0 = 0;
  9983. }
  9984. this.e = Math.sqrt(this.es);
  9985. if (this.lat_ts) {
  9986. if (this.sphere) {
  9987. this.k0 = Math.cos(this.lat_ts);
  9988. }
  9989. else {
  9990. this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
  9991. }
  9992. }
  9993. else {
  9994. if (!this.k0) {
  9995. if (this.k) {
  9996. this.k0 = this.k;
  9997. }
  9998. else {
  9999. this.k0 = 1;
  10000. }
  10001. }
  10002. }
  10003. }
  10004. /* Mercator forward equations--mapping lat,long to x,y
  10005. --------------------------------------------------*/
  10006. function forward(p) {
  10007. var lon = p.x;
  10008. var lat = p.y;
  10009. // convert to radians
  10010. if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {
  10011. return null;
  10012. }
  10013. var x, y;
  10014. if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
  10015. return null;
  10016. }
  10017. else {
  10018. if (this.sphere) {
  10019. x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
  10020. y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
  10021. }
  10022. else {
  10023. var sinphi = Math.sin(lat);
  10024. var ts = tsfnz(this.e, lat, sinphi);
  10025. x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
  10026. y = this.y0 - this.a * this.k0 * Math.log(ts);
  10027. }
  10028. p.x = x;
  10029. p.y = y;
  10030. return p;
  10031. }
  10032. }
  10033. /* Mercator inverse equations--mapping x,y to lat/long
  10034. --------------------------------------------------*/
  10035. function inverse(p) {
  10036. var x = p.x - this.x0;
  10037. var y = p.y - this.y0;
  10038. var lon, lat;
  10039. if (this.sphere) {
  10040. lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));
  10041. }
  10042. else {
  10043. var ts = Math.exp(-y / (this.a * this.k0));
  10044. lat = phi2z(this.e, ts);
  10045. if (lat === -9999) {
  10046. return null;
  10047. }
  10048. }
  10049. lon = adjust_lon(this.long0 + x / (this.a * this.k0));
  10050. p.x = lon;
  10051. p.y = lat;
  10052. return p;
  10053. }
  10054. var names$1 = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
  10055. var merc = {
  10056. init: init,
  10057. forward: forward,
  10058. inverse: inverse,
  10059. names: names$1
  10060. };
  10061. function init$1() {
  10062. //no-op for longlat
  10063. }
  10064. function identity(pt) {
  10065. return pt;
  10066. }
  10067. var names$2 = ["longlat", "identity"];
  10068. var longlat = {
  10069. init: init$1,
  10070. forward: identity,
  10071. inverse: identity,
  10072. names: names$2
  10073. };
  10074. var projs = [merc, longlat];
  10075. var names = {};
  10076. var projStore = [];
  10077. function add(proj, i) {
  10078. var len = projStore.length;
  10079. if (!proj.names) {
  10080. console.log(i);
  10081. return true;
  10082. }
  10083. projStore[len] = proj;
  10084. proj.names.forEach(function(n) {
  10085. names[n.toLowerCase()] = len;
  10086. });
  10087. return this;
  10088. }
  10089. function get(name) {
  10090. if (!name) {
  10091. return false;
  10092. }
  10093. var n = name.toLowerCase();
  10094. if (typeof names[n] !== 'undefined' && projStore[names[n]]) {
  10095. return projStore[names[n]];
  10096. }
  10097. }
  10098. function start() {
  10099. projs.forEach(add);
  10100. }
  10101. var projections = {
  10102. start: start,
  10103. add: add,
  10104. get: get
  10105. };
  10106. var exports$2 = {};
  10107. exports$2.MERIT = {
  10108. a: 6378137.0,
  10109. rf: 298.257,
  10110. ellipseName: "MERIT 1983"
  10111. };
  10112. exports$2.SGS85 = {
  10113. a: 6378136.0,
  10114. rf: 298.257,
  10115. ellipseName: "Soviet Geodetic System 85"
  10116. };
  10117. exports$2.GRS80 = {
  10118. a: 6378137.0,
  10119. rf: 298.257222101,
  10120. ellipseName: "GRS 1980(IUGG, 1980)"
  10121. };
  10122. exports$2.IAU76 = {
  10123. a: 6378140.0,
  10124. rf: 298.257,
  10125. ellipseName: "IAU 1976"
  10126. };
  10127. exports$2.airy = {
  10128. a: 6377563.396,
  10129. b: 6356256.910,
  10130. ellipseName: "Airy 1830"
  10131. };
  10132. exports$2.APL4 = {
  10133. a: 6378137,
  10134. rf: 298.25,
  10135. ellipseName: "Appl. Physics. 1965"
  10136. };
  10137. exports$2.NWL9D = {
  10138. a: 6378145.0,
  10139. rf: 298.25,
  10140. ellipseName: "Naval Weapons Lab., 1965"
  10141. };
  10142. exports$2.mod_airy = {
  10143. a: 6377340.189,
  10144. b: 6356034.446,
  10145. ellipseName: "Modified Airy"
  10146. };
  10147. exports$2.andrae = {
  10148. a: 6377104.43,
  10149. rf: 300.0,
  10150. ellipseName: "Andrae 1876 (Den., Iclnd.)"
  10151. };
  10152. exports$2.aust_SA = {
  10153. a: 6378160.0,
  10154. rf: 298.25,
  10155. ellipseName: "Australian Natl & S. Amer. 1969"
  10156. };
  10157. exports$2.GRS67 = {
  10158. a: 6378160.0,
  10159. rf: 298.2471674270,
  10160. ellipseName: "GRS 67(IUGG 1967)"
  10161. };
  10162. exports$2.bessel = {
  10163. a: 6377397.155,
  10164. rf: 299.1528128,
  10165. ellipseName: "Bessel 1841"
  10166. };
  10167. exports$2.bess_nam = {
  10168. a: 6377483.865,
  10169. rf: 299.1528128,
  10170. ellipseName: "Bessel 1841 (Namibia)"
  10171. };
  10172. exports$2.clrk66 = {
  10173. a: 6378206.4,
  10174. b: 6356583.8,
  10175. ellipseName: "Clarke 1866"
  10176. };
  10177. exports$2.clrk80 = {
  10178. a: 6378249.145,
  10179. rf: 293.4663,
  10180. ellipseName: "Clarke 1880 mod."
  10181. };
  10182. exports$2.clrk80ign = {
  10183. a: 6378249.2,
  10184. b: 6356515,
  10185. rf: 293.4660213,
  10186. ellipseName: "Clarke 1880 (IGN)"
  10187. };
  10188. exports$2.clrk58 = {
  10189. a: 6378293.645208759,
  10190. rf: 294.2606763692654,
  10191. ellipseName: "Clarke 1858"
  10192. };
  10193. exports$2.CPM = {
  10194. a: 6375738.7,
  10195. rf: 334.29,
  10196. ellipseName: "Comm. des Poids et Mesures 1799"
  10197. };
  10198. exports$2.delmbr = {
  10199. a: 6376428.0,
  10200. rf: 311.5,
  10201. ellipseName: "Delambre 1810 (Belgium)"
  10202. };
  10203. exports$2.engelis = {
  10204. a: 6378136.05,
  10205. rf: 298.2566,
  10206. ellipseName: "Engelis 1985"
  10207. };
  10208. exports$2.evrst30 = {
  10209. a: 6377276.345,
  10210. rf: 300.8017,
  10211. ellipseName: "Everest 1830"
  10212. };
  10213. exports$2.evrst48 = {
  10214. a: 6377304.063,
  10215. rf: 300.8017,
  10216. ellipseName: "Everest 1948"
  10217. };
  10218. exports$2.evrst56 = {
  10219. a: 6377301.243,
  10220. rf: 300.8017,
  10221. ellipseName: "Everest 1956"
  10222. };
  10223. exports$2.evrst69 = {
  10224. a: 6377295.664,
  10225. rf: 300.8017,
  10226. ellipseName: "Everest 1969"
  10227. };
  10228. exports$2.evrstSS = {
  10229. a: 6377298.556,
  10230. rf: 300.8017,
  10231. ellipseName: "Everest (Sabah & Sarawak)"
  10232. };
  10233. exports$2.fschr60 = {
  10234. a: 6378166.0,
  10235. rf: 298.3,
  10236. ellipseName: "Fischer (Mercury Datum) 1960"
  10237. };
  10238. exports$2.fschr60m = {
  10239. a: 6378155.0,
  10240. rf: 298.3,
  10241. ellipseName: "Fischer 1960"
  10242. };
  10243. exports$2.fschr68 = {
  10244. a: 6378150.0,
  10245. rf: 298.3,
  10246. ellipseName: "Fischer 1968"
  10247. };
  10248. exports$2.helmert = {
  10249. a: 6378200.0,
  10250. rf: 298.3,
  10251. ellipseName: "Helmert 1906"
  10252. };
  10253. exports$2.hough = {
  10254. a: 6378270.0,
  10255. rf: 297.0,
  10256. ellipseName: "Hough"
  10257. };
  10258. exports$2.intl = {
  10259. a: 6378388.0,
  10260. rf: 297.0,
  10261. ellipseName: "International 1909 (Hayford)"
  10262. };
  10263. exports$2.kaula = {
  10264. a: 6378163.0,
  10265. rf: 298.24,
  10266. ellipseName: "Kaula 1961"
  10267. };
  10268. exports$2.lerch = {
  10269. a: 6378139.0,
  10270. rf: 298.257,
  10271. ellipseName: "Lerch 1979"
  10272. };
  10273. exports$2.mprts = {
  10274. a: 6397300.0,
  10275. rf: 191.0,
  10276. ellipseName: "Maupertius 1738"
  10277. };
  10278. exports$2.new_intl = {
  10279. a: 6378157.5,
  10280. b: 6356772.2,
  10281. ellipseName: "New International 1967"
  10282. };
  10283. exports$2.plessis = {
  10284. a: 6376523.0,
  10285. rf: 6355863.0,
  10286. ellipseName: "Plessis 1817 (France)"
  10287. };
  10288. exports$2.krass = {
  10289. a: 6378245.0,
  10290. rf: 298.3,
  10291. ellipseName: "Krassovsky, 1942"
  10292. };
  10293. exports$2.SEasia = {
  10294. a: 6378155.0,
  10295. b: 6356773.3205,
  10296. ellipseName: "Southeast Asia"
  10297. };
  10298. exports$2.walbeck = {
  10299. a: 6376896.0,
  10300. b: 6355834.8467,
  10301. ellipseName: "Walbeck"
  10302. };
  10303. exports$2.WGS60 = {
  10304. a: 6378165.0,
  10305. rf: 298.3,
  10306. ellipseName: "WGS 60"
  10307. };
  10308. exports$2.WGS66 = {
  10309. a: 6378145.0,
  10310. rf: 298.25,
  10311. ellipseName: "WGS 66"
  10312. };
  10313. exports$2.WGS7 = {
  10314. a: 6378135.0,
  10315. rf: 298.26,
  10316. ellipseName: "WGS 72"
  10317. };
  10318. var WGS84 = exports$2.WGS84 = {
  10319. a: 6378137.0,
  10320. rf: 298.257223563,
  10321. ellipseName: "WGS 84"
  10322. };
  10323. exports$2.sphere = {
  10324. a: 6370997.0,
  10325. b: 6370997.0,
  10326. ellipseName: "Normal Sphere (r=6370997)"
  10327. };
  10328. function eccentricity(a, b, rf, R_A) {
  10329. var a2 = a * a; // used in geocentric
  10330. var b2 = b * b; // used in geocentric
  10331. var es = (a2 - b2) / a2; // e ^ 2
  10332. var e = 0;
  10333. if (R_A) {
  10334. a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));
  10335. a2 = a * a;
  10336. es = 0;
  10337. } else {
  10338. e = Math.sqrt(es); // eccentricity
  10339. }
  10340. var ep2 = (a2 - b2) / b2; // used in geocentric
  10341. return {
  10342. es: es,
  10343. e: e,
  10344. ep2: ep2
  10345. };
  10346. }
  10347. function sphere(a, b, rf, ellps, sphere) {
  10348. if (!a) { // do we have an ellipsoid?
  10349. var ellipse = match(exports$2, ellps);
  10350. if (!ellipse) {
  10351. ellipse = WGS84;
  10352. }
  10353. a = ellipse.a;
  10354. b = ellipse.b;
  10355. rf = ellipse.rf;
  10356. }
  10357. if (rf && !b) {
  10358. b = (1.0 - 1.0 / rf) * a;
  10359. }
  10360. if (rf === 0 || Math.abs(a - b) < EPSLN) {
  10361. sphere = true;
  10362. b = a;
  10363. }
  10364. return {
  10365. a: a,
  10366. b: b,
  10367. rf: rf,
  10368. sphere: sphere
  10369. };
  10370. }
  10371. var exports$3 = {};
  10372. exports$3.wgs84 = {
  10373. towgs84: "0,0,0",
  10374. ellipse: "WGS84",
  10375. datumName: "WGS84"
  10376. };
  10377. exports$3.ch1903 = {
  10378. towgs84: "674.374,15.056,405.346",
  10379. ellipse: "bessel",
  10380. datumName: "swiss"
  10381. };
  10382. exports$3.ggrs87 = {
  10383. towgs84: "-199.87,74.79,246.62",
  10384. ellipse: "GRS80",
  10385. datumName: "Greek_Geodetic_Reference_System_1987"
  10386. };
  10387. exports$3.nad83 = {
  10388. towgs84: "0,0,0",
  10389. ellipse: "GRS80",
  10390. datumName: "North_American_Datum_1983"
  10391. };
  10392. exports$3.nad27 = {
  10393. nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
  10394. ellipse: "clrk66",
  10395. datumName: "North_American_Datum_1927"
  10396. };
  10397. exports$3.potsdam = {
  10398. towgs84: "598.1,73.7,418.2,0.202,0.045,-2.455,6.7",
  10399. ellipse: "bessel",
  10400. datumName: "Potsdam Rauenberg 1950 DHDN"
  10401. };
  10402. exports$3.carthage = {
  10403. towgs84: "-263.0,6.0,431.0",
  10404. ellipse: "clark80",
  10405. datumName: "Carthage 1934 Tunisia"
  10406. };
  10407. exports$3.hermannskogel = {
  10408. towgs84: "577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
  10409. ellipse: "bessel",
  10410. datumName: "Hermannskogel"
  10411. };
  10412. exports$3.osni52 = {
  10413. towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
  10414. ellipse: "airy",
  10415. datumName: "Irish National"
  10416. };
  10417. exports$3.ire65 = {
  10418. towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
  10419. ellipse: "mod_airy",
  10420. datumName: "Ireland 1965"
  10421. };
  10422. exports$3.rassadiran = {
  10423. towgs84: "-133.63,-157.5,-158.62",
  10424. ellipse: "intl",
  10425. datumName: "Rassadiran"
  10426. };
  10427. exports$3.nzgd49 = {
  10428. towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
  10429. ellipse: "intl",
  10430. datumName: "New Zealand Geodetic Datum 1949"
  10431. };
  10432. exports$3.osgb36 = {
  10433. towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
  10434. ellipse: "airy",
  10435. datumName: "Airy 1830"
  10436. };
  10437. exports$3.s_jtsk = {
  10438. towgs84: "589,76,480",
  10439. ellipse: 'bessel',
  10440. datumName: 'S-JTSK (Ferro)'
  10441. };
  10442. exports$3.beduaram = {
  10443. towgs84: '-106,-87,188',
  10444. ellipse: 'clrk80',
  10445. datumName: 'Beduaram'
  10446. };
  10447. exports$3.gunung_segara = {
  10448. towgs84: '-403,684,41',
  10449. ellipse: 'bessel',
  10450. datumName: 'Gunung Segara Jakarta'
  10451. };
  10452. exports$3.rnb72 = {
  10453. towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
  10454. ellipse: "intl",
  10455. datumName: "Reseau National Belge 1972"
  10456. };
  10457. function datum(datumCode, datum_params, a, b, es, ep2, nadgrids) {
  10458. var out = {};
  10459. if (datumCode === undefined || datumCode === 'none') {
  10460. out.datum_type = PJD_NODATUM;
  10461. } else {
  10462. out.datum_type = PJD_WGS84;
  10463. }
  10464. if (datum_params) {
  10465. out.datum_params = datum_params.map(parseFloat);
  10466. if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
  10467. out.datum_type = PJD_3PARAM;
  10468. }
  10469. if (out.datum_params.length > 3) {
  10470. if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {
  10471. out.datum_type = PJD_7PARAM;
  10472. out.datum_params[3] *= SEC_TO_RAD;
  10473. out.datum_params[4] *= SEC_TO_RAD;
  10474. out.datum_params[5] *= SEC_TO_RAD;
  10475. out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;
  10476. }
  10477. }
  10478. }
  10479. if (nadgrids) {
  10480. out.datum_type = PJD_GRIDSHIFT;
  10481. out.grids = nadgrids;
  10482. }
  10483. out.a = a; //datum object also uses these values
  10484. out.b = b;
  10485. out.es = es;
  10486. out.ep2 = ep2;
  10487. return out;
  10488. }
  10489. /**
  10490. * Resources for details of NTv2 file formats:
  10491. * - https://web.archive.org/web/20140127204822if_/http://www.mgs.gov.on.ca:80/stdprodconsume/groups/content/@mgs/@iandit/documents/resourcelist/stel02_047447.pdf
  10492. * - http://mimaka.com/help/gs/html/004_NTV2%20Data%20Format.htm
  10493. */
  10494. var loadedNadgrids = {};
  10495. /**
  10496. * Load a binary NTv2 file (.gsb) to a key that can be used in a proj string like +nadgrids=<key>. Pass the NTv2 file
  10497. * as an ArrayBuffer.
  10498. */
  10499. function nadgrid(key, data) {
  10500. var view = new DataView(data);
  10501. var isLittleEndian = detectLittleEndian(view);
  10502. var header = readHeader(view, isLittleEndian);
  10503. if (header.nSubgrids > 1) {
  10504. console.log('Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored');
  10505. }
  10506. var subgrids = readSubgrids(view, header, isLittleEndian);
  10507. var nadgrid = {header: header, subgrids: subgrids};
  10508. loadedNadgrids[key] = nadgrid;
  10509. return nadgrid;
  10510. }
  10511. /**
  10512. * Given a proj4 value for nadgrids, return an array of loaded grids
  10513. */
  10514. function getNadgrids(nadgrids) {
  10515. // Format details: http://proj.maptools.org/gen_parms.html
  10516. if (nadgrids === undefined) { return null; }
  10517. var grids = nadgrids.split(',');
  10518. return grids.map(parseNadgridString);
  10519. }
  10520. function parseNadgridString(value) {
  10521. if (value.length === 0) {
  10522. return null;
  10523. }
  10524. var optional = value[0] === '@';
  10525. if (optional) {
  10526. value = value.slice(1);
  10527. }
  10528. if (value === 'null') {
  10529. return {name: 'null', mandatory: !optional, grid: null, isNull: true};
  10530. }
  10531. return {
  10532. name: value,
  10533. mandatory: !optional,
  10534. grid: loadedNadgrids[value] || null,
  10535. isNull: false
  10536. };
  10537. }
  10538. function secondsToRadians(seconds) {
  10539. return (seconds / 3600) * Math.PI / 180;
  10540. }
  10541. function detectLittleEndian(view) {
  10542. var nFields = view.getInt32(8, false);
  10543. if (nFields === 11) {
  10544. return false;
  10545. }
  10546. nFields = view.getInt32(8, true);
  10547. if (nFields !== 11) {
  10548. console.warn('Failed to detect nadgrid endian-ness, defaulting to little-endian');
  10549. }
  10550. return true;
  10551. }
  10552. function readHeader(view, isLittleEndian) {
  10553. return {
  10554. nFields: view.getInt32(8, isLittleEndian),
  10555. nSubgridFields: view.getInt32(24, isLittleEndian),
  10556. nSubgrids: view.getInt32(40, isLittleEndian),
  10557. shiftType: decodeString(view, 56, 56 + 8).trim(),
  10558. fromSemiMajorAxis: view.getFloat64(120, isLittleEndian),
  10559. fromSemiMinorAxis: view.getFloat64(136, isLittleEndian),
  10560. toSemiMajorAxis: view.getFloat64(152, isLittleEndian),
  10561. toSemiMinorAxis: view.getFloat64(168, isLittleEndian),
  10562. };
  10563. }
  10564. function decodeString(view, start, end) {
  10565. return String.fromCharCode.apply(null, new Uint8Array(view.buffer.slice(start, end)));
  10566. }
  10567. function readSubgrids(view, header, isLittleEndian) {
  10568. var gridOffset = 176;
  10569. var grids = [];
  10570. for (var i = 0; i < header.nSubgrids; i++) {
  10571. var subHeader = readGridHeader(view, gridOffset, isLittleEndian);
  10572. var nodes = readGridNodes(view, gridOffset, subHeader, isLittleEndian);
  10573. var lngColumnCount = Math.round(
  10574. 1 + (subHeader.upperLongitude - subHeader.lowerLongitude) / subHeader.longitudeInterval);
  10575. var latColumnCount = Math.round(
  10576. 1 + (subHeader.upperLatitude - subHeader.lowerLatitude) / subHeader.latitudeInterval);
  10577. // Proj4 operates on radians whereas the coordinates are in seconds in the grid
  10578. grids.push({
  10579. ll: [secondsToRadians(subHeader.lowerLongitude), secondsToRadians(subHeader.lowerLatitude)],
  10580. del: [secondsToRadians(subHeader.longitudeInterval), secondsToRadians(subHeader.latitudeInterval)],
  10581. lim: [lngColumnCount, latColumnCount],
  10582. count: subHeader.gridNodeCount,
  10583. cvs: mapNodes(nodes)
  10584. });
  10585. }
  10586. return grids;
  10587. }
  10588. function mapNodes(nodes) {
  10589. return nodes.map(function (r) {return [secondsToRadians(r.longitudeShift), secondsToRadians(r.latitudeShift)];});
  10590. }
  10591. function readGridHeader(view, offset, isLittleEndian) {
  10592. return {
  10593. name: decodeString(view, offset + 8, offset + 16).trim(),
  10594. parent: decodeString(view, offset + 24, offset + 24 + 8).trim(),
  10595. lowerLatitude: view.getFloat64(offset + 72, isLittleEndian),
  10596. upperLatitude: view.getFloat64(offset + 88, isLittleEndian),
  10597. lowerLongitude: view.getFloat64(offset + 104, isLittleEndian),
  10598. upperLongitude: view.getFloat64(offset + 120, isLittleEndian),
  10599. latitudeInterval: view.getFloat64(offset + 136, isLittleEndian),
  10600. longitudeInterval: view.getFloat64(offset + 152, isLittleEndian),
  10601. gridNodeCount: view.getInt32(offset + 168, isLittleEndian)
  10602. };
  10603. }
  10604. function readGridNodes(view, offset, gridHeader, isLittleEndian) {
  10605. var nodesOffset = offset + 176;
  10606. var gridRecordLength = 16;
  10607. var gridShiftRecords = [];
  10608. for (var i = 0; i < gridHeader.gridNodeCount; i++) {
  10609. var record = {
  10610. latitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength, isLittleEndian),
  10611. longitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength + 4, isLittleEndian),
  10612. latitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 8, isLittleEndian),
  10613. longitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 12, isLittleEndian),
  10614. };
  10615. gridShiftRecords.push(record);
  10616. }
  10617. return gridShiftRecords;
  10618. }
  10619. function Projection(srsCode,callback) {
  10620. if (!(this instanceof Projection)) {
  10621. return new Projection(srsCode);
  10622. }
  10623. callback = callback || function(error){
  10624. if(error){
  10625. throw error;
  10626. }
  10627. };
  10628. var json = parse(srsCode);
  10629. if(typeof json !== 'object'){
  10630. callback(srsCode);
  10631. return;
  10632. }
  10633. var ourProj = Projection.projections.get(json.projName);
  10634. if(!ourProj){
  10635. callback(srsCode);
  10636. return;
  10637. }
  10638. if (json.datumCode && json.datumCode !== 'none') {
  10639. var datumDef = match(exports$3, json.datumCode);
  10640. if (datumDef) {
  10641. json.datum_params = json.datum_params || (datumDef.towgs84 ? datumDef.towgs84.split(',') : null);
  10642. json.ellps = datumDef.ellipse;
  10643. json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;
  10644. }
  10645. }
  10646. json.k0 = json.k0 || 1.0;
  10647. json.axis = json.axis || 'enu';
  10648. json.ellps = json.ellps || 'wgs84';
  10649. json.lat1 = json.lat1 || json.lat0; // Lambert_Conformal_Conic_1SP, for example, needs this
  10650. var sphere_ = sphere(json.a, json.b, json.rf, json.ellps, json.sphere);
  10651. var ecc = eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);
  10652. var nadgrids = getNadgrids(json.nadgrids);
  10653. var datumObj = json.datum || datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2,
  10654. nadgrids);
  10655. extend(this, json); // transfer everything over from the projection because we don't know what we'll need
  10656. extend(this, ourProj); // transfer all the methods from the projection
  10657. // copy the 4 things over we calculated in deriveConstants.sphere
  10658. this.a = sphere_.a;
  10659. this.b = sphere_.b;
  10660. this.rf = sphere_.rf;
  10661. this.sphere = sphere_.sphere;
  10662. // copy the 3 things we calculated in deriveConstants.eccentricity
  10663. this.es = ecc.es;
  10664. this.e = ecc.e;
  10665. this.ep2 = ecc.ep2;
  10666. // add in the datum object
  10667. this.datum = datumObj;
  10668. // init the projection
  10669. this.init();
  10670. // legecy callback from back in the day when it went to spatialreference.org
  10671. callback(null, this);
  10672. }
  10673. Projection.projections = projections;
  10674. Projection.projections.start();
  10675. 'use strict';
  10676. function compareDatums(source, dest) {
  10677. if (source.datum_type !== dest.datum_type) {
  10678. return false; // false, datums are not equal
  10679. } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {
  10680. // the tolerance for es is to ensure that GRS80 and WGS84
  10681. // are considered identical
  10682. return false;
  10683. } else if (source.datum_type === PJD_3PARAM) {
  10684. return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);
  10685. } else if (source.datum_type === PJD_7PARAM) {
  10686. return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);
  10687. } else {
  10688. return true; // datums are equal
  10689. }
  10690. } // cs_compare_datums()
  10691. /*
  10692. * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
  10693. * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
  10694. * according to the current ellipsoid parameters.
  10695. *
  10696. * Latitude : Geodetic latitude in radians (input)
  10697. * Longitude : Geodetic longitude in radians (input)
  10698. * Height : Geodetic height, in meters (input)
  10699. * X : Calculated Geocentric X coordinate, in meters (output)
  10700. * Y : Calculated Geocentric Y coordinate, in meters (output)
  10701. * Z : Calculated Geocentric Z coordinate, in meters (output)
  10702. *
  10703. */
  10704. function geodeticToGeocentric(p, es, a) {
  10705. var Longitude = p.x;
  10706. var Latitude = p.y;
  10707. var Height = p.z ? p.z : 0; //Z value not always supplied
  10708. var Rn; /* Earth radius at location */
  10709. var Sin_Lat; /* Math.sin(Latitude) */
  10710. var Sin2_Lat; /* Square of Math.sin(Latitude) */
  10711. var Cos_Lat; /* Math.cos(Latitude) */
  10712. /*
  10713. ** Don't blow up if Latitude is just a little out of the value
  10714. ** range as it may just be a rounding issue. Also removed longitude
  10715. ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.
  10716. */
  10717. if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {
  10718. Latitude = -HALF_PI;
  10719. } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {
  10720. Latitude = HALF_PI;
  10721. } else if (Latitude < -HALF_PI) {
  10722. /* Latitude out of range */
  10723. //..reportError('geocent:lat out of range:' + Latitude);
  10724. return { x: -Infinity, y: -Infinity, z: p.z };
  10725. } else if (Latitude > HALF_PI) {
  10726. /* Latitude out of range */
  10727. return { x: Infinity, y: Infinity, z: p.z };
  10728. }
  10729. if (Longitude > Math.PI) {
  10730. Longitude -= (2 * Math.PI);
  10731. }
  10732. Sin_Lat = Math.sin(Latitude);
  10733. Cos_Lat = Math.cos(Latitude);
  10734. Sin2_Lat = Sin_Lat * Sin_Lat;
  10735. Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));
  10736. return {
  10737. x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),
  10738. y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),
  10739. z: ((Rn * (1 - es)) + Height) * Sin_Lat
  10740. };
  10741. } // cs_geodetic_to_geocentric()
  10742. function geocentricToGeodetic(p, es, a, b) {
  10743. /* local defintions and variables */
  10744. /* end-criterium of loop, accuracy of sin(Latitude) */
  10745. var genau = 1e-12;
  10746. var genau2 = (genau * genau);
  10747. var maxiter = 30;
  10748. var P; /* distance between semi-minor axis and location */
  10749. var RR; /* distance between center and location */
  10750. var CT; /* sin of geocentric latitude */
  10751. var ST; /* cos of geocentric latitude */
  10752. var RX;
  10753. var RK;
  10754. var RN; /* Earth radius at location */
  10755. var CPHI0; /* cos of start or old geodetic latitude in iterations */
  10756. var SPHI0; /* sin of start or old geodetic latitude in iterations */
  10757. var CPHI; /* cos of searched geodetic latitude */
  10758. var SPHI; /* sin of searched geodetic latitude */
  10759. var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
  10760. var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
  10761. var X = p.x;
  10762. var Y = p.y;
  10763. var Z = p.z ? p.z : 0.0; //Z value not always supplied
  10764. var Longitude;
  10765. var Latitude;
  10766. var Height;
  10767. P = Math.sqrt(X * X + Y * Y);
  10768. RR = Math.sqrt(X * X + Y * Y + Z * Z);
  10769. /* special cases for latitude and longitude */
  10770. if (P / a < genau) {
  10771. /* special case, if P=0. (X=0., Y=0.) */
  10772. Longitude = 0.0;
  10773. /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
  10774. * of ellipsoid (=center of mass), Latitude becomes PI/2 */
  10775. if (RR / a < genau) {
  10776. Latitude = HALF_PI;
  10777. Height = -b;
  10778. return {
  10779. x: p.x,
  10780. y: p.y,
  10781. z: p.z
  10782. };
  10783. }
  10784. } else {
  10785. /* ellipsoidal (geodetic) longitude
  10786. * interval: -PI < Longitude <= +PI */
  10787. Longitude = Math.atan2(Y, X);
  10788. }
  10789. /* --------------------------------------------------------------
  10790. * Following iterative algorithm was developped by
  10791. * "Institut for Erdmessung", University of Hannover, July 1988.
  10792. * Internet: www.ife.uni-hannover.de
  10793. * Iterative computation of CPHI,SPHI and Height.
  10794. * Iteration of CPHI and SPHI to 10**-12 radian resp.
  10795. * 2*10**-7 arcsec.
  10796. * --------------------------------------------------------------
  10797. */
  10798. CT = Z / RR;
  10799. ST = P / RR;
  10800. RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);
  10801. CPHI0 = ST * (1.0 - es) * RX;
  10802. SPHI0 = CT * RX;
  10803. iter = 0;
  10804. /* loop to find sin(Latitude) resp. Latitude
  10805. * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */
  10806. do {
  10807. iter++;
  10808. RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);
  10809. /* ellipsoidal (geodetic) height */
  10810. Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);
  10811. RK = es * RN / (RN + Height);
  10812. RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);
  10813. CPHI = ST * (1.0 - RK) * RX;
  10814. SPHI = CT * RX;
  10815. SDPHI = SPHI * CPHI0 - CPHI * SPHI0;
  10816. CPHI0 = CPHI;
  10817. SPHI0 = SPHI;
  10818. }
  10819. while (SDPHI * SDPHI > genau2 && iter < maxiter);
  10820. /* ellipsoidal (geodetic) latitude */
  10821. Latitude = Math.atan(SPHI / Math.abs(CPHI));
  10822. return {
  10823. x: Longitude,
  10824. y: Latitude,
  10825. z: Height
  10826. };
  10827. } // cs_geocentric_to_geodetic()
  10828. /****************************************************************/
  10829. // pj_geocentic_to_wgs84( p )
  10830. // p = point to transform in geocentric coordinates (x,y,z)
  10831. /** point object, nothing fancy, just allows values to be
  10832. passed back and forth by reference rather than by value.
  10833. Other point classes may be used as long as they have
  10834. x and y properties, which will get modified in the transform method.
  10835. */
  10836. function geocentricToWgs84(p, datum_type, datum_params) {
  10837. if (datum_type === PJD_3PARAM) {
  10838. // if( x[io] === HUGE_VAL )
  10839. // continue;
  10840. return {
  10841. x: p.x + datum_params[0],
  10842. y: p.y + datum_params[1],
  10843. z: p.z + datum_params[2],
  10844. };
  10845. } else if (datum_type === PJD_7PARAM) {
  10846. var Dx_BF = datum_params[0];
  10847. var Dy_BF = datum_params[1];
  10848. var Dz_BF = datum_params[2];
  10849. var Rx_BF = datum_params[3];
  10850. var Ry_BF = datum_params[4];
  10851. var Rz_BF = datum_params[5];
  10852. var M_BF = datum_params[6];
  10853. // if( x[io] === HUGE_VAL )
  10854. // continue;
  10855. return {
  10856. x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,
  10857. y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,
  10858. z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF
  10859. };
  10860. }
  10861. } // cs_geocentric_to_wgs84
  10862. /****************************************************************/
  10863. // pj_geocentic_from_wgs84()
  10864. // coordinate system definition,
  10865. // point to transform in geocentric coordinates (x,y,z)
  10866. function geocentricFromWgs84(p, datum_type, datum_params) {
  10867. if (datum_type === PJD_3PARAM) {
  10868. //if( x[io] === HUGE_VAL )
  10869. // continue;
  10870. return {
  10871. x: p.x - datum_params[0],
  10872. y: p.y - datum_params[1],
  10873. z: p.z - datum_params[2],
  10874. };
  10875. } else if (datum_type === PJD_7PARAM) {
  10876. var Dx_BF = datum_params[0];
  10877. var Dy_BF = datum_params[1];
  10878. var Dz_BF = datum_params[2];
  10879. var Rx_BF = datum_params[3];
  10880. var Ry_BF = datum_params[4];
  10881. var Rz_BF = datum_params[5];
  10882. var M_BF = datum_params[6];
  10883. var x_tmp = (p.x - Dx_BF) / M_BF;
  10884. var y_tmp = (p.y - Dy_BF) / M_BF;
  10885. var z_tmp = (p.z - Dz_BF) / M_BF;
  10886. //if( x[io] === HUGE_VAL )
  10887. // continue;
  10888. return {
  10889. x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,
  10890. y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,
  10891. z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp
  10892. };
  10893. } //cs_geocentric_from_wgs84()
  10894. }
  10895. function checkParams(type) {
  10896. return (type === PJD_3PARAM || type === PJD_7PARAM);
  10897. }
  10898. var datum_transform = function(source, dest, point) {
  10899. // Short cut if the datums are identical.
  10900. if (compareDatums(source, dest)) {
  10901. return point; // in this case, zero is sucess,
  10902. // whereas cs_compare_datums returns 1 to indicate TRUE
  10903. // confusing, should fix this
  10904. }
  10905. // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest
  10906. if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {
  10907. return point;
  10908. }
  10909. // If this datum requires grid shifts, then apply it to geodetic coordinates.
  10910. var source_a = source.a;
  10911. var source_es = source.es;
  10912. if (source.datum_type === PJD_GRIDSHIFT) {
  10913. var gridShiftCode = applyGridShift(source, false, point);
  10914. if (gridShiftCode !== 0) {
  10915. return undefined;
  10916. }
  10917. source_a = SRS_WGS84_SEMIMAJOR;
  10918. source_es = SRS_WGS84_ESQUARED;
  10919. }
  10920. var dest_a = dest.a;
  10921. var dest_b = dest.b;
  10922. var dest_es = dest.es;
  10923. if (dest.datum_type === PJD_GRIDSHIFT) {
  10924. dest_a = SRS_WGS84_SEMIMAJOR;
  10925. dest_b = SRS_WGS84_SEMIMINOR;
  10926. dest_es = SRS_WGS84_ESQUARED;
  10927. }
  10928. // Do we need to go through geocentric coordinates?
  10929. if (source_es === dest_es && source_a === dest_a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {
  10930. return point;
  10931. }
  10932. // Convert to geocentric coordinates.
  10933. point = geodeticToGeocentric(point, source_es, source_a);
  10934. // Convert between datums
  10935. if (checkParams(source.datum_type)) {
  10936. point = geocentricToWgs84(point, source.datum_type, source.datum_params);
  10937. }
  10938. if (checkParams(dest.datum_type)) {
  10939. point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);
  10940. }
  10941. point = geocentricToGeodetic(point, dest_es, dest_a, dest_b);
  10942. if (dest.datum_type === PJD_GRIDSHIFT) {
  10943. var destGridShiftResult = applyGridShift(dest, true, point);
  10944. if (destGridShiftResult !== 0) {
  10945. return undefined;
  10946. }
  10947. }
  10948. return point;
  10949. };
  10950. function applyGridShift(source, inverse, point) {
  10951. if (source.grids === null || source.grids.length === 0) {
  10952. console.log('Grid shift grids not found');
  10953. return -1;
  10954. }
  10955. var input = {x: -point.x, y: point.y};
  10956. var output = {x: Number.NaN, y: Number.NaN};
  10957. var attemptedGrids = [];
  10958. for (var i = 0; i < source.grids.length; i++) {
  10959. var grid = source.grids[i];
  10960. attemptedGrids.push(grid.name);
  10961. if (grid.isNull) {
  10962. output = input;
  10963. break;
  10964. }
  10965. if (grid.grid === null) {
  10966. if (grid.mandatory) {
  10967. console.log("Unable to find mandatory grid '" + grid.name + "'");
  10968. return -1;
  10969. }
  10970. continue;
  10971. }
  10972. var subgrid = grid.grid.subgrids[0];
  10973. // skip tables that don't match our point at all
  10974. var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0;
  10975. var minX = subgrid.ll[0] - epsilon;
  10976. var minY = subgrid.ll[1] - epsilon;
  10977. var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon;
  10978. var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon;
  10979. if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x ) {
  10980. continue;
  10981. }
  10982. output = applySubgridShift(input, inverse, subgrid);
  10983. if (!isNaN(output.x)) {
  10984. break;
  10985. }
  10986. }
  10987. if (isNaN(output.x)) {
  10988. console.log("Failed to find a grid shift table for location '"+
  10989. -input.x * R2D + " " + input.y * R2D + " tried: '" + attemptedGrids + "'");
  10990. return -1;
  10991. }
  10992. point.x = -output.x;
  10993. point.y = output.y;
  10994. return 0;
  10995. }
  10996. function applySubgridShift(pin, inverse, ct) {
  10997. var val = {x: Number.NaN, y: Number.NaN};
  10998. if (isNaN(pin.x)) { return val; }
  10999. var tb = {x: pin.x, y: pin.y};
  11000. tb.x -= ct.ll[0];
  11001. tb.y -= ct.ll[1];
  11002. tb.x = adjust_lon(tb.x - Math.PI) + Math.PI;
  11003. var t = nadInterpolate(tb, ct);
  11004. if (inverse) {
  11005. if (isNaN(t.x)) {
  11006. return val;
  11007. }
  11008. t.x = tb.x - t.x;
  11009. t.y = tb.y - t.y;
  11010. var i = 9, tol = 1e-12;
  11011. var dif, del;
  11012. do {
  11013. del = nadInterpolate(t, ct);
  11014. if (isNaN(del.x)) {
  11015. console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");
  11016. break;
  11017. }
  11018. dif = {x: tb.x - (del.x + t.x), y: tb.y - (del.y + t.y)};
  11019. t.x += dif.x;
  11020. t.y += dif.y;
  11021. } while (i-- && Math.abs(dif.x) > tol && Math.abs(dif.y) > tol);
  11022. if (i < 0) {
  11023. console.log("Inverse grid shift iterator failed to converge.");
  11024. return val;
  11025. }
  11026. val.x = adjust_lon(t.x + ct.ll[0]);
  11027. val.y = t.y + ct.ll[1];
  11028. } else {
  11029. if (!isNaN(t.x)) {
  11030. val.x = pin.x + t.x;
  11031. val.y = pin.y + t.y;
  11032. }
  11033. }
  11034. return val;
  11035. }
  11036. function nadInterpolate(pin, ct) {
  11037. var t = {x: pin.x / ct.del[0], y: pin.y / ct.del[1]};
  11038. var indx = {x: Math.floor(t.x), y: Math.floor(t.y)};
  11039. var frct = {x: t.x - 1.0 * indx.x, y: t.y - 1.0 * indx.y};
  11040. var val= {x: Number.NaN, y: Number.NaN};
  11041. var inx;
  11042. if (indx.x < 0 || indx.x >= ct.lim[0]) {
  11043. return val;
  11044. }
  11045. if (indx.y < 0 || indx.y >= ct.lim[1]) {
  11046. return val;
  11047. }
  11048. inx = (indx.y * ct.lim[0]) + indx.x;
  11049. var f00 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
  11050. inx++;
  11051. var f10= {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
  11052. inx += ct.lim[0];
  11053. var f11 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
  11054. inx--;
  11055. var f01 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};
  11056. var m11 = frct.x * frct.y, m10 = frct.x * (1.0 - frct.y),
  11057. m00 = (1.0 - frct.x) * (1.0 - frct.y), m01 = (1.0 - frct.x) * frct.y;
  11058. val.x = (m00 * f00.x + m10 * f10.x + m01 * f01.x + m11 * f11.x);
  11059. val.y = (m00 * f00.y + m10 * f10.y + m01 * f01.y + m11 * f11.y);
  11060. return val;
  11061. }
  11062. var adjust_axis = function(crs, denorm, point) {
  11063. var xin = point.x,
  11064. yin = point.y,
  11065. zin = point.z || 0.0;
  11066. var v, t, i;
  11067. var out = {};
  11068. for (i = 0; i < 3; i++) {
  11069. if (denorm && i === 2 && point.z === undefined) {
  11070. continue;
  11071. }
  11072. if (i === 0) {
  11073. v = xin;
  11074. if ("ew".indexOf(crs.axis[i]) !== -1) {
  11075. t = 'x';
  11076. } else {
  11077. t = 'y';
  11078. }
  11079. }
  11080. else if (i === 1) {
  11081. v = yin;
  11082. if ("ns".indexOf(crs.axis[i]) !== -1) {
  11083. t = 'y';
  11084. } else {
  11085. t = 'x';
  11086. }
  11087. }
  11088. else {
  11089. v = zin;
  11090. t = 'z';
  11091. }
  11092. switch (crs.axis[i]) {
  11093. case 'e':
  11094. out[t] = v;
  11095. break;
  11096. case 'w':
  11097. out[t] = -v;
  11098. break;
  11099. case 'n':
  11100. out[t] = v;
  11101. break;
  11102. case 's':
  11103. out[t] = -v;
  11104. break;
  11105. case 'u':
  11106. if (point[t] !== undefined) {
  11107. out.z = v;
  11108. }
  11109. break;
  11110. case 'd':
  11111. if (point[t] !== undefined) {
  11112. out.z = -v;
  11113. }
  11114. break;
  11115. default:
  11116. //console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
  11117. return null;
  11118. }
  11119. }
  11120. return out;
  11121. };
  11122. var toPoint = function (array){
  11123. var out = {
  11124. x: array[0],
  11125. y: array[1]
  11126. };
  11127. if (array.length>2) {
  11128. out.z = array[2];
  11129. }
  11130. if (array.length>3) {
  11131. out.m = array[3];
  11132. }
  11133. return out;
  11134. };
  11135. var checkSanity = function (point) {
  11136. checkCoord(point.x);
  11137. checkCoord(point.y);
  11138. };
  11139. function checkCoord(num) {
  11140. if (typeof Number.isFinite === 'function') {
  11141. if (Number.isFinite(num)) {
  11142. return;
  11143. }
  11144. throw new TypeError('coordinates must be finite numbers');
  11145. }
  11146. if (typeof num !== 'number' || num !== num || !isFinite(num)) {
  11147. throw new TypeError('coordinates must be finite numbers');
  11148. }
  11149. }
  11150. function checkNotWGS(source, dest) {
  11151. return (
  11152. (source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM || source.datum.datum_type === PJD_GRIDSHIFT) && dest.datumCode !== 'WGS84') ||
  11153. ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM || dest.datum.datum_type === PJD_GRIDSHIFT) && source.datumCode !== 'WGS84');
  11154. }
  11155. function transform(source, dest, point, enforceAxis) {
  11156. var wgs84;
  11157. if (Array.isArray(point)) {
  11158. point = toPoint(point);
  11159. } else {
  11160. // Clone the point object so inputs don't get modified
  11161. point = {
  11162. x: point.x,
  11163. y: point.y,
  11164. z: point.z,
  11165. m: point.m
  11166. };
  11167. }
  11168. var hasZ = point.z !== undefined;
  11169. checkSanity(point);
  11170. // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
  11171. if (source.datum && dest.datum && checkNotWGS(source, dest)) {
  11172. wgs84 = new Projection('WGS84');
  11173. point = transform(source, wgs84, point, enforceAxis);
  11174. source = wgs84;
  11175. }
  11176. // DGR, 2010/11/12
  11177. if (enforceAxis && source.axis !== 'enu') {
  11178. point = adjust_axis(source, false, point);
  11179. }
  11180. // Transform source points to long/lat, if they aren't already.
  11181. if (source.projName === 'longlat') {
  11182. point = {
  11183. x: point.x * D2R,
  11184. y: point.y * D2R,
  11185. z: point.z || 0
  11186. };
  11187. } else {
  11188. if (source.to_meter) {
  11189. point = {
  11190. x: point.x * source.to_meter,
  11191. y: point.y * source.to_meter,
  11192. z: point.z || 0
  11193. };
  11194. }
  11195. point = source.inverse(point); // Convert Cartesian to longlat
  11196. if (!point) {
  11197. return;
  11198. }
  11199. }
  11200. // Adjust for the prime meridian if necessary
  11201. if (source.from_greenwich) {
  11202. point.x += source.from_greenwich;
  11203. }
  11204. // Convert datums if needed, and if possible.
  11205. point = datum_transform(source.datum, dest.datum, point);
  11206. if (!point) {
  11207. return;
  11208. }
  11209. // Adjust for the prime meridian if necessary
  11210. if (dest.from_greenwich) {
  11211. point = {
  11212. x: point.x - dest.from_greenwich,
  11213. y: point.y,
  11214. z: point.z || 0
  11215. };
  11216. }
  11217. if (dest.projName === 'longlat') {
  11218. // convert radians to decimal degrees
  11219. point = {
  11220. x: point.x * R2D,
  11221. y: point.y * R2D,
  11222. z: point.z || 0
  11223. };
  11224. } else { // else project
  11225. point = dest.forward(point);
  11226. if (dest.to_meter) {
  11227. point = {
  11228. x: point.x / dest.to_meter,
  11229. y: point.y / dest.to_meter,
  11230. z: point.z || 0
  11231. };
  11232. }
  11233. }
  11234. // DGR, 2010/11/12
  11235. if (enforceAxis && dest.axis !== 'enu') {
  11236. return adjust_axis(dest, true, point);
  11237. }
  11238. if (!hasZ) {
  11239. delete point.z;
  11240. }
  11241. return point;
  11242. }
  11243. var wgs84 = Projection('WGS84');
  11244. function transformer(from, to, coords, enforceAxis) {
  11245. var transformedArray, out, keys;
  11246. if (Array.isArray(coords)) {
  11247. transformedArray = transform(from, to, coords, enforceAxis) || {x: NaN, y: NaN};
  11248. if (coords.length > 2) {
  11249. if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
  11250. if (typeof transformedArray.z === 'number') {
  11251. return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));
  11252. } else {
  11253. return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));
  11254. }
  11255. } else {
  11256. return [transformedArray.x, transformedArray.y].concat(coords.splice(2));
  11257. }
  11258. } else {
  11259. return [transformedArray.x, transformedArray.y];
  11260. }
  11261. } else {
  11262. out = transform(from, to, coords, enforceAxis);
  11263. keys = Object.keys(coords);
  11264. if (keys.length === 2) {
  11265. return out;
  11266. }
  11267. keys.forEach(function (key) {
  11268. if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
  11269. if (key === 'x' || key === 'y' || key === 'z') {
  11270. return;
  11271. }
  11272. } else {
  11273. if (key === 'x' || key === 'y') {
  11274. return;
  11275. }
  11276. }
  11277. out[key] = coords[key];
  11278. });
  11279. return out;
  11280. }
  11281. }
  11282. function checkProj(item) {
  11283. if (item instanceof Projection) {
  11284. return item;
  11285. }
  11286. if (item.oProj) {
  11287. return item.oProj;
  11288. }
  11289. return Projection(item);
  11290. }
  11291. function proj4$1(fromProj, toProj, coord) {
  11292. fromProj = checkProj(fromProj);
  11293. var single = false;
  11294. var obj;
  11295. if (typeof toProj === 'undefined') {
  11296. toProj = fromProj;
  11297. fromProj = wgs84;
  11298. single = true;
  11299. } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {
  11300. coord = toProj;
  11301. toProj = fromProj;
  11302. fromProj = wgs84;
  11303. single = true;
  11304. }
  11305. toProj = checkProj(toProj);
  11306. if (coord) {
  11307. return transformer(fromProj, toProj, coord);
  11308. } else {
  11309. obj = {
  11310. forward: function (coords, enforceAxis) {
  11311. return transformer(fromProj, toProj, coords, enforceAxis);
  11312. },
  11313. inverse: function (coords, enforceAxis) {
  11314. return transformer(toProj, fromProj, coords, enforceAxis);
  11315. }
  11316. };
  11317. if (single) {
  11318. obj.oProj = toProj;
  11319. }
  11320. return obj;
  11321. }
  11322. }
  11323. /**
  11324. * UTM zones are grouped, and assigned to one of a group of 6
  11325. * sets.
  11326. *
  11327. * {int} @private
  11328. */
  11329. var NUM_100K_SETS = 6;
  11330. /**
  11331. * The column letters (for easting) of the lower left value, per
  11332. * set.
  11333. *
  11334. * {string} @private
  11335. */
  11336. var SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';
  11337. /**
  11338. * The row letters (for northing) of the lower left value, per
  11339. * set.
  11340. *
  11341. * {string} @private
  11342. */
  11343. var SET_ORIGIN_ROW_LETTERS = 'AFAFAF';
  11344. var A = 65; // A
  11345. var I = 73; // I
  11346. var O = 79; // O
  11347. var V = 86; // V
  11348. var Z = 90; // Z
  11349. var mgrs = {
  11350. forward: forward$1,
  11351. inverse: inverse$1,
  11352. toPoint: toPoint$1
  11353. };
  11354. /**
  11355. * Conversion of lat/lon to MGRS.
  11356. *
  11357. * @param {object} ll Object literal with lat and lon properties on a
  11358. * WGS84 ellipsoid.
  11359. * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for
  11360. * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
  11361. * @return {string} the MGRS string for the given location and accuracy.
  11362. */
  11363. function forward$1(ll, accuracy) {
  11364. accuracy = accuracy || 5; // default accuracy 1m
  11365. return encode(LLtoUTM({
  11366. lat: ll[1],
  11367. lon: ll[0]
  11368. }), accuracy);
  11369. }
  11370. /**
  11371. * Conversion of MGRS to lat/lon.
  11372. *
  11373. * @param {string} mgrs MGRS string.
  11374. * @return {array} An array with left (longitude), bottom (latitude), right
  11375. * (longitude) and top (latitude) values in WGS84, representing the
  11376. * bounding box for the provided MGRS reference.
  11377. */
  11378. function inverse$1(mgrs) {
  11379. var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
  11380. if (bbox.lat && bbox.lon) {
  11381. return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
  11382. }
  11383. return [bbox.left, bbox.bottom, bbox.right, bbox.top];
  11384. }
  11385. function toPoint$1(mgrs) {
  11386. var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
  11387. if (bbox.lat && bbox.lon) {
  11388. return [bbox.lon, bbox.lat];
  11389. }
  11390. return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
  11391. }
  11392. /**
  11393. * Conversion from degrees to radians.
  11394. *
  11395. * @private
  11396. * @param {number} deg the angle in degrees.
  11397. * @return {number} the angle in radians.
  11398. */
  11399. function degToRad(deg) {
  11400. return (deg * (Math.PI / 180.0));
  11401. }
  11402. /**
  11403. * Conversion from radians to degrees.
  11404. *
  11405. * @private
  11406. * @param {number} rad the angle in radians.
  11407. * @return {number} the angle in degrees.
  11408. */
  11409. function radToDeg(rad) {
  11410. return (180.0 * (rad / Math.PI));
  11411. }
  11412. /**
  11413. * Converts a set of Longitude and Latitude co-ordinates to UTM
  11414. * using the WGS84 ellipsoid.
  11415. *
  11416. * @private
  11417. * @param {object} ll Object literal with lat and lon properties
  11418. * representing the WGS84 coordinate to be converted.
  11419. * @return {object} Object literal containing the UTM value with easting,
  11420. * northing, zoneNumber and zoneLetter properties, and an optional
  11421. * accuracy property in digits. Returns null if the conversion failed.
  11422. */
  11423. function LLtoUTM(ll) {
  11424. var Lat = ll.lat;
  11425. var Long = ll.lon;
  11426. var a = 6378137.0; //ellip.radius;
  11427. var eccSquared = 0.00669438; //ellip.eccsq;
  11428. var k0 = 0.9996;
  11429. var LongOrigin;
  11430. var eccPrimeSquared;
  11431. var N, T, C, A, M;
  11432. var LatRad = degToRad(Lat);
  11433. var LongRad = degToRad(Long);
  11434. var LongOriginRad;
  11435. var ZoneNumber;
  11436. // (int)
  11437. ZoneNumber = Math.floor((Long + 180) / 6) + 1;
  11438. //Make sure the longitude 180.00 is in Zone 60
  11439. if (Long === 180) {
  11440. ZoneNumber = 60;
  11441. }
  11442. // Special zone for Norway
  11443. if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {
  11444. ZoneNumber = 32;
  11445. }
  11446. // Special zones for Svalbard
  11447. if (Lat >= 72.0 && Lat < 84.0) {
  11448. if (Long >= 0.0 && Long < 9.0) {
  11449. ZoneNumber = 31;
  11450. }
  11451. else if (Long >= 9.0 && Long < 21.0) {
  11452. ZoneNumber = 33;
  11453. }
  11454. else if (Long >= 21.0 && Long < 33.0) {
  11455. ZoneNumber = 35;
  11456. }
  11457. else if (Long >= 33.0 && Long < 42.0) {
  11458. ZoneNumber = 37;
  11459. }
  11460. }
  11461. LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin
  11462. // in middle of
  11463. // zone
  11464. LongOriginRad = degToRad(LongOrigin);
  11465. eccPrimeSquared = (eccSquared) / (1 - eccSquared);
  11466. N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));
  11467. T = Math.tan(LatRad) * Math.tan(LatRad);
  11468. C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);
  11469. A = Math.cos(LatRad) * (LongRad - LongOriginRad);
  11470. M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));
  11471. var UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0);
  11472. var UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0)));
  11473. if (Lat < 0.0) {
  11474. UTMNorthing += 10000000.0; //10000000 meter offset for
  11475. // southern hemisphere
  11476. }
  11477. return {
  11478. northing: Math.round(UTMNorthing),
  11479. easting: Math.round(UTMEasting),
  11480. zoneNumber: ZoneNumber,
  11481. zoneLetter: getLetterDesignator(Lat)
  11482. };
  11483. }
  11484. /**
  11485. * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience
  11486. * class where the Zone can be specified as a single string eg."60N" which
  11487. * is then broken down into the ZoneNumber and ZoneLetter.
  11488. *
  11489. * @private
  11490. * @param {object} utm An object literal with northing, easting, zoneNumber
  11491. * and zoneLetter properties. If an optional accuracy property is
  11492. * provided (in meters), a bounding box will be returned instead of
  11493. * latitude and longitude.
  11494. * @return {object} An object literal containing either lat and lon values
  11495. * (if no accuracy was provided), or top, right, bottom and left values
  11496. * for the bounding box calculated according to the provided accuracy.
  11497. * Returns null if the conversion failed.
  11498. */
  11499. function UTMtoLL(utm) {
  11500. var UTMNorthing = utm.northing;
  11501. var UTMEasting = utm.easting;
  11502. var zoneLetter = utm.zoneLetter;
  11503. var zoneNumber = utm.zoneNumber;
  11504. // check the ZoneNummber is valid
  11505. if (zoneNumber < 0 || zoneNumber > 60) {
  11506. return null;
  11507. }
  11508. var k0 = 0.9996;
  11509. var a = 6378137.0; //ellip.radius;
  11510. var eccSquared = 0.00669438; //ellip.eccsq;
  11511. var eccPrimeSquared;
  11512. var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));
  11513. var N1, T1, C1, R1, D, M;
  11514. var LongOrigin;
  11515. var mu, phi1Rad;
  11516. // remove 500,000 meter offset for longitude
  11517. var x = UTMEasting - 500000.0;
  11518. var y = UTMNorthing;
  11519. // We must know somehow if we are in the Northern or Southern
  11520. // hemisphere, this is the only time we use the letter So even
  11521. // if the Zone letter isn't exactly correct it should indicate
  11522. // the hemisphere correctly
  11523. if (zoneLetter < 'N') {
  11524. y -= 10000000.0; // remove 10,000,000 meter offset used
  11525. // for southern hemisphere
  11526. }
  11527. // There are 60 zones with zone 1 being at West -180 to -174
  11528. LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin
  11529. // in middle of
  11530. // zone
  11531. eccPrimeSquared = (eccSquared) / (1 - eccSquared);
  11532. M = y / k0;
  11533. mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));
  11534. phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + (151 * e1 * e1 * e1 / 96) * Math.sin(6 * mu);
  11535. // double phi1 = ProjMath.radToDeg(phi1Rad);
  11536. N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));
  11537. T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);
  11538. C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);
  11539. R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);
  11540. D = x / (N1 * k0);
  11541. var lat = phi1Rad - (N1 * Math.tan(phi1Rad) / R1) * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720);
  11542. lat = radToDeg(lat);
  11543. var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad);
  11544. lon = LongOrigin + radToDeg(lon);
  11545. var result;
  11546. if (utm.accuracy) {
  11547. var topRight = UTMtoLL({
  11548. northing: utm.northing + utm.accuracy,
  11549. easting: utm.easting + utm.accuracy,
  11550. zoneLetter: utm.zoneLetter,
  11551. zoneNumber: utm.zoneNumber
  11552. });
  11553. result = {
  11554. top: topRight.lat,
  11555. right: topRight.lon,
  11556. bottom: lat,
  11557. left: lon
  11558. };
  11559. }
  11560. else {
  11561. result = {
  11562. lat: lat,
  11563. lon: lon
  11564. };
  11565. }
  11566. return result;
  11567. }
  11568. /**
  11569. * Calculates the MGRS letter designator for the given latitude.
  11570. *
  11571. * @private
  11572. * @param {number} lat The latitude in WGS84 to get the letter designator
  11573. * for.
  11574. * @return {char} The letter designator.
  11575. */
  11576. function getLetterDesignator(lat) {
  11577. //This is here as an error flag to show that the Latitude is
  11578. //outside MGRS limits
  11579. var LetterDesignator = 'Z';
  11580. if ((84 >= lat) && (lat >= 72)) {
  11581. LetterDesignator = 'X';
  11582. }
  11583. else if ((72 > lat) && (lat >= 64)) {
  11584. LetterDesignator = 'W';
  11585. }
  11586. else if ((64 > lat) && (lat >= 56)) {
  11587. LetterDesignator = 'V';
  11588. }
  11589. else if ((56 > lat) && (lat >= 48)) {
  11590. LetterDesignator = 'U';
  11591. }
  11592. else if ((48 > lat) && (lat >= 40)) {
  11593. LetterDesignator = 'T';
  11594. }
  11595. else if ((40 > lat) && (lat >= 32)) {
  11596. LetterDesignator = 'S';
  11597. }
  11598. else if ((32 > lat) && (lat >= 24)) {
  11599. LetterDesignator = 'R';
  11600. }
  11601. else if ((24 > lat) && (lat >= 16)) {
  11602. LetterDesignator = 'Q';
  11603. }
  11604. else if ((16 > lat) && (lat >= 8)) {
  11605. LetterDesignator = 'P';
  11606. }
  11607. else if ((8 > lat) && (lat >= 0)) {
  11608. LetterDesignator = 'N';
  11609. }
  11610. else if ((0 > lat) && (lat >= -8)) {
  11611. LetterDesignator = 'M';
  11612. }
  11613. else if ((-8 > lat) && (lat >= -16)) {
  11614. LetterDesignator = 'L';
  11615. }
  11616. else if ((-16 > lat) && (lat >= -24)) {
  11617. LetterDesignator = 'K';
  11618. }
  11619. else if ((-24 > lat) && (lat >= -32)) {
  11620. LetterDesignator = 'J';
  11621. }
  11622. else if ((-32 > lat) && (lat >= -40)) {
  11623. LetterDesignator = 'H';
  11624. }
  11625. else if ((-40 > lat) && (lat >= -48)) {
  11626. LetterDesignator = 'G';
  11627. }
  11628. else if ((-48 > lat) && (lat >= -56)) {
  11629. LetterDesignator = 'F';
  11630. }
  11631. else if ((-56 > lat) && (lat >= -64)) {
  11632. LetterDesignator = 'E';
  11633. }
  11634. else if ((-64 > lat) && (lat >= -72)) {
  11635. LetterDesignator = 'D';
  11636. }
  11637. else if ((-72 > lat) && (lat >= -80)) {
  11638. LetterDesignator = 'C';
  11639. }
  11640. return LetterDesignator;
  11641. }
  11642. /**
  11643. * Encodes a UTM location as MGRS string.
  11644. *
  11645. * @private
  11646. * @param {object} utm An object literal with easting, northing,
  11647. * zoneLetter, zoneNumber
  11648. * @param {number} accuracy Accuracy in digits (1-5).
  11649. * @return {string} MGRS string for the given UTM location.
  11650. */
  11651. function encode(utm, accuracy) {
  11652. // prepend with leading zeroes
  11653. var seasting = "00000" + utm.easting,
  11654. snorthing = "00000" + utm.northing;
  11655. return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);
  11656. }
  11657. /**
  11658. * Get the two letter 100k designator for a given UTM easting,
  11659. * northing and zone number value.
  11660. *
  11661. * @private
  11662. * @param {number} easting
  11663. * @param {number} northing
  11664. * @param {number} zoneNumber
  11665. * @return the two letter 100k designator for the given UTM location.
  11666. */
  11667. function get100kID(easting, northing, zoneNumber) {
  11668. var setParm = get100kSetForZone(zoneNumber);
  11669. var setColumn = Math.floor(easting / 100000);
  11670. var setRow = Math.floor(northing / 100000) % 20;
  11671. return getLetter100kID(setColumn, setRow, setParm);
  11672. }
  11673. /**
  11674. * Given a UTM zone number, figure out the MGRS 100K set it is in.
  11675. *
  11676. * @private
  11677. * @param {number} i An UTM zone number.
  11678. * @return {number} the 100k set the UTM zone is in.
  11679. */
  11680. function get100kSetForZone(i) {
  11681. var setParm = i % NUM_100K_SETS;
  11682. if (setParm === 0) {
  11683. setParm = NUM_100K_SETS;
  11684. }
  11685. return setParm;
  11686. }
  11687. /**
  11688. * Get the two-letter MGRS 100k designator given information
  11689. * translated from the UTM northing, easting and zone number.
  11690. *
  11691. * @private
  11692. * @param {number} column the column index as it relates to the MGRS
  11693. * 100k set spreadsheet, created from the UTM easting.
  11694. * Values are 1-8.
  11695. * @param {number} row the row index as it relates to the MGRS 100k set
  11696. * spreadsheet, created from the UTM northing value. Values
  11697. * are from 0-19.
  11698. * @param {number} parm the set block, as it relates to the MGRS 100k set
  11699. * spreadsheet, created from the UTM zone. Values are from
  11700. * 1-60.
  11701. * @return two letter MGRS 100k code.
  11702. */
  11703. function getLetter100kID(column, row, parm) {
  11704. // colOrigin and rowOrigin are the letters at the origin of the set
  11705. var index = parm - 1;
  11706. var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);
  11707. var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);
  11708. // colInt and rowInt are the letters to build to return
  11709. var colInt = colOrigin + column - 1;
  11710. var rowInt = rowOrigin + row;
  11711. var rollover = false;
  11712. if (colInt > Z) {
  11713. colInt = colInt - Z + A - 1;
  11714. rollover = true;
  11715. }
  11716. if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {
  11717. colInt++;
  11718. }
  11719. if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {
  11720. colInt++;
  11721. if (colInt === I) {
  11722. colInt++;
  11723. }
  11724. }
  11725. if (colInt > Z) {
  11726. colInt = colInt - Z + A - 1;
  11727. }
  11728. if (rowInt > V) {
  11729. rowInt = rowInt - V + A - 1;
  11730. rollover = true;
  11731. }
  11732. else {
  11733. rollover = false;
  11734. }
  11735. if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {
  11736. rowInt++;
  11737. }
  11738. if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {
  11739. rowInt++;
  11740. if (rowInt === I) {
  11741. rowInt++;
  11742. }
  11743. }
  11744. if (rowInt > V) {
  11745. rowInt = rowInt - V + A - 1;
  11746. }
  11747. var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);
  11748. return twoLetter;
  11749. }
  11750. /**
  11751. * Decode the UTM parameters from a MGRS string.
  11752. *
  11753. * @private
  11754. * @param {string} mgrsString an UPPERCASE coordinate string is expected.
  11755. * @return {object} An object literal with easting, northing, zoneLetter,
  11756. * zoneNumber and accuracy (in meters) properties.
  11757. */
  11758. function decode(mgrsString) {
  11759. if (mgrsString && mgrsString.length === 0) {
  11760. throw ("MGRSPoint coverting from nothing");
  11761. }
  11762. var length = mgrsString.length;
  11763. var hunK = null;
  11764. var sb = "";
  11765. var testChar;
  11766. var i = 0;
  11767. // get Zone number
  11768. while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {
  11769. if (i >= 2) {
  11770. throw ("MGRSPoint bad conversion from: " + mgrsString);
  11771. }
  11772. sb += testChar;
  11773. i++;
  11774. }
  11775. var zoneNumber = parseInt(sb, 10);
  11776. if (i === 0 || i + 3 > length) {
  11777. // A good MGRS string has to be 4-5 digits long,
  11778. // ##AAA/#AAA at least.
  11779. throw ("MGRSPoint bad conversion from: " + mgrsString);
  11780. }
  11781. var zoneLetter = mgrsString.charAt(i++);
  11782. // Should we check the zone letter here? Why not.
  11783. if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {
  11784. throw ("MGRSPoint zone letter " + zoneLetter + " not handled: " + mgrsString);
  11785. }
  11786. hunK = mgrsString.substring(i, i += 2);
  11787. var set = get100kSetForZone(zoneNumber);
  11788. var east100k = getEastingFromChar(hunK.charAt(0), set);
  11789. var north100k = getNorthingFromChar(hunK.charAt(1), set);
  11790. // We have a bug where the northing may be 2000000 too low.
  11791. // How
  11792. // do we know when to roll over?
  11793. while (north100k < getMinNorthing(zoneLetter)) {
  11794. north100k += 2000000;
  11795. }
  11796. // calculate the char index for easting/northing separator
  11797. var remainder = length - i;
  11798. if (remainder % 2 !== 0) {
  11799. throw ("MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters" + mgrsString);
  11800. }
  11801. var sep = remainder / 2;
  11802. var sepEasting = 0.0;
  11803. var sepNorthing = 0.0;
  11804. var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;
  11805. if (sep > 0) {
  11806. accuracyBonus = 100000.0 / Math.pow(10, sep);
  11807. sepEastingString = mgrsString.substring(i, i + sep);
  11808. sepEasting = parseFloat(sepEastingString) * accuracyBonus;
  11809. sepNorthingString = mgrsString.substring(i + sep);
  11810. sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;
  11811. }
  11812. easting = sepEasting + east100k;
  11813. northing = sepNorthing + north100k;
  11814. return {
  11815. easting: easting,
  11816. northing: northing,
  11817. zoneLetter: zoneLetter,
  11818. zoneNumber: zoneNumber,
  11819. accuracy: accuracyBonus
  11820. };
  11821. }
  11822. /**
  11823. * Given the first letter from a two-letter MGRS 100k zone, and given the
  11824. * MGRS table set for the zone number, figure out the easting value that
  11825. * should be added to the other, secondary easting value.
  11826. *
  11827. * @private
  11828. * @param {char} e The first letter from a two-letter MGRS 100´k zone.
  11829. * @param {number} set The MGRS table set for the zone number.
  11830. * @return {number} The easting value for the given letter and set.
  11831. */
  11832. function getEastingFromChar(e, set) {
  11833. // colOrigin is the letter at the origin of the set for the
  11834. // column
  11835. var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);
  11836. var eastingValue = 100000.0;
  11837. var rewindMarker = false;
  11838. while (curCol !== e.charCodeAt(0)) {
  11839. curCol++;
  11840. if (curCol === I) {
  11841. curCol++;
  11842. }
  11843. if (curCol === O) {
  11844. curCol++;
  11845. }
  11846. if (curCol > Z) {
  11847. if (rewindMarker) {
  11848. throw ("Bad character: " + e);
  11849. }
  11850. curCol = A;
  11851. rewindMarker = true;
  11852. }
  11853. eastingValue += 100000.0;
  11854. }
  11855. return eastingValue;
  11856. }
  11857. /**
  11858. * Given the second letter from a two-letter MGRS 100k zone, and given the
  11859. * MGRS table set for the zone number, figure out the northing value that
  11860. * should be added to the other, secondary northing value. You have to
  11861. * remember that Northings are determined from the equator, and the vertical
  11862. * cycle of letters mean a 2000000 additional northing meters. This happens
  11863. * approx. every 18 degrees of latitude. This method does *NOT* count any
  11864. * additional northings. You have to figure out how many 2000000 meters need
  11865. * to be added for the zone letter of the MGRS coordinate.
  11866. *
  11867. * @private
  11868. * @param {char} n Second letter of the MGRS 100k zone
  11869. * @param {number} set The MGRS table set number, which is dependent on the
  11870. * UTM zone number.
  11871. * @return {number} The northing value for the given letter and set.
  11872. */
  11873. function getNorthingFromChar(n, set) {
  11874. if (n > 'V') {
  11875. throw ("MGRSPoint given invalid Northing " + n);
  11876. }
  11877. // rowOrigin is the letter at the origin of the set for the
  11878. // column
  11879. var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);
  11880. var northingValue = 0.0;
  11881. var rewindMarker = false;
  11882. while (curRow !== n.charCodeAt(0)) {
  11883. curRow++;
  11884. if (curRow === I) {
  11885. curRow++;
  11886. }
  11887. if (curRow === O) {
  11888. curRow++;
  11889. }
  11890. // fixing a bug making whole application hang in this loop
  11891. // when 'n' is a wrong character
  11892. if (curRow > V) {
  11893. if (rewindMarker) { // making sure that this loop ends
  11894. throw ("Bad character: " + n);
  11895. }
  11896. curRow = A;
  11897. rewindMarker = true;
  11898. }
  11899. northingValue += 100000.0;
  11900. }
  11901. return northingValue;
  11902. }
  11903. /**
  11904. * The function getMinNorthing returns the minimum northing value of a MGRS
  11905. * zone.
  11906. *
  11907. * Ported from Geotrans' c Lattitude_Band_Value structure table.
  11908. *
  11909. * @private
  11910. * @param {char} zoneLetter The MGRS zone to get the min northing for.
  11911. * @return {number}
  11912. */
  11913. function getMinNorthing(zoneLetter) {
  11914. var northing;
  11915. switch (zoneLetter) {
  11916. case 'C':
  11917. northing = 1100000.0;
  11918. break;
  11919. case 'D':
  11920. northing = 2000000.0;
  11921. break;
  11922. case 'E':
  11923. northing = 2800000.0;
  11924. break;
  11925. case 'F':
  11926. northing = 3700000.0;
  11927. break;
  11928. case 'G':
  11929. northing = 4600000.0;
  11930. break;
  11931. case 'H':
  11932. northing = 5500000.0;
  11933. break;
  11934. case 'J':
  11935. northing = 6400000.0;
  11936. break;
  11937. case 'K':
  11938. northing = 7300000.0;
  11939. break;
  11940. case 'L':
  11941. northing = 8200000.0;
  11942. break;
  11943. case 'M':
  11944. northing = 9100000.0;
  11945. break;
  11946. case 'N':
  11947. northing = 0.0;
  11948. break;
  11949. case 'P':
  11950. northing = 800000.0;
  11951. break;
  11952. case 'Q':
  11953. northing = 1700000.0;
  11954. break;
  11955. case 'R':
  11956. northing = 2600000.0;
  11957. break;
  11958. case 'S':
  11959. northing = 3500000.0;
  11960. break;
  11961. case 'T':
  11962. northing = 4400000.0;
  11963. break;
  11964. case 'U':
  11965. northing = 5300000.0;
  11966. break;
  11967. case 'V':
  11968. northing = 6200000.0;
  11969. break;
  11970. case 'W':
  11971. northing = 7000000.0;
  11972. break;
  11973. case 'X':
  11974. northing = 7900000.0;
  11975. break;
  11976. default:
  11977. northing = -1.0;
  11978. }
  11979. if (northing >= 0.0) {
  11980. return northing;
  11981. }
  11982. else {
  11983. throw ("Invalid zone letter: " + zoneLetter);
  11984. }
  11985. }
  11986. function Point(x, y, z) {
  11987. if (!(this instanceof Point)) {
  11988. return new Point(x, y, z);
  11989. }
  11990. if (Array.isArray(x)) {
  11991. this.x = x[0];
  11992. this.y = x[1];
  11993. this.z = x[2] || 0.0;
  11994. } else if(typeof x === 'object') {
  11995. this.x = x.x;
  11996. this.y = x.y;
  11997. this.z = x.z || 0.0;
  11998. } else if (typeof x === 'string' && typeof y === 'undefined') {
  11999. var coords = x.split(',');
  12000. this.x = parseFloat(coords[0], 10);
  12001. this.y = parseFloat(coords[1], 10);
  12002. this.z = parseFloat(coords[2], 10) || 0.0;
  12003. } else {
  12004. this.x = x;
  12005. this.y = y;
  12006. this.z = z || 0.0;
  12007. }
  12008. console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');
  12009. }
  12010. Point.fromMGRS = function(mgrsStr) {
  12011. return new Point(toPoint$1(mgrsStr));
  12012. };
  12013. Point.prototype.toMGRS = function(accuracy) {
  12014. return forward$1([this.x, this.y], accuracy);
  12015. };
  12016. var C00 = 1;
  12017. var C02 = 0.25;
  12018. var C04 = 0.046875;
  12019. var C06 = 0.01953125;
  12020. var C08 = 0.01068115234375;
  12021. var C22 = 0.75;
  12022. var C44 = 0.46875;
  12023. var C46 = 0.01302083333333333333;
  12024. var C48 = 0.00712076822916666666;
  12025. var C66 = 0.36458333333333333333;
  12026. var C68 = 0.00569661458333333333;
  12027. var C88 = 0.3076171875;
  12028. var pj_enfn = function(es) {
  12029. var en = [];
  12030. en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));
  12031. en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));
  12032. var t = es * es;
  12033. en[2] = t * (C44 - es * (C46 + es * C48));
  12034. t *= es;
  12035. en[3] = t * (C66 - es * C68);
  12036. en[4] = t * es * C88;
  12037. return en;
  12038. };
  12039. var pj_mlfn = function(phi, sphi, cphi, en) {
  12040. cphi *= sphi;
  12041. sphi *= sphi;
  12042. return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4]))));
  12043. };
  12044. var MAX_ITER = 20;
  12045. var pj_inv_mlfn = function(arg, es, en) {
  12046. var k = 1 / (1 - es);
  12047. var phi = arg;
  12048. for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */
  12049. var s = Math.sin(phi);
  12050. var t = 1 - es * s * s;
  12051. //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
  12052. //phi -= t * (t * Math.sqrt(t)) * k;
  12053. t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
  12054. phi -= t;
  12055. if (Math.abs(t) < EPSLN) {
  12056. return phi;
  12057. }
  12058. }
  12059. //..reportError("cass:pj_inv_mlfn: Convergence error");
  12060. return phi;
  12061. };
  12062. // Heavily based on this tmerc projection implementation
  12063. // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js
  12064. function init$2() {
  12065. this.x0 = this.x0 !== undefined ? this.x0 : 0;
  12066. this.y0 = this.y0 !== undefined ? this.y0 : 0;
  12067. this.long0 = this.long0 !== undefined ? this.long0 : 0;
  12068. this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
  12069. if (this.es) {
  12070. this.en = pj_enfn(this.es);
  12071. this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);
  12072. }
  12073. }
  12074. /**
  12075. Transverse Mercator Forward - long/lat to x/y
  12076. long/lat in radians
  12077. */
  12078. function forward$2(p) {
  12079. var lon = p.x;
  12080. var lat = p.y;
  12081. var delta_lon = adjust_lon(lon - this.long0);
  12082. var con;
  12083. var x, y;
  12084. var sin_phi = Math.sin(lat);
  12085. var cos_phi = Math.cos(lat);
  12086. if (!this.es) {
  12087. var b = cos_phi * Math.sin(delta_lon);
  12088. if ((Math.abs(Math.abs(b) - 1)) < EPSLN) {
  12089. return (93);
  12090. }
  12091. else {
  12092. x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;
  12093. y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));
  12094. b = Math.abs(y);
  12095. if (b >= 1) {
  12096. if ((b - 1) > EPSLN) {
  12097. return (93);
  12098. }
  12099. else {
  12100. y = 0;
  12101. }
  12102. }
  12103. else {
  12104. y = Math.acos(y);
  12105. }
  12106. if (lat < 0) {
  12107. y = -y;
  12108. }
  12109. y = this.a * this.k0 * (y - this.lat0) + this.y0;
  12110. }
  12111. }
  12112. else {
  12113. var al = cos_phi * delta_lon;
  12114. var als = Math.pow(al, 2);
  12115. var c = this.ep2 * Math.pow(cos_phi, 2);
  12116. var cs = Math.pow(c, 2);
  12117. var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;
  12118. var t = Math.pow(tq, 2);
  12119. var ts = Math.pow(t, 2);
  12120. con = 1 - this.es * Math.pow(sin_phi, 2);
  12121. al = al / Math.sqrt(con);
  12122. var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);
  12123. x = this.a * (this.k0 * al * (1 +
  12124. als / 6 * (1 - t + c +
  12125. als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c +
  12126. als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) +
  12127. this.x0;
  12128. y = this.a * (this.k0 * (ml - this.ml0 +
  12129. sin_phi * delta_lon * al / 2 * (1 +
  12130. als / 12 * (5 - t + 9 * c + 4 * cs +
  12131. als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c +
  12132. als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) +
  12133. this.y0;
  12134. }
  12135. p.x = x;
  12136. p.y = y;
  12137. return p;
  12138. }
  12139. /**
  12140. Transverse Mercator Inverse - x/y to long/lat
  12141. */
  12142. function inverse$2(p) {
  12143. var con, phi;
  12144. var lat, lon;
  12145. var x = (p.x - this.x0) * (1 / this.a);
  12146. var y = (p.y - this.y0) * (1 / this.a);
  12147. if (!this.es) {
  12148. var f = Math.exp(x / this.k0);
  12149. var g = 0.5 * (f - 1 / f);
  12150. var temp = this.lat0 + y / this.k0;
  12151. var h = Math.cos(temp);
  12152. con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));
  12153. lat = Math.asin(con);
  12154. if (y < 0) {
  12155. lat = -lat;
  12156. }
  12157. if ((g === 0) && (h === 0)) {
  12158. lon = 0;
  12159. }
  12160. else {
  12161. lon = adjust_lon(Math.atan2(g, h) + this.long0);
  12162. }
  12163. }
  12164. else { // ellipsoidal form
  12165. con = this.ml0 + y / this.k0;
  12166. phi = pj_inv_mlfn(con, this.es, this.en);
  12167. if (Math.abs(phi) < HALF_PI) {
  12168. var sin_phi = Math.sin(phi);
  12169. var cos_phi = Math.cos(phi);
  12170. var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;
  12171. var c = this.ep2 * Math.pow(cos_phi, 2);
  12172. var cs = Math.pow(c, 2);
  12173. var t = Math.pow(tan_phi, 2);
  12174. var ts = Math.pow(t, 2);
  12175. con = 1 - this.es * Math.pow(sin_phi, 2);
  12176. var d = x * Math.sqrt(con) / this.k0;
  12177. var ds = Math.pow(d, 2);
  12178. con = con * tan_phi;
  12179. lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -
  12180. ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -
  12181. ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -
  12182. ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));
  12183. lon = adjust_lon(this.long0 + (d * (1 -
  12184. ds / 6 * (1 + 2 * t + c -
  12185. ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -
  12186. ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));
  12187. }
  12188. else {
  12189. lat = HALF_PI * sign(y);
  12190. lon = 0;
  12191. }
  12192. }
  12193. p.x = lon;
  12194. p.y = lat;
  12195. return p;
  12196. }
  12197. var names$3 = ["Fast_Transverse_Mercator", "Fast Transverse Mercator"];
  12198. var tmerc = {
  12199. init: init$2,
  12200. forward: forward$2,
  12201. inverse: inverse$2,
  12202. names: names$3
  12203. };
  12204. var sinh = function(x) {
  12205. var r = Math.exp(x);
  12206. r = (r - 1 / r) / 2;
  12207. return r;
  12208. };
  12209. var hypot = function(x, y) {
  12210. x = Math.abs(x);
  12211. y = Math.abs(y);
  12212. var a = Math.max(x, y);
  12213. var b = Math.min(x, y) / (a ? a : 1);
  12214. return a * Math.sqrt(1 + Math.pow(b, 2));
  12215. };
  12216. var log1py = function(x) {
  12217. var y = 1 + x;
  12218. var z = y - 1;
  12219. return z === 0 ? x : x * Math.log(y) / z;
  12220. };
  12221. var asinhy = function(x) {
  12222. var y = Math.abs(x);
  12223. y = log1py(y * (1 + y / (hypot(1, y) + 1)));
  12224. return x < 0 ? -y : y;
  12225. };
  12226. var gatg = function(pp, B) {
  12227. var cos_2B = 2 * Math.cos(2 * B);
  12228. var i = pp.length - 1;
  12229. var h1 = pp[i];
  12230. var h2 = 0;
  12231. var h;
  12232. while (--i >= 0) {
  12233. h = -h2 + cos_2B * h1 + pp[i];
  12234. h2 = h1;
  12235. h1 = h;
  12236. }
  12237. return (B + h * Math.sin(2 * B));
  12238. };
  12239. var clens = function(pp, arg_r) {
  12240. var r = 2 * Math.cos(arg_r);
  12241. var i = pp.length - 1;
  12242. var hr1 = pp[i];
  12243. var hr2 = 0;
  12244. var hr;
  12245. while (--i >= 0) {
  12246. hr = -hr2 + r * hr1 + pp[i];
  12247. hr2 = hr1;
  12248. hr1 = hr;
  12249. }
  12250. return Math.sin(arg_r) * hr;
  12251. };
  12252. var cosh = function(x) {
  12253. var r = Math.exp(x);
  12254. r = (r + 1 / r) / 2;
  12255. return r;
  12256. };
  12257. var clens_cmplx = function(pp, arg_r, arg_i) {
  12258. var sin_arg_r = Math.sin(arg_r);
  12259. var cos_arg_r = Math.cos(arg_r);
  12260. var sinh_arg_i = sinh(arg_i);
  12261. var cosh_arg_i = cosh(arg_i);
  12262. var r = 2 * cos_arg_r * cosh_arg_i;
  12263. var i = -2 * sin_arg_r * sinh_arg_i;
  12264. var j = pp.length - 1;
  12265. var hr = pp[j];
  12266. var hi1 = 0;
  12267. var hr1 = 0;
  12268. var hi = 0;
  12269. var hr2;
  12270. var hi2;
  12271. while (--j >= 0) {
  12272. hr2 = hr1;
  12273. hi2 = hi1;
  12274. hr1 = hr;
  12275. hi1 = hi;
  12276. hr = -hr2 + r * hr1 - i * hi1 + pp[j];
  12277. hi = -hi2 + i * hr1 + r * hi1;
  12278. }
  12279. r = sin_arg_r * cosh_arg_i;
  12280. i = cos_arg_r * sinh_arg_i;
  12281. return [r * hr - i * hi, r * hi + i * hr];
  12282. };
  12283. // Heavily based on this etmerc projection implementation
  12284. // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js
  12285. function init$3() {
  12286. if (!this.approx && (isNaN(this.es) || this.es <= 0)) {
  12287. throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');
  12288. }
  12289. if (this.approx) {
  12290. // When '+approx' is set, use tmerc instead
  12291. tmerc.init.apply(this);
  12292. this.forward = tmerc.forward;
  12293. this.inverse = tmerc.inverse;
  12294. }
  12295. this.x0 = this.x0 !== undefined ? this.x0 : 0;
  12296. this.y0 = this.y0 !== undefined ? this.y0 : 0;
  12297. this.long0 = this.long0 !== undefined ? this.long0 : 0;
  12298. this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
  12299. this.cgb = [];
  12300. this.cbg = [];
  12301. this.utg = [];
  12302. this.gtu = [];
  12303. var f = this.es / (1 + Math.sqrt(1 - this.es));
  12304. var n = f / (2 - f);
  12305. var np = n;
  12306. this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675 ))))));
  12307. this.cbg[0] = n * (-2 + n * ( 2 / 3 + n * ( 4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));
  12308. np = np * n;
  12309. this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));
  12310. this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * ( -13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));
  12311. np = np * n;
  12312. this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));
  12313. this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));
  12314. np = np * n;
  12315. this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));
  12316. this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * ( -24832 / 14175)));
  12317. np = np * n;
  12318. this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));
  12319. this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));
  12320. np = np * n;
  12321. this.cgb[5] = np * (601676 / 22275);
  12322. this.cbg[5] = np * (444337 / 155925);
  12323. np = Math.pow(n, 2);
  12324. this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));
  12325. this.utg[0] = n * (-0.5 + n * ( 2 / 3 + n * (-37 / 96 + n * ( 1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));
  12326. this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));
  12327. this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));
  12328. this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));
  12329. np = np * n;
  12330. this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720 ))));
  12331. this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));
  12332. np = np * n;
  12333. this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));
  12334. this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));
  12335. np = np * n;
  12336. this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));
  12337. this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));
  12338. np = np * n;
  12339. this.utg[5] = np * (-20648693 / 638668800);
  12340. this.gtu[5] = np * (212378941 / 319334400);
  12341. var Z = gatg(this.cbg, this.lat0);
  12342. this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));
  12343. }
  12344. function forward$3(p) {
  12345. var Ce = adjust_lon(p.x - this.long0);
  12346. var Cn = p.y;
  12347. Cn = gatg(this.cbg, Cn);
  12348. var sin_Cn = Math.sin(Cn);
  12349. var cos_Cn = Math.cos(Cn);
  12350. var sin_Ce = Math.sin(Ce);
  12351. var cos_Ce = Math.cos(Ce);
  12352. Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);
  12353. Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));
  12354. Ce = asinhy(Math.tan(Ce));
  12355. var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);
  12356. Cn = Cn + tmp[0];
  12357. Ce = Ce + tmp[1];
  12358. var x;
  12359. var y;
  12360. if (Math.abs(Ce) <= 2.623395162778) {
  12361. x = this.a * (this.Qn * Ce) + this.x0;
  12362. y = this.a * (this.Qn * Cn + this.Zb) + this.y0;
  12363. }
  12364. else {
  12365. x = Infinity;
  12366. y = Infinity;
  12367. }
  12368. p.x = x;
  12369. p.y = y;
  12370. return p;
  12371. }
  12372. function inverse$3(p) {
  12373. var Ce = (p.x - this.x0) * (1 / this.a);
  12374. var Cn = (p.y - this.y0) * (1 / this.a);
  12375. Cn = (Cn - this.Zb) / this.Qn;
  12376. Ce = Ce / this.Qn;
  12377. var lon;
  12378. var lat;
  12379. if (Math.abs(Ce) <= 2.623395162778) {
  12380. var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);
  12381. Cn = Cn + tmp[0];
  12382. Ce = Ce + tmp[1];
  12383. Ce = Math.atan(sinh(Ce));
  12384. var sin_Cn = Math.sin(Cn);
  12385. var cos_Cn = Math.cos(Cn);
  12386. var sin_Ce = Math.sin(Ce);
  12387. var cos_Ce = Math.cos(Ce);
  12388. Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));
  12389. Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);
  12390. lon = adjust_lon(Ce + this.long0);
  12391. lat = gatg(this.cgb, Cn);
  12392. }
  12393. else {
  12394. lon = Infinity;
  12395. lat = Infinity;
  12396. }
  12397. p.x = lon;
  12398. p.y = lat;
  12399. return p;
  12400. }
  12401. var names$4 = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc", "Transverse_Mercator", "Transverse Mercator", "tmerc"];
  12402. var etmerc = {
  12403. init: init$3,
  12404. forward: forward$3,
  12405. inverse: inverse$3,
  12406. names: names$4
  12407. };
  12408. var adjust_zone = function(zone, lon) {
  12409. if (zone === undefined) {
  12410. zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;
  12411. if (zone < 0) {
  12412. return 0;
  12413. } else if (zone > 60) {
  12414. return 60;
  12415. }
  12416. }
  12417. return zone;
  12418. };
  12419. var dependsOn = 'etmerc';
  12420. function init$4() {
  12421. var zone = adjust_zone(this.zone, this.long0);
  12422. if (zone === undefined) {
  12423. throw new Error('unknown utm zone');
  12424. }
  12425. this.lat0 = 0;
  12426. this.long0 = ((6 * Math.abs(zone)) - 183) * D2R;
  12427. this.x0 = 500000;
  12428. this.y0 = this.utmSouth ? 10000000 : 0;
  12429. this.k0 = 0.9996;
  12430. etmerc.init.apply(this);
  12431. this.forward = etmerc.forward;
  12432. this.inverse = etmerc.inverse;
  12433. }
  12434. var names$5 = ["Universal Transverse Mercator System", "utm"];
  12435. var utm = {
  12436. init: init$4,
  12437. names: names$5,
  12438. dependsOn: dependsOn
  12439. };
  12440. var srat = function(esinp, exp) {
  12441. return (Math.pow((1 - esinp) / (1 + esinp), exp));
  12442. };
  12443. var MAX_ITER$1 = 20;
  12444. function init$6() {
  12445. var sphi = Math.sin(this.lat0);
  12446. var cphi = Math.cos(this.lat0);
  12447. cphi *= cphi;
  12448. this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);
  12449. this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));
  12450. this.phic0 = Math.asin(sphi / this.C);
  12451. this.ratexp = 0.5 * this.C * this.e;
  12452. this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));
  12453. }
  12454. function forward$5(p) {
  12455. var lon = p.x;
  12456. var lat = p.y;
  12457. p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;
  12458. p.x = this.C * lon;
  12459. return p;
  12460. }
  12461. function inverse$5(p) {
  12462. var DEL_TOL = 1e-14;
  12463. var lon = p.x / this.C;
  12464. var lat = p.y;
  12465. var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);
  12466. for (var i = MAX_ITER$1; i > 0; --i) {
  12467. lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), - 0.5 * this.e)) - HALF_PI;
  12468. if (Math.abs(lat - p.y) < DEL_TOL) {
  12469. break;
  12470. }
  12471. p.y = lat;
  12472. }
  12473. /* convergence failed */
  12474. if (!i) {
  12475. return null;
  12476. }
  12477. p.x = lon;
  12478. p.y = lat;
  12479. return p;
  12480. }
  12481. var names$7 = ["gauss"];
  12482. var gauss = {
  12483. init: init$6,
  12484. forward: forward$5,
  12485. inverse: inverse$5,
  12486. names: names$7
  12487. };
  12488. function init$5() {
  12489. gauss.init.apply(this);
  12490. if (!this.rc) {
  12491. return;
  12492. }
  12493. this.sinc0 = Math.sin(this.phic0);
  12494. this.cosc0 = Math.cos(this.phic0);
  12495. this.R2 = 2 * this.rc;
  12496. if (!this.title) {
  12497. this.title = "Oblique Stereographic Alternative";
  12498. }
  12499. }
  12500. function forward$4(p) {
  12501. var sinc, cosc, cosl, k;
  12502. p.x = adjust_lon(p.x - this.long0);
  12503. gauss.forward.apply(this, [p]);
  12504. sinc = Math.sin(p.y);
  12505. cosc = Math.cos(p.y);
  12506. cosl = Math.cos(p.x);
  12507. k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);
  12508. p.x = k * cosc * Math.sin(p.x);
  12509. p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);
  12510. p.x = this.a * p.x + this.x0;
  12511. p.y = this.a * p.y + this.y0;
  12512. return p;
  12513. }
  12514. function inverse$4(p) {
  12515. var sinc, cosc, lon, lat, rho;
  12516. p.x = (p.x - this.x0) / this.a;
  12517. p.y = (p.y - this.y0) / this.a;
  12518. p.x /= this.k0;
  12519. p.y /= this.k0;
  12520. if ((rho = Math.sqrt(p.x * p.x + p.y * p.y))) {
  12521. var c = 2 * Math.atan2(rho, this.R2);
  12522. sinc = Math.sin(c);
  12523. cosc = Math.cos(c);
  12524. lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);
  12525. lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);
  12526. }
  12527. else {
  12528. lat = this.phic0;
  12529. lon = 0;
  12530. }
  12531. p.x = lon;
  12532. p.y = lat;
  12533. gauss.inverse.apply(this, [p]);
  12534. p.x = adjust_lon(p.x + this.long0);
  12535. return p;
  12536. }
  12537. var names$6 = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"];
  12538. var sterea = {
  12539. init: init$5,
  12540. forward: forward$4,
  12541. inverse: inverse$4,
  12542. names: names$6
  12543. };
  12544. function ssfn_(phit, sinphi, eccen) {
  12545. sinphi *= eccen;
  12546. return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));
  12547. }
  12548. function init$7() {
  12549. this.coslat0 = Math.cos(this.lat0);
  12550. this.sinlat0 = Math.sin(this.lat0);
  12551. if (this.sphere) {
  12552. if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
  12553. this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));
  12554. }
  12555. }
  12556. else {
  12557. if (Math.abs(this.coslat0) <= EPSLN) {
  12558. if (this.lat0 > 0) {
  12559. //North pole
  12560. //trace('stere:north pole');
  12561. this.con = 1;
  12562. }
  12563. else {
  12564. //South pole
  12565. //trace('stere:south pole');
  12566. this.con = -1;
  12567. }
  12568. }
  12569. this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));
  12570. if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
  12571. this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));
  12572. }
  12573. this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);
  12574. this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
  12575. this.cosX0 = Math.cos(this.X0);
  12576. this.sinX0 = Math.sin(this.X0);
  12577. }
  12578. }
  12579. // Stereographic forward equations--mapping lat,long to x,y
  12580. function forward$6(p) {
  12581. var lon = p.x;
  12582. var lat = p.y;
  12583. var sinlat = Math.sin(lat);
  12584. var coslat = Math.cos(lat);
  12585. var A, X, sinX, cosX, ts, rh;
  12586. var dlon = adjust_lon(lon - this.long0);
  12587. if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
  12588. //case of the origine point
  12589. //trace('stere:this is the origin point');
  12590. p.x = NaN;
  12591. p.y = NaN;
  12592. return p;
  12593. }
  12594. if (this.sphere) {
  12595. //trace('stere:sphere case');
  12596. A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
  12597. p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
  12598. p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
  12599. return p;
  12600. }
  12601. else {
  12602. X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
  12603. cosX = Math.cos(X);
  12604. sinX = Math.sin(X);
  12605. if (Math.abs(this.coslat0) <= EPSLN) {
  12606. ts = tsfnz(this.e, lat * this.con, this.con * sinlat);
  12607. rh = 2 * this.a * this.k0 * ts / this.cons;
  12608. p.x = this.x0 + rh * Math.sin(lon - this.long0);
  12609. p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
  12610. //trace(p.toString());
  12611. return p;
  12612. }
  12613. else if (Math.abs(this.sinlat0) < EPSLN) {
  12614. //Eq
  12615. //trace('stere:equateur');
  12616. A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
  12617. p.y = A * sinX;
  12618. }
  12619. else {
  12620. //other case
  12621. //trace('stere:normal case');
  12622. A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
  12623. p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
  12624. }
  12625. p.x = A * cosX * Math.sin(dlon) + this.x0;
  12626. }
  12627. //trace(p.toString());
  12628. return p;
  12629. }
  12630. //* Stereographic inverse equations--mapping x,y to lat/long
  12631. function inverse$6(p) {
  12632. p.x -= this.x0;
  12633. p.y -= this.y0;
  12634. var lon, lat, ts, ce, Chi;
  12635. var rh = Math.sqrt(p.x * p.x + p.y * p.y);
  12636. if (this.sphere) {
  12637. var c = 2 * Math.atan(rh / (2 * this.a * this.k0));
  12638. lon = this.long0;
  12639. lat = this.lat0;
  12640. if (rh <= EPSLN) {
  12641. p.x = lon;
  12642. p.y = lat;
  12643. return p;
  12644. }
  12645. lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);
  12646. if (Math.abs(this.coslat0) < EPSLN) {
  12647. if (this.lat0 > 0) {
  12648. lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
  12649. }
  12650. else {
  12651. lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
  12652. }
  12653. }
  12654. else {
  12655. lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));
  12656. }
  12657. p.x = lon;
  12658. p.y = lat;
  12659. return p;
  12660. }
  12661. else {
  12662. if (Math.abs(this.coslat0) <= EPSLN) {
  12663. if (rh <= EPSLN) {
  12664. lat = this.lat0;
  12665. lon = this.long0;
  12666. p.x = lon;
  12667. p.y = lat;
  12668. //trace(p.toString());
  12669. return p;
  12670. }
  12671. p.x *= this.con;
  12672. p.y *= this.con;
  12673. ts = rh * this.cons / (2 * this.a * this.k0);
  12674. lat = this.con * phi2z(this.e, ts);
  12675. lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));
  12676. }
  12677. else {
  12678. ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));
  12679. lon = this.long0;
  12680. if (rh <= EPSLN) {
  12681. Chi = this.X0;
  12682. }
  12683. else {
  12684. Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);
  12685. lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));
  12686. }
  12687. lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));
  12688. }
  12689. }
  12690. p.x = lon;
  12691. p.y = lat;
  12692. //trace(p.toString());
  12693. return p;
  12694. }
  12695. var names$8 = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
  12696. var stere = {
  12697. init: init$7,
  12698. forward: forward$6,
  12699. inverse: inverse$6,
  12700. names: names$8,
  12701. ssfn_: ssfn_
  12702. };
  12703. /*
  12704. references:
  12705. Formules et constantes pour le Calcul pour la
  12706. projection cylindrique conforme à axe oblique et pour la transformation entre
  12707. des systèmes de référence.
  12708. http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf
  12709. */
  12710. function init$8() {
  12711. var phy0 = this.lat0;
  12712. this.lambda0 = this.long0;
  12713. var sinPhy0 = Math.sin(phy0);
  12714. var semiMajorAxis = this.a;
  12715. var invF = this.rf;
  12716. var flattening = 1 / invF;
  12717. var e2 = 2 * flattening - Math.pow(flattening, 2);
  12718. var e = this.e = Math.sqrt(e2);
  12719. this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));
  12720. this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));
  12721. this.b0 = Math.asin(sinPhy0 / this.alpha);
  12722. var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));
  12723. var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));
  12724. var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));
  12725. this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;
  12726. }
  12727. function forward$7(p) {
  12728. var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));
  12729. var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));
  12730. var S = -this.alpha * (Sa1 + Sa2) + this.K;
  12731. // spheric latitude
  12732. var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);
  12733. // spheric longitude
  12734. var I = this.alpha * (p.x - this.lambda0);
  12735. // psoeudo equatorial rotation
  12736. var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));
  12737. var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));
  12738. p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;
  12739. p.x = this.R * rotI + this.x0;
  12740. return p;
  12741. }
  12742. function inverse$7(p) {
  12743. var Y = p.x - this.x0;
  12744. var X = p.y - this.y0;
  12745. var rotI = Y / this.R;
  12746. var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);
  12747. var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));
  12748. var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));
  12749. var lambda = this.lambda0 + I / this.alpha;
  12750. var S = 0;
  12751. var phy = b;
  12752. var prevPhy = -1000;
  12753. var iteration = 0;
  12754. while (Math.abs(phy - prevPhy) > 0.0000001) {
  12755. if (++iteration > 20) {
  12756. //...reportError("omercFwdInfinity");
  12757. return;
  12758. }
  12759. //S = Math.log(Math.tan(Math.PI / 4 + phy / 2));
  12760. S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));
  12761. prevPhy = phy;
  12762. phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
  12763. }
  12764. p.x = lambda;
  12765. p.y = phy;
  12766. return p;
  12767. }
  12768. var names$9 = ["somerc"];
  12769. var somerc = {
  12770. init: init$8,
  12771. forward: forward$7,
  12772. inverse: inverse$7,
  12773. names: names$9
  12774. };
  12775. var TOL = 1e-7;
  12776. function isTypeA(P) {
  12777. var typeAProjections = ['Hotine_Oblique_Mercator','Hotine_Oblique_Mercator_Azimuth_Natural_Origin'];
  12778. var projectionName = typeof P.PROJECTION === "object" ? Object.keys(P.PROJECTION)[0] : P.PROJECTION;
  12779. return 'no_uoff' in P || 'no_off' in P || typeAProjections.indexOf(projectionName) !== -1;
  12780. }
  12781. /* Initialize the Oblique Mercator projection
  12782. ------------------------------------------*/
  12783. function init$9() {
  12784. var con, com, cosph0, D, F, H, L, sinph0, p, J, gamma = 0,
  12785. gamma0, lamc = 0, lam1 = 0, lam2 = 0, phi1 = 0, phi2 = 0, alpha_c = 0;
  12786. // only Type A uses the no_off or no_uoff property
  12787. // https://github.com/OSGeo/proj.4/issues/104
  12788. this.no_off = isTypeA(this);
  12789. this.no_rot = 'no_rot' in this;
  12790. var alp = false;
  12791. if ("alpha" in this) {
  12792. alp = true;
  12793. }
  12794. var gam = false;
  12795. if ("rectified_grid_angle" in this) {
  12796. gam = true;
  12797. }
  12798. if (alp) {
  12799. alpha_c = this.alpha;
  12800. }
  12801. if (gam) {
  12802. gamma = (this.rectified_grid_angle * D2R);
  12803. }
  12804. if (alp || gam) {
  12805. lamc = this.longc;
  12806. } else {
  12807. lam1 = this.long1;
  12808. phi1 = this.lat1;
  12809. lam2 = this.long2;
  12810. phi2 = this.lat2;
  12811. if (Math.abs(phi1 - phi2) <= TOL || (con = Math.abs(phi1)) <= TOL ||
  12812. Math.abs(con - HALF_PI) <= TOL || Math.abs(Math.abs(this.lat0) - HALF_PI) <= TOL ||
  12813. Math.abs(Math.abs(phi2) - HALF_PI) <= TOL) {
  12814. throw new Error();
  12815. }
  12816. }
  12817. var one_es = 1.0 - this.es;
  12818. com = Math.sqrt(one_es);
  12819. if (Math.abs(this.lat0) > EPSLN) {
  12820. sinph0 = Math.sin(this.lat0);
  12821. cosph0 = Math.cos(this.lat0);
  12822. con = 1 - this.es * sinph0 * sinph0;
  12823. this.B = cosph0 * cosph0;
  12824. this.B = Math.sqrt(1 + this.es * this.B * this.B / one_es);
  12825. this.A = this.B * this.k0 * com / con;
  12826. D = this.B * com / (cosph0 * Math.sqrt(con));
  12827. F = D * D -1;
  12828. if (F <= 0) {
  12829. F = 0;
  12830. } else {
  12831. F = Math.sqrt(F);
  12832. if (this.lat0 < 0) {
  12833. F = -F;
  12834. }
  12835. }
  12836. this.E = F += D;
  12837. this.E *= Math.pow(tsfnz(this.e, this.lat0, sinph0), this.B);
  12838. } else {
  12839. this.B = 1 / com;
  12840. this.A = this.k0;
  12841. this.E = D = F = 1;
  12842. }
  12843. if (alp || gam) {
  12844. if (alp) {
  12845. gamma0 = Math.asin(Math.sin(alpha_c) / D);
  12846. if (!gam) {
  12847. gamma = alpha_c;
  12848. }
  12849. } else {
  12850. gamma0 = gamma;
  12851. alpha_c = Math.asin(D * Math.sin(gamma0));
  12852. }
  12853. this.lam0 = lamc - Math.asin(0.5 * (F - 1 / F) * Math.tan(gamma0)) / this.B;
  12854. } else {
  12855. H = Math.pow(tsfnz(this.e, phi1, Math.sin(phi1)), this.B);
  12856. L = Math.pow(tsfnz(this.e, phi2, Math.sin(phi2)), this.B);
  12857. F = this.E / H;
  12858. p = (L - H) / (L + H);
  12859. J = this.E * this.E;
  12860. J = (J - L * H) / (J + L * H);
  12861. con = lam1 - lam2;
  12862. if (con < -Math.pi) {
  12863. lam2 -=TWO_PI;
  12864. } else if (con > Math.pi) {
  12865. lam2 += TWO_PI;
  12866. }
  12867. this.lam0 = adjust_lon(0.5 * (lam1 + lam2) - Math.atan(J * Math.tan(0.5 * this.B * (lam1 - lam2)) / p) / this.B);
  12868. gamma0 = Math.atan(2 * Math.sin(this.B * adjust_lon(lam1 - this.lam0)) / (F - 1 / F));
  12869. gamma = alpha_c = Math.asin(D * Math.sin(gamma0));
  12870. }
  12871. this.singam = Math.sin(gamma0);
  12872. this.cosgam = Math.cos(gamma0);
  12873. this.sinrot = Math.sin(gamma);
  12874. this.cosrot = Math.cos(gamma);
  12875. this.rB = 1 / this.B;
  12876. this.ArB = this.A * this.rB;
  12877. this.BrA = 1 / this.ArB;
  12878. if (this.no_off) {
  12879. this.u_0 = 0;
  12880. } else {
  12881. this.u_0 = Math.abs(this.ArB * Math.atan(Math.sqrt(D * D - 1) / Math.cos(alpha_c)));
  12882. if (this.lat0 < 0) {
  12883. this.u_0 = - this.u_0;
  12884. }
  12885. }
  12886. F = 0.5 * gamma0;
  12887. this.v_pole_n = this.ArB * Math.log(Math.tan(FORTPI - F));
  12888. this.v_pole_s = this.ArB * Math.log(Math.tan(FORTPI + F));
  12889. }
  12890. /* Oblique Mercator forward equations--mapping lat,long to x,y
  12891. ----------------------------------------------------------*/
  12892. function forward$8(p) {
  12893. var coords = {};
  12894. var S, T, U, V, W, temp, u, v;
  12895. p.x = p.x - this.lam0;
  12896. if (Math.abs(Math.abs(p.y) - HALF_PI) > EPSLN) {
  12897. W = this.E / Math.pow(tsfnz(this.e, p.y, Math.sin(p.y)), this.B);
  12898. temp = 1 / W;
  12899. S = 0.5 * (W - temp);
  12900. T = 0.5 * (W + temp);
  12901. V = Math.sin(this.B * p.x);
  12902. U = (S * this.singam - V * this.cosgam) / T;
  12903. if (Math.abs(Math.abs(U) - 1.0) < EPSLN) {
  12904. throw new Error();
  12905. }
  12906. v = 0.5 * this.ArB * Math.log((1 - U)/(1 + U));
  12907. temp = Math.cos(this.B * p.x);
  12908. if (Math.abs(temp) < TOL) {
  12909. u = this.A * p.x;
  12910. } else {
  12911. u = this.ArB * Math.atan2((S * this.cosgam + V * this.singam), temp);
  12912. }
  12913. } else {
  12914. v = p.y > 0 ? this.v_pole_n : this.v_pole_s;
  12915. u = this.ArB * p.y;
  12916. }
  12917. if (this.no_rot) {
  12918. coords.x = u;
  12919. coords.y = v;
  12920. } else {
  12921. u -= this.u_0;
  12922. coords.x = v * this.cosrot + u * this.sinrot;
  12923. coords.y = u * this.cosrot - v * this.sinrot;
  12924. }
  12925. coords.x = (this.a * coords.x + this.x0);
  12926. coords.y = (this.a * coords.y + this.y0);
  12927. return coords;
  12928. }
  12929. function inverse$8(p) {
  12930. var u, v, Qp, Sp, Tp, Vp, Up;
  12931. var coords = {};
  12932. p.x = (p.x - this.x0) * (1.0 / this.a);
  12933. p.y = (p.y - this.y0) * (1.0 / this.a);
  12934. if (this.no_rot) {
  12935. v = p.y;
  12936. u = p.x;
  12937. } else {
  12938. v = p.x * this.cosrot - p.y * this.sinrot;
  12939. u = p.y * this.cosrot + p.x * this.sinrot + this.u_0;
  12940. }
  12941. Qp = Math.exp(-this.BrA * v);
  12942. Sp = 0.5 * (Qp - 1 / Qp);
  12943. Tp = 0.5 * (Qp + 1 / Qp);
  12944. Vp = Math.sin(this.BrA * u);
  12945. Up = (Vp * this.cosgam + Sp * this.singam) / Tp;
  12946. if (Math.abs(Math.abs(Up) - 1) < EPSLN) {
  12947. coords.x = 0;
  12948. coords.y = Up < 0 ? -HALF_PI : HALF_PI;
  12949. } else {
  12950. coords.y = this.E / Math.sqrt((1 + Up) / (1 - Up));
  12951. coords.y = phi2z(this.e, Math.pow(coords.y, 1 / this.B));
  12952. if (coords.y === Infinity) {
  12953. throw new Error();
  12954. }
  12955. coords.x = -this.rB * Math.atan2((Sp * this.cosgam - Vp * this.singam), Math.cos(this.BrA * u));
  12956. }
  12957. coords.x += this.lam0;
  12958. return coords;
  12959. }
  12960. var names$10 = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Two_Point_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "Oblique_Mercator", "omerc"];
  12961. var omerc = {
  12962. init: init$9,
  12963. forward: forward$8,
  12964. inverse: inverse$8,
  12965. names: names$10
  12966. };
  12967. function init$10() {
  12968. //double lat0; /* the reference latitude */
  12969. //double long0; /* the reference longitude */
  12970. //double lat1; /* first standard parallel */
  12971. //double lat2; /* second standard parallel */
  12972. //double r_maj; /* major axis */
  12973. //double r_min; /* minor axis */
  12974. //double false_east; /* x offset in meters */
  12975. //double false_north; /* y offset in meters */
  12976. //the above value can be set with proj4.defs
  12977. //example: proj4.defs("EPSG:2154","+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
  12978. if (!this.lat2) {
  12979. this.lat2 = this.lat1;
  12980. } //if lat2 is not defined
  12981. if (!this.k0) {
  12982. this.k0 = 1;
  12983. }
  12984. this.x0 = this.x0 || 0;
  12985. this.y0 = this.y0 || 0;
  12986. // Standard Parallels cannot be equal and on opposite sides of the equator
  12987. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  12988. return;
  12989. }
  12990. var temp = this.b / this.a;
  12991. this.e = Math.sqrt(1 - temp * temp);
  12992. var sin1 = Math.sin(this.lat1);
  12993. var cos1 = Math.cos(this.lat1);
  12994. var ms1 = msfnz(this.e, sin1, cos1);
  12995. var ts1 = tsfnz(this.e, this.lat1, sin1);
  12996. var sin2 = Math.sin(this.lat2);
  12997. var cos2 = Math.cos(this.lat2);
  12998. var ms2 = msfnz(this.e, sin2, cos2);
  12999. var ts2 = tsfnz(this.e, this.lat2, sin2);
  13000. var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));
  13001. if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
  13002. this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);
  13003. }
  13004. else {
  13005. this.ns = sin1;
  13006. }
  13007. if (isNaN(this.ns)) {
  13008. this.ns = sin1;
  13009. }
  13010. this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));
  13011. this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);
  13012. if (!this.title) {
  13013. this.title = "Lambert Conformal Conic";
  13014. }
  13015. }
  13016. // Lambert Conformal conic forward equations--mapping lat,long to x,y
  13017. // -----------------------------------------------------------------
  13018. function forward$9(p) {
  13019. var lon = p.x;
  13020. var lat = p.y;
  13021. // singular cases :
  13022. if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {
  13023. lat = sign(lat) * (HALF_PI - 2 * EPSLN);
  13024. }
  13025. var con = Math.abs(Math.abs(lat) - HALF_PI);
  13026. var ts, rh1;
  13027. if (con > EPSLN) {
  13028. ts = tsfnz(this.e, lat, Math.sin(lat));
  13029. rh1 = this.a * this.f0 * Math.pow(ts, this.ns);
  13030. }
  13031. else {
  13032. con = lat * this.ns;
  13033. if (con <= 0) {
  13034. return null;
  13035. }
  13036. rh1 = 0;
  13037. }
  13038. var theta = this.ns * adjust_lon(lon - this.long0);
  13039. p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;
  13040. p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;
  13041. return p;
  13042. }
  13043. // Lambert Conformal Conic inverse equations--mapping x,y to lat/long
  13044. // -----------------------------------------------------------------
  13045. function inverse$9(p) {
  13046. var rh1, con, ts;
  13047. var lat, lon;
  13048. var x = (p.x - this.x0) / this.k0;
  13049. var y = (this.rh - (p.y - this.y0) / this.k0);
  13050. if (this.ns > 0) {
  13051. rh1 = Math.sqrt(x * x + y * y);
  13052. con = 1;
  13053. }
  13054. else {
  13055. rh1 = -Math.sqrt(x * x + y * y);
  13056. con = -1;
  13057. }
  13058. var theta = 0;
  13059. if (rh1 !== 0) {
  13060. theta = Math.atan2((con * x), (con * y));
  13061. }
  13062. if ((rh1 !== 0) || (this.ns > 0)) {
  13063. con = 1 / this.ns;
  13064. ts = Math.pow((rh1 / (this.a * this.f0)), con);
  13065. lat = phi2z(this.e, ts);
  13066. if (lat === -9999) {
  13067. return null;
  13068. }
  13069. }
  13070. else {
  13071. lat = -HALF_PI;
  13072. }
  13073. lon = adjust_lon(theta / this.ns + this.long0);
  13074. p.x = lon;
  13075. p.y = lat;
  13076. return p;
  13077. }
  13078. var names$11 = [
  13079. "Lambert Tangential Conformal Conic Projection",
  13080. "Lambert_Conformal_Conic",
  13081. "Lambert_Conformal_Conic_1SP",
  13082. "Lambert_Conformal_Conic_2SP",
  13083. "lcc",
  13084. "Lambert Conic Conformal (1SP)",
  13085. "Lambert Conic Conformal (2SP)"
  13086. ];
  13087. var lcc = {
  13088. init: init$10,
  13089. forward: forward$9,
  13090. inverse: inverse$9,
  13091. names: names$11
  13092. };
  13093. function init$11() {
  13094. this.a = 6377397.155;
  13095. this.es = 0.006674372230614;
  13096. this.e = Math.sqrt(this.es);
  13097. if (!this.lat0) {
  13098. this.lat0 = 0.863937979737193;
  13099. }
  13100. if (!this.long0) {
  13101. this.long0 = 0.7417649320975901 - 0.308341501185665;
  13102. }
  13103. /* if scale not set default to 0.9999 */
  13104. if (!this.k0) {
  13105. this.k0 = 0.9999;
  13106. }
  13107. this.s45 = 0.785398163397448; /* 45 */
  13108. this.s90 = 2 * this.s45;
  13109. this.fi0 = this.lat0;
  13110. this.e2 = this.es;
  13111. this.e = Math.sqrt(this.e2);
  13112. this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2));
  13113. this.uq = 1.04216856380474;
  13114. this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);
  13115. this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);
  13116. this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;
  13117. this.k1 = this.k0;
  13118. this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));
  13119. this.s0 = 1.37008346281555;
  13120. this.n = Math.sin(this.s0);
  13121. this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);
  13122. this.ad = this.s90 - this.uq;
  13123. }
  13124. /* ellipsoid */
  13125. /* calculate xy from lat/lon */
  13126. /* Constants, identical to inverse transform function */
  13127. function forward$10(p) {
  13128. var gfi, u, deltav, s, d, eps, ro;
  13129. var lon = p.x;
  13130. var lat = p.y;
  13131. var delta_lon = adjust_lon(lon - this.long0);
  13132. /* Transformation */
  13133. gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));
  13134. u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);
  13135. deltav = -delta_lon * this.alfa;
  13136. s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));
  13137. d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));
  13138. eps = this.n * d;
  13139. ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);
  13140. p.y = ro * Math.cos(eps) / 1;
  13141. p.x = ro * Math.sin(eps) / 1;
  13142. if (!this.czech) {
  13143. p.y *= -1;
  13144. p.x *= -1;
  13145. }
  13146. return (p);
  13147. }
  13148. /* calculate lat/lon from xy */
  13149. function inverse$10(p) {
  13150. var u, deltav, s, d, eps, ro, fi1;
  13151. var ok;
  13152. /* Transformation */
  13153. /* revert y, x*/
  13154. var tmp = p.x;
  13155. p.x = p.y;
  13156. p.y = tmp;
  13157. if (!this.czech) {
  13158. p.y *= -1;
  13159. p.x *= -1;
  13160. }
  13161. ro = Math.sqrt(p.x * p.x + p.y * p.y);
  13162. eps = Math.atan2(p.y, p.x);
  13163. d = eps / Math.sin(this.s0);
  13164. s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);
  13165. u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));
  13166. deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));
  13167. p.x = this.long0 - deltav / this.alfa;
  13168. fi1 = u;
  13169. ok = 0;
  13170. var iter = 0;
  13171. do {
  13172. p.y = 2 * (Math.atan(Math.pow(this.k, - 1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);
  13173. if (Math.abs(fi1 - p.y) < 0.0000000001) {
  13174. ok = 1;
  13175. }
  13176. fi1 = p.y;
  13177. iter += 1;
  13178. } while (ok === 0 && iter < 15);
  13179. if (iter >= 15) {
  13180. return null;
  13181. }
  13182. return (p);
  13183. }
  13184. var names$12 = ["Krovak", "krovak"];
  13185. var krovak = {
  13186. init: init$11,
  13187. forward: forward$10,
  13188. inverse: inverse$10,
  13189. names: names$12
  13190. };
  13191. var mlfn = function(e0, e1, e2, e3, phi) {
  13192. return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi));
  13193. };
  13194. var e0fn = function(x) {
  13195. return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x)));
  13196. };
  13197. var e1fn = function(x) {
  13198. return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x)));
  13199. };
  13200. var e2fn = function(x) {
  13201. return (0.05859375 * x * x * (1 + 0.75 * x));
  13202. };
  13203. var e3fn = function(x) {
  13204. return (x * x * x * (35 / 3072));
  13205. };
  13206. var gN = function(a, e, sinphi) {
  13207. var temp = e * sinphi;
  13208. return a / Math.sqrt(1 - temp * temp);
  13209. };
  13210. var adjust_lat = function(x) {
  13211. return (Math.abs(x) < HALF_PI) ? x : (x - (sign(x) * Math.PI));
  13212. };
  13213. var imlfn = function(ml, e0, e1, e2, e3) {
  13214. var phi;
  13215. var dphi;
  13216. phi = ml / e0;
  13217. for (var i = 0; i < 15; i++) {
  13218. dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));
  13219. phi += dphi;
  13220. if (Math.abs(dphi) <= 0.0000000001) {
  13221. return phi;
  13222. }
  13223. }
  13224. //..reportError("IMLFN-CONV:Latitude failed to converge after 15 iterations");
  13225. return NaN;
  13226. };
  13227. function init$12() {
  13228. if (!this.sphere) {
  13229. this.e0 = e0fn(this.es);
  13230. this.e1 = e1fn(this.es);
  13231. this.e2 = e2fn(this.es);
  13232. this.e3 = e3fn(this.es);
  13233. this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
  13234. }
  13235. }
  13236. /* Cassini forward equations--mapping lat,long to x,y
  13237. -----------------------------------------------------------------------*/
  13238. function forward$11(p) {
  13239. /* Forward equations
  13240. -----------------*/
  13241. var x, y;
  13242. var lam = p.x;
  13243. var phi = p.y;
  13244. lam = adjust_lon(lam - this.long0);
  13245. if (this.sphere) {
  13246. x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));
  13247. y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);
  13248. }
  13249. else {
  13250. //ellipsoid
  13251. var sinphi = Math.sin(phi);
  13252. var cosphi = Math.cos(phi);
  13253. var nl = gN(this.a, this.e, sinphi);
  13254. var tl = Math.tan(phi) * Math.tan(phi);
  13255. var al = lam * Math.cos(phi);
  13256. var asq = al * al;
  13257. var cl = this.es * cosphi * cosphi / (1 - this.es);
  13258. var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
  13259. x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));
  13260. y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);
  13261. }
  13262. p.x = x + this.x0;
  13263. p.y = y + this.y0;
  13264. return p;
  13265. }
  13266. /* Inverse equations
  13267. -----------------*/
  13268. function inverse$11(p) {
  13269. p.x -= this.x0;
  13270. p.y -= this.y0;
  13271. var x = p.x / this.a;
  13272. var y = p.y / this.a;
  13273. var phi, lam;
  13274. if (this.sphere) {
  13275. var dd = y + this.lat0;
  13276. phi = Math.asin(Math.sin(dd) * Math.cos(x));
  13277. lam = Math.atan2(Math.tan(x), Math.cos(dd));
  13278. }
  13279. else {
  13280. /* ellipsoid */
  13281. var ml1 = this.ml0 / this.a + y;
  13282. var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);
  13283. if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {
  13284. p.x = this.long0;
  13285. p.y = HALF_PI;
  13286. if (y < 0) {
  13287. p.y *= -1;
  13288. }
  13289. return p;
  13290. }
  13291. var nl1 = gN(this.a, this.e, Math.sin(phi1));
  13292. var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);
  13293. var tl1 = Math.pow(Math.tan(phi1), 2);
  13294. var dl = x * this.a / nl1;
  13295. var dsq = dl * dl;
  13296. phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);
  13297. lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);
  13298. }
  13299. p.x = adjust_lon(lam + this.long0);
  13300. p.y = adjust_lat(phi);
  13301. return p;
  13302. }
  13303. var names$13 = ["Cassini", "Cassini_Soldner", "cass"];
  13304. var cass = {
  13305. init: init$12,
  13306. forward: forward$11,
  13307. inverse: inverse$11,
  13308. names: names$13
  13309. };
  13310. var qsfnz = function(eccent, sinphi) {
  13311. var con;
  13312. if (eccent > 1.0e-7) {
  13313. con = eccent * sinphi;
  13314. return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con))));
  13315. }
  13316. else {
  13317. return (2 * sinphi);
  13318. }
  13319. };
  13320. /*
  13321. reference
  13322. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
  13323. The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
  13324. */
  13325. var S_POLE = 1;
  13326. var N_POLE = 2;
  13327. var EQUIT = 3;
  13328. var OBLIQ = 4;
  13329. /* Initialize the Lambert Azimuthal Equal Area projection
  13330. ------------------------------------------------------*/
  13331. function init$13() {
  13332. var t = Math.abs(this.lat0);
  13333. if (Math.abs(t - HALF_PI) < EPSLN) {
  13334. this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;
  13335. }
  13336. else if (Math.abs(t) < EPSLN) {
  13337. this.mode = this.EQUIT;
  13338. }
  13339. else {
  13340. this.mode = this.OBLIQ;
  13341. }
  13342. if (this.es > 0) {
  13343. var sinphi;
  13344. this.qp = qsfnz(this.e, 1);
  13345. this.mmf = 0.5 / (1 - this.es);
  13346. this.apa = authset(this.es);
  13347. switch (this.mode) {
  13348. case this.N_POLE:
  13349. this.dd = 1;
  13350. break;
  13351. case this.S_POLE:
  13352. this.dd = 1;
  13353. break;
  13354. case this.EQUIT:
  13355. this.rq = Math.sqrt(0.5 * this.qp);
  13356. this.dd = 1 / this.rq;
  13357. this.xmf = 1;
  13358. this.ymf = 0.5 * this.qp;
  13359. break;
  13360. case this.OBLIQ:
  13361. this.rq = Math.sqrt(0.5 * this.qp);
  13362. sinphi = Math.sin(this.lat0);
  13363. this.sinb1 = qsfnz(this.e, sinphi) / this.qp;
  13364. this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);
  13365. this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);
  13366. this.ymf = (this.xmf = this.rq) / this.dd;
  13367. this.xmf *= this.dd;
  13368. break;
  13369. }
  13370. }
  13371. else {
  13372. if (this.mode === this.OBLIQ) {
  13373. this.sinph0 = Math.sin(this.lat0);
  13374. this.cosph0 = Math.cos(this.lat0);
  13375. }
  13376. }
  13377. }
  13378. /* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
  13379. -----------------------------------------------------------------------*/
  13380. function forward$12(p) {
  13381. /* Forward equations
  13382. -----------------*/
  13383. var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
  13384. var lam = p.x;
  13385. var phi = p.y;
  13386. lam = adjust_lon(lam - this.long0);
  13387. if (this.sphere) {
  13388. sinphi = Math.sin(phi);
  13389. cosphi = Math.cos(phi);
  13390. coslam = Math.cos(lam);
  13391. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  13392. y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
  13393. if (y <= EPSLN) {
  13394. return null;
  13395. }
  13396. y = Math.sqrt(2 / y);
  13397. x = y * cosphi * Math.sin(lam);
  13398. y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
  13399. }
  13400. else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
  13401. if (this.mode === this.N_POLE) {
  13402. coslam = -coslam;
  13403. }
  13404. if (Math.abs(phi + this.lat0) < EPSLN) {
  13405. return null;
  13406. }
  13407. y = FORTPI - phi * 0.5;
  13408. y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));
  13409. x = y * Math.sin(lam);
  13410. y *= coslam;
  13411. }
  13412. }
  13413. else {
  13414. sinb = 0;
  13415. cosb = 0;
  13416. b = 0;
  13417. coslam = Math.cos(lam);
  13418. sinlam = Math.sin(lam);
  13419. sinphi = Math.sin(phi);
  13420. q = qsfnz(this.e, sinphi);
  13421. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  13422. sinb = q / this.qp;
  13423. cosb = Math.sqrt(1 - sinb * sinb);
  13424. }
  13425. switch (this.mode) {
  13426. case this.OBLIQ:
  13427. b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
  13428. break;
  13429. case this.EQUIT:
  13430. b = 1 + cosb * coslam;
  13431. break;
  13432. case this.N_POLE:
  13433. b = HALF_PI + phi;
  13434. q = this.qp - q;
  13435. break;
  13436. case this.S_POLE:
  13437. b = phi - HALF_PI;
  13438. q = this.qp + q;
  13439. break;
  13440. }
  13441. if (Math.abs(b) < EPSLN) {
  13442. return null;
  13443. }
  13444. switch (this.mode) {
  13445. case this.OBLIQ:
  13446. case this.EQUIT:
  13447. b = Math.sqrt(2 / b);
  13448. if (this.mode === this.OBLIQ) {
  13449. y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
  13450. }
  13451. else {
  13452. y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
  13453. }
  13454. x = this.xmf * b * cosb * sinlam;
  13455. break;
  13456. case this.N_POLE:
  13457. case this.S_POLE:
  13458. if (q >= 0) {
  13459. x = (b = Math.sqrt(q)) * sinlam;
  13460. y = coslam * ((this.mode === this.S_POLE) ? b : -b);
  13461. }
  13462. else {
  13463. x = y = 0;
  13464. }
  13465. break;
  13466. }
  13467. }
  13468. p.x = this.a * x + this.x0;
  13469. p.y = this.a * y + this.y0;
  13470. return p;
  13471. }
  13472. /* Inverse equations
  13473. -----------------*/
  13474. function inverse$12(p) {
  13475. p.x -= this.x0;
  13476. p.y -= this.y0;
  13477. var x = p.x / this.a;
  13478. var y = p.y / this.a;
  13479. var lam, phi, cCe, sCe, q, rho, ab;
  13480. if (this.sphere) {
  13481. var cosz = 0,
  13482. rh, sinz = 0;
  13483. rh = Math.sqrt(x * x + y * y);
  13484. phi = rh * 0.5;
  13485. if (phi > 1) {
  13486. return null;
  13487. }
  13488. phi = 2 * Math.asin(phi);
  13489. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  13490. sinz = Math.sin(phi);
  13491. cosz = Math.cos(phi);
  13492. }
  13493. switch (this.mode) {
  13494. case this.EQUIT:
  13495. phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);
  13496. x *= sinz;
  13497. y = cosz * rh;
  13498. break;
  13499. case this.OBLIQ:
  13500. phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);
  13501. x *= sinz * this.cosph0;
  13502. y = (cosz - Math.sin(phi) * this.sinph0) * rh;
  13503. break;
  13504. case this.N_POLE:
  13505. y = -y;
  13506. phi = HALF_PI - phi;
  13507. break;
  13508. case this.S_POLE:
  13509. phi -= HALF_PI;
  13510. break;
  13511. }
  13512. lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);
  13513. }
  13514. else {
  13515. ab = 0;
  13516. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  13517. x /= this.dd;
  13518. y *= this.dd;
  13519. rho = Math.sqrt(x * x + y * y);
  13520. if (rho < EPSLN) {
  13521. p.x = this.long0;
  13522. p.y = this.lat0;
  13523. return p;
  13524. }
  13525. sCe = 2 * Math.asin(0.5 * rho / this.rq);
  13526. cCe = Math.cos(sCe);
  13527. x *= (sCe = Math.sin(sCe));
  13528. if (this.mode === this.OBLIQ) {
  13529. ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;
  13530. q = this.qp * ab;
  13531. y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;
  13532. }
  13533. else {
  13534. ab = y * sCe / rho;
  13535. q = this.qp * ab;
  13536. y = rho * cCe;
  13537. }
  13538. }
  13539. else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
  13540. if (this.mode === this.N_POLE) {
  13541. y = -y;
  13542. }
  13543. q = (x * x + y * y);
  13544. if (!q) {
  13545. p.x = this.long0;
  13546. p.y = this.lat0;
  13547. return p;
  13548. }
  13549. ab = 1 - q / this.qp;
  13550. if (this.mode === this.S_POLE) {
  13551. ab = -ab;
  13552. }
  13553. }
  13554. lam = Math.atan2(x, y);
  13555. phi = authlat(Math.asin(ab), this.apa);
  13556. }
  13557. p.x = adjust_lon(this.long0 + lam);
  13558. p.y = phi;
  13559. return p;
  13560. }
  13561. /* determine latitude from authalic latitude */
  13562. var P00 = 0.33333333333333333333;
  13563. var P01 = 0.17222222222222222222;
  13564. var P02 = 0.10257936507936507936;
  13565. var P10 = 0.06388888888888888888;
  13566. var P11 = 0.06640211640211640211;
  13567. var P20 = 0.01641501294219154443;
  13568. function authset(es) {
  13569. var t;
  13570. var APA = [];
  13571. APA[0] = es * P00;
  13572. t = es * es;
  13573. APA[0] += t * P01;
  13574. APA[1] = t * P10;
  13575. t *= es;
  13576. APA[0] += t * P02;
  13577. APA[1] += t * P11;
  13578. APA[2] = t * P20;
  13579. return APA;
  13580. }
  13581. function authlat(beta, APA) {
  13582. var t = beta + beta;
  13583. return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
  13584. }
  13585. var names$14 = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
  13586. var laea = {
  13587. init: init$13,
  13588. forward: forward$12,
  13589. inverse: inverse$12,
  13590. names: names$14,
  13591. S_POLE: S_POLE,
  13592. N_POLE: N_POLE,
  13593. EQUIT: EQUIT,
  13594. OBLIQ: OBLIQ
  13595. };
  13596. var asinz = function(x) {
  13597. if (Math.abs(x) > 1) {
  13598. x = (x > 1) ? 1 : -1;
  13599. }
  13600. return Math.asin(x);
  13601. };
  13602. function init$14() {
  13603. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  13604. return;
  13605. }
  13606. this.temp = this.b / this.a;
  13607. this.es = 1 - Math.pow(this.temp, 2);
  13608. this.e3 = Math.sqrt(this.es);
  13609. this.sin_po = Math.sin(this.lat1);
  13610. this.cos_po = Math.cos(this.lat1);
  13611. this.t1 = this.sin_po;
  13612. this.con = this.sin_po;
  13613. this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);
  13614. this.qs1 = qsfnz(this.e3, this.sin_po);
  13615. this.sin_po = Math.sin(this.lat2);
  13616. this.cos_po = Math.cos(this.lat2);
  13617. this.t2 = this.sin_po;
  13618. this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);
  13619. this.qs2 = qsfnz(this.e3, this.sin_po);
  13620. this.sin_po = Math.sin(this.lat0);
  13621. this.cos_po = Math.cos(this.lat0);
  13622. this.t3 = this.sin_po;
  13623. this.qs0 = qsfnz(this.e3, this.sin_po);
  13624. if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
  13625. this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);
  13626. }
  13627. else {
  13628. this.ns0 = this.con;
  13629. }
  13630. this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
  13631. this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;
  13632. }
  13633. /* Albers Conical Equal Area forward equations--mapping lat,long to x,y
  13634. -------------------------------------------------------------------*/
  13635. function forward$13(p) {
  13636. var lon = p.x;
  13637. var lat = p.y;
  13638. this.sin_phi = Math.sin(lat);
  13639. this.cos_phi = Math.cos(lat);
  13640. var qs = qsfnz(this.e3, this.sin_phi);
  13641. var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;
  13642. var theta = this.ns0 * adjust_lon(lon - this.long0);
  13643. var x = rh1 * Math.sin(theta) + this.x0;
  13644. var y = this.rh - rh1 * Math.cos(theta) + this.y0;
  13645. p.x = x;
  13646. p.y = y;
  13647. return p;
  13648. }
  13649. function inverse$13(p) {
  13650. var rh1, qs, con, theta, lon, lat;
  13651. p.x -= this.x0;
  13652. p.y = this.rh - p.y + this.y0;
  13653. if (this.ns0 >= 0) {
  13654. rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
  13655. con = 1;
  13656. }
  13657. else {
  13658. rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
  13659. con = -1;
  13660. }
  13661. theta = 0;
  13662. if (rh1 !== 0) {
  13663. theta = Math.atan2(con * p.x, con * p.y);
  13664. }
  13665. con = rh1 * this.ns0 / this.a;
  13666. if (this.sphere) {
  13667. lat = Math.asin((this.c - con * con) / (2 * this.ns0));
  13668. }
  13669. else {
  13670. qs = (this.c - con * con) / this.ns0;
  13671. lat = this.phi1z(this.e3, qs);
  13672. }
  13673. lon = adjust_lon(theta / this.ns0 + this.long0);
  13674. p.x = lon;
  13675. p.y = lat;
  13676. return p;
  13677. }
  13678. /* Function to compute phi1, the latitude for the inverse of the
  13679. Albers Conical Equal-Area projection.
  13680. -------------------------------------------*/
  13681. function phi1z(eccent, qs) {
  13682. var sinphi, cosphi, con, com, dphi;
  13683. var phi = asinz(0.5 * qs);
  13684. if (eccent < EPSLN) {
  13685. return phi;
  13686. }
  13687. var eccnts = eccent * eccent;
  13688. for (var i = 1; i <= 25; i++) {
  13689. sinphi = Math.sin(phi);
  13690. cosphi = Math.cos(phi);
  13691. con = eccent * sinphi;
  13692. com = 1 - con * con;
  13693. dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
  13694. phi = phi + dphi;
  13695. if (Math.abs(dphi) <= 1e-7) {
  13696. return phi;
  13697. }
  13698. }
  13699. return null;
  13700. }
  13701. var names$15 = ["Albers_Conic_Equal_Area", "Albers", "aea"];
  13702. var aea = {
  13703. init: init$14,
  13704. forward: forward$13,
  13705. inverse: inverse$13,
  13706. names: names$15,
  13707. phi1z: phi1z
  13708. };
  13709. /*
  13710. reference:
  13711. Wolfram Mathworld "Gnomonic Projection"
  13712. http://mathworld.wolfram.com/GnomonicProjection.html
  13713. Accessed: 12th November 2009
  13714. */
  13715. function init$15() {
  13716. /* Place parameters in static storage for common use
  13717. -------------------------------------------------*/
  13718. this.sin_p14 = Math.sin(this.lat0);
  13719. this.cos_p14 = Math.cos(this.lat0);
  13720. // Approximation for projecting points to the horizon (infinity)
  13721. this.infinity_dist = 1000 * this.a;
  13722. this.rc = 1;
  13723. }
  13724. /* Gnomonic forward equations--mapping lat,long to x,y
  13725. ---------------------------------------------------*/
  13726. function forward$14(p) {
  13727. var sinphi, cosphi; /* sin and cos value */
  13728. var dlon; /* delta longitude value */
  13729. var coslon; /* cos of longitude */
  13730. var ksp; /* scale factor */
  13731. var g;
  13732. var x, y;
  13733. var lon = p.x;
  13734. var lat = p.y;
  13735. /* Forward equations
  13736. -----------------*/
  13737. dlon = adjust_lon(lon - this.long0);
  13738. sinphi = Math.sin(lat);
  13739. cosphi = Math.cos(lat);
  13740. coslon = Math.cos(dlon);
  13741. g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
  13742. ksp = 1;
  13743. if ((g > 0) || (Math.abs(g) <= EPSLN)) {
  13744. x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;
  13745. y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;
  13746. }
  13747. else {
  13748. // Point is in the opposing hemisphere and is unprojectable
  13749. // We still need to return a reasonable point, so we project
  13750. // to infinity, on a bearing
  13751. // equivalent to the northern hemisphere equivalent
  13752. // This is a reasonable approximation for short shapes and lines that
  13753. // straddle the horizon.
  13754. x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);
  13755. y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
  13756. }
  13757. p.x = x;
  13758. p.y = y;
  13759. return p;
  13760. }
  13761. function inverse$14(p) {
  13762. var rh; /* Rho */
  13763. var sinc, cosc;
  13764. var c;
  13765. var lon, lat;
  13766. /* Inverse equations
  13767. -----------------*/
  13768. p.x = (p.x - this.x0) / this.a;
  13769. p.y = (p.y - this.y0) / this.a;
  13770. p.x /= this.k0;
  13771. p.y /= this.k0;
  13772. if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) {
  13773. c = Math.atan2(rh, this.rc);
  13774. sinc = Math.sin(c);
  13775. cosc = Math.cos(c);
  13776. lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);
  13777. lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
  13778. lon = adjust_lon(this.long0 + lon);
  13779. }
  13780. else {
  13781. lat = this.phic0;
  13782. lon = 0;
  13783. }
  13784. p.x = lon;
  13785. p.y = lat;
  13786. return p;
  13787. }
  13788. var names$16 = ["gnom"];
  13789. var gnom = {
  13790. init: init$15,
  13791. forward: forward$14,
  13792. inverse: inverse$14,
  13793. names: names$16
  13794. };
  13795. var iqsfnz = function(eccent, q) {
  13796. var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
  13797. if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {
  13798. if (q < 0) {
  13799. return (-1 * HALF_PI);
  13800. }
  13801. else {
  13802. return HALF_PI;
  13803. }
  13804. }
  13805. //var phi = 0.5* q/(1-eccent*eccent);
  13806. var phi = Math.asin(0.5 * q);
  13807. var dphi;
  13808. var sin_phi;
  13809. var cos_phi;
  13810. var con;
  13811. for (var i = 0; i < 30; i++) {
  13812. sin_phi = Math.sin(phi);
  13813. cos_phi = Math.cos(phi);
  13814. con = eccent * sin_phi;
  13815. dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
  13816. phi += dphi;
  13817. if (Math.abs(dphi) <= 0.0000000001) {
  13818. return phi;
  13819. }
  13820. }
  13821. //console.log("IQSFN-CONV:Latitude failed to converge after 30 iterations");
  13822. return NaN;
  13823. };
  13824. /*
  13825. reference:
  13826. "Cartographic Projection Procedures for the UNIX Environment-
  13827. A User's Manual" by Gerald I. Evenden,
  13828. USGS Open File Report 90-284and Release 4 Interim Reports (2003)
  13829. */
  13830. function init$16() {
  13831. //no-op
  13832. if (!this.sphere) {
  13833. this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
  13834. }
  13835. }
  13836. /* Cylindrical Equal Area forward equations--mapping lat,long to x,y
  13837. ------------------------------------------------------------*/
  13838. function forward$15(p) {
  13839. var lon = p.x;
  13840. var lat = p.y;
  13841. var x, y;
  13842. /* Forward equations
  13843. -----------------*/
  13844. var dlon = adjust_lon(lon - this.long0);
  13845. if (this.sphere) {
  13846. x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
  13847. y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
  13848. }
  13849. else {
  13850. var qs = qsfnz(this.e, Math.sin(lat));
  13851. x = this.x0 + this.a * this.k0 * dlon;
  13852. y = this.y0 + this.a * qs * 0.5 / this.k0;
  13853. }
  13854. p.x = x;
  13855. p.y = y;
  13856. return p;
  13857. }
  13858. /* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
  13859. ------------------------------------------------------------*/
  13860. function inverse$15(p) {
  13861. p.x -= this.x0;
  13862. p.y -= this.y0;
  13863. var lon, lat;
  13864. if (this.sphere) {
  13865. lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));
  13866. lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));
  13867. }
  13868. else {
  13869. lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
  13870. lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
  13871. }
  13872. p.x = lon;
  13873. p.y = lat;
  13874. return p;
  13875. }
  13876. var names$17 = ["cea"];
  13877. var cea = {
  13878. init: init$16,
  13879. forward: forward$15,
  13880. inverse: inverse$15,
  13881. names: names$17
  13882. };
  13883. function init$17() {
  13884. this.x0 = this.x0 || 0;
  13885. this.y0 = this.y0 || 0;
  13886. this.lat0 = this.lat0 || 0;
  13887. this.long0 = this.long0 || 0;
  13888. this.lat_ts = this.lat_ts || 0;
  13889. this.title = this.title || "Equidistant Cylindrical (Plate Carre)";
  13890. this.rc = Math.cos(this.lat_ts);
  13891. }
  13892. // forward equations--mapping lat,long to x,y
  13893. // -----------------------------------------------------------------
  13894. function forward$16(p) {
  13895. var lon = p.x;
  13896. var lat = p.y;
  13897. var dlon = adjust_lon(lon - this.long0);
  13898. var dlat = adjust_lat(lat - this.lat0);
  13899. p.x = this.x0 + (this.a * dlon * this.rc);
  13900. p.y = this.y0 + (this.a * dlat);
  13901. return p;
  13902. }
  13903. // inverse equations--mapping x,y to lat/long
  13904. // -----------------------------------------------------------------
  13905. function inverse$16(p) {
  13906. var x = p.x;
  13907. var y = p.y;
  13908. p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));
  13909. p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));
  13910. return p;
  13911. }
  13912. var names$18 = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
  13913. var eqc = {
  13914. init: init$17,
  13915. forward: forward$16,
  13916. inverse: inverse$16,
  13917. names: names$18
  13918. };
  13919. var MAX_ITER$2 = 20;
  13920. function init$18() {
  13921. /* Place parameters in static storage for common use
  13922. -------------------------------------------------*/
  13923. this.temp = this.b / this.a;
  13924. this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles
  13925. this.e = Math.sqrt(this.es);
  13926. this.e0 = e0fn(this.es);
  13927. this.e1 = e1fn(this.es);
  13928. this.e2 = e2fn(this.es);
  13929. this.e3 = e3fn(this.es);
  13930. this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0); //si que des zeros le calcul ne se fait pas
  13931. }
  13932. /* Polyconic forward equations--mapping lat,long to x,y
  13933. ---------------------------------------------------*/
  13934. function forward$17(p) {
  13935. var lon = p.x;
  13936. var lat = p.y;
  13937. var x, y, el;
  13938. var dlon = adjust_lon(lon - this.long0);
  13939. el = dlon * Math.sin(lat);
  13940. if (this.sphere) {
  13941. if (Math.abs(lat) <= EPSLN) {
  13942. x = this.a * dlon;
  13943. y = -1 * this.a * this.lat0;
  13944. }
  13945. else {
  13946. x = this.a * Math.sin(el) / Math.tan(lat);
  13947. y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));
  13948. }
  13949. }
  13950. else {
  13951. if (Math.abs(lat) <= EPSLN) {
  13952. x = this.a * dlon;
  13953. y = -1 * this.ml0;
  13954. }
  13955. else {
  13956. var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);
  13957. x = nl * Math.sin(el);
  13958. y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));
  13959. }
  13960. }
  13961. p.x = x + this.x0;
  13962. p.y = y + this.y0;
  13963. return p;
  13964. }
  13965. /* Inverse equations
  13966. -----------------*/
  13967. function inverse$17(p) {
  13968. var lon, lat, x, y, i;
  13969. var al, bl;
  13970. var phi, dphi;
  13971. x = p.x - this.x0;
  13972. y = p.y - this.y0;
  13973. if (this.sphere) {
  13974. if (Math.abs(y + this.a * this.lat0) <= EPSLN) {
  13975. lon = adjust_lon(x / this.a + this.long0);
  13976. lat = 0;
  13977. }
  13978. else {
  13979. al = this.lat0 + y / this.a;
  13980. bl = x * x / this.a / this.a + al * al;
  13981. phi = al;
  13982. var tanphi;
  13983. for (i = MAX_ITER$2; i; --i) {
  13984. tanphi = Math.tan(phi);
  13985. dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);
  13986. phi += dphi;
  13987. if (Math.abs(dphi) <= EPSLN) {
  13988. lat = phi;
  13989. break;
  13990. }
  13991. }
  13992. lon = adjust_lon(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat));
  13993. }
  13994. }
  13995. else {
  13996. if (Math.abs(y + this.ml0) <= EPSLN) {
  13997. lat = 0;
  13998. lon = adjust_lon(this.long0 + x / this.a);
  13999. }
  14000. else {
  14001. al = (this.ml0 + y) / this.a;
  14002. bl = x * x / this.a / this.a + al * al;
  14003. phi = al;
  14004. var cl, mln, mlnp, ma;
  14005. var con;
  14006. for (i = MAX_ITER$2; i; --i) {
  14007. con = this.e * Math.sin(phi);
  14008. cl = Math.sqrt(1 - con * con) * Math.tan(phi);
  14009. mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
  14010. mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);
  14011. ma = mln / this.a;
  14012. dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);
  14013. phi -= dphi;
  14014. if (Math.abs(dphi) <= EPSLN) {
  14015. lat = phi;
  14016. break;
  14017. }
  14018. }
  14019. //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);
  14020. cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);
  14021. lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));
  14022. }
  14023. }
  14024. p.x = lon;
  14025. p.y = lat;
  14026. return p;
  14027. }
  14028. var names$19 = ["Polyconic", "poly"];
  14029. var poly = {
  14030. init: init$18,
  14031. forward: forward$17,
  14032. inverse: inverse$17,
  14033. names: names$19
  14034. };
  14035. /*
  14036. reference
  14037. Department of Land and Survey Technical Circular 1973/32
  14038. http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf
  14039. OSG Technical Report 4.1
  14040. http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf
  14041. */
  14042. /**
  14043. * iterations: Number of iterations to refine inverse transform.
  14044. * 0 -> km accuracy
  14045. * 1 -> m accuracy -- suitable for most mapping applications
  14046. * 2 -> mm accuracy
  14047. */
  14048. function init$19() {
  14049. this.A = [];
  14050. this.A[1] = 0.6399175073;
  14051. this.A[2] = -0.1358797613;
  14052. this.A[3] = 0.063294409;
  14053. this.A[4] = -0.02526853;
  14054. this.A[5] = 0.0117879;
  14055. this.A[6] = -0.0055161;
  14056. this.A[7] = 0.0026906;
  14057. this.A[8] = -0.001333;
  14058. this.A[9] = 0.00067;
  14059. this.A[10] = -0.00034;
  14060. this.B_re = [];
  14061. this.B_im = [];
  14062. this.B_re[1] = 0.7557853228;
  14063. this.B_im[1] = 0;
  14064. this.B_re[2] = 0.249204646;
  14065. this.B_im[2] = 0.003371507;
  14066. this.B_re[3] = -0.001541739;
  14067. this.B_im[3] = 0.041058560;
  14068. this.B_re[4] = -0.10162907;
  14069. this.B_im[4] = 0.01727609;
  14070. this.B_re[5] = -0.26623489;
  14071. this.B_im[5] = -0.36249218;
  14072. this.B_re[6] = -0.6870983;
  14073. this.B_im[6] = -1.1651967;
  14074. this.C_re = [];
  14075. this.C_im = [];
  14076. this.C_re[1] = 1.3231270439;
  14077. this.C_im[1] = 0;
  14078. this.C_re[2] = -0.577245789;
  14079. this.C_im[2] = -0.007809598;
  14080. this.C_re[3] = 0.508307513;
  14081. this.C_im[3] = -0.112208952;
  14082. this.C_re[4] = -0.15094762;
  14083. this.C_im[4] = 0.18200602;
  14084. this.C_re[5] = 1.01418179;
  14085. this.C_im[5] = 1.64497696;
  14086. this.C_re[6] = 1.9660549;
  14087. this.C_im[6] = 2.5127645;
  14088. this.D = [];
  14089. this.D[1] = 1.5627014243;
  14090. this.D[2] = 0.5185406398;
  14091. this.D[3] = -0.03333098;
  14092. this.D[4] = -0.1052906;
  14093. this.D[5] = -0.0368594;
  14094. this.D[6] = 0.007317;
  14095. this.D[7] = 0.01220;
  14096. this.D[8] = 0.00394;
  14097. this.D[9] = -0.0013;
  14098. }
  14099. /**
  14100. New Zealand Map Grid Forward - long/lat to x/y
  14101. long/lat in radians
  14102. */
  14103. function forward$18(p) {
  14104. var n;
  14105. var lon = p.x;
  14106. var lat = p.y;
  14107. var delta_lat = lat - this.lat0;
  14108. var delta_lon = lon - this.long0;
  14109. // 1. Calculate d_phi and d_psi ... // and d_lambda
  14110. // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.
  14111. var d_phi = delta_lat / SEC_TO_RAD * 1E-5;
  14112. var d_lambda = delta_lon;
  14113. var d_phi_n = 1; // d_phi^0
  14114. var d_psi = 0;
  14115. for (n = 1; n <= 10; n++) {
  14116. d_phi_n = d_phi_n * d_phi;
  14117. d_psi = d_psi + this.A[n] * d_phi_n;
  14118. }
  14119. // 2. Calculate theta
  14120. var th_re = d_psi;
  14121. var th_im = d_lambda;
  14122. // 3. Calculate z
  14123. var th_n_re = 1;
  14124. var th_n_im = 0; // theta^0
  14125. var th_n_re1;
  14126. var th_n_im1;
  14127. var z_re = 0;
  14128. var z_im = 0;
  14129. for (n = 1; n <= 6; n++) {
  14130. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  14131. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  14132. th_n_re = th_n_re1;
  14133. th_n_im = th_n_im1;
  14134. z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;
  14135. z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;
  14136. }
  14137. // 4. Calculate easting and northing
  14138. p.x = (z_im * this.a) + this.x0;
  14139. p.y = (z_re * this.a) + this.y0;
  14140. return p;
  14141. }
  14142. /**
  14143. New Zealand Map Grid Inverse - x/y to long/lat
  14144. */
  14145. function inverse$18(p) {
  14146. var n;
  14147. var x = p.x;
  14148. var y = p.y;
  14149. var delta_x = x - this.x0;
  14150. var delta_y = y - this.y0;
  14151. // 1. Calculate z
  14152. var z_re = delta_y / this.a;
  14153. var z_im = delta_x / this.a;
  14154. // 2a. Calculate theta - first approximation gives km accuracy
  14155. var z_n_re = 1;
  14156. var z_n_im = 0; // z^0
  14157. var z_n_re1;
  14158. var z_n_im1;
  14159. var th_re = 0;
  14160. var th_im = 0;
  14161. for (n = 1; n <= 6; n++) {
  14162. z_n_re1 = z_n_re * z_re - z_n_im * z_im;
  14163. z_n_im1 = z_n_im * z_re + z_n_re * z_im;
  14164. z_n_re = z_n_re1;
  14165. z_n_im = z_n_im1;
  14166. th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;
  14167. th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;
  14168. }
  14169. // 2b. Iterate to refine the accuracy of the calculation
  14170. // 0 iterations gives km accuracy
  14171. // 1 iteration gives m accuracy -- good enough for most mapping applications
  14172. // 2 iterations bives mm accuracy
  14173. for (var i = 0; i < this.iterations; i++) {
  14174. var th_n_re = th_re;
  14175. var th_n_im = th_im;
  14176. var th_n_re1;
  14177. var th_n_im1;
  14178. var num_re = z_re;
  14179. var num_im = z_im;
  14180. for (n = 2; n <= 6; n++) {
  14181. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  14182. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  14183. th_n_re = th_n_re1;
  14184. th_n_im = th_n_im1;
  14185. num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
  14186. num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
  14187. }
  14188. th_n_re = 1;
  14189. th_n_im = 0;
  14190. var den_re = this.B_re[1];
  14191. var den_im = this.B_im[1];
  14192. for (n = 2; n <= 6; n++) {
  14193. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  14194. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  14195. th_n_re = th_n_re1;
  14196. th_n_im = th_n_im1;
  14197. den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
  14198. den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
  14199. }
  14200. // Complex division
  14201. var den2 = den_re * den_re + den_im * den_im;
  14202. th_re = (num_re * den_re + num_im * den_im) / den2;
  14203. th_im = (num_im * den_re - num_re * den_im) / den2;
  14204. }
  14205. // 3. Calculate d_phi ... // and d_lambda
  14206. var d_psi = th_re;
  14207. var d_lambda = th_im;
  14208. var d_psi_n = 1; // d_psi^0
  14209. var d_phi = 0;
  14210. for (n = 1; n <= 9; n++) {
  14211. d_psi_n = d_psi_n * d_psi;
  14212. d_phi = d_phi + this.D[n] * d_psi_n;
  14213. }
  14214. // 4. Calculate latitude and longitude
  14215. // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.
  14216. var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);
  14217. var lon = this.long0 + d_lambda;
  14218. p.x = lon;
  14219. p.y = lat;
  14220. return p;
  14221. }
  14222. var names$20 = ["New_Zealand_Map_Grid", "nzmg"];
  14223. var nzmg = {
  14224. init: init$19,
  14225. forward: forward$18,
  14226. inverse: inverse$18,
  14227. names: names$20
  14228. };
  14229. /*
  14230. reference
  14231. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
  14232. The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
  14233. */
  14234. /* Initialize the Miller Cylindrical projection
  14235. -------------------------------------------*/
  14236. function init$20() {
  14237. //no-op
  14238. }
  14239. /* Miller Cylindrical forward equations--mapping lat,long to x,y
  14240. ------------------------------------------------------------*/
  14241. function forward$19(p) {
  14242. var lon = p.x;
  14243. var lat = p.y;
  14244. /* Forward equations
  14245. -----------------*/
  14246. var dlon = adjust_lon(lon - this.long0);
  14247. var x = this.x0 + this.a * dlon;
  14248. var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;
  14249. p.x = x;
  14250. p.y = y;
  14251. return p;
  14252. }
  14253. /* Miller Cylindrical inverse equations--mapping x,y to lat/long
  14254. ------------------------------------------------------------*/
  14255. function inverse$19(p) {
  14256. p.x -= this.x0;
  14257. p.y -= this.y0;
  14258. var lon = adjust_lon(this.long0 + p.x / this.a);
  14259. var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);
  14260. p.x = lon;
  14261. p.y = lat;
  14262. return p;
  14263. }
  14264. var names$21 = ["Miller_Cylindrical", "mill"];
  14265. var mill = {
  14266. init: init$20,
  14267. forward: forward$19,
  14268. inverse: inverse$19,
  14269. names: names$21
  14270. };
  14271. var MAX_ITER$3 = 20;
  14272. function init$21() {
  14273. /* Place parameters in static storage for common use
  14274. -------------------------------------------------*/
  14275. if (!this.sphere) {
  14276. this.en = pj_enfn(this.es);
  14277. }
  14278. else {
  14279. this.n = 1;
  14280. this.m = 0;
  14281. this.es = 0;
  14282. this.C_y = Math.sqrt((this.m + 1) / this.n);
  14283. this.C_x = this.C_y / (this.m + 1);
  14284. }
  14285. }
  14286. /* Sinusoidal forward equations--mapping lat,long to x,y
  14287. -----------------------------------------------------*/
  14288. function forward$20(p) {
  14289. var x, y;
  14290. var lon = p.x;
  14291. var lat = p.y;
  14292. /* Forward equations
  14293. -----------------*/
  14294. lon = adjust_lon(lon - this.long0);
  14295. if (this.sphere) {
  14296. if (!this.m) {
  14297. lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;
  14298. }
  14299. else {
  14300. var k = this.n * Math.sin(lat);
  14301. for (var i = MAX_ITER$3; i; --i) {
  14302. var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));
  14303. lat -= V;
  14304. if (Math.abs(V) < EPSLN) {
  14305. break;
  14306. }
  14307. }
  14308. }
  14309. x = this.a * this.C_x * lon * (this.m + Math.cos(lat));
  14310. y = this.a * this.C_y * lat;
  14311. }
  14312. else {
  14313. var s = Math.sin(lat);
  14314. var c = Math.cos(lat);
  14315. y = this.a * pj_mlfn(lat, s, c, this.en);
  14316. x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);
  14317. }
  14318. p.x = x;
  14319. p.y = y;
  14320. return p;
  14321. }
  14322. function inverse$20(p) {
  14323. var lat, temp, lon, s;
  14324. p.x -= this.x0;
  14325. lon = p.x / this.a;
  14326. p.y -= this.y0;
  14327. lat = p.y / this.a;
  14328. if (this.sphere) {
  14329. lat /= this.C_y;
  14330. lon = lon / (this.C_x * (this.m + Math.cos(lat)));
  14331. if (this.m) {
  14332. lat = asinz((this.m * lat + Math.sin(lat)) / this.n);
  14333. }
  14334. else if (this.n !== 1) {
  14335. lat = asinz(Math.sin(lat) / this.n);
  14336. }
  14337. lon = adjust_lon(lon + this.long0);
  14338. lat = adjust_lat(lat);
  14339. }
  14340. else {
  14341. lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);
  14342. s = Math.abs(lat);
  14343. if (s < HALF_PI) {
  14344. s = Math.sin(lat);
  14345. temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));
  14346. //temp = this.long0 + p.x / (this.a * Math.cos(lat));
  14347. lon = adjust_lon(temp);
  14348. }
  14349. else if ((s - EPSLN) < HALF_PI) {
  14350. lon = this.long0;
  14351. }
  14352. }
  14353. p.x = lon;
  14354. p.y = lat;
  14355. return p;
  14356. }
  14357. var names$22 = ["Sinusoidal", "sinu"];
  14358. var sinu = {
  14359. init: init$21,
  14360. forward: forward$20,
  14361. inverse: inverse$20,
  14362. names: names$22
  14363. };
  14364. function init$22() {}
  14365. /* Mollweide forward equations--mapping lat,long to x,y
  14366. ----------------------------------------------------*/
  14367. function forward$21(p) {
  14368. /* Forward equations
  14369. -----------------*/
  14370. var lon = p.x;
  14371. var lat = p.y;
  14372. var delta_lon = adjust_lon(lon - this.long0);
  14373. var theta = lat;
  14374. var con = Math.PI * Math.sin(lat);
  14375. /* Iterate using the Newton-Raphson method to find theta
  14376. -----------------------------------------------------*/
  14377. while (true) {
  14378. var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));
  14379. theta += delta_theta;
  14380. if (Math.abs(delta_theta) < EPSLN) {
  14381. break;
  14382. }
  14383. }
  14384. theta /= 2;
  14385. /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting"
  14386. this is done here because of precision problems with "cos(theta)"
  14387. --------------------------------------------------------------------------*/
  14388. if (Math.PI / 2 - Math.abs(lat) < EPSLN) {
  14389. delta_lon = 0;
  14390. }
  14391. var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;
  14392. var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;
  14393. p.x = x;
  14394. p.y = y;
  14395. return p;
  14396. }
  14397. function inverse$21(p) {
  14398. var theta;
  14399. var arg;
  14400. /* Inverse equations
  14401. -----------------*/
  14402. p.x -= this.x0;
  14403. p.y -= this.y0;
  14404. arg = p.y / (1.4142135623731 * this.a);
  14405. /* Because of division by zero problems, 'arg' can not be 1. Therefore
  14406. a number very close to one is used instead.
  14407. -------------------------------------------------------------------*/
  14408. if (Math.abs(arg) > 0.999999999999) {
  14409. arg = 0.999999999999;
  14410. }
  14411. theta = Math.asin(arg);
  14412. var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))));
  14413. if (lon < (-Math.PI)) {
  14414. lon = -Math.PI;
  14415. }
  14416. if (lon > Math.PI) {
  14417. lon = Math.PI;
  14418. }
  14419. arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;
  14420. if (Math.abs(arg) > 1) {
  14421. arg = 1;
  14422. }
  14423. var lat = Math.asin(arg);
  14424. p.x = lon;
  14425. p.y = lat;
  14426. return p;
  14427. }
  14428. var names$23 = ["Mollweide", "moll"];
  14429. var moll = {
  14430. init: init$22,
  14431. forward: forward$21,
  14432. inverse: inverse$21,
  14433. names: names$23
  14434. };
  14435. function init$23() {
  14436. /* Place parameters in static storage for common use
  14437. -------------------------------------------------*/
  14438. // Standard Parallels cannot be equal and on opposite sides of the equator
  14439. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  14440. return;
  14441. }
  14442. this.lat2 = this.lat2 || this.lat1;
  14443. this.temp = this.b / this.a;
  14444. this.es = 1 - Math.pow(this.temp, 2);
  14445. this.e = Math.sqrt(this.es);
  14446. this.e0 = e0fn(this.es);
  14447. this.e1 = e1fn(this.es);
  14448. this.e2 = e2fn(this.es);
  14449. this.e3 = e3fn(this.es);
  14450. this.sinphi = Math.sin(this.lat1);
  14451. this.cosphi = Math.cos(this.lat1);
  14452. this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);
  14453. this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);
  14454. if (Math.abs(this.lat1 - this.lat2) < EPSLN) {
  14455. this.ns = this.sinphi;
  14456. }
  14457. else {
  14458. this.sinphi = Math.sin(this.lat2);
  14459. this.cosphi = Math.cos(this.lat2);
  14460. this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);
  14461. this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);
  14462. this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);
  14463. }
  14464. this.g = this.ml1 + this.ms1 / this.ns;
  14465. this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
  14466. this.rh = this.a * (this.g - this.ml0);
  14467. }
  14468. /* Equidistant Conic forward equations--mapping lat,long to x,y
  14469. -----------------------------------------------------------*/
  14470. function forward$22(p) {
  14471. var lon = p.x;
  14472. var lat = p.y;
  14473. var rh1;
  14474. /* Forward equations
  14475. -----------------*/
  14476. if (this.sphere) {
  14477. rh1 = this.a * (this.g - lat);
  14478. }
  14479. else {
  14480. var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
  14481. rh1 = this.a * (this.g - ml);
  14482. }
  14483. var theta = this.ns * adjust_lon(lon - this.long0);
  14484. var x = this.x0 + rh1 * Math.sin(theta);
  14485. var y = this.y0 + this.rh - rh1 * Math.cos(theta);
  14486. p.x = x;
  14487. p.y = y;
  14488. return p;
  14489. }
  14490. /* Inverse equations
  14491. -----------------*/
  14492. function inverse$22(p) {
  14493. p.x -= this.x0;
  14494. p.y = this.rh - p.y + this.y0;
  14495. var con, rh1, lat, lon;
  14496. if (this.ns >= 0) {
  14497. rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
  14498. con = 1;
  14499. }
  14500. else {
  14501. rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
  14502. con = -1;
  14503. }
  14504. var theta = 0;
  14505. if (rh1 !== 0) {
  14506. theta = Math.atan2(con * p.x, con * p.y);
  14507. }
  14508. if (this.sphere) {
  14509. lon = adjust_lon(this.long0 + theta / this.ns);
  14510. lat = adjust_lat(this.g - rh1 / this.a);
  14511. p.x = lon;
  14512. p.y = lat;
  14513. return p;
  14514. }
  14515. else {
  14516. var ml = this.g - rh1 / this.a;
  14517. lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
  14518. lon = adjust_lon(this.long0 + theta / this.ns);
  14519. p.x = lon;
  14520. p.y = lat;
  14521. return p;
  14522. }
  14523. }
  14524. var names$24 = ["Equidistant_Conic", "eqdc"];
  14525. var eqdc = {
  14526. init: init$23,
  14527. forward: forward$22,
  14528. inverse: inverse$22,
  14529. names: names$24
  14530. };
  14531. /* Initialize the Van Der Grinten projection
  14532. ----------------------------------------*/
  14533. function init$24() {
  14534. //this.R = 6370997; //Radius of earth
  14535. this.R = this.a;
  14536. }
  14537. function forward$23(p) {
  14538. var lon = p.x;
  14539. var lat = p.y;
  14540. /* Forward equations
  14541. -----------------*/
  14542. var dlon = adjust_lon(lon - this.long0);
  14543. var x, y;
  14544. if (Math.abs(lat) <= EPSLN) {
  14545. x = this.x0 + this.R * dlon;
  14546. y = this.y0;
  14547. }
  14548. var theta = asinz(2 * Math.abs(lat / Math.PI));
  14549. if ((Math.abs(dlon) <= EPSLN) || (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN)) {
  14550. x = this.x0;
  14551. if (lat >= 0) {
  14552. y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);
  14553. }
  14554. else {
  14555. y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);
  14556. }
  14557. // return(OK);
  14558. }
  14559. var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI));
  14560. var asq = al * al;
  14561. var sinth = Math.sin(theta);
  14562. var costh = Math.cos(theta);
  14563. var g = costh / (sinth + costh - 1);
  14564. var gsq = g * g;
  14565. var m = g * (2 / sinth - 1);
  14566. var msq = m * m;
  14567. var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);
  14568. if (dlon < 0) {
  14569. con = -con;
  14570. }
  14571. x = this.x0 + con;
  14572. //con = Math.abs(con / (Math.PI * this.R));
  14573. var q = asq + g;
  14574. con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);
  14575. if (lat >= 0) {
  14576. //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
  14577. y = this.y0 + con;
  14578. }
  14579. else {
  14580. //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
  14581. y = this.y0 - con;
  14582. }
  14583. p.x = x;
  14584. p.y = y;
  14585. return p;
  14586. }
  14587. /* Van Der Grinten inverse equations--mapping x,y to lat/long
  14588. ---------------------------------------------------------*/
  14589. function inverse$23(p) {
  14590. var lon, lat;
  14591. var xx, yy, xys, c1, c2, c3;
  14592. var a1;
  14593. var m1;
  14594. var con;
  14595. var th1;
  14596. var d;
  14597. /* inverse equations
  14598. -----------------*/
  14599. p.x -= this.x0;
  14600. p.y -= this.y0;
  14601. con = Math.PI * this.R;
  14602. xx = p.x / con;
  14603. yy = p.y / con;
  14604. xys = xx * xx + yy * yy;
  14605. c1 = -Math.abs(yy) * (1 + xys);
  14606. c2 = c1 - 2 * yy * yy + xx * xx;
  14607. c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;
  14608. d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;
  14609. a1 = (c1 - c2 * c2 / 3 / c3) / c3;
  14610. m1 = 2 * Math.sqrt(-a1 / 3);
  14611. con = ((3 * d) / a1) / m1;
  14612. if (Math.abs(con) > 1) {
  14613. if (con >= 0) {
  14614. con = 1;
  14615. }
  14616. else {
  14617. con = -1;
  14618. }
  14619. }
  14620. th1 = Math.acos(con) / 3;
  14621. if (p.y >= 0) {
  14622. lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
  14623. }
  14624. else {
  14625. lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
  14626. }
  14627. if (Math.abs(xx) < EPSLN) {
  14628. lon = this.long0;
  14629. }
  14630. else {
  14631. lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);
  14632. }
  14633. p.x = lon;
  14634. p.y = lat;
  14635. return p;
  14636. }
  14637. var names$25 = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
  14638. var vandg = {
  14639. init: init$24,
  14640. forward: forward$23,
  14641. inverse: inverse$23,
  14642. names: names$25
  14643. };
  14644. function init$25() {
  14645. this.sin_p12 = Math.sin(this.lat0);
  14646. this.cos_p12 = Math.cos(this.lat0);
  14647. }
  14648. function forward$24(p) {
  14649. var lon = p.x;
  14650. var lat = p.y;
  14651. var sinphi = Math.sin(p.y);
  14652. var cosphi = Math.cos(p.y);
  14653. var dlon = adjust_lon(lon - this.long0);
  14654. var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5;
  14655. if (this.sphere) {
  14656. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  14657. //North Pole case
  14658. p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);
  14659. p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);
  14660. return p;
  14661. }
  14662. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  14663. //South Pole case
  14664. p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);
  14665. p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);
  14666. return p;
  14667. }
  14668. else {
  14669. //default case
  14670. cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);
  14671. c = Math.acos(cos_c);
  14672. kp = c ? c / Math.sin(c) : 1;
  14673. p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);
  14674. p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));
  14675. return p;
  14676. }
  14677. }
  14678. else {
  14679. e0 = e0fn(this.es);
  14680. e1 = e1fn(this.es);
  14681. e2 = e2fn(this.es);
  14682. e3 = e3fn(this.es);
  14683. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  14684. //North Pole case
  14685. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  14686. Ml = this.a * mlfn(e0, e1, e2, e3, lat);
  14687. p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);
  14688. p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);
  14689. return p;
  14690. }
  14691. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  14692. //South Pole case
  14693. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  14694. Ml = this.a * mlfn(e0, e1, e2, e3, lat);
  14695. p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);
  14696. p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);
  14697. return p;
  14698. }
  14699. else {
  14700. //Default case
  14701. tanphi = sinphi / cosphi;
  14702. Nl1 = gN(this.a, this.e, this.sin_p12);
  14703. Nl = gN(this.a, this.e, sinphi);
  14704. psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));
  14705. Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));
  14706. if (Az === 0) {
  14707. s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
  14708. }
  14709. else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {
  14710. s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
  14711. }
  14712. else {
  14713. s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));
  14714. }
  14715. G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);
  14716. H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);
  14717. GH = G * H;
  14718. Hs = H * H;
  14719. s2 = s * s;
  14720. s3 = s2 * s;
  14721. s4 = s3 * s;
  14722. s5 = s4 * s;
  14723. c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH);
  14724. p.x = this.x0 + c * Math.sin(Az);
  14725. p.y = this.y0 + c * Math.cos(Az);
  14726. return p;
  14727. }
  14728. }
  14729. }
  14730. function inverse$24(p) {
  14731. p.x -= this.x0;
  14732. p.y -= this.y0;
  14733. var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi;
  14734. if (this.sphere) {
  14735. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  14736. if (rh > (2 * HALF_PI * this.a)) {
  14737. return;
  14738. }
  14739. z = rh / this.a;
  14740. sinz = Math.sin(z);
  14741. cosz = Math.cos(z);
  14742. lon = this.long0;
  14743. if (Math.abs(rh) <= EPSLN) {
  14744. lat = this.lat0;
  14745. }
  14746. else {
  14747. lat = asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);
  14748. con = Math.abs(this.lat0) - HALF_PI;
  14749. if (Math.abs(con) <= EPSLN) {
  14750. if (this.lat0 >= 0) {
  14751. lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
  14752. }
  14753. else {
  14754. lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
  14755. }
  14756. }
  14757. else {
  14758. /*con = cosz - this.sin_p12 * Math.sin(lat);
  14759. if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) {
  14760. //no-op, just keep the lon value as is
  14761. } else {
  14762. var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));
  14763. lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));
  14764. }*/
  14765. lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));
  14766. }
  14767. }
  14768. p.x = lon;
  14769. p.y = lat;
  14770. return p;
  14771. }
  14772. else {
  14773. e0 = e0fn(this.es);
  14774. e1 = e1fn(this.es);
  14775. e2 = e2fn(this.es);
  14776. e3 = e3fn(this.es);
  14777. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  14778. //North pole case
  14779. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  14780. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  14781. M = Mlp - rh;
  14782. lat = imlfn(M / this.a, e0, e1, e2, e3);
  14783. lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
  14784. p.x = lon;
  14785. p.y = lat;
  14786. return p;
  14787. }
  14788. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  14789. //South pole case
  14790. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  14791. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  14792. M = rh - Mlp;
  14793. lat = imlfn(M / this.a, e0, e1, e2, e3);
  14794. lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
  14795. p.x = lon;
  14796. p.y = lat;
  14797. return p;
  14798. }
  14799. else {
  14800. //default case
  14801. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  14802. Az = Math.atan2(p.x, p.y);
  14803. N1 = gN(this.a, this.e, this.sin_p12);
  14804. cosAz = Math.cos(Az);
  14805. tmp = this.e * this.cos_p12 * cosAz;
  14806. A = -tmp * tmp / (1 - this.es);
  14807. B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);
  14808. D = rh / N1;
  14809. Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;
  14810. F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;
  14811. psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);
  14812. lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));
  14813. sinpsi = Math.sin(psi);
  14814. lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));
  14815. p.x = lon;
  14816. p.y = lat;
  14817. return p;
  14818. }
  14819. }
  14820. }
  14821. var names$26 = ["Azimuthal_Equidistant", "aeqd"];
  14822. var aeqd = {
  14823. init: init$25,
  14824. forward: forward$24,
  14825. inverse: inverse$24,
  14826. names: names$26
  14827. };
  14828. function init$26() {
  14829. //double temp; /* temporary variable */
  14830. /* Place parameters in static storage for common use
  14831. -------------------------------------------------*/
  14832. this.sin_p14 = Math.sin(this.lat0);
  14833. this.cos_p14 = Math.cos(this.lat0);
  14834. }
  14835. /* Orthographic forward equations--mapping lat,long to x,y
  14836. ---------------------------------------------------*/
  14837. function forward$25(p) {
  14838. var sinphi, cosphi; /* sin and cos value */
  14839. var dlon; /* delta longitude value */
  14840. var coslon; /* cos of longitude */
  14841. var ksp; /* scale factor */
  14842. var g, x, y;
  14843. var lon = p.x;
  14844. var lat = p.y;
  14845. /* Forward equations
  14846. -----------------*/
  14847. dlon = adjust_lon(lon - this.long0);
  14848. sinphi = Math.sin(lat);
  14849. cosphi = Math.cos(lat);
  14850. coslon = Math.cos(dlon);
  14851. g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
  14852. ksp = 1;
  14853. if ((g > 0) || (Math.abs(g) <= EPSLN)) {
  14854. x = this.a * ksp * cosphi * Math.sin(dlon);
  14855. y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
  14856. }
  14857. p.x = x;
  14858. p.y = y;
  14859. return p;
  14860. }
  14861. function inverse$25(p) {
  14862. var rh; /* height above ellipsoid */
  14863. var z; /* angle */
  14864. var sinz, cosz; /* sin of z and cos of z */
  14865. var con;
  14866. var lon, lat;
  14867. /* Inverse equations
  14868. -----------------*/
  14869. p.x -= this.x0;
  14870. p.y -= this.y0;
  14871. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  14872. z = asinz(rh / this.a);
  14873. sinz = Math.sin(z);
  14874. cosz = Math.cos(z);
  14875. lon = this.long0;
  14876. if (Math.abs(rh) <= EPSLN) {
  14877. lat = this.lat0;
  14878. p.x = lon;
  14879. p.y = lat;
  14880. return p;
  14881. }
  14882. lat = asinz(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh);
  14883. con = Math.abs(this.lat0) - HALF_PI;
  14884. if (Math.abs(con) <= EPSLN) {
  14885. if (this.lat0 >= 0) {
  14886. lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
  14887. }
  14888. else {
  14889. lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
  14890. }
  14891. p.x = lon;
  14892. p.y = lat;
  14893. return p;
  14894. }
  14895. lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));
  14896. p.x = lon;
  14897. p.y = lat;
  14898. return p;
  14899. }
  14900. var names$27 = ["ortho"];
  14901. var ortho = {
  14902. init: init$26,
  14903. forward: forward$25,
  14904. inverse: inverse$25,
  14905. names: names$27
  14906. };
  14907. // QSC projection rewritten from the original PROJ4
  14908. // https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c
  14909. /* constants */
  14910. var FACE_ENUM = {
  14911. FRONT: 1,
  14912. RIGHT: 2,
  14913. BACK: 3,
  14914. LEFT: 4,
  14915. TOP: 5,
  14916. BOTTOM: 6
  14917. };
  14918. var AREA_ENUM = {
  14919. AREA_0: 1,
  14920. AREA_1: 2,
  14921. AREA_2: 3,
  14922. AREA_3: 4
  14923. };
  14924. function init$27() {
  14925. this.x0 = this.x0 || 0;
  14926. this.y0 = this.y0 || 0;
  14927. this.lat0 = this.lat0 || 0;
  14928. this.long0 = this.long0 || 0;
  14929. this.lat_ts = this.lat_ts || 0;
  14930. this.title = this.title || "Quadrilateralized Spherical Cube";
  14931. /* Determine the cube face from the center of projection. */
  14932. if (this.lat0 >= HALF_PI - FORTPI / 2.0) {
  14933. this.face = FACE_ENUM.TOP;
  14934. } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {
  14935. this.face = FACE_ENUM.BOTTOM;
  14936. } else if (Math.abs(this.long0) <= FORTPI) {
  14937. this.face = FACE_ENUM.FRONT;
  14938. } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {
  14939. this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;
  14940. } else {
  14941. this.face = FACE_ENUM.BACK;
  14942. }
  14943. /* Fill in useful values for the ellipsoid <-> sphere shift
  14944. * described in [LK12]. */
  14945. if (this.es !== 0) {
  14946. this.one_minus_f = 1 - (this.a - this.b) / this.a;
  14947. this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;
  14948. }
  14949. }
  14950. // QSC forward equations--mapping lat,long to x,y
  14951. // -----------------------------------------------------------------
  14952. function forward$26(p) {
  14953. var xy = {x: 0, y: 0};
  14954. var lat, lon;
  14955. var theta, phi;
  14956. var t, mu;
  14957. /* nu; */
  14958. var area = {value: 0};
  14959. // move lon according to projection's lon
  14960. p.x -= this.long0;
  14961. /* Convert the geodetic latitude to a geocentric latitude.
  14962. * This corresponds to the shift from the ellipsoid to the sphere
  14963. * described in [LK12]. */
  14964. if (this.es !== 0) {//if (P->es != 0) {
  14965. lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));
  14966. } else {
  14967. lat = p.y;
  14968. }
  14969. /* Convert the input lat, lon into theta, phi as used by QSC.
  14970. * This depends on the cube face and the area on it.
  14971. * For the top and bottom face, we can compute theta and phi
  14972. * directly from phi, lam. For the other faces, we must use
  14973. * unit sphere cartesian coordinates as an intermediate step. */
  14974. lon = p.x; //lon = lp.lam;
  14975. if (this.face === FACE_ENUM.TOP) {
  14976. phi = HALF_PI - lat;
  14977. if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
  14978. area.value = AREA_ENUM.AREA_0;
  14979. theta = lon - HALF_PI;
  14980. } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
  14981. area.value = AREA_ENUM.AREA_1;
  14982. theta = (lon > 0.0 ? lon - SPI : lon + SPI);
  14983. } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
  14984. area.value = AREA_ENUM.AREA_2;
  14985. theta = lon + HALF_PI;
  14986. } else {
  14987. area.value = AREA_ENUM.AREA_3;
  14988. theta = lon;
  14989. }
  14990. } else if (this.face === FACE_ENUM.BOTTOM) {
  14991. phi = HALF_PI + lat;
  14992. if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
  14993. area.value = AREA_ENUM.AREA_0;
  14994. theta = -lon + HALF_PI;
  14995. } else if (lon < FORTPI && lon >= -FORTPI) {
  14996. area.value = AREA_ENUM.AREA_1;
  14997. theta = -lon;
  14998. } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {
  14999. area.value = AREA_ENUM.AREA_2;
  15000. theta = -lon - HALF_PI;
  15001. } else {
  15002. area.value = AREA_ENUM.AREA_3;
  15003. theta = (lon > 0.0 ? -lon + SPI : -lon - SPI);
  15004. }
  15005. } else {
  15006. var q, r, s;
  15007. var sinlat, coslat;
  15008. var sinlon, coslon;
  15009. if (this.face === FACE_ENUM.RIGHT) {
  15010. lon = qsc_shift_lon_origin(lon, +HALF_PI);
  15011. } else if (this.face === FACE_ENUM.BACK) {
  15012. lon = qsc_shift_lon_origin(lon, +SPI);
  15013. } else if (this.face === FACE_ENUM.LEFT) {
  15014. lon = qsc_shift_lon_origin(lon, -HALF_PI);
  15015. }
  15016. sinlat = Math.sin(lat);
  15017. coslat = Math.cos(lat);
  15018. sinlon = Math.sin(lon);
  15019. coslon = Math.cos(lon);
  15020. q = coslat * coslon;
  15021. r = coslat * sinlon;
  15022. s = sinlat;
  15023. if (this.face === FACE_ENUM.FRONT) {
  15024. phi = Math.acos(q);
  15025. theta = qsc_fwd_equat_face_theta(phi, s, r, area);
  15026. } else if (this.face === FACE_ENUM.RIGHT) {
  15027. phi = Math.acos(r);
  15028. theta = qsc_fwd_equat_face_theta(phi, s, -q, area);
  15029. } else if (this.face === FACE_ENUM.BACK) {
  15030. phi = Math.acos(-q);
  15031. theta = qsc_fwd_equat_face_theta(phi, s, -r, area);
  15032. } else if (this.face === FACE_ENUM.LEFT) {
  15033. phi = Math.acos(-r);
  15034. theta = qsc_fwd_equat_face_theta(phi, s, q, area);
  15035. } else {
  15036. /* Impossible */
  15037. phi = theta = 0;
  15038. area.value = AREA_ENUM.AREA_0;
  15039. }
  15040. }
  15041. /* Compute mu and nu for the area of definition.
  15042. * For mu, see Eq. (3-21) in [OL76], but note the typos:
  15043. * compare with Eq. (3-14). For nu, see Eq. (3-38). */
  15044. mu = Math.atan((12 / SPI) * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
  15045. t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
  15046. /* Apply the result to the real area. */
  15047. if (area.value === AREA_ENUM.AREA_1) {
  15048. mu += HALF_PI;
  15049. } else if (area.value === AREA_ENUM.AREA_2) {
  15050. mu += SPI;
  15051. } else if (area.value === AREA_ENUM.AREA_3) {
  15052. mu += 1.5 * SPI;
  15053. }
  15054. /* Now compute x, y from mu and nu */
  15055. xy.x = t * Math.cos(mu);
  15056. xy.y = t * Math.sin(mu);
  15057. xy.x = xy.x * this.a + this.x0;
  15058. xy.y = xy.y * this.a + this.y0;
  15059. p.x = xy.x;
  15060. p.y = xy.y;
  15061. return p;
  15062. }
  15063. // QSC inverse equations--mapping x,y to lat/long
  15064. // -----------------------------------------------------------------
  15065. function inverse$26(p) {
  15066. var lp = {lam: 0, phi: 0};
  15067. var mu, nu, cosmu, tannu;
  15068. var tantheta, theta, cosphi, phi;
  15069. var t;
  15070. var area = {value: 0};
  15071. /* de-offset */
  15072. p.x = (p.x - this.x0) / this.a;
  15073. p.y = (p.y - this.y0) / this.a;
  15074. /* Convert the input x, y to the mu and nu angles as used by QSC.
  15075. * This depends on the area of the cube face. */
  15076. nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
  15077. mu = Math.atan2(p.y, p.x);
  15078. if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {
  15079. area.value = AREA_ENUM.AREA_0;
  15080. } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {
  15081. area.value = AREA_ENUM.AREA_1;
  15082. mu -= HALF_PI;
  15083. } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {
  15084. area.value = AREA_ENUM.AREA_2;
  15085. mu = (mu < 0.0 ? mu + SPI : mu - SPI);
  15086. } else {
  15087. area.value = AREA_ENUM.AREA_3;
  15088. mu += HALF_PI;
  15089. }
  15090. /* Compute phi and theta for the area of definition.
  15091. * The inverse projection is not described in the original paper, but some
  15092. * good hints can be found here (as of 2011-12-14):
  15093. * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302
  15094. * (search for "Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>") */
  15095. t = (SPI / 12) * Math.tan(mu);
  15096. tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2)));
  15097. theta = Math.atan(tantheta);
  15098. cosmu = Math.cos(mu);
  15099. tannu = Math.tan(nu);
  15100. cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));
  15101. if (cosphi < -1) {
  15102. cosphi = -1;
  15103. } else if (cosphi > +1) {
  15104. cosphi = +1;
  15105. }
  15106. /* Apply the result to the real area on the cube face.
  15107. * For the top and bottom face, we can compute phi and lam directly.
  15108. * For the other faces, we must use unit sphere cartesian coordinates
  15109. * as an intermediate step. */
  15110. if (this.face === FACE_ENUM.TOP) {
  15111. phi = Math.acos(cosphi);
  15112. lp.phi = HALF_PI - phi;
  15113. if (area.value === AREA_ENUM.AREA_0) {
  15114. lp.lam = theta + HALF_PI;
  15115. } else if (area.value === AREA_ENUM.AREA_1) {
  15116. lp.lam = (theta < 0.0 ? theta + SPI : theta - SPI);
  15117. } else if (area.value === AREA_ENUM.AREA_2) {
  15118. lp.lam = theta - HALF_PI;
  15119. } else /* area.value == AREA_ENUM.AREA_3 */ {
  15120. lp.lam = theta;
  15121. }
  15122. } else if (this.face === FACE_ENUM.BOTTOM) {
  15123. phi = Math.acos(cosphi);
  15124. lp.phi = phi - HALF_PI;
  15125. if (area.value === AREA_ENUM.AREA_0) {
  15126. lp.lam = -theta + HALF_PI;
  15127. } else if (area.value === AREA_ENUM.AREA_1) {
  15128. lp.lam = -theta;
  15129. } else if (area.value === AREA_ENUM.AREA_2) {
  15130. lp.lam = -theta - HALF_PI;
  15131. } else /* area.value == AREA_ENUM.AREA_3 */ {
  15132. lp.lam = (theta < 0.0 ? -theta - SPI : -theta + SPI);
  15133. }
  15134. } else {
  15135. /* Compute phi and lam via cartesian unit sphere coordinates. */
  15136. var q, r, s;
  15137. q = cosphi;
  15138. t = q * q;
  15139. if (t >= 1) {
  15140. s = 0;
  15141. } else {
  15142. s = Math.sqrt(1 - t) * Math.sin(theta);
  15143. }
  15144. t += s * s;
  15145. if (t >= 1) {
  15146. r = 0;
  15147. } else {
  15148. r = Math.sqrt(1 - t);
  15149. }
  15150. /* Rotate q,r,s into the correct area. */
  15151. if (area.value === AREA_ENUM.AREA_1) {
  15152. t = r;
  15153. r = -s;
  15154. s = t;
  15155. } else if (area.value === AREA_ENUM.AREA_2) {
  15156. r = -r;
  15157. s = -s;
  15158. } else if (area.value === AREA_ENUM.AREA_3) {
  15159. t = r;
  15160. r = s;
  15161. s = -t;
  15162. }
  15163. /* Rotate q,r,s into the correct cube face. */
  15164. if (this.face === FACE_ENUM.RIGHT) {
  15165. t = q;
  15166. q = -r;
  15167. r = t;
  15168. } else if (this.face === FACE_ENUM.BACK) {
  15169. q = -q;
  15170. r = -r;
  15171. } else if (this.face === FACE_ENUM.LEFT) {
  15172. t = q;
  15173. q = r;
  15174. r = -t;
  15175. }
  15176. /* Now compute phi and lam from the unit sphere coordinates. */
  15177. lp.phi = Math.acos(-s) - HALF_PI;
  15178. lp.lam = Math.atan2(r, q);
  15179. if (this.face === FACE_ENUM.RIGHT) {
  15180. lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
  15181. } else if (this.face === FACE_ENUM.BACK) {
  15182. lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
  15183. } else if (this.face === FACE_ENUM.LEFT) {
  15184. lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
  15185. }
  15186. }
  15187. /* Apply the shift from the sphere to the ellipsoid as described
  15188. * in [LK12]. */
  15189. if (this.es !== 0) {
  15190. var invert_sign;
  15191. var tanphi, xa;
  15192. invert_sign = (lp.phi < 0 ? 1 : 0);
  15193. tanphi = Math.tan(lp.phi);
  15194. xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);
  15195. lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));
  15196. if (invert_sign) {
  15197. lp.phi = -lp.phi;
  15198. }
  15199. }
  15200. lp.lam += this.long0;
  15201. p.x = lp.lam;
  15202. p.y = lp.phi;
  15203. return p;
  15204. }
  15205. /* Helper function for forward projection: compute the theta angle
  15206. * and determine the area number. */
  15207. function qsc_fwd_equat_face_theta(phi, y, x, area) {
  15208. var theta;
  15209. if (phi < EPSLN) {
  15210. area.value = AREA_ENUM.AREA_0;
  15211. theta = 0.0;
  15212. } else {
  15213. theta = Math.atan2(y, x);
  15214. if (Math.abs(theta) <= FORTPI) {
  15215. area.value = AREA_ENUM.AREA_0;
  15216. } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
  15217. area.value = AREA_ENUM.AREA_1;
  15218. theta -= HALF_PI;
  15219. } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
  15220. area.value = AREA_ENUM.AREA_2;
  15221. theta = (theta >= 0.0 ? theta - SPI : theta + SPI);
  15222. } else {
  15223. area.value = AREA_ENUM.AREA_3;
  15224. theta += HALF_PI;
  15225. }
  15226. }
  15227. return theta;
  15228. }
  15229. /* Helper function: shift the longitude. */
  15230. function qsc_shift_lon_origin(lon, offset) {
  15231. var slon = lon + offset;
  15232. if (slon < -SPI) {
  15233. slon += TWO_PI;
  15234. } else if (slon > +SPI) {
  15235. slon -= TWO_PI;
  15236. }
  15237. return slon;
  15238. }
  15239. var names$28 = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
  15240. var qsc = {
  15241. init: init$27,
  15242. forward: forward$26,
  15243. inverse: inverse$26,
  15244. names: names$28
  15245. };
  15246. // Robinson projection
  15247. // Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c
  15248. // Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
  15249. var COEFS_X = [
  15250. [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],
  15251. [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],
  15252. [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],
  15253. [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],
  15254. [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],
  15255. [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],
  15256. [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],
  15257. [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],
  15258. [0.9216, -0.00467746, -0.00010457, 4.81243e-06],
  15259. [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],
  15260. [0.8679, -0.00609363, -0.000113898, 3.32484e-06],
  15261. [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],
  15262. [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],
  15263. [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],
  15264. [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],
  15265. [0.6732, -0.00986209, -0.000199569, 1.91974e-05],
  15266. [0.6213, -0.010418, 8.83923e-05, 6.24051e-06],
  15267. [0.5722, -0.00906601, 0.000182, 6.24051e-06],
  15268. [0.5322, -0.00677797, 0.000275608, 6.24051e-06]
  15269. ];
  15270. var COEFS_Y = [
  15271. [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],
  15272. [0.0620, 0.0124, -1.26793e-09, 4.22642e-10],
  15273. [0.1240, 0.0124, 5.07171e-09, -1.60604e-09],
  15274. [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],
  15275. [0.2480, 0.0124002, 7.10039e-08, -2.24e-08],
  15276. [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],
  15277. [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],
  15278. [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],
  15279. [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],
  15280. [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],
  15281. [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],
  15282. [0.6769, 0.011713, -3.20223e-05, -5.16405e-07],
  15283. [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],
  15284. [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],
  15285. [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],
  15286. [0.8936, 0.00969686, -6.4636e-05, -8.547e-06],
  15287. [0.9394, 0.00840947, -0.000192841, -4.2106e-06],
  15288. [0.9761, 0.00616527, -0.000256, -4.2106e-06],
  15289. [1.0000, 0.00328947, -0.000319159, -4.2106e-06]
  15290. ];
  15291. var FXC = 0.8487;
  15292. var FYC = 1.3523;
  15293. var C1 = R2D/5; // rad to 5-degree interval
  15294. var RC1 = 1/C1;
  15295. var NODES = 18;
  15296. var poly3_val = function(coefs, x) {
  15297. return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));
  15298. };
  15299. var poly3_der = function(coefs, x) {
  15300. return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
  15301. };
  15302. function newton_rapshon(f_df, start, max_err, iters) {
  15303. var x = start;
  15304. for (; iters; --iters) {
  15305. var upd = f_df(x);
  15306. x -= upd;
  15307. if (Math.abs(upd) < max_err) {
  15308. break;
  15309. }
  15310. }
  15311. return x;
  15312. }
  15313. function init$28() {
  15314. this.x0 = this.x0 || 0;
  15315. this.y0 = this.y0 || 0;
  15316. this.long0 = this.long0 || 0;
  15317. this.es = 0;
  15318. this.title = this.title || "Robinson";
  15319. }
  15320. function forward$27(ll) {
  15321. var lon = adjust_lon(ll.x - this.long0);
  15322. var dphi = Math.abs(ll.y);
  15323. var i = Math.floor(dphi * C1);
  15324. if (i < 0) {
  15325. i = 0;
  15326. } else if (i >= NODES) {
  15327. i = NODES - 1;
  15328. }
  15329. dphi = R2D * (dphi - RC1 * i);
  15330. var xy = {
  15331. x: poly3_val(COEFS_X[i], dphi) * lon,
  15332. y: poly3_val(COEFS_Y[i], dphi)
  15333. };
  15334. if (ll.y < 0) {
  15335. xy.y = -xy.y;
  15336. }
  15337. xy.x = xy.x * this.a * FXC + this.x0;
  15338. xy.y = xy.y * this.a * FYC + this.y0;
  15339. return xy;
  15340. }
  15341. function inverse$27(xy) {
  15342. var ll = {
  15343. x: (xy.x - this.x0) / (this.a * FXC),
  15344. y: Math.abs(xy.y - this.y0) / (this.a * FYC)
  15345. };
  15346. if (ll.y >= 1) { // pathologic case
  15347. ll.x /= COEFS_X[NODES][0];
  15348. ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
  15349. } else {
  15350. // find table interval
  15351. var i = Math.floor(ll.y * NODES);
  15352. if (i < 0) {
  15353. i = 0;
  15354. } else if (i >= NODES) {
  15355. i = NODES - 1;
  15356. }
  15357. for (;;) {
  15358. if (COEFS_Y[i][0] > ll.y) {
  15359. --i;
  15360. } else if (COEFS_Y[i+1][0] <= ll.y) {
  15361. ++i;
  15362. } else {
  15363. break;
  15364. }
  15365. }
  15366. // linear interpolation in 5 degree interval
  15367. var coefs = COEFS_Y[i];
  15368. var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]);
  15369. // find t so that poly3_val(coefs, t) = ll.y
  15370. t = newton_rapshon(function(x) {
  15371. return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
  15372. }, t, EPSLN, 100);
  15373. ll.x /= poly3_val(COEFS_X[i], t);
  15374. ll.y = (5 * i + t) * D2R;
  15375. if (xy.y < 0) {
  15376. ll.y = -ll.y;
  15377. }
  15378. }
  15379. ll.x = adjust_lon(ll.x + this.long0);
  15380. return ll;
  15381. }
  15382. var names$29 = ["Robinson", "robin"];
  15383. var robin = {
  15384. init: init$28,
  15385. forward: forward$27,
  15386. inverse: inverse$27,
  15387. names: names$29
  15388. };
  15389. function init$29() {
  15390. this.name = 'geocent';
  15391. }
  15392. function forward$28(p) {
  15393. var point = geodeticToGeocentric(p, this.es, this.a);
  15394. return point;
  15395. }
  15396. function inverse$28(p) {
  15397. var point = geocentricToGeodetic(p, this.es, this.a, this.b);
  15398. return point;
  15399. }
  15400. var names$30 = ["Geocentric", 'geocentric', "geocent", "Geocent"];
  15401. var geocent = {
  15402. init: init$29,
  15403. forward: forward$28,
  15404. inverse: inverse$28,
  15405. names: names$30
  15406. };
  15407. var mode = {
  15408. N_POLE: 0,
  15409. S_POLE: 1,
  15410. EQUIT: 2,
  15411. OBLIQ: 3
  15412. };
  15413. var params = {
  15414. h: { def: 100000, num: true }, // default is Karman line, no default in PROJ.7
  15415. azi: { def: 0, num: true, degrees: true }, // default is North
  15416. tilt: { def: 0, num: true, degrees: true }, // default is Nadir
  15417. long0: { def: 0, num: true }, // default is Greenwich, conversion to rad is automatic
  15418. lat0: { def: 0, num: true } // default is Equator, conversion to rad is automatic
  15419. };
  15420. function init$30() {
  15421. Object.keys(params).forEach(function (p) {
  15422. if (typeof this[p] === "undefined") {
  15423. this[p] = params[p].def;
  15424. } else if (params[p].num && isNaN(this[p])) {
  15425. throw new Error("Invalid parameter value, must be numeric " + p + " = " + this[p]);
  15426. } else if (params[p].num) {
  15427. this[p] = parseFloat(this[p]);
  15428. }
  15429. if (params[p].degrees) {
  15430. this[p] = this[p] * D2R;
  15431. }
  15432. }.bind(this));
  15433. if (Math.abs((Math.abs(this.lat0) - HALF_PI)) < EPSLN) {
  15434. this.mode = this.lat0 < 0 ? mode.S_POLE : mode.N_POLE;
  15435. } else if (Math.abs(this.lat0) < EPSLN) {
  15436. this.mode = mode.EQUIT;
  15437. } else {
  15438. this.mode = mode.OBLIQ;
  15439. this.sinph0 = Math.sin(this.lat0);
  15440. this.cosph0 = Math.cos(this.lat0);
  15441. }
  15442. this.pn1 = this.h / this.a; // Normalize relative to the Earth's radius
  15443. if (this.pn1 <= 0 || this.pn1 > 1e10) {
  15444. throw new Error("Invalid height");
  15445. }
  15446. this.p = 1 + this.pn1;
  15447. this.rp = 1 / this.p;
  15448. this.h1 = 1 / this.pn1;
  15449. this.pfact = (this.p + 1) * this.h1;
  15450. this.es = 0;
  15451. var omega = this.tilt;
  15452. var gamma = this.azi;
  15453. this.cg = Math.cos(gamma);
  15454. this.sg = Math.sin(gamma);
  15455. this.cw = Math.cos(omega);
  15456. this.sw = Math.sin(omega);
  15457. }
  15458. function forward$29(p) {
  15459. p.x -= this.long0;
  15460. var sinphi = Math.sin(p.y);
  15461. var cosphi = Math.cos(p.y);
  15462. var coslam = Math.cos(p.x);
  15463. var x, y;
  15464. switch (this.mode) {
  15465. case mode.OBLIQ:
  15466. y = this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
  15467. break;
  15468. case mode.EQUIT:
  15469. y = cosphi * coslam;
  15470. break;
  15471. case mode.S_POLE:
  15472. y = -sinphi;
  15473. break;
  15474. case mode.N_POLE:
  15475. y = sinphi;
  15476. break;
  15477. }
  15478. y = this.pn1 / (this.p - y);
  15479. x = y * cosphi * Math.sin(p.x);
  15480. switch (this.mode) {
  15481. case mode.OBLIQ:
  15482. y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
  15483. break;
  15484. case mode.EQUIT:
  15485. y *= sinphi;
  15486. break;
  15487. case mode.N_POLE:
  15488. y *= -(cosphi * coslam);
  15489. break;
  15490. case mode.S_POLE:
  15491. y *= cosphi * coslam;
  15492. break;
  15493. }
  15494. // Tilt
  15495. var yt, ba;
  15496. yt = y * this.cg + x * this.sg;
  15497. ba = 1 / (yt * this.sw * this.h1 + this.cw);
  15498. x = (x * this.cg - y * this.sg) * this.cw * ba;
  15499. y = yt * ba;
  15500. p.x = x * this.a;
  15501. p.y = y * this.a;
  15502. return p;
  15503. }
  15504. function inverse$29(p) {
  15505. p.x /= this.a;
  15506. p.y /= this.a;
  15507. var r = { x: p.x, y: p.y };
  15508. // Un-Tilt
  15509. var bm, bq, yt;
  15510. yt = 1 / (this.pn1 - p.y * this.sw);
  15511. bm = this.pn1 * p.x * yt;
  15512. bq = this.pn1 * p.y * this.cw * yt;
  15513. p.x = bm * this.cg + bq * this.sg;
  15514. p.y = bq * this.cg - bm * this.sg;
  15515. var rh = hypot(p.x, p.y);
  15516. if (Math.abs(rh) < EPSLN) {
  15517. r.x = 0;
  15518. r.y = p.y;
  15519. } else {
  15520. var cosz, sinz;
  15521. sinz = 1 - rh * rh * this.pfact;
  15522. sinz = (this.p - Math.sqrt(sinz)) / (this.pn1 / rh + rh / this.pn1);
  15523. cosz = Math.sqrt(1 - sinz * sinz);
  15524. switch (this.mode) {
  15525. case mode.OBLIQ:
  15526. r.y = Math.asin(cosz * this.sinph0 + p.y * sinz * this.cosph0 / rh);
  15527. p.y = (cosz - this.sinph0 * Math.sin(r.y)) * rh;
  15528. p.x *= sinz * this.cosph0;
  15529. break;
  15530. case mode.EQUIT:
  15531. r.y = Math.asin(p.y * sinz / rh);
  15532. p.y = cosz * rh;
  15533. p.x *= sinz;
  15534. break;
  15535. case mode.N_POLE:
  15536. r.y = Math.asin(cosz);
  15537. p.y = -p.y;
  15538. break;
  15539. case mode.S_POLE:
  15540. r.y = -Math.asin(cosz);
  15541. break;
  15542. }
  15543. r.x = Math.atan2(p.x, p.y);
  15544. }
  15545. p.x = r.x + this.long0;
  15546. p.y = r.y;
  15547. return p;
  15548. }
  15549. var names$31 = ["Tilted_Perspective", "tpers"];
  15550. var tpers = {
  15551. init: init$30,
  15552. forward: forward$29,
  15553. inverse: inverse$29,
  15554. names: names$31
  15555. };
  15556. function init$31() {
  15557. this.flip_axis = (this.sweep === 'x' ? 1 : 0);
  15558. this.h = Number(this.h);
  15559. this.radius_g_1 = this.h / this.a;
  15560. if (this.radius_g_1 <= 0 || this.radius_g_1 > 1e10) {
  15561. throw new Error();
  15562. }
  15563. this.radius_g = 1.0 + this.radius_g_1;
  15564. this.C = this.radius_g * this.radius_g - 1.0;
  15565. if (this.es !== 0.0) {
  15566. var one_es = 1.0 - this.es;
  15567. var rone_es = 1 / one_es;
  15568. this.radius_p = Math.sqrt(one_es);
  15569. this.radius_p2 = one_es;
  15570. this.radius_p_inv2 = rone_es;
  15571. this.shape = 'ellipse'; // Use as a condition in the forward and inverse functions.
  15572. } else {
  15573. this.radius_p = 1.0;
  15574. this.radius_p2 = 1.0;
  15575. this.radius_p_inv2 = 1.0;
  15576. this.shape = 'sphere'; // Use as a condition in the forward and inverse functions.
  15577. }
  15578. if (!this.title) {
  15579. this.title = "Geostationary Satellite View";
  15580. }
  15581. }
  15582. function forward$30(p) {
  15583. var lon = p.x;
  15584. var lat = p.y;
  15585. var tmp, v_x, v_y, v_z;
  15586. lon = lon - this.long0;
  15587. if (this.shape === 'ellipse') {
  15588. lat = Math.atan(this.radius_p2 * Math.tan(lat));
  15589. var r = this.radius_p / hypot(this.radius_p * Math.cos(lat), Math.sin(lat));
  15590. v_x = r * Math.cos(lon) * Math.cos(lat);
  15591. v_y = r * Math.sin(lon) * Math.cos(lat);
  15592. v_z = r * Math.sin(lat);
  15593. if (((this.radius_g - v_x) * v_x - v_y * v_y - v_z * v_z * this.radius_p_inv2) < 0.0) {
  15594. p.x = Number.NaN;
  15595. p.y = Number.NaN;
  15596. return p;
  15597. }
  15598. tmp = this.radius_g - v_x;
  15599. if (this.flip_axis) {
  15600. p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
  15601. p.y = this.radius_g_1 * Math.atan(v_z / tmp);
  15602. } else {
  15603. p.x = this.radius_g_1 * Math.atan(v_y / tmp);
  15604. p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
  15605. }
  15606. } else if (this.shape === 'sphere') {
  15607. tmp = Math.cos(lat);
  15608. v_x = Math.cos(lon) * tmp;
  15609. v_y = Math.sin(lon) * tmp;
  15610. v_z = Math.sin(lat);
  15611. tmp = this.radius_g - v_x;
  15612. if (this.flip_axis) {
  15613. p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
  15614. p.y = this.radius_g_1 * Math.atan(v_z / tmp);
  15615. } else {
  15616. p.x = this.radius_g_1 * Math.atan(v_y / tmp);
  15617. p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
  15618. }
  15619. }
  15620. p.x = p.x * this.a;
  15621. p.y = p.y * this.a;
  15622. return p;
  15623. }
  15624. function inverse$30(p) {
  15625. var v_x = -1.0;
  15626. var v_y = 0.0;
  15627. var v_z = 0.0;
  15628. var a, b, det, k;
  15629. p.x = p.x / this.a;
  15630. p.y = p.y / this.a;
  15631. if (this.shape === 'ellipse') {
  15632. if (this.flip_axis) {
  15633. v_z = Math.tan(p.y / this.radius_g_1);
  15634. v_y = Math.tan(p.x / this.radius_g_1) * hypot(1.0, v_z);
  15635. } else {
  15636. v_y = Math.tan(p.x / this.radius_g_1);
  15637. v_z = Math.tan(p.y / this.radius_g_1) * hypot(1.0, v_y);
  15638. }
  15639. var v_zp = v_z / this.radius_p;
  15640. a = v_y * v_y + v_zp * v_zp + v_x * v_x;
  15641. b = 2 * this.radius_g * v_x;
  15642. det = (b * b) - 4 * a * this.C;
  15643. if (det < 0.0) {
  15644. p.x = Number.NaN;
  15645. p.y = Number.NaN;
  15646. return p;
  15647. }
  15648. k = (-b - Math.sqrt(det)) / (2.0 * a);
  15649. v_x = this.radius_g + k * v_x;
  15650. v_y *= k;
  15651. v_z *= k;
  15652. p.x = Math.atan2(v_y, v_x);
  15653. p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
  15654. p.y = Math.atan(this.radius_p_inv2 * Math.tan(p.y));
  15655. } else if (this.shape === 'sphere') {
  15656. if (this.flip_axis) {
  15657. v_z = Math.tan(p.y / this.radius_g_1);
  15658. v_y = Math.tan(p.x / this.radius_g_1) * Math.sqrt(1.0 + v_z * v_z);
  15659. } else {
  15660. v_y = Math.tan(p.x / this.radius_g_1);
  15661. v_z = Math.tan(p.y / this.radius_g_1) * Math.sqrt(1.0 + v_y * v_y);
  15662. }
  15663. a = v_y * v_y + v_z * v_z + v_x * v_x;
  15664. b = 2 * this.radius_g * v_x;
  15665. det = (b * b) - 4 * a * this.C;
  15666. if (det < 0.0) {
  15667. p.x = Number.NaN;
  15668. p.y = Number.NaN;
  15669. return p;
  15670. }
  15671. k = (-b - Math.sqrt(det)) / (2.0 * a);
  15672. v_x = this.radius_g + k * v_x;
  15673. v_y *= k;
  15674. v_z *= k;
  15675. p.x = Math.atan2(v_y, v_x);
  15676. p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
  15677. }
  15678. p.x = p.x + this.long0;
  15679. return p;
  15680. }
  15681. var names$32 = ["Geostationary Satellite View", "Geostationary_Satellite", "geos"];
  15682. var geos = {
  15683. init: init$31,
  15684. forward: forward$30,
  15685. inverse: inverse$30,
  15686. names: names$32,
  15687. };
  15688. var includedProjections = function(proj4){
  15689. proj4.Proj.projections.add(tmerc);
  15690. proj4.Proj.projections.add(etmerc);
  15691. proj4.Proj.projections.add(utm);
  15692. proj4.Proj.projections.add(sterea);
  15693. proj4.Proj.projections.add(stere);
  15694. proj4.Proj.projections.add(somerc);
  15695. proj4.Proj.projections.add(omerc);
  15696. proj4.Proj.projections.add(lcc);
  15697. proj4.Proj.projections.add(krovak);
  15698. proj4.Proj.projections.add(cass);
  15699. proj4.Proj.projections.add(laea);
  15700. proj4.Proj.projections.add(aea);
  15701. proj4.Proj.projections.add(gnom);
  15702. proj4.Proj.projections.add(cea);
  15703. proj4.Proj.projections.add(eqc);
  15704. proj4.Proj.projections.add(poly);
  15705. proj4.Proj.projections.add(nzmg);
  15706. proj4.Proj.projections.add(mill);
  15707. proj4.Proj.projections.add(sinu);
  15708. proj4.Proj.projections.add(moll);
  15709. proj4.Proj.projections.add(eqdc);
  15710. proj4.Proj.projections.add(vandg);
  15711. proj4.Proj.projections.add(aeqd);
  15712. proj4.Proj.projections.add(ortho);
  15713. proj4.Proj.projections.add(qsc);
  15714. proj4.Proj.projections.add(robin);
  15715. proj4.Proj.projections.add(geocent);
  15716. proj4.Proj.projections.add(tpers);
  15717. proj4.Proj.projections.add(geos);
  15718. };
  15719. proj4$1.defaultDatum = 'WGS84'; //default datum
  15720. proj4$1.Proj = Projection;
  15721. proj4$1.WGS84 = new proj4$1.Proj('WGS84');
  15722. proj4$1.Point = Point;
  15723. proj4$1.toPoint = toPoint;
  15724. proj4$1.defs = defs;
  15725. proj4$1.nadgrid = nadgrid;
  15726. proj4$1.transform = transform;
  15727. proj4$1.mgrs = mgrs;
  15728. proj4$1.version = '2.9.0';
  15729. includedProjections(proj4$1);
  15730. return proj4$1;
  15731. })));
  15732. /***/ }),
  15733. /***/ 107:
  15734. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  15735. (function (global, factory) {
  15736. true ? factory() :
  15737. 0;
  15738. }(this, (function () { 'use strict';
  15739. /**
  15740. * @this {Promise}
  15741. */
  15742. function finallyConstructor(callback) {
  15743. var constructor = this.constructor;
  15744. return this.then(
  15745. function(value) {
  15746. // @ts-ignore
  15747. return constructor.resolve(callback()).then(function() {
  15748. return value;
  15749. });
  15750. },
  15751. function(reason) {
  15752. // @ts-ignore
  15753. return constructor.resolve(callback()).then(function() {
  15754. // @ts-ignore
  15755. return constructor.reject(reason);
  15756. });
  15757. }
  15758. );
  15759. }
  15760. function allSettled(arr) {
  15761. var P = this;
  15762. return new P(function(resolve, reject) {
  15763. if (!(arr && typeof arr.length !== 'undefined')) {
  15764. return reject(
  15765. new TypeError(
  15766. typeof arr +
  15767. ' ' +
  15768. arr +
  15769. ' is not iterable(cannot read property Symbol(Symbol.iterator))'
  15770. )
  15771. );
  15772. }
  15773. var args = Array.prototype.slice.call(arr);
  15774. if (args.length === 0) return resolve([]);
  15775. var remaining = args.length;
  15776. function res(i, val) {
  15777. if (val && (typeof val === 'object' || typeof val === 'function')) {
  15778. var then = val.then;
  15779. if (typeof then === 'function') {
  15780. then.call(
  15781. val,
  15782. function(val) {
  15783. res(i, val);
  15784. },
  15785. function(e) {
  15786. args[i] = { status: 'rejected', reason: e };
  15787. if (--remaining === 0) {
  15788. resolve(args);
  15789. }
  15790. }
  15791. );
  15792. return;
  15793. }
  15794. }
  15795. args[i] = { status: 'fulfilled', value: val };
  15796. if (--remaining === 0) {
  15797. resolve(args);
  15798. }
  15799. }
  15800. for (var i = 0; i < args.length; i++) {
  15801. res(i, args[i]);
  15802. }
  15803. });
  15804. }
  15805. // Store setTimeout reference so promise-polyfill will be unaffected by
  15806. // other code modifying setTimeout (like sinon.useFakeTimers())
  15807. var setTimeoutFunc = setTimeout;
  15808. function isArray(x) {
  15809. return Boolean(x && typeof x.length !== 'undefined');
  15810. }
  15811. function noop() {}
  15812. // Polyfill for Function.prototype.bind
  15813. function bind(fn, thisArg) {
  15814. return function() {
  15815. fn.apply(thisArg, arguments);
  15816. };
  15817. }
  15818. /**
  15819. * @constructor
  15820. * @param {Function} fn
  15821. */
  15822. function Promise(fn) {
  15823. if (!(this instanceof Promise))
  15824. throw new TypeError('Promises must be constructed via new');
  15825. if (typeof fn !== 'function') throw new TypeError('not a function');
  15826. /** @type {!number} */
  15827. this._state = 0;
  15828. /** @type {!boolean} */
  15829. this._handled = false;
  15830. /** @type {Promise|undefined} */
  15831. this._value = undefined;
  15832. /** @type {!Array<!Function>} */
  15833. this._deferreds = [];
  15834. doResolve(fn, this);
  15835. }
  15836. function handle(self, deferred) {
  15837. while (self._state === 3) {
  15838. self = self._value;
  15839. }
  15840. if (self._state === 0) {
  15841. self._deferreds.push(deferred);
  15842. return;
  15843. }
  15844. self._handled = true;
  15845. Promise._immediateFn(function() {
  15846. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  15847. if (cb === null) {
  15848. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  15849. return;
  15850. }
  15851. var ret;
  15852. try {
  15853. ret = cb(self._value);
  15854. } catch (e) {
  15855. reject(deferred.promise, e);
  15856. return;
  15857. }
  15858. resolve(deferred.promise, ret);
  15859. });
  15860. }
  15861. function resolve(self, newValue) {
  15862. try {
  15863. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  15864. if (newValue === self)
  15865. throw new TypeError('A promise cannot be resolved with itself.');
  15866. if (
  15867. newValue &&
  15868. (typeof newValue === 'object' || typeof newValue === 'function')
  15869. ) {
  15870. var then = newValue.then;
  15871. if (newValue instanceof Promise) {
  15872. self._state = 3;
  15873. self._value = newValue;
  15874. finale(self);
  15875. return;
  15876. } else if (typeof then === 'function') {
  15877. doResolve(bind(then, newValue), self);
  15878. return;
  15879. }
  15880. }
  15881. self._state = 1;
  15882. self._value = newValue;
  15883. finale(self);
  15884. } catch (e) {
  15885. reject(self, e);
  15886. }
  15887. }
  15888. function reject(self, newValue) {
  15889. self._state = 2;
  15890. self._value = newValue;
  15891. finale(self);
  15892. }
  15893. function finale(self) {
  15894. if (self._state === 2 && self._deferreds.length === 0) {
  15895. Promise._immediateFn(function() {
  15896. if (!self._handled) {
  15897. Promise._unhandledRejectionFn(self._value);
  15898. }
  15899. });
  15900. }
  15901. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  15902. handle(self, self._deferreds[i]);
  15903. }
  15904. self._deferreds = null;
  15905. }
  15906. /**
  15907. * @constructor
  15908. */
  15909. function Handler(onFulfilled, onRejected, promise) {
  15910. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  15911. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  15912. this.promise = promise;
  15913. }
  15914. /**
  15915. * Take a potentially misbehaving resolver function and make sure
  15916. * onFulfilled and onRejected are only called once.
  15917. *
  15918. * Makes no guarantees about asynchrony.
  15919. */
  15920. function doResolve(fn, self) {
  15921. var done = false;
  15922. try {
  15923. fn(
  15924. function(value) {
  15925. if (done) return;
  15926. done = true;
  15927. resolve(self, value);
  15928. },
  15929. function(reason) {
  15930. if (done) return;
  15931. done = true;
  15932. reject(self, reason);
  15933. }
  15934. );
  15935. } catch (ex) {
  15936. if (done) return;
  15937. done = true;
  15938. reject(self, ex);
  15939. }
  15940. }
  15941. Promise.prototype['catch'] = function(onRejected) {
  15942. return this.then(null, onRejected);
  15943. };
  15944. Promise.prototype.then = function(onFulfilled, onRejected) {
  15945. // @ts-ignore
  15946. var prom = new this.constructor(noop);
  15947. handle(this, new Handler(onFulfilled, onRejected, prom));
  15948. return prom;
  15949. };
  15950. Promise.prototype['finally'] = finallyConstructor;
  15951. Promise.all = function(arr) {
  15952. return new Promise(function(resolve, reject) {
  15953. if (!isArray(arr)) {
  15954. return reject(new TypeError('Promise.all accepts an array'));
  15955. }
  15956. var args = Array.prototype.slice.call(arr);
  15957. if (args.length === 0) return resolve([]);
  15958. var remaining = args.length;
  15959. function res(i, val) {
  15960. try {
  15961. if (val && (typeof val === 'object' || typeof val === 'function')) {
  15962. var then = val.then;
  15963. if (typeof then === 'function') {
  15964. then.call(
  15965. val,
  15966. function(val) {
  15967. res(i, val);
  15968. },
  15969. reject
  15970. );
  15971. return;
  15972. }
  15973. }
  15974. args[i] = val;
  15975. if (--remaining === 0) {
  15976. resolve(args);
  15977. }
  15978. } catch (ex) {
  15979. reject(ex);
  15980. }
  15981. }
  15982. for (var i = 0; i < args.length; i++) {
  15983. res(i, args[i]);
  15984. }
  15985. });
  15986. };
  15987. Promise.allSettled = allSettled;
  15988. Promise.resolve = function(value) {
  15989. if (value && typeof value === 'object' && value.constructor === Promise) {
  15990. return value;
  15991. }
  15992. return new Promise(function(resolve) {
  15993. resolve(value);
  15994. });
  15995. };
  15996. Promise.reject = function(value) {
  15997. return new Promise(function(resolve, reject) {
  15998. reject(value);
  15999. });
  16000. };
  16001. Promise.race = function(arr) {
  16002. return new Promise(function(resolve, reject) {
  16003. if (!isArray(arr)) {
  16004. return reject(new TypeError('Promise.race accepts an array'));
  16005. }
  16006. for (var i = 0, len = arr.length; i < len; i++) {
  16007. Promise.resolve(arr[i]).then(resolve, reject);
  16008. }
  16009. });
  16010. };
  16011. // Use polyfill for setImmediate for performance gains
  16012. Promise._immediateFn =
  16013. // @ts-ignore
  16014. (typeof setImmediate === 'function' &&
  16015. function(fn) {
  16016. // @ts-ignore
  16017. setImmediate(fn);
  16018. }) ||
  16019. function(fn) {
  16020. setTimeoutFunc(fn, 0);
  16021. };
  16022. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  16023. if (typeof console !== 'undefined' && console) {
  16024. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  16025. }
  16026. };
  16027. /** @suppress {undefinedVars} */
  16028. var globalNS = (function() {
  16029. // the only reliable means to get the global object is
  16030. // `Function('return this')()`
  16031. // However, this causes CSP violations in Chrome apps.
  16032. if (typeof self !== 'undefined') {
  16033. return self;
  16034. }
  16035. if (typeof window !== 'undefined') {
  16036. return window;
  16037. }
  16038. if (typeof __webpack_require__.g !== 'undefined') {
  16039. return __webpack_require__.g;
  16040. }
  16041. throw new Error('unable to locate global object');
  16042. })();
  16043. // Expose the polyfill if Promise is undefined or set to a
  16044. // non-function value. The latter can be due to a named HTMLElement
  16045. // being exposed by browsers for legacy reasons.
  16046. // https://github.com/taylorhakes/promise-polyfill/issues/114
  16047. if (typeof globalNS['Promise'] !== 'function') {
  16048. globalNS['Promise'] = Promise;
  16049. } else {
  16050. if (!globalNS.Promise.prototype['finally']) {
  16051. globalNS.Promise.prototype['finally'] = finallyConstructor;
  16052. }
  16053. if (!globalNS.Promise.allSettled) {
  16054. globalNS.Promise.allSettled = allSettled;
  16055. }
  16056. }
  16057. })));
  16058. /***/ }),
  16059. /***/ 901:
  16060. /***/ (function(module) {
  16061. // https://github.com/mbostock/slice-source Version 0.4.1. Copyright 2016 Mike Bostock.
  16062. (function (global, factory) {
  16063. true ? module.exports = factory() :
  16064. 0;
  16065. }(this, (function () { 'use strict';
  16066. var empty = new Uint8Array(0);
  16067. function slice_cancel() {
  16068. return this._source.cancel();
  16069. }
  16070. function concat(a, b) {
  16071. if (!a.length) return b;
  16072. if (!b.length) return a;
  16073. var c = new Uint8Array(a.length + b.length);
  16074. c.set(a);
  16075. c.set(b, a.length);
  16076. return c;
  16077. }
  16078. function slice_read() {
  16079. var that = this, array = that._array.subarray(that._index);
  16080. return that._source.read().then(function(result) {
  16081. that._array = empty;
  16082. that._index = 0;
  16083. return result.done ? (array.length > 0
  16084. ? {done: false, value: array}
  16085. : {done: true, value: undefined})
  16086. : {done: false, value: concat(array, result.value)};
  16087. });
  16088. }
  16089. function slice_slice(length) {
  16090. if ((length |= 0) < 0) throw new Error("invalid length");
  16091. var that = this, index = this._array.length - this._index;
  16092. // If the request fits within the remaining buffer, resolve it immediately.
  16093. if (this._index + length <= this._array.length) {
  16094. return Promise.resolve(this._array.subarray(this._index, this._index += length));
  16095. }
  16096. // Otherwise, read chunks repeatedly until the request is fulfilled.
  16097. var array = new Uint8Array(length);
  16098. array.set(this._array.subarray(this._index));
  16099. return (function read() {
  16100. return that._source.read().then(function(result) {
  16101. // When done, it’s possible the request wasn’t fully fullfilled!
  16102. // If so, the pre-allocated array is too big and needs slicing.
  16103. if (result.done) {
  16104. that._array = empty;
  16105. that._index = 0;
  16106. return index > 0 ? array.subarray(0, index) : null;
  16107. }
  16108. // If this chunk fulfills the request, return the resulting array.
  16109. if (index + result.value.length >= length) {
  16110. that._array = result.value;
  16111. that._index = length - index;
  16112. array.set(result.value.subarray(0, length - index), index);
  16113. return array;
  16114. }
  16115. // Otherwise copy this chunk into the array, then read the next chunk.
  16116. array.set(result.value, index);
  16117. index += result.value.length;
  16118. return read();
  16119. });
  16120. })();
  16121. }
  16122. function slice(source) {
  16123. return typeof source.slice === "function" ? source :
  16124. new SliceSource(typeof source.read === "function" ? source
  16125. : source.getReader());
  16126. }
  16127. function SliceSource(source) {
  16128. this._source = source;
  16129. this._array = empty;
  16130. this._index = 0;
  16131. }
  16132. SliceSource.prototype.read = slice_read;
  16133. SliceSource.prototype.slice = slice_slice;
  16134. SliceSource.prototype.cancel = slice_cancel;
  16135. return slice;
  16136. })));
  16137. /***/ }),
  16138. /***/ 982:
  16139. /***/ ((__unused_webpack_module, exports) => {
  16140. "use strict";
  16141. var __webpack_unused_export__;
  16142. __webpack_unused_export__ = ({ value: true });
  16143. /*! *****************************************************************************
  16144. Copyright (c) Microsoft Corporation.
  16145. Permission to use, copy, modify, and/or distribute this software for any
  16146. purpose with or without fee is hereby granted.
  16147. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  16148. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  16149. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  16150. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  16151. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  16152. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16153. PERFORMANCE OF THIS SOFTWARE.
  16154. ***************************************************************************** */
  16155. /* global Reflect, Promise */
  16156. var extendStatics = function(d, b) {
  16157. extendStatics = Object.setPrototypeOf ||
  16158. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16159. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16160. return extendStatics(d, b);
  16161. };
  16162. function __extends(d, b) {
  16163. extendStatics(d, b);
  16164. function __() { this.constructor = d; }
  16165. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16166. }
  16167. function __awaiter(thisArg, _arguments, P, generator) {
  16168. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  16169. return new (P || (P = Promise))(function (resolve, reject) {
  16170. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  16171. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  16172. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  16173. step((generator = generator.apply(thisArg, _arguments || [])).next());
  16174. });
  16175. }
  16176. function __generator(thisArg, body) {
  16177. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  16178. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  16179. function verb(n) { return function (v) { return step([n, v]); }; }
  16180. function step(op) {
  16181. if (f) throw new TypeError("Generator is already executing.");
  16182. while (_) try {
  16183. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  16184. if (y = 0, t) op = [op[0] & 2, t.value];
  16185. switch (op[0]) {
  16186. case 0: case 1: t = op; break;
  16187. case 4: _.label++; return { value: op[1], done: false };
  16188. case 5: _.label++; y = op[1]; op = [0]; continue;
  16189. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  16190. default:
  16191. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  16192. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  16193. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  16194. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  16195. if (t[2]) _.ops.pop();
  16196. _.trys.pop(); continue;
  16197. }
  16198. op = body.call(thisArg, _);
  16199. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  16200. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  16201. }
  16202. }
  16203. function __values(o) {
  16204. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  16205. if (m) return m.call(o);
  16206. if (o && typeof o.length === "number") return {
  16207. next: function () {
  16208. if (o && i >= o.length) o = void 0;
  16209. return { value: o && o[i++], done: !o };
  16210. }
  16211. };
  16212. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  16213. }
  16214. function __await(v) {
  16215. return this instanceof __await ? (this.v = v, this) : new __await(v);
  16216. }
  16217. function __asyncGenerator(thisArg, _arguments, generator) {
  16218. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  16219. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  16220. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  16221. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  16222. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  16223. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  16224. function fulfill(value) { resume("next", value); }
  16225. function reject(value) { resume("throw", value); }
  16226. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  16227. }
  16228. /** An error subclass which is thrown when there are too many pending push or next operations on a single repeater. */
  16229. var RepeaterOverflowError = /** @class */ (function (_super) {
  16230. __extends(RepeaterOverflowError, _super);
  16231. function RepeaterOverflowError(message) {
  16232. var _this = _super.call(this, message) || this;
  16233. Object.defineProperty(_this, "name", {
  16234. value: "RepeaterOverflowError",
  16235. enumerable: false,
  16236. });
  16237. if (typeof Object.setPrototypeOf === "function") {
  16238. Object.setPrototypeOf(_this, _this.constructor.prototype);
  16239. }
  16240. else {
  16241. _this.__proto__ = _this.constructor.prototype;
  16242. }
  16243. if (typeof Error.captureStackTrace === "function") {
  16244. Error.captureStackTrace(_this, _this.constructor);
  16245. }
  16246. return _this;
  16247. }
  16248. return RepeaterOverflowError;
  16249. }(Error));
  16250. /** A buffer which allows you to push a set amount of values to the repeater without pushes waiting or throwing errors. */
  16251. var FixedBuffer = /** @class */ (function () {
  16252. function FixedBuffer(capacity) {
  16253. if (capacity < 0) {
  16254. throw new RangeError("Capacity may not be less than 0");
  16255. }
  16256. this._c = capacity;
  16257. this._q = [];
  16258. }
  16259. Object.defineProperty(FixedBuffer.prototype, "empty", {
  16260. get: function () {
  16261. return this._q.length === 0;
  16262. },
  16263. enumerable: false,
  16264. configurable: true
  16265. });
  16266. Object.defineProperty(FixedBuffer.prototype, "full", {
  16267. get: function () {
  16268. return this._q.length >= this._c;
  16269. },
  16270. enumerable: false,
  16271. configurable: true
  16272. });
  16273. FixedBuffer.prototype.add = function (value) {
  16274. if (this.full) {
  16275. throw new Error("Buffer full");
  16276. }
  16277. else {
  16278. this._q.push(value);
  16279. }
  16280. };
  16281. FixedBuffer.prototype.remove = function () {
  16282. if (this.empty) {
  16283. throw new Error("Buffer empty");
  16284. }
  16285. return this._q.shift();
  16286. };
  16287. return FixedBuffer;
  16288. }());
  16289. // TODO: Use a circular buffer here.
  16290. /** Sliding buffers allow you to push a set amount of values to the repeater without pushes waiting or throwing errors. If the number of values exceeds the capacity set in the constructor, the buffer will discard the earliest values added. */
  16291. var SlidingBuffer = /** @class */ (function () {
  16292. function SlidingBuffer(capacity) {
  16293. if (capacity < 1) {
  16294. throw new RangeError("Capacity may not be less than 1");
  16295. }
  16296. this._c = capacity;
  16297. this._q = [];
  16298. }
  16299. Object.defineProperty(SlidingBuffer.prototype, "empty", {
  16300. get: function () {
  16301. return this._q.length === 0;
  16302. },
  16303. enumerable: false,
  16304. configurable: true
  16305. });
  16306. Object.defineProperty(SlidingBuffer.prototype, "full", {
  16307. get: function () {
  16308. return false;
  16309. },
  16310. enumerable: false,
  16311. configurable: true
  16312. });
  16313. SlidingBuffer.prototype.add = function (value) {
  16314. while (this._q.length >= this._c) {
  16315. this._q.shift();
  16316. }
  16317. this._q.push(value);
  16318. };
  16319. SlidingBuffer.prototype.remove = function () {
  16320. if (this.empty) {
  16321. throw new Error("Buffer empty");
  16322. }
  16323. return this._q.shift();
  16324. };
  16325. return SlidingBuffer;
  16326. }());
  16327. /** Dropping buffers allow you to push a set amount of values to the repeater without the push function waiting or throwing errors. If the number of values exceeds the capacity set in the constructor, the buffer will discard the latest values added. */
  16328. var DroppingBuffer = /** @class */ (function () {
  16329. function DroppingBuffer(capacity) {
  16330. if (capacity < 1) {
  16331. throw new RangeError("Capacity may not be less than 1");
  16332. }
  16333. this._c = capacity;
  16334. this._q = [];
  16335. }
  16336. Object.defineProperty(DroppingBuffer.prototype, "empty", {
  16337. get: function () {
  16338. return this._q.length === 0;
  16339. },
  16340. enumerable: false,
  16341. configurable: true
  16342. });
  16343. Object.defineProperty(DroppingBuffer.prototype, "full", {
  16344. get: function () {
  16345. return false;
  16346. },
  16347. enumerable: false,
  16348. configurable: true
  16349. });
  16350. DroppingBuffer.prototype.add = function (value) {
  16351. if (this._q.length < this._c) {
  16352. this._q.push(value);
  16353. }
  16354. };
  16355. DroppingBuffer.prototype.remove = function () {
  16356. if (this.empty) {
  16357. throw new Error("Buffer empty");
  16358. }
  16359. return this._q.shift();
  16360. };
  16361. return DroppingBuffer;
  16362. }());
  16363. /** Makes sure promise-likes don’t cause unhandled rejections. */
  16364. function swallow(value) {
  16365. if (value != null && typeof value.then === "function") {
  16366. value.then(NOOP, NOOP);
  16367. }
  16368. }
  16369. /*** REPEATER STATES ***/
  16370. /** The following is an enumeration of all possible repeater states. These states are ordered, and a repeater may only advance to higher states. */
  16371. /** The initial state of the repeater. */
  16372. var Initial = 0;
  16373. /** Repeaters advance to this state the first time the next method is called on the repeater. */
  16374. var Started = 1;
  16375. /** Repeaters advance to this state when the stop function is called. */
  16376. var Stopped = 2;
  16377. /** Repeaters advance to this state when there are no values left to be pulled from the repeater. */
  16378. var Done = 3;
  16379. /** Repeaters advance to this state if an error is thrown into the repeater. */
  16380. var Rejected = 4;
  16381. /** The maximum number of push or next operations which may exist on a single repeater. */
  16382. var MAX_QUEUE_LENGTH = 1024;
  16383. var NOOP = function () { };
  16384. /** A helper function used to mimic the behavior of async generators where the final iteration is consumed. */
  16385. function consumeExecution(r) {
  16386. var err = r.err;
  16387. var execution = Promise.resolve(r.execution).then(function (value) {
  16388. if (err != null) {
  16389. throw err;
  16390. }
  16391. return value;
  16392. });
  16393. r.err = undefined;
  16394. r.execution = execution.then(function () { return undefined; }, function () { return undefined; });
  16395. return r.pending === undefined ? execution : r.pending.then(function () { return execution; });
  16396. }
  16397. /** A helper function for building iterations from values. Promises are unwrapped, so that iterations never have their value property set to a promise. */
  16398. function createIteration(r, value) {
  16399. var done = r.state >= Done;
  16400. return Promise.resolve(value).then(function (value) {
  16401. if (!done && r.state >= Rejected) {
  16402. return consumeExecution(r).then(function (value) { return ({
  16403. value: value,
  16404. done: true,
  16405. }); });
  16406. }
  16407. return { value: value, done: done };
  16408. });
  16409. }
  16410. /**
  16411. * This function is bound and passed to the executor as the stop argument.
  16412. *
  16413. * Advances state to Stopped.
  16414. */
  16415. function stop(r, err) {
  16416. var e_1, _a;
  16417. if (r.state >= Stopped) {
  16418. return;
  16419. }
  16420. r.state = Stopped;
  16421. r.onnext();
  16422. r.onstop();
  16423. if (r.err == null) {
  16424. r.err = err;
  16425. }
  16426. if (r.pushes.length === 0 &&
  16427. (typeof r.buffer === "undefined" || r.buffer.empty)) {
  16428. finish(r);
  16429. }
  16430. else {
  16431. try {
  16432. for (var _b = __values(r.pushes), _d = _b.next(); !_d.done; _d = _b.next()) {
  16433. var push_1 = _d.value;
  16434. push_1.resolve();
  16435. }
  16436. }
  16437. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  16438. finally {
  16439. try {
  16440. if (_d && !_d.done && (_a = _b.return)) _a.call(_b);
  16441. }
  16442. finally { if (e_1) throw e_1.error; }
  16443. }
  16444. }
  16445. }
  16446. /**
  16447. * The difference between stopping a repeater vs finishing a repeater is that stopping a repeater allows next to continue to drain values from the push queue and buffer, while finishing a repeater will clear all pending values and end iteration immediately. Once, a repeater is finished, all iterations will have the done property set to true.
  16448. *
  16449. * Advances state to Done.
  16450. */
  16451. function finish(r) {
  16452. var e_2, _a;
  16453. if (r.state >= Done) {
  16454. return;
  16455. }
  16456. if (r.state < Stopped) {
  16457. stop(r);
  16458. }
  16459. r.state = Done;
  16460. r.buffer = undefined;
  16461. try {
  16462. for (var _b = __values(r.nexts), _d = _b.next(); !_d.done; _d = _b.next()) {
  16463. var next = _d.value;
  16464. var execution = r.pending === undefined
  16465. ? consumeExecution(r)
  16466. : r.pending.then(function () { return consumeExecution(r); });
  16467. next.resolve(createIteration(r, execution));
  16468. }
  16469. }
  16470. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  16471. finally {
  16472. try {
  16473. if (_d && !_d.done && (_a = _b.return)) _a.call(_b);
  16474. }
  16475. finally { if (e_2) throw e_2.error; }
  16476. }
  16477. r.pushes = [];
  16478. r.nexts = [];
  16479. }
  16480. /**
  16481. * Called when a promise passed to push rejects, or when a push call is unhandled.
  16482. *
  16483. * Advances state to Rejected.
  16484. */
  16485. function reject(r) {
  16486. if (r.state >= Rejected) {
  16487. return;
  16488. }
  16489. if (r.state < Done) {
  16490. finish(r);
  16491. }
  16492. r.state = Rejected;
  16493. }
  16494. /** This function is bound and passed to the executor as the push argument. */
  16495. function push(r, value) {
  16496. swallow(value);
  16497. if (r.pushes.length >= MAX_QUEUE_LENGTH) {
  16498. throw new RepeaterOverflowError("No more than " + MAX_QUEUE_LENGTH + " pending calls to push are allowed on a single repeater.");
  16499. }
  16500. else if (r.state >= Stopped) {
  16501. return Promise.resolve(undefined);
  16502. }
  16503. var valueP = r.pending === undefined
  16504. ? Promise.resolve(value)
  16505. : r.pending.then(function () { return value; });
  16506. valueP = valueP.catch(function (err) {
  16507. if (r.state < Stopped) {
  16508. r.err = err;
  16509. }
  16510. reject(r);
  16511. return undefined; // void :(
  16512. });
  16513. var nextP;
  16514. if (r.nexts.length) {
  16515. var next_1 = r.nexts.shift();
  16516. next_1.resolve(createIteration(r, valueP));
  16517. if (r.nexts.length) {
  16518. nextP = Promise.resolve(r.nexts[0].value);
  16519. }
  16520. else {
  16521. nextP = new Promise(function (resolve) { return (r.onnext = resolve); });
  16522. }
  16523. }
  16524. else if (typeof r.buffer !== "undefined" && !r.buffer.full) {
  16525. r.buffer.add(valueP);
  16526. nextP = Promise.resolve(undefined);
  16527. }
  16528. else {
  16529. nextP = new Promise(function (resolve) { return r.pushes.push({ resolve: resolve, value: valueP }); });
  16530. }
  16531. // If an error is thrown into the repeater via the next or throw methods, we give the repeater a chance to handle this by rejecting the promise returned from push. If the push call is not immediately handled we throw the next iteration of the repeater.
  16532. // To check that the promise returned from push is floating, we modify the then and catch methods of the returned promise so that they flip the floating flag. The push function actually does not return a promise, because modern engines do not call the then and catch methods on native promises. By making next a plain old javascript object, we ensure that the then and catch methods will be called.
  16533. var floating = true;
  16534. var next = {};
  16535. var unhandled = nextP.catch(function (err) {
  16536. if (floating) {
  16537. throw err;
  16538. }
  16539. return undefined; // void :(
  16540. });
  16541. next.then = function (onfulfilled, onrejected) {
  16542. floating = false;
  16543. return Promise.prototype.then.call(nextP, onfulfilled, onrejected);
  16544. };
  16545. next.catch = function (onrejected) {
  16546. floating = false;
  16547. return Promise.prototype.catch.call(nextP, onrejected);
  16548. };
  16549. next.finally = nextP.finally.bind(nextP);
  16550. r.pending = valueP
  16551. .then(function () { return unhandled; })
  16552. .catch(function (err) {
  16553. r.err = err;
  16554. reject(r);
  16555. });
  16556. return next;
  16557. }
  16558. /**
  16559. * Creates the stop callable promise which is passed to the executor
  16560. */
  16561. function createStop(r) {
  16562. var stop1 = stop.bind(null, r);
  16563. var stopP = new Promise(function (resolve) { return (r.onstop = resolve); });
  16564. stop1.then = stopP.then.bind(stopP);
  16565. stop1.catch = stopP.catch.bind(stopP);
  16566. stop1.finally = stopP.finally.bind(stopP);
  16567. return stop1;
  16568. }
  16569. /**
  16570. * Calls the executor passed into the constructor. This function is called the first time the next method is called on the repeater.
  16571. *
  16572. * Advances state to Started.
  16573. */
  16574. function execute(r) {
  16575. if (r.state >= Started) {
  16576. return;
  16577. }
  16578. r.state = Started;
  16579. var push1 = push.bind(null, r);
  16580. var stop1 = createStop(r);
  16581. r.execution = new Promise(function (resolve) { return resolve(r.executor(push1, stop1)); });
  16582. // TODO: We should consider stopping all repeaters when the executor settles.
  16583. r.execution.catch(function () { return stop(r); });
  16584. }
  16585. var records = new WeakMap();
  16586. // NOTE: While repeaters implement and are assignable to the AsyncGenerator interface, and you can use the types interchangeably, we don’t use typescript’s implements syntax here because this would make supporting earlier versions of typescript trickier. This is because TypeScript version 3.6 changed the iterator types by adding the TReturn and TNext type parameters.
  16587. var Repeater = /** @class */ (function () {
  16588. function Repeater(executor, buffer) {
  16589. records.set(this, {
  16590. executor: executor,
  16591. buffer: buffer,
  16592. err: undefined,
  16593. state: Initial,
  16594. pushes: [],
  16595. nexts: [],
  16596. pending: undefined,
  16597. execution: undefined,
  16598. onnext: NOOP,
  16599. onstop: NOOP,
  16600. });
  16601. }
  16602. Repeater.prototype.next = function (value) {
  16603. swallow(value);
  16604. var r = records.get(this);
  16605. if (r === undefined) {
  16606. throw new Error("WeakMap error");
  16607. }
  16608. if (r.nexts.length >= MAX_QUEUE_LENGTH) {
  16609. throw new RepeaterOverflowError("No more than " + MAX_QUEUE_LENGTH + " pending calls to next are allowed on a single repeater.");
  16610. }
  16611. if (r.state <= Initial) {
  16612. execute(r);
  16613. }
  16614. r.onnext(value);
  16615. if (typeof r.buffer !== "undefined" && !r.buffer.empty) {
  16616. var result = createIteration(r, r.buffer.remove());
  16617. if (r.pushes.length) {
  16618. var push_2 = r.pushes.shift();
  16619. r.buffer.add(push_2.value);
  16620. r.onnext = push_2.resolve;
  16621. }
  16622. return result;
  16623. }
  16624. else if (r.pushes.length) {
  16625. var push_3 = r.pushes.shift();
  16626. r.onnext = push_3.resolve;
  16627. return createIteration(r, push_3.value);
  16628. }
  16629. else if (r.state >= Stopped) {
  16630. finish(r);
  16631. return createIteration(r, consumeExecution(r));
  16632. }
  16633. return new Promise(function (resolve) { return r.nexts.push({ resolve: resolve, value: value }); });
  16634. };
  16635. Repeater.prototype.return = function (value) {
  16636. swallow(value);
  16637. var r = records.get(this);
  16638. if (r === undefined) {
  16639. throw new Error("WeakMap error");
  16640. }
  16641. finish(r);
  16642. // We override the execution because return should always return the value passed in.
  16643. r.execution = Promise.resolve(r.execution).then(function () { return value; });
  16644. return createIteration(r, consumeExecution(r));
  16645. };
  16646. Repeater.prototype.throw = function (err) {
  16647. var r = records.get(this);
  16648. if (r === undefined) {
  16649. throw new Error("WeakMap error");
  16650. }
  16651. if (r.state <= Initial ||
  16652. r.state >= Stopped ||
  16653. (typeof r.buffer !== "undefined" && !r.buffer.empty)) {
  16654. finish(r);
  16655. // If r.err is already set, that mean the repeater has already produced an error, so we throw that error rather than the error passed in, because doing so might be more informative for the caller.
  16656. if (r.err == null) {
  16657. r.err = err;
  16658. }
  16659. return createIteration(r, consumeExecution(r));
  16660. }
  16661. return this.next(Promise.reject(err));
  16662. };
  16663. Repeater.prototype[Symbol.asyncIterator] = function () {
  16664. return this;
  16665. };
  16666. // TODO: Remove these static methods from the class.
  16667. Repeater.race = race;
  16668. Repeater.merge = merge;
  16669. Repeater.zip = zip;
  16670. Repeater.latest = latest;
  16671. return Repeater;
  16672. }());
  16673. /*** COMBINATOR FUNCTIONS ***/
  16674. // TODO: move these combinators to their own file.
  16675. function getIterators(values, options) {
  16676. var e_3, _a;
  16677. var iters = [];
  16678. var _loop_1 = function (value) {
  16679. if (value != null && typeof value[Symbol.asyncIterator] === "function") {
  16680. iters.push(value[Symbol.asyncIterator]());
  16681. }
  16682. else if (value != null && typeof value[Symbol.iterator] === "function") {
  16683. iters.push(value[Symbol.iterator]());
  16684. }
  16685. else {
  16686. iters.push((function valueToAsyncIterator() {
  16687. return __asyncGenerator(this, arguments, function valueToAsyncIterator_1() {
  16688. return __generator(this, function (_a) {
  16689. switch (_a.label) {
  16690. case 0:
  16691. if (!options.yieldValues) return [3 /*break*/, 3];
  16692. return [4 /*yield*/, __await(value)];
  16693. case 1: return [4 /*yield*/, _a.sent()];
  16694. case 2:
  16695. _a.sent();
  16696. _a.label = 3;
  16697. case 3:
  16698. if (!options.returnValues) return [3 /*break*/, 5];
  16699. return [4 /*yield*/, __await(value)];
  16700. case 4: return [2 /*return*/, _a.sent()];
  16701. case 5: return [2 /*return*/];
  16702. }
  16703. });
  16704. });
  16705. })());
  16706. }
  16707. };
  16708. try {
  16709. for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
  16710. var value = values_1_1.value;
  16711. _loop_1(value);
  16712. }
  16713. }
  16714. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  16715. finally {
  16716. try {
  16717. if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
  16718. }
  16719. finally { if (e_3) throw e_3.error; }
  16720. }
  16721. return iters;
  16722. }
  16723. // NOTE: whenever you see any variables called `advance` or `advances`, know that it is a hack to get around the fact that `Promise.race` leaks memory. These variables are intended to be set to the resolve function of a promise which is constructed and awaited as an alternative to Promise.race. For more information, see this comment in the Node.js issue tracker: https://github.com/nodejs/node/issues/17469#issuecomment-685216777.
  16724. function race(contenders) {
  16725. var _this = this;
  16726. var iters = getIterators(contenders, { returnValues: true });
  16727. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  16728. var advance, stopped, finalIteration, iteration, i_1, _loop_2;
  16729. return __generator(this, function (_a) {
  16730. switch (_a.label) {
  16731. case 0:
  16732. if (!iters.length) {
  16733. stop();
  16734. return [2 /*return*/];
  16735. }
  16736. stopped = false;
  16737. stop.then(function () {
  16738. advance();
  16739. stopped = true;
  16740. });
  16741. _a.label = 1;
  16742. case 1:
  16743. _a.trys.push([1, , 5, 7]);
  16744. iteration = void 0;
  16745. i_1 = 0;
  16746. _loop_2 = function () {
  16747. var j, iters_1, iters_1_1, iter;
  16748. var e_4, _a;
  16749. return __generator(this, function (_b) {
  16750. switch (_b.label) {
  16751. case 0:
  16752. j = i_1;
  16753. try {
  16754. for (iters_1 = (e_4 = void 0, __values(iters)), iters_1_1 = iters_1.next(); !iters_1_1.done; iters_1_1 = iters_1.next()) {
  16755. iter = iters_1_1.value;
  16756. Promise.resolve(iter.next()).then(function (iteration) {
  16757. if (iteration.done) {
  16758. stop();
  16759. if (finalIteration === undefined) {
  16760. finalIteration = iteration;
  16761. }
  16762. }
  16763. else if (i_1 === j) {
  16764. // This iterator has won, advance i and resolve the promise.
  16765. i_1++;
  16766. advance(iteration);
  16767. }
  16768. }, function (err) { return stop(err); });
  16769. }
  16770. }
  16771. catch (e_4_1) { e_4 = { error: e_4_1 }; }
  16772. finally {
  16773. try {
  16774. if (iters_1_1 && !iters_1_1.done && (_a = iters_1.return)) _a.call(iters_1);
  16775. }
  16776. finally { if (e_4) throw e_4.error; }
  16777. }
  16778. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  16779. case 1:
  16780. iteration = _b.sent();
  16781. if (!(iteration !== undefined)) return [3 /*break*/, 3];
  16782. return [4 /*yield*/, push(iteration.value)];
  16783. case 2:
  16784. _b.sent();
  16785. _b.label = 3;
  16786. case 3: return [2 /*return*/];
  16787. }
  16788. });
  16789. };
  16790. _a.label = 2;
  16791. case 2:
  16792. if (!!stopped) return [3 /*break*/, 4];
  16793. return [5 /*yield**/, _loop_2()];
  16794. case 3:
  16795. _a.sent();
  16796. return [3 /*break*/, 2];
  16797. case 4: return [2 /*return*/, finalIteration && finalIteration.value];
  16798. case 5:
  16799. stop();
  16800. return [4 /*yield*/, Promise.race(iters.map(function (iter) { return iter.return && iter.return(); }))];
  16801. case 6:
  16802. _a.sent();
  16803. return [7 /*endfinally*/];
  16804. case 7: return [2 /*return*/];
  16805. }
  16806. });
  16807. }); });
  16808. }
  16809. function merge(contenders) {
  16810. var _this = this;
  16811. var iters = getIterators(contenders, { yieldValues: true });
  16812. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  16813. var advances, stopped, finalIteration;
  16814. var _this = this;
  16815. return __generator(this, function (_a) {
  16816. switch (_a.label) {
  16817. case 0:
  16818. if (!iters.length) {
  16819. stop();
  16820. return [2 /*return*/];
  16821. }
  16822. advances = [];
  16823. stopped = false;
  16824. stop.then(function () {
  16825. var e_5, _a;
  16826. stopped = true;
  16827. try {
  16828. for (var advances_1 = __values(advances), advances_1_1 = advances_1.next(); !advances_1_1.done; advances_1_1 = advances_1.next()) {
  16829. var advance = advances_1_1.value;
  16830. advance();
  16831. }
  16832. }
  16833. catch (e_5_1) { e_5 = { error: e_5_1 }; }
  16834. finally {
  16835. try {
  16836. if (advances_1_1 && !advances_1_1.done && (_a = advances_1.return)) _a.call(advances_1);
  16837. }
  16838. finally { if (e_5) throw e_5.error; }
  16839. }
  16840. });
  16841. _a.label = 1;
  16842. case 1:
  16843. _a.trys.push([1, , 3, 4]);
  16844. return [4 /*yield*/, Promise.all(iters.map(function (iter, i) { return __awaiter(_this, void 0, void 0, function () {
  16845. var iteration, _a;
  16846. return __generator(this, function (_b) {
  16847. switch (_b.label) {
  16848. case 0:
  16849. _b.trys.push([0, , 6, 9]);
  16850. _b.label = 1;
  16851. case 1:
  16852. if (!!stopped) return [3 /*break*/, 5];
  16853. Promise.resolve(iter.next()).then(function (iteration) { return advances[i](iteration); }, function (err) { return stop(err); });
  16854. return [4 /*yield*/, new Promise(function (resolve) {
  16855. advances[i] = resolve;
  16856. })];
  16857. case 2:
  16858. iteration = _b.sent();
  16859. if (!(iteration !== undefined)) return [3 /*break*/, 4];
  16860. if (iteration.done) {
  16861. finalIteration = iteration;
  16862. return [2 /*return*/];
  16863. }
  16864. return [4 /*yield*/, push(iteration.value)];
  16865. case 3:
  16866. _b.sent();
  16867. _b.label = 4;
  16868. case 4: return [3 /*break*/, 1];
  16869. case 5: return [3 /*break*/, 9];
  16870. case 6:
  16871. _a = iter.return;
  16872. if (!_a) return [3 /*break*/, 8];
  16873. return [4 /*yield*/, iter.return()];
  16874. case 7:
  16875. _a = (_b.sent());
  16876. _b.label = 8;
  16877. case 8:
  16878. return [7 /*endfinally*/];
  16879. case 9: return [2 /*return*/];
  16880. }
  16881. });
  16882. }); }))];
  16883. case 2:
  16884. _a.sent();
  16885. return [2 /*return*/, finalIteration && finalIteration.value];
  16886. case 3:
  16887. stop();
  16888. return [7 /*endfinally*/];
  16889. case 4: return [2 /*return*/];
  16890. }
  16891. });
  16892. }); });
  16893. }
  16894. function zip(contenders) {
  16895. var _this = this;
  16896. var iters = getIterators(contenders, { returnValues: true });
  16897. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  16898. var advance, stopped, iterations, values;
  16899. return __generator(this, function (_a) {
  16900. switch (_a.label) {
  16901. case 0:
  16902. if (!iters.length) {
  16903. stop();
  16904. return [2 /*return*/, []];
  16905. }
  16906. stopped = false;
  16907. stop.then(function () {
  16908. advance();
  16909. stopped = true;
  16910. });
  16911. _a.label = 1;
  16912. case 1:
  16913. _a.trys.push([1, , 6, 8]);
  16914. _a.label = 2;
  16915. case 2:
  16916. if (!!stopped) return [3 /*break*/, 5];
  16917. Promise.all(iters.map(function (iter) { return iter.next(); })).then(function (iterations) { return advance(iterations); }, function (err) { return stop(err); });
  16918. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  16919. case 3:
  16920. iterations = _a.sent();
  16921. if (iterations === undefined) {
  16922. return [2 /*return*/];
  16923. }
  16924. values = iterations.map(function (iteration) { return iteration.value; });
  16925. if (iterations.some(function (iteration) { return iteration.done; })) {
  16926. return [2 /*return*/, values];
  16927. }
  16928. return [4 /*yield*/, push(values)];
  16929. case 4:
  16930. _a.sent();
  16931. return [3 /*break*/, 2];
  16932. case 5: return [3 /*break*/, 8];
  16933. case 6:
  16934. stop();
  16935. return [4 /*yield*/, Promise.all(iters.map(function (iter) { return iter.return && iter.return(); }))];
  16936. case 7:
  16937. _a.sent();
  16938. return [7 /*endfinally*/];
  16939. case 8: return [2 /*return*/];
  16940. }
  16941. });
  16942. }); });
  16943. }
  16944. function latest(contenders) {
  16945. var _this = this;
  16946. var iters = getIterators(contenders, {
  16947. yieldValues: true,
  16948. returnValues: true,
  16949. });
  16950. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  16951. var advance, advances, stopped, iterations_1, values_2;
  16952. var _this = this;
  16953. return __generator(this, function (_a) {
  16954. switch (_a.label) {
  16955. case 0:
  16956. if (!iters.length) {
  16957. stop();
  16958. return [2 /*return*/, []];
  16959. }
  16960. advances = [];
  16961. stopped = false;
  16962. stop.then(function () {
  16963. var e_6, _a;
  16964. advance();
  16965. try {
  16966. for (var advances_2 = __values(advances), advances_2_1 = advances_2.next(); !advances_2_1.done; advances_2_1 = advances_2.next()) {
  16967. var advance1 = advances_2_1.value;
  16968. advance1();
  16969. }
  16970. }
  16971. catch (e_6_1) { e_6 = { error: e_6_1 }; }
  16972. finally {
  16973. try {
  16974. if (advances_2_1 && !advances_2_1.done && (_a = advances_2.return)) _a.call(advances_2);
  16975. }
  16976. finally { if (e_6) throw e_6.error; }
  16977. }
  16978. stopped = true;
  16979. });
  16980. _a.label = 1;
  16981. case 1:
  16982. _a.trys.push([1, , 5, 7]);
  16983. Promise.all(iters.map(function (iter) { return iter.next(); })).then(function (iterations) { return advance(iterations); }, function (err) { return stop(err); });
  16984. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  16985. case 2:
  16986. iterations_1 = _a.sent();
  16987. if (iterations_1 === undefined) {
  16988. return [2 /*return*/];
  16989. }
  16990. values_2 = iterations_1.map(function (iteration) { return iteration.value; });
  16991. if (iterations_1.every(function (iteration) { return iteration.done; })) {
  16992. return [2 /*return*/, values_2];
  16993. }
  16994. // We continuously yield and mutate the same values array so we shallow copy it each time it is pushed.
  16995. return [4 /*yield*/, push(values_2.slice())];
  16996. case 3:
  16997. // We continuously yield and mutate the same values array so we shallow copy it each time it is pushed.
  16998. _a.sent();
  16999. return [4 /*yield*/, Promise.all(iters.map(function (iter, i) { return __awaiter(_this, void 0, void 0, function () {
  17000. var iteration;
  17001. return __generator(this, function (_a) {
  17002. switch (_a.label) {
  17003. case 0:
  17004. if (iterations_1[i].done) {
  17005. return [2 /*return*/, iterations_1[i].value];
  17006. }
  17007. _a.label = 1;
  17008. case 1:
  17009. if (!!stopped) return [3 /*break*/, 4];
  17010. Promise.resolve(iter.next()).then(function (iteration) { return advances[i](iteration); }, function (err) { return stop(err); });
  17011. return [4 /*yield*/, new Promise(function (resolve) { return (advances[i] = resolve); })];
  17012. case 2:
  17013. iteration = _a.sent();
  17014. if (iteration === undefined) {
  17015. return [2 /*return*/, iterations_1[i].value];
  17016. }
  17017. else if (iteration.done) {
  17018. return [2 /*return*/, iteration.value];
  17019. }
  17020. values_2[i] = iteration.value;
  17021. return [4 /*yield*/, push(values_2.slice())];
  17022. case 3:
  17023. _a.sent();
  17024. return [3 /*break*/, 1];
  17025. case 4: return [2 /*return*/];
  17026. }
  17027. });
  17028. }); }))];
  17029. case 4: return [2 /*return*/, _a.sent()];
  17030. case 5:
  17031. stop();
  17032. return [4 /*yield*/, Promise.all(iters.map(function (iter) { return iter.return && iter.return(); }))];
  17033. case 6:
  17034. _a.sent();
  17035. return [7 /*endfinally*/];
  17036. case 7: return [2 /*return*/];
  17037. }
  17038. });
  17039. }); });
  17040. }
  17041. __webpack_unused_export__ = DroppingBuffer;
  17042. __webpack_unused_export__ = FixedBuffer;
  17043. __webpack_unused_export__ = MAX_QUEUE_LENGTH;
  17044. exports.ZN = Repeater;
  17045. __webpack_unused_export__ = RepeaterOverflowError;
  17046. __webpack_unused_export__ = SlidingBuffer;
  17047. //# sourceMappingURL=repeater.js.map
  17048. /***/ })
  17049. /******/ });
  17050. /************************************************************************/
  17051. /******/ // The module cache
  17052. /******/ var __webpack_module_cache__ = {};
  17053. /******/
  17054. /******/ // The require function
  17055. /******/ function __webpack_require__(moduleId) {
  17056. /******/ // Check if module is in cache
  17057. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  17058. /******/ if (cachedModule !== undefined) {
  17059. /******/ return cachedModule.exports;
  17060. /******/ }
  17061. /******/ // Create a new module (and put it into the cache)
  17062. /******/ var module = __webpack_module_cache__[moduleId] = {
  17063. /******/ id: moduleId,
  17064. /******/ loaded: false,
  17065. /******/ exports: {}
  17066. /******/ };
  17067. /******/
  17068. /******/ // Execute the module function
  17069. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  17070. /******/
  17071. /******/ // Flag the module as loaded
  17072. /******/ module.loaded = true;
  17073. /******/
  17074. /******/ // Return the exports of the module
  17075. /******/ return module.exports;
  17076. /******/ }
  17077. /******/
  17078. /************************************************************************/
  17079. /******/ /* webpack/runtime/compat get default export */
  17080. /******/ (() => {
  17081. /******/ // getDefaultExport function for compatibility with non-harmony modules
  17082. /******/ __webpack_require__.n = (module) => {
  17083. /******/ var getter = module && module.__esModule ?
  17084. /******/ () => (module['default']) :
  17085. /******/ () => (module);
  17086. /******/ __webpack_require__.d(getter, { a: getter });
  17087. /******/ return getter;
  17088. /******/ };
  17089. /******/ })();
  17090. /******/
  17091. /******/ /* webpack/runtime/define property getters */
  17092. /******/ (() => {
  17093. /******/ // define getter functions for harmony exports
  17094. /******/ __webpack_require__.d = (exports, definition) => {
  17095. /******/ for(var key in definition) {
  17096. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  17097. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  17098. /******/ }
  17099. /******/ }
  17100. /******/ };
  17101. /******/ })();
  17102. /******/
  17103. /******/ /* webpack/runtime/global */
  17104. /******/ (() => {
  17105. /******/ __webpack_require__.g = (function() {
  17106. /******/ if (typeof globalThis === 'object') return globalThis;
  17107. /******/ try {
  17108. /******/ return this || new Function('return this')();
  17109. /******/ } catch (e) {
  17110. /******/ if (typeof window === 'object') return window;
  17111. /******/ }
  17112. /******/ })();
  17113. /******/ })();
  17114. /******/
  17115. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  17116. /******/ (() => {
  17117. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  17118. /******/ })();
  17119. /******/
  17120. /******/ /* webpack/runtime/node module decorator */
  17121. /******/ (() => {
  17122. /******/ __webpack_require__.nmd = (module) => {
  17123. /******/ module.paths = [];
  17124. /******/ if (!module.children) module.children = [];
  17125. /******/ return module;
  17126. /******/ };
  17127. /******/ })();
  17128. /******/
  17129. /************************************************************************/
  17130. var __webpack_exports__ = {};
  17131. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  17132. (() => {
  17133. "use strict";
  17134. // UNUSED EXPORTS: AddressMatchService, AggregationParameter, AggregationTypes, AlongLineDirection, AnalystAreaUnit, AnalystSizeUnit, AreaSolarRadiationParameters, ArrayStatistic, AttributesPopContainer, BaiduMap, Bounds, Browser, BucketAggParameter, BucketAggType, BufferAnalystParameters, BufferDistance, BufferEndType, BufferRadiusUnit, BufferSetting, BuffersAnalystJobsParameter, BurstPipelineAnalystParameters, CartoCSS, ChangeTileVersion, ChartQueryFilterParameter, ChartQueryParameters, ChartService, ChartType, ChartView, ChartViewModel, CityTabsPage, ClientType, ClipAnalystMode, ClipParameter, CloverShape, ColorDictionary, ColorGradientType, ColorSpaceType, ColorsPickerUtil, CommonContainer, CommonServiceBase, CommonTheme, CommonUtil, ComponentsUtil, ComputeWeightMatrixParameters, CreateDatasetParameters, Credential, DataFlow, DataFlowService, DataFormat, DataItemOrderBy, DataItemType, DataReturnMode, DataReturnOption, DatasetBufferAnalystParameters, DatasetInfo, DatasetOverlayAnalystParameters, DatasetService, DatasetSurfaceAnalystParameters, DatasetThiessenAnalystParameters, DatasourceConnectionInfo, DatasourceService, DeafultCanvasStyle, DensityKernelAnalystParameters, DirectionType, DropDownBox, EditFeaturesParameters, EditType, ElasticSearch, EngineType, EntityType, Event, Events, Exponent, FGB, FacilityAnalyst3DParameters, FacilityAnalystSinks3DParameters, FacilityAnalystSources3DParameters, FacilityAnalystStreamParameters, FacilityAnalystTracedown3DParameters, FacilityAnalystTraceup3DParameters, FacilityAnalystUpstream3DParameters, Feature, FeatureService, FeatureShapeFactory, FeatureTheme, FeatureThemeGraph, FeatureThemeRankSymbol, FeatureThemeVector, FeatureVector, FetchRequest, FieldParameters, FieldService, FieldStatisticsParameters, FieldsFilter, FileReaderUtil, FillGradientMode, FilterField, FilterParameter, FindClosestFacilitiesParameters, FindLocationParameters, FindMTSPPathsParameters, FindPathParameters, FindServiceAreasParameters, FindTSPPathsParameters, Format, GenerateSpatialDataParameters, GeoCodingParameter, GeoDecodingParameter, GeoFeature, GeoHashGridAggParameter, GeoJSONFormat, GeoRelationAnalystParameters, Geometry, GeometryBufferAnalystParameters, GeometryCollection, GeometryCurve, GeometryGeoText, GeometryLineString, GeometryLinearRing, GeometryMultiLineString, GeometryMultiPoint, GeometryMultiPolygon, GeometryOverlayAnalystParameters, GeometryPoint, GeometryPolygon, GeometryRectangle, GeometrySurfaceAnalystParameters, GeometryThiessenAnalystParameters, GeometryType, GeoprocessingService, GetFeatureMode, GetFeaturesByBoundsParameters, GetFeaturesByBufferParameters, GetFeaturesByGeometryParameters, GetFeaturesByIDsParameters, GetFeaturesBySQLParameters, GetFeaturesParametersBase, GetFeaturesServiceBase, GetGridCellInfosParameters, GraduatedMode, Graph, GraphAxesTextDisplayMode, GraphMap, Graphic, GraphicCanvasRenderer, GraphicWebGLRenderer, Grid, GridCellInfosService, GridType, HeatMap, HillshadeParameter, HitCloverShape, IManager, IManagerCreateNodeParam, IManagerServiceBase, IPortal, IPortalAddDataParam, IPortalAddResourceParam, IPortalDataConnectionInfoParam, IPortalDataMetaInfoParam, IPortalDataStoreInfoParam, IPortalQueryParam, IPortalQueryResult, IPortalRegisterServiceParam, IPortalResource, IPortalServiceBase, IPortalShareEntity, IPortalShareParam, IPortalUser, ImageCollectionService, ImageGFAspect, ImageGFHillShade, ImageGFOrtho, ImageGFSlope, ImageRenderingRule, ImageSearchParameter, ImageService, ImageStretchOption, ImageSuperMapRest, ImageTileSuperMapRest, IndexTabsPageContainer, InterpolationAlgorithmType, InterpolationAnalystParameters, InterpolationDensityAnalystParameters, InterpolationIDWAnalystParameters, InterpolationKrigingAnalystParameters, InterpolationRBFAnalystParameters, JSONFormat, JoinItem, JoinType, KernelDensityJobParameter, KeyServiceParameter, KnowledgeGraph, KnowledgeGraphService, Label, LabelBackShape, LabelImageCell, LabelMatrixCell, LabelMixedTextStyle, LabelOverLengthMode, LabelSymbolCell, LabelThemeCell, Lang, LayerInfoService, LayerStatus, LayerType, LinkItem, Logo, LonLat, MapExtend, MapService, MapboxStyles, MappingParameters, Mapv, MapvCanvasLayer, MapvLayer, MathExpressionAnalysisParameters, MeasureMode, MeasureParameters, MeasureService, MessageBox, MetricsAggParameter, MetricsAggType, NDVIParameter, NavTabsPage, NetworkAnalyst3DService, NetworkAnalystService, NetworkAnalystServiceBase, Online, OnlineData, OnlineQueryDatasParameter, OnlineServiceBase, OrderBy, OrderType, OutputSetting, OutputType, OverlapDisplayedOptions, OverlayAnalystParameters, OverlayGeoJobParameter, OverlayGraphic, OverlayOperationType, PaginationContainer, PermissionType, Pixel, PixelFormat, PointWithMeasure, PopContainer, ProcessingService, ProcessingServiceBase, QueryByBoundsParameters, QueryByDistanceParameters, QueryByGeometryParameters, QueryBySQLParameters, QueryOption, QueryParameters, QueryService, Range, RangeMode, RankSymbol, RasterFunctionParameter, RasterFunctionType, ResourceType, Route, RouteCalculateMeasureParameters, RouteLocatorParameters, ScaleLine, SearchMode, SearchType, SecurityManager, Select, ServerColor, ServerFeature, ServerGeometry, ServerInfo, ServerStyle, ServerTextStyle, ServerTheme, ServerType, ServiceBase, ServiceStatus, SetDatasourceParameters, SetLayerInfoParameters, SetLayerStatusParameters, SetLayersInfoParameters, ShapeParameters, ShapeParametersCircle, ShapeParametersImage, ShapeParametersLabel, ShapeParametersLine, ShapeParametersPoint, ShapeParametersPolygon, ShapeParametersRectangle, ShapeParametersSector, SideType, SingleObjectQueryJobsParameter, Size, SmoothMethod, Sortby, SpatialAnalystBase, SpatialAnalystService, SpatialQueryMode, SpatialRelationType, StatisticAnalystMode, StatisticMode, StopQueryParameters, StyleMap, StyleUtils, SummaryAttributesJobsParameter, SummaryMeshJobParameter, SummaryRegionJobParameter, SummaryType, SuperMap, SuperMapCloud, SupplyCenter, SupplyCenterType, SurfaceAnalystMethod, SurfaceAnalystParameters, SurfaceAnalystParametersSetting, TemplateBase, TerrainCurvatureCalculationParameters, TextAlignment, Theme, ThemeDotDensity, ThemeFeature, ThemeGraduatedSymbol, ThemeGraduatedSymbolStyle, ThemeGraph, ThemeGraphAxes, ThemeGraphItem, ThemeGraphSize, ThemeGraphText, ThemeGraphTextFormat, ThemeGraphType, ThemeGridRange, ThemeGridRangeItem, ThemeGridUnique, ThemeGridUniqueItem, ThemeLabel, ThemeLabelAlongLine, ThemeLabelBackground, ThemeLabelItem, ThemeLabelText, ThemeLabelUniqueItem, ThemeMemoryData, ThemeOffset, ThemeParameters, ThemeRange, ThemeRangeItem, ThemeService, ThemeStyle, ThemeType, ThemeUnique, ThemeUniqueItem, ThiessenAnalystParameters, Tianditu, TileSuperMapRest, TimeControlBase, TimeFlowControl, TokenServiceParameter, TopologyValidatorJobsParameter, TopologyValidatorRule, TrafficTransferAnalystService, TransferLine, TransferPathParameters, TransferPreference, TransferSolutionParameters, TransferTactic, Transform, TransportationAnalystParameter, TransportationAnalystResultSetting, Turf, TurnType, UGCLayer, UGCLayerType, UGCMapLayer, UGCSubLayer, Unique, Unit, UpdateDatasetParameters, UpdateEdgeWeightParameters, UpdateTurnNodeWeightParameters, Util, VariogramMode, Vector, VectorClipJobsParameter, VectorTileStyles, VectorTileSuperMapRest, WKTFormat, WebExportFormatType, WebMap, WebPrintingJobContent, WebPrintingJobCustomItems, WebPrintingJobExportOptions, WebPrintingJobImage, WebPrintingJobLayers, WebPrintingJobLayoutOptions, WebPrintingJobLegendOptions, WebPrintingJobLittleMapOptions, WebPrintingJobNorthArrowOptions, WebPrintingJobParameters, WebPrintingJobScaleBarOptions, WebPrintingJobService, WebScaleOrientationType, WebScaleType, WebScaleUnit, conversionDegree, getMeterPerMapUnit, getWrapNum, initMap, isCORS, lineMap, lineStyle, pointMap, pointStyle, polygonMap, polygonStyle, setCORS, viewOptionsFromMapJSON
  17135. ;// CONCATENATED MODULE: ./src/common/SuperMap.js
  17136. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  17137. * This program are made available under the terms of the Apache License, Version 2.0
  17138. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17139. var SuperMap = window.SuperMap = window.SuperMap || {};
  17140. SuperMap.Components = window.SuperMap.Components || {};
  17141. ;// CONCATENATED MODULE: ./src/common/REST.js
  17142. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  17143. * This program are made available under the terms of the Apache License, Version 2.0
  17144. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17145. /**
  17146. * @enum DataFormat
  17147. * @description 服务请求返回结果数据类型
  17148. * @category BaseTypes Constant
  17149. * @type {string}
  17150. * @usage
  17151. * ```
  17152. * // 浏览器
  17153. * <script type="text/javascript" src="{cdn}"></script>
  17154. * <script>
  17155. * const result = {namespace}.DataFormat.GEOJSON;
  17156. *
  17157. * </script>
  17158. * // ES6 Import
  17159. * import { DataFormat } from '{npm}';
  17160. *
  17161. * const result = DataFormat.GEOJSON;
  17162. * ```
  17163. */
  17164. var DataFormat = {
  17165. /** GEOJSON */
  17166. GEOJSON: "GEOJSON",
  17167. /** ISERVER */
  17168. ISERVER: "ISERVER",
  17169. /** FGB */
  17170. FGB: "FGB"
  17171. };
  17172. /**
  17173. * @enum ServerType
  17174. * @description 服务器类型
  17175. * @category BaseTypes Constant
  17176. * @type {string}
  17177. * @usage
  17178. * ```
  17179. * // 浏览器
  17180. * <script type="text/javascript" src="{cdn}"></script>
  17181. * <script>
  17182. * const result = {namespace}.ServerType.ISERVER;
  17183. *
  17184. * </script>
  17185. * // ES6 Import
  17186. * import { ServerType } from '{npm}';
  17187. *
  17188. * const result = ServerType.ISERVER;
  17189. * ```
  17190. */
  17191. var ServerType = {
  17192. /** ISERVER */
  17193. ISERVER: "ISERVER",
  17194. /** IPORTAL */
  17195. IPORTAL: "IPORTAL",
  17196. /** ONLINE */
  17197. ONLINE: "ONLINE"
  17198. };
  17199. /**
  17200. * @enum GeometryType
  17201. * @description 几何对象枚举,定义了一系列几何对象类型。
  17202. * @category BaseTypes Constant
  17203. * @type {string}
  17204. * @usage
  17205. * ```
  17206. * // 浏览器
  17207. * <script type="text/javascript" src="{cdn}"></script>
  17208. * <script>
  17209. * const result = {namespace}.GeometryType.LINE;
  17210. *
  17211. * </script>
  17212. * // ES6 Import
  17213. * import { GeometryType } from '{npm}';
  17214. *
  17215. * const result = GeometryType.LINE;
  17216. * ```
  17217. */
  17218. var REST_GeometryType = {
  17219. /** 线几何对象类型。 */
  17220. LINE: "LINE",
  17221. /** 路由对象。 */
  17222. LINEM: "LINEM",
  17223. /** 点几何对象类型。 */
  17224. POINT: "POINT",
  17225. /** 面几何对象类型。 */
  17226. REGION: "REGION",
  17227. /** EPS点几何对象。 */
  17228. POINTEPS: "POINTEPS",
  17229. /** EPS线几何对象。 */
  17230. LINEEPS: "LINEEPS",
  17231. /** EPS面几何对象。 */
  17232. REGIONEPS: "REGIONEPS",
  17233. /** 椭圆。 */
  17234. ELLIPSE: "ELLIPSE",
  17235. /** 圆。 */
  17236. CIRCLE: "CIRCLE",
  17237. /** 文本几何对象类型。 */
  17238. TEXT: "TEXT",
  17239. /** 矩形。 */
  17240. RECTANGLE: "RECTANGLE",
  17241. /** 未定义。 */
  17242. UNKNOWN: "UNKNOWN",
  17243. /** 复合几何对象类型。 */
  17244. GEOCOMPOUND:"GEOCOMPOUND"
  17245. };
  17246. /**
  17247. * @enum QueryOption
  17248. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  17249. * @category BaseTypes Constant
  17250. * @type {string}
  17251. * @usage
  17252. * ```
  17253. * // 浏览器
  17254. * <script type="text/javascript" src="{cdn}"></script>
  17255. * <script>
  17256. * const result = {namespace}.QueryOption.ATTRIBUTE;
  17257. *
  17258. * </script>
  17259. * // ES6 Import
  17260. * import { QueryOption } from '{npm}';
  17261. *
  17262. * const result = QueryOption.ATTRIBUTE;
  17263. * ```
  17264. */
  17265. var QueryOption = {
  17266. /** 属性。 */
  17267. ATTRIBUTE: "ATTRIBUTE",
  17268. /** 属性和几何对象。 */
  17269. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  17270. /** 几何对象。 */
  17271. GEOMETRY: "GEOMETRY"
  17272. };
  17273. /**
  17274. * @enum JoinType
  17275. * @description 关联查询时的关联类型常量。
  17276. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  17277. * @category BaseTypes Constant
  17278. * @type {string}
  17279. * @usage
  17280. * ```
  17281. * // 浏览器
  17282. * <script type="text/javascript" src="{cdn}"></script>
  17283. * <script>
  17284. * const result = {namespace}.JoinType.INNERJOIN;
  17285. *
  17286. * </script>
  17287. * // ES6 Import
  17288. * import { JoinType } from '{npm}';
  17289. *
  17290. * const result = JoinType.INNERJOIN;
  17291. * ```
  17292. */
  17293. var JoinType = {
  17294. /** 内连接。 */
  17295. INNERJOIN: "INNERJOIN",
  17296. /** 左连接。 */
  17297. LEFTJOIN: "LEFTJOIN"
  17298. };
  17299. /**
  17300. * @enum SpatialQueryMode
  17301. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  17302. * @category BaseTypes Constant
  17303. * @type {string}
  17304. * @usage
  17305. * ```
  17306. * // 浏览器
  17307. * <script type="text/javascript" src="{cdn}"></script>
  17308. * <script>
  17309. * const result = {namespace}.SpatialQueryMode.CONTAIN;
  17310. *
  17311. * </script>
  17312. * // ES6 Import
  17313. * import { SpatialQueryMode } from '{npm}';
  17314. *
  17315. * const result = SpatialQueryMode.CONTAIN;
  17316. * ```
  17317. */
  17318. var SpatialQueryMode = {
  17319. /** 包含空间查询模式。 */
  17320. CONTAIN: "CONTAIN",
  17321. /** 交叉空间查询模式。 */
  17322. CROSS: "CROSS",
  17323. /** 分离空间查询模式。 */
  17324. DISJOINT: "DISJOINT",
  17325. /** 重合空间查询模式。 */
  17326. IDENTITY: "IDENTITY",
  17327. /** 相交空间查询模式。 */
  17328. INTERSECT: "INTERSECT",
  17329. /** 无空间查询。 */
  17330. NONE: "NONE",
  17331. /** 叠加空间查询模式。 */
  17332. OVERLAP: "OVERLAP",
  17333. /** 邻接空间查询模式。 */
  17334. TOUCH: "TOUCH",
  17335. /** 被包含空间查询模式。 */
  17336. WITHIN: "WITHIN"
  17337. };
  17338. /**
  17339. * @enum SpatialRelationType
  17340. * @description 数据集对象间的空间关系枚举。
  17341. * 该类定义了数据集对象间的空间关系类型常量。
  17342. * @category BaseTypes Constant
  17343. * @type {string}
  17344. * @usage
  17345. * ```
  17346. * // 浏览器
  17347. * <script type="text/javascript" src="{cdn}"></script>
  17348. * <script>
  17349. * const result = {namespace}.SpatialRelationType.CONTAIN;
  17350. *
  17351. * </script>
  17352. * // ES6 Import
  17353. * import { SpatialRelationType } from '{npm}';
  17354. *
  17355. * const result = {namespace}.SpatialRelationType.CONTAIN;
  17356. * ```
  17357. */
  17358. var SpatialRelationType = {
  17359. /** 包含关系。 */
  17360. CONTAIN: "CONTAIN",
  17361. /** 相交关系。 */
  17362. INTERSECT: "INTERSECT",
  17363. /** 被包含关系。 */
  17364. WITHIN: "WITHIN"
  17365. };
  17366. /**
  17367. * @enum MeasureMode
  17368. * @type {string}
  17369. * @description 量算模式枚举。
  17370. * @category BaseTypes Constant
  17371. * 该类定义了两种测量模式:距离测量和面积测量。
  17372. * @usage
  17373. * ```
  17374. * // 浏览器
  17375. * <script type="text/javascript" src="{cdn}"></script>
  17376. * <script>
  17377. * const result = {namespace}.MeasureMode.DISTANCE;
  17378. *
  17379. * </script>
  17380. * // ES6 Import
  17381. * import { MeasureMode } from '{npm}';
  17382. *
  17383. * const result = MeasureMode.DISTANCE;
  17384. * ```
  17385. */
  17386. var MeasureMode = {
  17387. /** 距离测量。 */
  17388. DISTANCE: "DISTANCE",
  17389. /** 面积测量。 */
  17390. AREA: "AREA"
  17391. };
  17392. /**
  17393. * @enum Unit
  17394. * @description 距离单位枚举。
  17395. * 该类定义了一系列距离单位类型。
  17396. * @category BaseTypes Constant
  17397. * @type {string}
  17398. * @usage
  17399. * ```
  17400. * // 浏览器
  17401. * <script type="text/javascript" src="{cdn}"></script>
  17402. * <script>
  17403. * const result = {namespace}.Unit.METER;
  17404. *
  17405. * </script>
  17406. * // ES6 Import
  17407. * import { Unit } from '{npm}';
  17408. *
  17409. * const result = Unit.METER;
  17410. * ```
  17411. */
  17412. var Unit = {
  17413. /** 米。 */
  17414. METER: "METER",
  17415. /** 千米。 */
  17416. KILOMETER: "KILOMETER",
  17417. /** 英里。 */
  17418. MILE: "MILE",
  17419. /** 码。 */
  17420. YARD: "YARD",
  17421. /** 度。 */
  17422. DEGREE: "DEGREE",
  17423. /** 毫米。 */
  17424. MILLIMETER: "MILLIMETER",
  17425. /** 厘米。 */
  17426. CENTIMETER: "CENTIMETER",
  17427. /** 英寸。 */
  17428. INCH: "INCH",
  17429. /** 分米。 */
  17430. DECIMETER: "DECIMETER",
  17431. /** 英尺。 */
  17432. FOOT: "FOOT",
  17433. /** 秒。 */
  17434. SECOND: "SECOND",
  17435. /** 分。 */
  17436. MINUTE: "MINUTE",
  17437. /** 弧度。 */
  17438. RADIAN: "RADIAN"
  17439. };
  17440. /**
  17441. * @enum BufferRadiusUnit
  17442. * @description 缓冲区距离单位枚举。该类定义了一系列缓冲距离单位类型。
  17443. * @category BaseTypes Constant
  17444. * @type {string}
  17445. * @usage
  17446. * ```
  17447. * // 浏览器
  17448. * <script type="text/javascript" src="{cdn}"></script>
  17449. * <script>
  17450. * const result = {namespace}.BufferRadiusUnit.CENTIMETER;
  17451. *
  17452. * </script>
  17453. * // ES6 Import
  17454. * import { BufferRadiusUnit } from '{npm}';
  17455. *
  17456. * const result = BufferRadiusUnit.CENTIMETER;
  17457. * ```
  17458. */
  17459. var BufferRadiusUnit = {
  17460. /** 厘米。 */
  17461. CENTIMETER: "CENTIMETER",
  17462. /** 分米。 */
  17463. DECIMETER: "DECIMETER",
  17464. /** 英尺。 */
  17465. FOOT: "FOOT",
  17466. /** 英寸。 */
  17467. INCH: "INCH",
  17468. /** 千米。 */
  17469. KILOMETER: "KILOMETER",
  17470. /** 米。 */
  17471. METER: "METER",
  17472. /** 英里。 */
  17473. MILE: "MILE",
  17474. /** 毫米。 */
  17475. MILLIMETER: "MILLIMETER",
  17476. /** 码。 */
  17477. YARD: "YARD"
  17478. }
  17479. /**
  17480. * @enum EngineType
  17481. * @description 数据源引擎类型枚举。
  17482. * @category BaseTypes Constant
  17483. * @type {string}
  17484. * @usage
  17485. * ```
  17486. * // 浏览器
  17487. * <script type="text/javascript" src="{cdn}"></script>
  17488. * <script>
  17489. * const result = {namespace}.EngineType.IMAGEPLUGINS;
  17490. *
  17491. * </script>
  17492. * // ES6 Import
  17493. * import { EngineType } from '{npm}';
  17494. *
  17495. * const result = EngineType.IMAGEPLUGINS;
  17496. * ```
  17497. */
  17498. var EngineType = {
  17499. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  17500. IMAGEPLUGINS: "IMAGEPLUGINS",
  17501. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  17502. OGC: "OGC",
  17503. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  17504. ORACLEPLUS: "ORACLEPLUS",
  17505. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  17506. SDBPLUS: "SDBPLUS",
  17507. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎。 */
  17508. SQLPLUS: "SQLPLUS",
  17509. /** UDB 引擎类型,文件引擎。 */
  17510. UDB: "UDB"
  17511. };
  17512. /**
  17513. * @enum ThemeGraphTextFormat
  17514. * @description 统计专题图文本显示格式枚举。
  17515. * @category BaseTypes Constant
  17516. * @type {string}
  17517. * @usage
  17518. * ```
  17519. * // 浏览器
  17520. * <script type="text/javascript" src="{cdn}"></script>
  17521. * <script>
  17522. * const result = {namespace}.ThemeGraphTextFormat.CAPTION;
  17523. *
  17524. * </script>
  17525. * // ES6 Import
  17526. * import { ThemeGraphTextFormat } from '{npm}';
  17527. *
  17528. * const result = ThemeGraphTextFormat.CAPTION;
  17529. * ```
  17530. */
  17531. var ThemeGraphTextFormat = {
  17532. /** 标题。以各子项的标题来进行标注。 */
  17533. CAPTION: "CAPTION",
  17534. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  17535. CAPTION_PERCENT: "CAPTION_PERCENT",
  17536. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  17537. CAPTION_VALUE: "CAPTION_VALUE",
  17538. /** 百分数。以各子项所占的百分比来进行标注。 */
  17539. PERCENT: "PERCENT",
  17540. /** 实际数值。以各子项的真实数值来进行标注。 */
  17541. VALUE: "VALUE"
  17542. };
  17543. /**
  17544. * @enum ThemeGraphType
  17545. * @description 统计专题图类型枚举。
  17546. * @category BaseTypes Constant
  17547. * @type {string}
  17548. * @usage
  17549. * ```
  17550. * // 浏览器
  17551. * <script type="text/javascript" src="{cdn}"></script>
  17552. * <script>
  17553. * const result = {namespace}.ThemeGraphType.AREA;
  17554. *
  17555. * </script>
  17556. * // ES6 Import
  17557. * import { ThemeGraphType } from '{npm}';
  17558. *
  17559. * const result = ThemeGraphType.AREA;
  17560. * ```
  17561. */
  17562. var ThemeGraphType = {
  17563. /** 面积图。 */
  17564. AREA: "AREA",
  17565. /** 柱状图。 */
  17566. BAR: "BAR",
  17567. /** 三维柱状图。 */
  17568. BAR3D: "BAR3D",
  17569. /** 折线图。 */
  17570. LINE: "LINE",
  17571. /** 饼图。 */
  17572. PIE: "PIE",
  17573. /** 三维饼图。 */
  17574. PIE3D: "PIE3D",
  17575. /** 点状图。 */
  17576. POINT: "POINT",
  17577. /** 环状图。 */
  17578. RING: "RING",
  17579. /** 玫瑰图。 */
  17580. ROSE: "ROSE",
  17581. /** 三维玫瑰图。 */
  17582. ROSE3D: "ROSE3D",
  17583. /** 堆叠柱状图。 */
  17584. STACK_BAR: "STACK_BAR",
  17585. /** 三维堆叠柱状图。 */
  17586. STACK_BAR3D: "STACK_BAR3D",
  17587. /** 阶梯图。 */
  17588. STEP: "STEP"
  17589. };
  17590. /**
  17591. * @enum GraphAxesTextDisplayMode
  17592. * @description 统计专题图坐标轴文本显示模式。
  17593. * @category BaseTypes Constant
  17594. * @type {string}
  17595. * @usage
  17596. * ```
  17597. * // 浏览器
  17598. * <script type="text/javascript" src="{cdn}"></script>
  17599. * <script>
  17600. * const result = {namespace}.GraphAxesTextDisplayMode.ALL;
  17601. *
  17602. * </script>
  17603. * // ES6 Import
  17604. * import { GraphAxesTextDisplayMode } from '{npm}';
  17605. *
  17606. * const result = GraphAxesTextDisplayMode.ALL;
  17607. * ```
  17608. */
  17609. var GraphAxesTextDisplayMode = {
  17610. /** 显示全部文本。 */
  17611. ALL: "ALL",
  17612. /** 不显示。 */
  17613. NONE: "NONE",
  17614. /** 显示Y轴的文本。 */
  17615. YAXES: "YAXES"
  17616. };
  17617. /**
  17618. * @enum GraduatedMode
  17619. * @description 专题图分级模式枚举。
  17620. * @category BaseTypes Constant
  17621. * @type {string}
  17622. * @usage
  17623. * ```
  17624. * // 浏览器
  17625. * <script type="text/javascript" src="{cdn}"></script>
  17626. * <script>
  17627. * const result = {namespace}.GraduatedMode.CONSTANT;
  17628. *
  17629. * </script>
  17630. * // ES6 Import
  17631. * import { GraduatedMode } from '{npm}';
  17632. *
  17633. * const result = GraduatedMode.CONSTANT;
  17634. * ```
  17635. */
  17636. var GraduatedMode = {
  17637. /** 常量分级模式。 */
  17638. CONSTANT: "CONSTANT",
  17639. /** 对数分级模式。 */
  17640. LOGARITHM: "LOGARITHM",
  17641. /** 平方根分级模式。 */
  17642. SQUAREROOT: "SQUAREROOT"
  17643. };
  17644. /**
  17645. * @enum RangeMode
  17646. * @description 范围分段专题图分段方式枚举。
  17647. * @category BaseTypes Constant
  17648. * @type {string}
  17649. * @usage
  17650. * ```
  17651. * // 浏览器
  17652. * <script type="text/javascript" src="{cdn}"></script>
  17653. * <script>
  17654. * const result = {namespace}.RangeMode.CUSTOMINTERVAL;
  17655. *
  17656. * </script>
  17657. * // ES6 Import
  17658. * import { RangeMode } from '{npm}';
  17659. *
  17660. * const result = RangeMode.CUSTOMINTERVAL;
  17661. * ```
  17662. */
  17663. var RangeMode = {
  17664. /** 自定义分段法。 */
  17665. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  17666. /** 等距离分段法。 */
  17667. EQUALINTERVAL: "EQUALINTERVAL",
  17668. /** 对数分段法。 */
  17669. LOGARITHM: "LOGARITHM",
  17670. /** 等计数分段法。 */
  17671. QUANTILE: "QUANTILE",
  17672. /** 平方根分段法。 */
  17673. SQUAREROOT: "SQUAREROOT",
  17674. /** 标准差分段法。 */
  17675. STDDEVIATION: "STDDEVIATION"
  17676. };
  17677. /**
  17678. * @enum ThemeType
  17679. * @description 专题图类型枚举。
  17680. * @category BaseTypes Constant
  17681. * @type {string}
  17682. * @usage
  17683. * ```
  17684. * // 浏览器
  17685. * <script type="text/javascript" src="{cdn}"></script>
  17686. * <script>
  17687. * const result = {namespace}.ThemeType.DOTDENSITY;
  17688. *
  17689. * </script>
  17690. * // ES6 Import
  17691. * import { ThemeType } from '{npm}';
  17692. *
  17693. * const result = ThemeType.DOTDENSITY;
  17694. * ```
  17695. */
  17696. var ThemeType = {
  17697. /** 点密度专题图。 */
  17698. DOTDENSITY: "DOTDENSITY",
  17699. /** 等级符号专题图。 */
  17700. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  17701. /** 统计专题图。 */
  17702. GRAPH: "GRAPH",
  17703. /** 标签专题图。 */
  17704. LABEL: "LABEL",
  17705. /** 分段专题图。 */
  17706. RANGE: "RANGE",
  17707. /** 単值专题图。 */
  17708. UNIQUE: "UNIQUE"
  17709. };
  17710. /**
  17711. * @enum ColorGradientType
  17712. * @description 渐变颜色枚举。
  17713. * @category BaseTypes Constant
  17714. * @type {string}
  17715. * @usage
  17716. * ```
  17717. * // 浏览器
  17718. * <script type="text/javascript" src="{cdn}"></script>
  17719. * <script>
  17720. * const result = {namespace}.ColorGradientType.BLACK_WHITE;
  17721. *
  17722. * </script>
  17723. * // ES6 Import
  17724. * import { ColorGradientType } from '{npm}';
  17725. *
  17726. * const result = ColorGradientType.BLACK_WHITE;
  17727. * ```
  17728. */
  17729. var ColorGradientType = {
  17730. /** 黑白渐变色。 */
  17731. BLACK_WHITE: "BLACKWHITE",
  17732. /** 蓝黑渐变色。 */
  17733. BLUE_BLACK: "BLUEBLACK",
  17734. /** 蓝红渐变色。 */
  17735. BLUE_RED: "BLUERED",
  17736. /** 蓝白渐变色。 */
  17737. BLUE_WHITE: "BLUEWHITE",
  17738. /** 青黑渐变色。 */
  17739. CYAN_BLACK: "CYANBLACK",
  17740. /** 青蓝渐变色。 */
  17741. CYAN_BLUE: "CYANBLUE",
  17742. /** 青绿渐变色。 */
  17743. CYAN_GREEN: "CYANGREEN",
  17744. /** 青白渐变色。 */
  17745. CYAN_WHITE: "CYANWHITE",
  17746. /** 绿黑渐变色。 */
  17747. GREEN_BLACK: "GREENBLACK",
  17748. /** 绿蓝渐变色。 */
  17749. GREEN_BLUE: "GREENBLUE",
  17750. /** 绿橙紫渐变色。 */
  17751. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  17752. /** 绿红渐变色。 */
  17753. GREEN_RED: "GREENRED",
  17754. /** 蓝红渐变色。 */
  17755. GREEN_WHITE: "GREENWHITE",
  17756. /** 粉黑渐变色。 */
  17757. PINK_BLACK: "PINKBLACK",
  17758. /** 粉蓝渐变色。 */
  17759. PINK_BLUE: "PINKBLUE",
  17760. /** 粉红渐变色。 */
  17761. PINK_RED: "PINKRED",
  17762. /** 粉白渐变色。 */
  17763. PINK_WHITE: "PINKWHITE",
  17764. /** 彩虹色。 */
  17765. RAIN_BOW: "RAINBOW",
  17766. /** 红黑渐变色。 */
  17767. RED_BLACK: "REDBLACK",
  17768. /** 红白渐变色。 */
  17769. RED_WHITE: "REDWHITE",
  17770. /** 光谱渐变。 */
  17771. SPECTRUM: "SPECTRUM",
  17772. /** 地形渐变,用于三维显示效果较好。 */
  17773. TERRAIN: "TERRAIN",
  17774. /** 黄黑渐变色。 */
  17775. YELLOW_BLACK: "YELLOWBLACK",
  17776. /** 黄蓝渐变色。 */
  17777. YELLOW_BLUE: "YELLOWBLUE",
  17778. /** 黄绿渐变色。 */
  17779. YELLOW_GREEN: "YELLOWGREEN",
  17780. /** 黄红渐变色。 */
  17781. YELLOW_RED: "YELLOWRED",
  17782. /** 黄白渐变色。 */
  17783. YELLOW_WHITE: "YELLOWWHITE"
  17784. };
  17785. /**
  17786. * @enum TextAlignment
  17787. * @description 文本对齐枚举。
  17788. * @category BaseTypes Constant
  17789. * @type {string}
  17790. * @usage
  17791. * ```
  17792. * // 浏览器
  17793. * <script type="text/javascript" src="{cdn}"></script>
  17794. * <script>
  17795. * const result = {namespace}.TextAlignment.TOPLEFT;
  17796. *
  17797. * </script>
  17798. * // ES6 Import
  17799. * import { TextAlignment } from '{npm}';
  17800. *
  17801. * const result = TextAlignment.TOPLEFT;
  17802. * ```
  17803. */
  17804. var TextAlignment = {
  17805. /** 左上角对齐。 */
  17806. TOPLEFT: "TOPLEFT",
  17807. /** 顶部居中对齐。 */
  17808. TOPCENTER: "TOPCENTER",
  17809. /** 右上角对齐。 */
  17810. TOPRIGHT: "TOPRIGHT",
  17811. /** 基准线左对齐。 */
  17812. BASELINELEFT: "BASELINELEFT",
  17813. /** 基准线居中对齐。 */
  17814. BASELINECENTER: "BASELINECENTER",
  17815. /** 基准线右对齐。 */
  17816. BASELINERIGHT: "BASELINERIGHT",
  17817. /** 左下角对齐。 */
  17818. BOTTOMLEFT: "BOTTOMLEFT",
  17819. /** 底部居中对齐。 */
  17820. BOTTOMCENTER: "BOTTOMCENTER",
  17821. /** 右下角对齐。 */
  17822. BOTTOMRIGHT: "BOTTOMRIGHT",
  17823. /** 左中对齐。 */
  17824. MIDDLELEFT: "MIDDLELEFT",
  17825. /** 中心对齐。 */
  17826. MIDDLECENTER: "MIDDLECENTER",
  17827. /** 右中对齐。 */
  17828. MIDDLERIGHT: "MIDDLERIGHT"
  17829. };
  17830. /**
  17831. * @enum FillGradientMode
  17832. * @description 渐变填充风格的渐变类型枚举。
  17833. * @category BaseTypes Constant
  17834. * @type {string}
  17835. * @usage
  17836. * ```
  17837. * // 浏览器
  17838. * <script type="text/javascript" src="{cdn}"></script>
  17839. * <script>
  17840. * const result = {namespace}.FillGradientMode.NONE;
  17841. *
  17842. * </script>
  17843. * // ES6 Import
  17844. * import { FillGradientMode } from '{npm}';
  17845. *
  17846. * const result = FillGradientMode.NONE;
  17847. * ```
  17848. */
  17849. var FillGradientMode = {
  17850. /** 无渐变。 */
  17851. NONE: "NONE",
  17852. /** 线性渐变填充。 */
  17853. LINEAR: "LINEAR",
  17854. /** 辐射渐变填充。 */
  17855. RADIAL: "RADIAL",
  17856. /** 圆锥渐变填充。 */
  17857. CONICAL: "CONICAL",
  17858. /** 四角渐变填充。 */
  17859. SQUARE: "SQUARE"
  17860. };
  17861. /**
  17862. * @enum AlongLineDirection
  17863. * @description 标签沿线标注方向枚举。
  17864. * @category BaseTypes Constant
  17865. * @type {string}
  17866. * @usage
  17867. * ```
  17868. * // 浏览器
  17869. * <script type="text/javascript" src="{cdn}"></script>
  17870. * <script>
  17871. * const result = {namespace}.AlongLineDirection.NORMAL;
  17872. *
  17873. * </script>
  17874. * // ES6 Import
  17875. * import { AlongLineDirection } from '{npm}';
  17876. *
  17877. * const result = AlongLineDirection.NORMAL;
  17878. * ```
  17879. */
  17880. var AlongLineDirection = {
  17881. /** 沿线的法线方向放置标签。 */
  17882. NORMAL: "ALONG_LINE_NORMAL",
  17883. /** 从下到上,从左到右放置。 */
  17884. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  17885. /** 从上到下,从左到右放置。 */
  17886. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  17887. /** 从下到上,从右到左放置。 */
  17888. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  17889. /** 从上到下,从右到左放置。 */
  17890. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  17891. };
  17892. /**
  17893. * @enum LabelBackShape
  17894. * @description 标签专题图中标签背景的形状枚举。
  17895. * @category BaseTypes Constant
  17896. * @type {string}
  17897. * @usage
  17898. * ```
  17899. * // 浏览器
  17900. * <script type="text/javascript" src="{cdn}"></script>
  17901. * <script>
  17902. * const result = {namespace}.LabelBackShape.DIAMOND;
  17903. *
  17904. * </script>
  17905. * // ES6 Import
  17906. * import { LabelBackShape } from '{npm}';
  17907. *
  17908. * const result = LabelBackShape.DIAMOND;
  17909. * ```
  17910. */
  17911. var LabelBackShape = {
  17912. /** 菱形背景,即标签背景的形状为菱形。 */
  17913. DIAMOND: "DIAMOND",
  17914. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  17915. ELLIPSE: "ELLIPSE",
  17916. /** 符号背景,即标签背景的形状为设定的符号。 */
  17917. MARKER: "MARKER",
  17918. /** 空背景,即不使用任何形状作为标签的背景。 */
  17919. NONE: "NONE",
  17920. /** 矩形背景,即标签背景的形状为矩形。 */
  17921. RECT: "RECT",
  17922. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  17923. ROUNDRECT: "ROUNDRECT",
  17924. /** 三角形背景,即标签背景的形状为三角形。 */
  17925. TRIANGLE: "TRIANGLE"
  17926. };
  17927. /**
  17928. * @enum LabelOverLengthMode
  17929. * @description 标签专题图中超长标签的处理模式枚举。
  17930. * @category BaseTypes Constant
  17931. * @type {string}
  17932. * @usage
  17933. * ```
  17934. * // 浏览器
  17935. * <script type="text/javascript" src="{cdn}"></script>
  17936. * <script>
  17937. * const result = {namespace}.LabelOverLengthMode.NEWLINE;
  17938. *
  17939. * </script>
  17940. * // ES6 Import
  17941. * import { LabelOverLengthMode } from '{npm}';
  17942. *
  17943. * const result = LabelOverLengthMode.NEWLINE;
  17944. * ```
  17945. */
  17946. var LabelOverLengthMode = {
  17947. /** 换行显示。 */
  17948. NEWLINE: "NEWLINE",
  17949. /** 对超长标签不进行处理。 */
  17950. NONE: "NONE",
  17951. /** 省略超出部分。 */
  17952. OMIT: "OMIT"
  17953. };
  17954. /**
  17955. * @enum DirectionType
  17956. * @description 网络分析中方向枚举。
  17957. * 在行驶引导子项中使用。
  17958. * @category BaseTypes Constant
  17959. * @type {string}
  17960. * @usage
  17961. * ```
  17962. * // 浏览器
  17963. * <script type="text/javascript" src="{cdn}"></script>
  17964. * <script>
  17965. * const result = {namespace}.DirectionType.EAST;
  17966. *
  17967. * </script>
  17968. * // ES6 Import
  17969. * import { DirectionType } from '{npm}';
  17970. *
  17971. * const result = DirectionType.EAST;
  17972. * ```
  17973. */
  17974. var DirectionType = {
  17975. /** 东。 */
  17976. EAST: "EAST",
  17977. /** 无方向。 */
  17978. NONE: "NONE",
  17979. /** 北。 */
  17980. NORTH: "NORTH",
  17981. /** 南。 */
  17982. SOURTH: "SOURTH",
  17983. /** 西。 */
  17984. WEST: "WEST"
  17985. };
  17986. /**
  17987. * @enum SideType
  17988. * @description 行驶位置枚举。
  17989. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  17990. * @category BaseTypes Constant
  17991. * @type {string}
  17992. * @usage
  17993. * ```
  17994. * // 浏览器
  17995. * <script type="text/javascript" src="{cdn}"></script>
  17996. * <script>
  17997. * const result = {namespace}.SideType.LEFT;
  17998. *
  17999. * </script>
  18000. * // ES6 Import
  18001. * import { SideType } from '{npm}';
  18002. *
  18003. * const result = SideType.LEFT;
  18004. * ```
  18005. */
  18006. var SideType = {
  18007. /** 路的左侧。 */
  18008. LEFT: "LEFT",
  18009. /** 在路上(即路的中间)。 */
  18010. MIDDLE: "MIDDLE",
  18011. /** 无效值。 */
  18012. NONE: "NONE",
  18013. /** 路的右侧。 */
  18014. RIGHT: "RIGHT"
  18015. };
  18016. /**
  18017. * @enum SupplyCenterType
  18018. * @description 资源供给中心类型枚举。
  18019. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  18020. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  18021. * @category BaseTypes Constant
  18022. * @type {string}
  18023. * @usage
  18024. * ```
  18025. * // 浏览器
  18026. * <script type="text/javascript" src="{cdn}"></script>
  18027. * <script>
  18028. * const result = {namespace}.SupplyCenterType.FIXEDCENTER;
  18029. *
  18030. * </script>
  18031. * // ES6 Import
  18032. * import { SupplyCenterType } from '{npm}';
  18033. *
  18034. * const result = SupplyCenterType.FIXEDCENTER;
  18035. * ```
  18036. */
  18037. var SupplyCenterType = {
  18038. /** 固定中心点。 */
  18039. FIXEDCENTER: "FIXEDCENTER",
  18040. /** 非中心点。 */
  18041. NULL: "NULL",
  18042. /** 可选中心点。 */
  18043. OPTIONALCENTER: "OPTIONALCENTER"
  18044. };
  18045. /**
  18046. * @enum TurnType
  18047. * @description 转弯方向枚举。
  18048. * 用在行驶引导子项类中,表示转弯的方向。
  18049. * @category BaseTypes Constant
  18050. * @type {string}
  18051. * @usage
  18052. * ```
  18053. * // 浏览器
  18054. * <script type="text/javascript" src="{cdn}"></script>
  18055. * <script>
  18056. * const result = {namespace}.TurnType.AHEAD;
  18057. *
  18058. * </script>
  18059. * // ES6 Import
  18060. * import { TurnType } from '{npm}';
  18061. *
  18062. * const result = TurnType.AHEAD;
  18063. * ```
  18064. */
  18065. var TurnType = {
  18066. /** 向前直行。 */
  18067. AHEAD: "AHEAD",
  18068. /** 掉头。 */
  18069. BACK: "BACK",
  18070. /** 终点,不拐弯。 */
  18071. END: "END",
  18072. /** 左转弯。 */
  18073. LEFT: "LEFT",
  18074. /** 无效值。 */
  18075. NONE: "NONE",
  18076. /** 右转弯。 */
  18077. RIGHT: "RIGHT"
  18078. };
  18079. /**
  18080. * @enum BufferEndType
  18081. * @description 缓冲区分析BufferEnd类型。
  18082. * @category BaseTypes Constant
  18083. * @type {string}
  18084. * @usage
  18085. * ```
  18086. * // 浏览器
  18087. * <script type="text/javascript" src="{cdn}"></script>
  18088. * <script>
  18089. * const result = {namespace}.BufferEndType.FLAT;
  18090. *
  18091. * </script>
  18092. * // ES6 Import
  18093. * import { BufferEndType } from '{npm}';
  18094. *
  18095. * const result = BufferEndType.FLAT;
  18096. * ```
  18097. */
  18098. var BufferEndType = {
  18099. /** 平头缓冲。 */
  18100. FLAT: "FLAT",
  18101. /** 圆头缓冲。 */
  18102. ROUND: "ROUND"
  18103. };
  18104. /**
  18105. * @enum OverlayOperationType
  18106. * @description 叠加分析类型枚举。
  18107. * @category BaseTypes Constant
  18108. * @type {string}
  18109. * @usage
  18110. * ```
  18111. * // 浏览器
  18112. * <script type="text/javascript" src="{cdn}"></script>
  18113. * <script>
  18114. * const result = {namespace}.OverlayOperationType.CLIP;
  18115. *
  18116. * </script>
  18117. * // ES6 Import
  18118. * import { OverlayOperationType } from '{npm}';
  18119. *
  18120. * const result = OverlayOperationType.CLIP;
  18121. * ```
  18122. */
  18123. var OverlayOperationType = {
  18124. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  18125. CLIP: "CLIP",
  18126. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  18127. ERASE: "ERASE",
  18128. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  18129. IDENTITY: "IDENTITY",
  18130. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  18131. INTERSECT: "INTERSECT",
  18132. /** 对两个面数据集(几何对象)进行合并操作。 */
  18133. UNION: "UNION",
  18134. /** 对两个面数据集(几何对象)进行更新操作。 */
  18135. UPDATE: "UPDATE",
  18136. /** 对两个面数据集(几何对象)进行对称差操作。 */
  18137. XOR: "XOR"
  18138. };
  18139. /**
  18140. * @enum OutputType
  18141. * @description 分布式分析输出类型枚举。
  18142. * @category BaseTypes Constant
  18143. * @type {string}
  18144. * @usage
  18145. * ```
  18146. * // 浏览器
  18147. * <script type="text/javascript" src="{cdn}"></script>
  18148. * <script>
  18149. * const result = {namespace}.OutputType.INDEXEDHDFS;
  18150. *
  18151. * </script>
  18152. * // ES6 Import
  18153. * import { OutputType } from '{npm}';
  18154. *
  18155. * const result = OutputType.INDEXEDHDFS;
  18156. * ```
  18157. */
  18158. var OutputType = {
  18159. /** INDEXEDHDFS */
  18160. INDEXEDHDFS: "INDEXEDHDFS",
  18161. /** UDB */
  18162. UDB: "UDB",
  18163. /** MONGODB */
  18164. MONGODB: "MONGODB",
  18165. /** PG */
  18166. PG: "PG"
  18167. };
  18168. /**
  18169. * @enum SmoothMethod
  18170. * @description 光滑方法枚举。
  18171. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  18172. * @category BaseTypes Constant
  18173. * @type {string}
  18174. * @usage
  18175. * ```
  18176. * // 浏览器
  18177. * <script type="text/javascript" src="{cdn}"></script>
  18178. * <script>
  18179. * const result = {namespace}.SmoothMethod.BSPLINE;
  18180. *
  18181. * </script>
  18182. * // ES6 Import
  18183. * import { SmoothMethod } from '{npm}';
  18184. *
  18185. * const result = SmoothMethod.BSPLINE;
  18186. * ```
  18187. */
  18188. var SmoothMethod = {
  18189. /** B 样条法。 */
  18190. BSPLINE: "BSPLINE",
  18191. /** 磨角法。 */
  18192. POLISH: "POLISH"
  18193. };
  18194. /**
  18195. * @enum SurfaceAnalystMethod
  18196. * @description 表面分析方法枚举。
  18197. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  18198. * @category BaseTypes Constant
  18199. * @type {string}
  18200. * @usage
  18201. * ```
  18202. * // 浏览器
  18203. * <script type="text/javascript" src="{cdn}"></script>
  18204. * <script>
  18205. * const result = {namespace}.SurfaceAnalystMethod.ISOLINE;
  18206. *
  18207. * </script>
  18208. * // ES6 Import
  18209. * import { SurfaceAnalystMethod } from '{npm}';
  18210. *
  18211. * const result = SurfaceAnalystMethod.ISOLINE;
  18212. * ```
  18213. */
  18214. var SurfaceAnalystMethod = {
  18215. /** 等值线提取。 */
  18216. ISOLINE: "ISOLINE",
  18217. /** 等值面提取。 */
  18218. ISOREGION: "ISOREGION"
  18219. };
  18220. /**
  18221. * @enum DataReturnMode
  18222. * @description 数据返回模式枚举。
  18223. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  18224. * @category BaseTypes Constant
  18225. * @type {string}
  18226. * @usage
  18227. * ```
  18228. * // 浏览器
  18229. * <script type="text/javascript" src="{cdn}"></script>
  18230. * <script>
  18231. * const result = {namespace}.DataReturnMode.DATASET_AND_RECORDSET;
  18232. *
  18233. * </script>
  18234. * // ES6 Import
  18235. * import { DataReturnMode } from '{npm}';
  18236. *
  18237. * const result = DataReturnMode.DATASET_AND_RECORDSET;
  18238. * ```
  18239. */
  18240. var DataReturnMode = {
  18241. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  18242. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  18243. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  18244. DATASET_ONLY: "DATASET_ONLY",
  18245. /** 只返回记录集(RecordSet)。 */
  18246. RECORDSET_ONLY: "RECORDSET_ONLY"
  18247. };
  18248. /**
  18249. * @enum EditType
  18250. * @description 要素集更新模式枚举。
  18251. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  18252. * @category BaseTypes Constant
  18253. * @type {string}
  18254. * @usage
  18255. * ```
  18256. * // 浏览器
  18257. * <script type="text/javascript" src="{cdn}"></script>
  18258. * <script>
  18259. * const result = {namespace}.EditType.ADD;
  18260. *
  18261. * </script>
  18262. * // ES6 Import
  18263. * import { EditType } from '{npm}';
  18264. *
  18265. * const result = {namespace}.EditType.ADD;
  18266. * ```
  18267. */
  18268. var EditType = {
  18269. /** 增加操作。 */
  18270. ADD: "add",
  18271. /** 修改操作。 */
  18272. UPDATE: "update",
  18273. /** 删除操作。 */
  18274. DELETE: "delete"
  18275. };
  18276. /**
  18277. * @enum TransferTactic
  18278. * @description 公交换乘策略枚举。
  18279. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  18280. * @category BaseTypes Constant
  18281. * @type {string}
  18282. * @usage
  18283. * ```
  18284. * // 浏览器
  18285. * <script type="text/javascript" src="{cdn}"></script>
  18286. * <script>
  18287. * const result = {namespace}.TransferTactic.LESS_TIME;
  18288. *
  18289. * </script>
  18290. * // ES6 Import
  18291. * import { TransferTactic } from '{npm}';
  18292. *
  18293. * const result = TransferTactic.LESS_TIME;
  18294. * ```
  18295. */
  18296. var TransferTactic = {
  18297. /** 时间短。 */
  18298. LESS_TIME: "LESS_TIME",
  18299. /** 少换乘。 */
  18300. LESS_TRANSFER: "LESS_TRANSFER",
  18301. /** 少步行。 */
  18302. LESS_WALK: "LESS_WALK",
  18303. /** 距离最短。 */
  18304. MIN_DISTANCE: "MIN_DISTANCE"
  18305. };
  18306. /**
  18307. * @enum TransferPreference
  18308. * @description 公交换乘策略枚举。
  18309. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  18310. * @category BaseTypes Constant
  18311. * @type {string}
  18312. * @usage
  18313. * ```
  18314. * // 浏览器
  18315. * <script type="text/javascript" src="{cdn}"></script>
  18316. * <script>
  18317. * const result = {namespace}.TransferPreference.BUS;
  18318. *
  18319. * </script>
  18320. * // ES6 Import
  18321. * import { TransferPreference } from '{npm}';
  18322. *
  18323. * const result = TransferPreference.BUS;
  18324. * ```
  18325. */
  18326. var TransferPreference = {
  18327. /** 公交汽车优先。 */
  18328. BUS: "BUS",
  18329. /** 地铁优先。 */
  18330. SUBWAY: "SUBWAY",
  18331. /** 不乘坐地铁。 */
  18332. NO_SUBWAY: "NO_SUBWAY",
  18333. /** 无乘车偏好。 */
  18334. NONE: "NONE"
  18335. };
  18336. /**
  18337. * @enum GridType
  18338. * @description 地图背景格网类型枚举。
  18339. * @category BaseTypes Constant
  18340. * @type {string}
  18341. * @usage
  18342. * ```
  18343. * // 浏览器
  18344. * <script type="text/javascript" src="{cdn}"></script>
  18345. * <script>
  18346. * const result = {namespace}.GridType.CROSS;
  18347. *
  18348. * </script>
  18349. * // ES6 Import
  18350. * import { GridType } from '{npm}';
  18351. *
  18352. * const result = GridType.CROSS;
  18353. * ```
  18354. */
  18355. var GridType = {
  18356. /** 十字叉丝。 */
  18357. CROSS: "CROSS",
  18358. /** 网格线。 */
  18359. GRID: "GRID",
  18360. /** 点。 */
  18361. POINT: "POINT"
  18362. };
  18363. /**
  18364. * @enum ColorSpaceType
  18365. * @description 色彩空间枚举。
  18366. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  18367. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  18368. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  18369. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  18370. * @category BaseTypes Constant
  18371. * @type {string}
  18372. * @usage
  18373. * ```
  18374. * // 浏览器
  18375. * <script type="text/javascript" src="{cdn}"></script>
  18376. * <script>
  18377. * const result = {namespace}.ColorSpaceType.CMYK;
  18378. *
  18379. * </script>
  18380. * // ES6 Import
  18381. * import { ColorSpaceType } from '{npm}';
  18382. *
  18383. * const result = ColorSpaceType.CMYK;
  18384. * ```
  18385. */
  18386. var ColorSpaceType = {
  18387. /** 该类型主要在印刷系统使用。 */
  18388. CMYK: "CMYK",
  18389. /** 该类型主要在显示系统中使用。 */
  18390. RGB: "RGB"
  18391. };
  18392. /**
  18393. * @enum LayerType
  18394. * @description 图层类型。
  18395. * @category BaseTypes Constant
  18396. * @type {string}
  18397. * @usage
  18398. * ```
  18399. * // 浏览器
  18400. * <script type="text/javascript" src="{cdn}"></script>
  18401. * <script>
  18402. * const result = {namespace}.LayerType.UGC;
  18403. *
  18404. * </script>
  18405. * // ES6 Import
  18406. * import { LayerType } from '{npm}';
  18407. *
  18408. * const result = LayerType.UGC;
  18409. * ```
  18410. */
  18411. var LayerType = {
  18412. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  18413. UGC: "UGC",
  18414. /** WMS 图层。 */
  18415. WMS: "WMS",
  18416. /** WFS 图层。 */
  18417. WFS: "WFS",
  18418. /** 自定义图层。 */
  18419. CUSTOM: "CUSTOM"
  18420. };
  18421. /**
  18422. * @enum UGCLayerType
  18423. * @description SuperMap 图层类型。
  18424. * @category BaseTypes Constant
  18425. * @type {string}
  18426. * @usage
  18427. * ```
  18428. * // 浏览器
  18429. * <script type="text/javascript" src="{cdn}"></script>
  18430. * <script>
  18431. * const result = {namespace}.UGCLayerType.THEME;
  18432. *
  18433. * </script>
  18434. * // ES6 Import
  18435. * import { UGCLayerType } from '{npm}';
  18436. *
  18437. * const result = UGCLayerType.THEME;
  18438. * ```
  18439. */
  18440. var UGCLayerType = {
  18441. /** 专题图层。 */
  18442. THEME: "THEME",
  18443. /** 矢量图层。 */
  18444. VECTOR: "VECTOR",
  18445. /** 栅格图层。 */
  18446. GRID: "GRID",
  18447. /** 影像图层。 */
  18448. IMAGE: "IMAGE"
  18449. };
  18450. /**
  18451. * @enum StatisticMode
  18452. * @description 字段统计方法类型。
  18453. * @category BaseTypes Constant
  18454. * @type {string}
  18455. * @usage
  18456. * ```
  18457. * // 浏览器
  18458. * <script type="text/javascript" src="{cdn}"></script>
  18459. * <script>
  18460. * const result = {namespace}.StatisticMode.AVERAGE;
  18461. *
  18462. * </script>
  18463. * // ES6 Import
  18464. * import { StatisticMode } from '{npm}';
  18465. *
  18466. * const result = StatisticMode.AVERAGE;
  18467. * ```
  18468. */
  18469. var StatisticMode = {
  18470. /** 统计所选字段的平均值。 */
  18471. AVERAGE: "AVERAGE",
  18472. /** 统计所选字段的最大值。 */
  18473. MAX: "MAX",
  18474. /** 统计所选字段的最小值。 */
  18475. MIN: "MIN",
  18476. /** 统计所选字段的标准差 */
  18477. STDDEVIATION: "STDDEVIATION",
  18478. /** 统计所选字段的总和。 */
  18479. SUM: "SUM",
  18480. /** 统计所选字段的方差。 */
  18481. VARIANCE: "VARIANCE"
  18482. };
  18483. /**
  18484. * @enum PixelFormat
  18485. * @description 栅格与影像数据存储的像素格式枚举。
  18486. * @category BaseTypes Constant
  18487. * @type {string}
  18488. * @usage
  18489. * ```
  18490. * // 浏览器
  18491. * <script type="text/javascript" src="{cdn}"></script>
  18492. * <script>
  18493. * const result = {namespace}.PixelFormat.BIT16;
  18494. *
  18495. * </script>
  18496. * // ES6 Import
  18497. * import { PixelFormat } from '{npm}';
  18498. *
  18499. * const result = PixelFormat.BIT16;
  18500. * ```
  18501. */
  18502. var PixelFormat = {
  18503. /** 每个像元用16个比特(即2个字节)表示。 */
  18504. BIT16: "BIT16",
  18505. /** 每个像元用32个比特(即4个字节)表示。 */
  18506. BIT32: "BIT32",
  18507. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  18508. BIT64: "BIT64",
  18509. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  18510. SINGLE: "SINGLE",
  18511. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  18512. DOUBLE: "DOUBLE",
  18513. /** 每个像元用1个比特表示。 */
  18514. UBIT1: "UBIT1",
  18515. /** 每个像元用4个比特来表示。 */
  18516. UBIT4: "UBIT4",
  18517. /** 每个像元用8个比特(即1个字节)来表示。 */
  18518. UBIT8: "UBIT8",
  18519. /** 每个像元用24个比特(即3个字节)来表示。 */
  18520. UBIT24: "UBIT24",
  18521. /** 每个像元用32个比特(即4个字节)来表示。 */
  18522. UBIT32: "UBIT32"
  18523. };
  18524. /**
  18525. * @enum SearchMode
  18526. * @description 内插时使用的样本点的查找方式枚举。
  18527. * @category BaseTypes Constant
  18528. * @type {string}
  18529. * @usage
  18530. * ```
  18531. * // 浏览器
  18532. * <script type="text/javascript" src="{cdn}"></script>
  18533. * <script>
  18534. * const result = {namespace}.SearchMode.KDTREE_FIXED_COUNT;
  18535. *
  18536. * </script>
  18537. * // ES6 Import
  18538. * import { SearchMode } from '{npm}';
  18539. *
  18540. * const result = SearchMode.KDTREE_FIXED_COUNT;
  18541. * ```
  18542. */
  18543. var SearchMode = {
  18544. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  18545. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  18546. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  18547. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  18548. /** 不进行查找,使用所有的输入点进行内插分析。 */
  18549. NONE: "NONE",
  18550. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  18551. QUADTREE: "QUADTREE"
  18552. };
  18553. /**
  18554. * @enum InterpolationAlgorithmType
  18555. * @description 插值分析的算法的类型。
  18556. * @category BaseTypes Constant
  18557. * @type {string}
  18558. * @usage
  18559. * ```
  18560. * // 浏览器
  18561. * <script type="text/javascript" src="{cdn}"></script>
  18562. * <script>
  18563. * const result = {namespace}.InterpolationAlgorithmType.KRIGING;
  18564. *
  18565. * </script>
  18566. * // ES6 Import
  18567. * import { InterpolationAlgorithmType } from '{npm}';
  18568. *
  18569. * const result = InterpolationAlgorithmType.KRIGING;
  18570. * ```
  18571. */
  18572. var InterpolationAlgorithmType = {
  18573. /** 普通克吕金插值法。 */
  18574. KRIGING: "KRIGING",
  18575. /** 简单克吕金插值法。 */
  18576. SimpleKriging: "SimpleKriging",
  18577. /** 泛克吕金插值法。 */
  18578. UniversalKriging: "UniversalKriging"
  18579. };
  18580. /**
  18581. * @enum VariogramMode
  18582. * @description 克吕金(Kriging)插值时的半变函数类型枚举。
  18583. * @category BaseTypes Constant
  18584. * @type {string}
  18585. * @usage
  18586. * ```
  18587. * // 浏览器
  18588. * <script type="text/javascript" src="{cdn}"></script>
  18589. * <script>
  18590. * const result = {namespace}.VariogramMode.EXPONENTIAL;
  18591. *
  18592. * </script>
  18593. * // ES6 Import
  18594. * import { VariogramMode } from '{npm}';
  18595. *
  18596. * const result = VariogramMode.EXPONENTIAL;
  18597. * ```
  18598. */
  18599. var VariogramMode = {
  18600. /** 指数函数。 */
  18601. EXPONENTIAL: "EXPONENTIAL",
  18602. /** 高斯函数。 */
  18603. GAUSSIAN: "GAUSSIAN",
  18604. /** 球型函数。 */
  18605. SPHERICAL: "SPHERICAL"
  18606. };
  18607. /**
  18608. * @enum Exponent
  18609. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数。
  18610. * @category BaseTypes Constant
  18611. * @type {string}
  18612. * @usage
  18613. * ```
  18614. * // 浏览器
  18615. * <script type="text/javascript" src="{cdn}"></script>
  18616. * <script>
  18617. * const result = {namespace}.Exponent.EXP1;
  18618. *
  18619. * </script>
  18620. * // ES6 Import
  18621. * import { Exponent } from '{npm}';
  18622. *
  18623. * const result = Exponent.EXP1;
  18624. * ```
  18625. */
  18626. var Exponent = {
  18627. /** 阶数为1。 */
  18628. EXP1: "EXP1",
  18629. /** 阶数为2。 */
  18630. EXP2: "EXP2"
  18631. };
  18632. /**
  18633. * @enum ClientType
  18634. * @description token申请的客户端标识类型。
  18635. * @category BaseTypes Constant
  18636. * @type {string}
  18637. * @usage
  18638. * ```
  18639. * // 浏览器
  18640. * <script type="text/javascript" src="{cdn}"></script>
  18641. * <script>
  18642. * const result = {namespace}.ClientType.IP;
  18643. *
  18644. * </script>
  18645. * // ES6 Import
  18646. * import { ClientType } from '{npm}';
  18647. *
  18648. * const result = ClientType.IP;
  18649. * ```
  18650. */
  18651. var ClientType = {
  18652. /** 指定的 IP 地址。 */
  18653. IP: "IP",
  18654. /** 指定的 URL。 */
  18655. REFERER: "Referer",
  18656. /** 发送申请令牌请求的客户端 IP。 */
  18657. REQUESTIP: "RequestIP",
  18658. /** 不做任何验证。 */
  18659. NONE: "NONE",
  18660. /** SERVER。 */
  18661. SERVER: "SERVER",
  18662. /** WEB。 */
  18663. WEB: "WEB"
  18664. };
  18665. /**
  18666. * @enum ChartType
  18667. * @description 客户端专题图图表类型。
  18668. * @category BaseTypes Constant
  18669. * @type {string}
  18670. * @usage
  18671. * ```
  18672. * // 浏览器
  18673. * <script type="text/javascript" src="{cdn}"></script>
  18674. * <script>
  18675. * const result = {namespace}.ChartType.BAR;
  18676. *
  18677. * </script>
  18678. * // ES6 Import
  18679. * import { ChartType } from '{npm}';
  18680. *
  18681. * const result = ChartType.BAR;
  18682. * ```
  18683. */
  18684. var ChartType = {
  18685. /** 柱状图。 */
  18686. BAR: "Bar",
  18687. /** 三维柱状图。 */
  18688. BAR3D: "Bar3D",
  18689. /** 圆形图。 */
  18690. CIRCLE: "Circle",
  18691. /** 饼图。 */
  18692. PIE: "Pie",
  18693. /** 散点图。 */
  18694. POINT: "Point",
  18695. /** 折线图。 */
  18696. LINE: "Line",
  18697. /** 环状图。 */
  18698. RING: "Ring"
  18699. };
  18700. /**
  18701. * @enum ClipAnalystMode
  18702. * @description 裁剪分析模式
  18703. * @category BaseTypes Constant
  18704. * @type {string}
  18705. * @usage
  18706. * ```
  18707. * // 浏览器
  18708. * <script type="text/javascript" src="{cdn}"></script>
  18709. * <script>
  18710. * const result = {namespace}.ClipAnalystMode.CLIP;
  18711. *
  18712. * </script>
  18713. * // ES6 Import
  18714. * import { ClipAnalystMode } from '{npm}';
  18715. *
  18716. * const result = ClipAnalystMode.CLIP;
  18717. * ```
  18718. */
  18719. var ClipAnalystMode = {
  18720. /** CLIP。 */
  18721. CLIP: "clip",
  18722. /** INTERSECT。 */
  18723. INTERSECT: "intersect"
  18724. };
  18725. /**
  18726. * @enum AnalystAreaUnit
  18727. * @description 分布式分析面积单位。
  18728. * @category BaseTypes Constant
  18729. * @type {string}
  18730. * @usage
  18731. * ```
  18732. * // 浏览器
  18733. * <script type="text/javascript" src="{cdn}"></script>
  18734. * <script>
  18735. * const result = {namespace}.AnalystAreaUnit.SQUAREMETER;
  18736. *
  18737. * </script>
  18738. * // ES6 Import
  18739. * import { AnalystAreaUnit } from '{npm}';
  18740. *
  18741. * const result = AnalystAreaUnit.SQUAREMETER;
  18742. * ```
  18743. */
  18744. var AnalystAreaUnit = {
  18745. /** 平方米。 */
  18746. "SQUAREMETER": "SquareMeter",
  18747. /** 平方千米。 */
  18748. "SQUAREKILOMETER": "SquareKiloMeter",
  18749. /** 公顷。 */
  18750. "HECTARE": "Hectare",
  18751. /** 公亩。 */
  18752. "ARE": "Are",
  18753. /** 英亩。 */
  18754. "ACRE": "Acre",
  18755. /** 平方英尺。 */
  18756. "SQUAREFOOT": "SquareFoot",
  18757. /** 平方码。 */
  18758. "SQUAREYARD": "SquareYard",
  18759. /** 平方英里。 */
  18760. "SQUAREMILE": "SquareMile"
  18761. };
  18762. /**
  18763. * @enum AnalystSizeUnit
  18764. * @description 分布式分析单位。
  18765. * @category BaseTypes Constant
  18766. * @type {string}
  18767. * @usage
  18768. * ```
  18769. * // 浏览器
  18770. * <script type="text/javascript" src="{cdn}"></script>
  18771. * <script>
  18772. * const result = {namespace}.AnalystSizeUnit.METER;
  18773. *
  18774. * </script>
  18775. * // ES6 Import
  18776. * import { AnalystSizeUnit } from '{npm}';
  18777. *
  18778. * const result = AnalystSizeUnit.METER;
  18779. * ```
  18780. */
  18781. var AnalystSizeUnit = {
  18782. /** 米。 */
  18783. "METER": "Meter",
  18784. /** 千米。 */
  18785. "KILOMETER": "Kilometer",
  18786. /** 码。 */
  18787. "YARD": "Yard",
  18788. /** 英尺。 */
  18789. "FOOT": "Foot",
  18790. /** 英里。 */
  18791. "MILE": "Mile"
  18792. };
  18793. /**
  18794. * @enum StatisticAnalystMode
  18795. * @description 分布式分析统计模式。
  18796. * @category BaseTypes Constant
  18797. * @type {string}
  18798. * @usage
  18799. * ```
  18800. * // 浏览器
  18801. * <script type="text/javascript" src="{cdn}"></script>
  18802. * <script>
  18803. * const result = {namespace}.StatisticAnalystMode.MAX;
  18804. *
  18805. * </script>
  18806. * // ES6 Import
  18807. * import { StatisticAnalystMode } from '{npm}';
  18808. *
  18809. * const result = StatisticAnalystMode.MAX;
  18810. * ```
  18811. */
  18812. var StatisticAnalystMode = {
  18813. /** 统计所选字段的最大值。 */
  18814. "MAX": "max",
  18815. /** 统计所选字段的最小值。 */
  18816. "MIN": "min",
  18817. /** 统计所选字段的平均值。 */
  18818. "AVERAGE": "average",
  18819. /** 统计所选字段的总和。 */
  18820. "SUM": "sum",
  18821. /** 统计所选字段的方差。 */
  18822. "VARIANCE": "variance",
  18823. /** 统计所选字段的标准差。 */
  18824. "STDDEVIATION": "stdDeviation"
  18825. };
  18826. /**
  18827. * @enum SummaryType
  18828. * @description 分布式分析聚合类型。
  18829. * @category BaseTypes Constant
  18830. * @type {string}
  18831. * @usage
  18832. * ```
  18833. * // 浏览器
  18834. * <script type="text/javascript" src="{cdn}"></script>
  18835. * <script>
  18836. * const result = {namespace}.SummaryType.SUMMARYMESH;
  18837. *
  18838. * </script>
  18839. * // ES6 Import
  18840. * import { SummaryType } from '{npm}';
  18841. *
  18842. * const result = SummaryType.SUMMARYMESH;
  18843. * ```
  18844. */
  18845. var SummaryType = {
  18846. /** 格网聚合。 */
  18847. "SUMMARYMESH": "SUMMARYMESH",
  18848. /** 多边形聚合。 */
  18849. "SUMMARYREGION": "SUMMARYREGION"
  18850. };
  18851. /**
  18852. * @enum TopologyValidatorRule
  18853. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  18854. * @category BaseTypes Constant
  18855. * @type {string}
  18856. * @usage
  18857. * ```
  18858. * // 浏览器
  18859. * <script type="text/javascript" src="{cdn}"></script>
  18860. * <script>
  18861. * const result = {namespace}.TopologyValidatorRule.REGIONNOOVERLAP;
  18862. *
  18863. * </script>
  18864. * // ES6 Import
  18865. * import { TopologyValidatorRule } from '{npm}';
  18866. *
  18867. * const result = TopologyValidatorRule.REGIONNOOVERLAP;
  18868. * ```
  18869. */
  18870. var TopologyValidatorRule = {
  18871. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  18872. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  18873. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  18874. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  18875. /** 面被面包含,用于对面数据进行拓扑检查。 */
  18876. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  18877. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  18878. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  18879. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  18880. LINENOOVERLAP: "LINENOOVERLAP",
  18881. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  18882. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  18883. /** 点不相同,用于对点数据进行拓扑检查。 */
  18884. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  18885. };
  18886. /**
  18887. * @enum BucketAggType
  18888. * @description 格网聚合查询枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量
  18889. * @category BaseTypes Constant
  18890. * @type {string}
  18891. * @usage
  18892. * ```
  18893. * // 浏览器
  18894. * <script type="text/javascript" src="{cdn}"></script>
  18895. * <script>
  18896. * const result = {namespace}.BucketAggType.GEOHASH_GRID;
  18897. *
  18898. * </script>
  18899. * // ES6 Import
  18900. * import { BucketAggType } from '{npm}';
  18901. *
  18902. * const result = BucketAggType.GEOHASH_GRID;
  18903. * ```
  18904. */
  18905. var BucketAggType = {
  18906. /** 格网聚合类型。 */
  18907. GEOHASH_GRID: "geohash_grid"
  18908. };
  18909. /**
  18910. * @enum MetricsAggType
  18911. * @description 指标聚合类型枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量。
  18912. * @category BaseTypes Constant
  18913. * @type {string}
  18914. * @usage
  18915. * ```
  18916. * // 浏览器
  18917. * <script type="text/javascript" src="{cdn}"></script>
  18918. * <script>
  18919. * const result = {namespace}.MetricsAggType.AVG;
  18920. *
  18921. * </script>
  18922. * // ES6 Import
  18923. * import { MetricsAggType } from '{npm}';
  18924. *
  18925. * const result = MetricsAggType.AVG;
  18926. * ```
  18927. */
  18928. var MetricsAggType = {
  18929. /** 平均值聚合类型。 */
  18930. AVG:'avg',
  18931. /** 最大值聚合类型。 */
  18932. MAX:'max',
  18933. /** 最小值聚合类型。 */
  18934. MIN:'min',
  18935. /** 求和聚合类型。 */
  18936. SUM:'sum'
  18937. };
  18938. /**
  18939. * @enum GetFeatureMode
  18940. * @description feature 查询方式。
  18941. * @category BaseTypes Constant
  18942. * @type {string}
  18943. * @usage
  18944. * ```
  18945. * // 浏览器
  18946. * <script type="text/javascript" src="{cdn}"></script>
  18947. * <script>
  18948. * const result = {namespace}.GetFeatureMode.BOUNDS;
  18949. *
  18950. * </script>
  18951. * // ES6 Import
  18952. * import { GetFeatureMode } from '{npm}';
  18953. *
  18954. * const result = GetFeatureMode.BOUNDS;
  18955. * ```
  18956. */
  18957. var GetFeatureMode = {
  18958. /** 通过范围查询来获取要素。 */
  18959. BOUNDS: "BOUNDS",
  18960. /** 通过几何对象的缓冲区来获取要素。 */
  18961. BUFFER: "BUFFER",
  18962. /** 通过 ID 来获取要素。 */
  18963. ID: "ID",
  18964. /** 通过空间查询模式来获取要素。 */
  18965. SPATIAL: "SPATIAL",
  18966. /** 通过 SQL 查询来获取要素。 */
  18967. SQL: 'SQL'
  18968. }
  18969. /**
  18970. * @enum RasterFunctionType
  18971. * @description 栅格分析方法。
  18972. * @category BaseTypes Constant
  18973. * @type {string}
  18974. * @usage
  18975. * ```
  18976. * // 浏览器
  18977. * <script type="text/javascript" src="{cdn}"></script>
  18978. * <script>
  18979. * const result = {namespace}.GetFeatureMode.NDVI;
  18980. *
  18981. * </script>
  18982. * // ES6 Import
  18983. * import { GetFeatureMode } from '{npm}';
  18984. *
  18985. * const result = GetFeatureMode.NDVI;
  18986. * ```
  18987. */
  18988. var RasterFunctionType = {
  18989. /** 归一化植被指数。 */
  18990. NDVI: "NDVI",
  18991. /** 阴影面分析。 */
  18992. HILLSHADE: "HILLSHADE"
  18993. }
  18994. /**
  18995. * @enum ResourceType
  18996. * @description iportal资源类型。
  18997. * @category BaseTypes Constant
  18998. * @version 10.0.1
  18999. * @type {string}
  19000. * @usage
  19001. * ```
  19002. * // 浏览器
  19003. * <script type="text/javascript" src="{cdn}"></script>
  19004. * <script>
  19005. * const result = {namespace}.GetFeatureMode.MAP;
  19006. *
  19007. * </script>
  19008. * // ES6 Import
  19009. * import { GetFeatureMode } from '{npm}';
  19010. *
  19011. * const result = GetFeatureMode.MAP;
  19012. * ```
  19013. */
  19014. var ResourceType = {
  19015. /** 地图。 */
  19016. MAP: "MAP",
  19017. /** 服务。 */
  19018. SERVICE: "SERVICE",
  19019. /** 场景。 */
  19020. SCENE: "SCENE",
  19021. /** 数据。 */
  19022. DATA: "DATA",
  19023. /** 洞察。 */
  19024. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  19025. /** 大屏。 */
  19026. MAP_DASHBOARD: "MAP_DASHBOARD"
  19027. }
  19028. /**
  19029. * @enum OrderBy
  19030. * @description iportal资源排序字段。
  19031. * @category BaseTypes Constant
  19032. * @version 10.0.1
  19033. * @type {string}
  19034. * @usage
  19035. * ```
  19036. * // 浏览器
  19037. * <script type="text/javascript" src="{cdn}"></script>
  19038. * <script>
  19039. * const result = {namespace}.OrderBy.UPDATETIME;
  19040. *
  19041. * </script>
  19042. * // ES6 Import
  19043. * import { OrderBy } from '{npm}';
  19044. *
  19045. * const result = OrderBy.UPDATETIME;
  19046. * ```
  19047. */
  19048. var OrderBy = {
  19049. /** 按更新时间排序。 */
  19050. UPDATETIME: "UPDATETIME",
  19051. /** 按热度(可能是访问量、下载量)排序。 */
  19052. HEATLEVEL: "HEATLEVEL",
  19053. /** 按相关性排序。 */
  19054. RELEVANCE: "RELEVANCE"
  19055. }
  19056. /**
  19057. * @enum OrderType
  19058. * @description iportal资源升序还是降序过滤。
  19059. * @category BaseTypes Constant
  19060. * @version 10.0.1
  19061. * @type {string}
  19062. * @usage
  19063. * ```
  19064. * // 浏览器
  19065. * <script type="text/javascript" src="{cdn}"></script>
  19066. * <script>
  19067. * const result = {namespace}.OrderType.ASC;
  19068. *
  19069. * </script>
  19070. * // ES6 Import
  19071. * import { OrderType } from '{npm}';
  19072. *
  19073. * const result = OrderType.ASC;
  19074. * ```
  19075. */
  19076. var OrderType = {
  19077. /** 升序。 */
  19078. ASC: "ASC",
  19079. /** 降序。 */
  19080. DESC: "DESC"
  19081. }
  19082. /**
  19083. * @enum SearchType
  19084. * @description iportal资源查询的范围进行过滤。
  19085. * @category BaseTypes Constant
  19086. * @version 10.0.1
  19087. * @type {string}
  19088. * @usage
  19089. * ```
  19090. * // 浏览器
  19091. * <script type="text/javascript" src="{cdn}"></script>
  19092. * <script>
  19093. * const result = {namespace}.SearchType.PUBLIC;
  19094. *
  19095. * </script>
  19096. * // ES6 Import
  19097. * import { SearchType } from '{npm}';
  19098. *
  19099. * const result = SearchType.PUBLIC;
  19100. * ```
  19101. */
  19102. var SearchType = {
  19103. /** 公开资源。 */
  19104. PUBLIC: "PUBLIC",
  19105. /** 我的资源。 */
  19106. MY_RES: "MY_RES",
  19107. /** 我的群组资源。 */
  19108. MYGROUP_RES: "MYGROUP_RES",
  19109. /** 我的部门资源。 */
  19110. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  19111. /** 分享给我的资源。 */
  19112. SHARETOME_RES: "SHARETOME_RES"
  19113. }
  19114. /**
  19115. * @enum AggregationTypes
  19116. * @description iportal资源聚合查询的类型。
  19117. * @category BaseTypes Constant
  19118. * @version 10.0.1
  19119. * @type {string}
  19120. * @usage
  19121. * ```
  19122. * // 浏览器
  19123. * <script type="text/javascript" src="{cdn}"></script>
  19124. * <script>
  19125. * const result = {namespace}.AggregationTypes.TAG;
  19126. *
  19127. * </script>
  19128. * // ES6 Import
  19129. * import { AggregationTypes } from '{npm}';
  19130. *
  19131. * const result = AggregationTypes.TAG;
  19132. * ```
  19133. */
  19134. var AggregationTypes = {
  19135. /** 标签。 */
  19136. TAG: "TAG",
  19137. /** 资源类型。 */
  19138. TYPE: "TYPE"
  19139. }
  19140. /**
  19141. * @enum PermissionType
  19142. * @description iportal资源权限类型。
  19143. * @category BaseTypes Constant
  19144. * @version 10.0.1
  19145. * @type {string}
  19146. * @usage
  19147. * ```
  19148. * // 浏览器
  19149. * <script type="text/javascript" src="{cdn}"></script>
  19150. * <script>
  19151. * const result = {namespace}.PermissionType.SEARCH;
  19152. *
  19153. * </script>
  19154. * // ES6 Import
  19155. * import { PermissionType } from '{npm}';
  19156. *
  19157. * const result = PermissionType.SEARCH;
  19158. * ```
  19159. */
  19160. var PermissionType = {
  19161. /** 可检索。 */
  19162. SEARCH:"SEARCH",
  19163. /** 可查看。 */
  19164. READ: "READ",
  19165. /** 可编辑。 */
  19166. READWRITE: "READWRITE",
  19167. /** 可删除。 */
  19168. DELETE: "DELETE",
  19169. /** 可下载,包括可读、可检索。 */
  19170. DOWNLOAD:"DOWNLOAD"
  19171. }
  19172. /**
  19173. * @enum EntityType
  19174. * @description iportal资源实体类型。
  19175. * @category BaseTypes Constant
  19176. * @version 10.0.1
  19177. * @type {string}
  19178. * @usage
  19179. * ```
  19180. * // 浏览器
  19181. * <script type="text/javascript" src="{cdn}"></script>
  19182. * <script>
  19183. * const result = {namespace}.EntityType.DEPARTMENT;
  19184. *
  19185. * </script>
  19186. * // ES6 Import
  19187. * import { EntityType } from '{npm}';
  19188. *
  19189. * const result = EntityType.DEPARTMENT;
  19190. * ```
  19191. */
  19192. var EntityType = {
  19193. /** 部门。 */
  19194. DEPARTMENT: "DEPARTMENT",
  19195. /** 用户组。 */
  19196. GROUP: "GROUP",
  19197. /** 群组。 */
  19198. IPORTALGROUP: "IPORTALGROUP",
  19199. /** 角色。 */
  19200. ROLE: "ROLE",
  19201. /** 用户。 */
  19202. USER: "USER"
  19203. }
  19204. /**
  19205. * @enum DataItemType
  19206. * @description iportal数据类型。
  19207. * @category BaseTypes Constant
  19208. * @version 10.0.1
  19209. * @type {string}
  19210. * @usage
  19211. * ```
  19212. * // 浏览器
  19213. * <script type="text/javascript" src="{cdn}"></script>
  19214. * <script>
  19215. * const result = {namespace}.DataItemType.GEOJSON;
  19216. *
  19217. * </script>
  19218. * // ES6 Import
  19219. * import { DataItemType } from '{npm}';
  19220. *
  19221. * const result = DataItemType.GEOJSON;
  19222. * ```
  19223. */
  19224. var DataItemType = {
  19225. /** geojson 数据。 */
  19226. GEOJSON: "GEOJSON",
  19227. /** UGCV5_MVT。 */
  19228. UGCV5_MVT: "UGCV5_MVT",
  19229. /** json数据。 */
  19230. JSON: "JSON",
  19231. /** 音频文件。 */
  19232. AUDIO: "AUDIO",
  19233. /** Color 颜色。 */
  19234. COLOR: "COLOR",
  19235. /** ColorScheme 颜色方案。 */
  19236. COLORSCHEME: "COLORSCHEME",
  19237. /** CSV 数据。 */
  19238. CSV: "CSV",
  19239. /** EXCEL 数据。 */
  19240. EXCEL: "EXCEL",
  19241. /** FillSymbol 填充符号库。 */
  19242. FILLSYMBOL: "FILLSYMBOL",
  19243. /** 图片类型。 */
  19244. IMAGE: "IMAGE",
  19245. /** LayerTemplate 图层模板。 */
  19246. LAYERTEMPLATE: "LAYERTEMPLATE",
  19247. /** LayoutTemplate 布局模板。 */
  19248. LAYOUTTEMPLATE: "LAYOUTTEMPLATE",
  19249. /** LineSymbol 线符号库。 */
  19250. LINESYMBOL: "LINESYMBOL",
  19251. /** MapTemplate 地图模板。 */
  19252. MAPTEMPLATE: "MAPTEMPLATE",
  19253. /** MarkerSymbol 点符号库。 */
  19254. MARKERSYMBOL: "MARKERSYMBOL",
  19255. /** MBTILES。 */
  19256. MBTILES: "MBTILES",
  19257. /** 照片。 */
  19258. PHOTOS: "PHOTOS",
  19259. /** SHP 空间数据。 */
  19260. SHP: "SHP",
  19261. /** SMTILES。 */
  19262. SMTILES: "SMTILES",
  19263. /** SVTILES。 */
  19264. SVTILES: "SVTILES",
  19265. /** ThemeTemplate 专题图模板。 */
  19266. THEMETEMPLATE: "THEMETEMPLATE",
  19267. /** TPK。 */
  19268. TPK: "TPK",
  19269. /** UDB 数据源。 */
  19270. UDB: "UDB",
  19271. /** UGCV5。 */
  19272. UGCV5: "UGCV5",
  19273. /** 其他类型(普通文件)。 */
  19274. UNKNOWN: "UNKNOWN",
  19275. /** 视频文件。 */
  19276. VIDEO: "VIDEO",
  19277. /** WorkEnviroment 工作环境。 */
  19278. WORKENVIRONMENT: "WORKENVIRONMENT",
  19279. /** 工作空间。 */
  19280. WORKSPACE: "WORKSPACE"
  19281. }
  19282. /**
  19283. * @enum WebExportFormatType
  19284. * @description Web 打印输出的格式。
  19285. * @category BaseTypes Constant
  19286. * @version 10.0.1
  19287. * @type {string}
  19288. * @usage
  19289. * ```
  19290. * // 浏览器
  19291. * <script type="text/javascript" src="{cdn}"></script>
  19292. * <script>
  19293. * const result = {namespace}.WebExportFormatType.PNG;
  19294. *
  19295. * </script>
  19296. * // ES6 Import
  19297. * import { WebExportFormatType } from '{npm}';
  19298. *
  19299. * const result = WebExportFormatType.PNG;
  19300. * ```
  19301. */
  19302. var WebExportFormatType = {
  19303. /** PNG */
  19304. PNG: "PNG",
  19305. /** PDF */
  19306. PDF: "PDF"
  19307. }
  19308. /**
  19309. * @enum WebScaleOrientationType
  19310. * @description Web 比例尺的方位样式。
  19311. * @category BaseTypes Constant
  19312. * @version 10.0.1
  19313. * @type {string}
  19314. * @usage
  19315. * ```
  19316. * // 浏览器
  19317. * <script type="text/javascript" src="{cdn}"></script>
  19318. * <script>
  19319. * const result = {namespace}.WebScaleOrientationType.HORIZONTALLABELSBELOW;
  19320. *
  19321. * </script>
  19322. * // ES6 Import
  19323. * import { WebScaleOrientationType } from '{npm}';
  19324. *
  19325. * const result = WebScaleOrientationType.HORIZONTALLABELSBELOW;
  19326. * ```
  19327. */
  19328. var WebScaleOrientationType = {
  19329. /** horizontal labels below. */
  19330. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  19331. /** horizontal labels above. */
  19332. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  19333. /** vertical labels left. */
  19334. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  19335. /** vertical labels right. */
  19336. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  19337. }
  19338. /**
  19339. * @enum WebScaleType
  19340. * @description Web 比例尺的样式。
  19341. * @category BaseTypes Constant
  19342. * @version 10.0.1
  19343. * @type {string}
  19344. * @usage
  19345. * ```
  19346. * // 浏览器
  19347. * <script type="text/javascript" src="{cdn}"></script>
  19348. * <script>
  19349. * const result = {namespace}.WebScaleType.LINE;
  19350. *
  19351. * </script>
  19352. * // ES6 Import
  19353. * import { WebScaleType } from '{npm}';
  19354. *
  19355. * const result = WebScaleType.LINE;
  19356. * ```
  19357. */
  19358. var WebScaleType = {
  19359. /** line. */
  19360. LINE: "LINE",
  19361. /** bar. */
  19362. BAR: "BAR",
  19363. /** bar sub. */
  19364. BAR_SUB: "BAR_SUB"
  19365. }
  19366. /**
  19367. * @enum WebScaleUnit
  19368. * @description Web 比例尺的单位制。
  19369. * @category BaseTypes Constant
  19370. * @version 10.0.1
  19371. * @type {string}
  19372. * @usage
  19373. * ```
  19374. * // 浏览器
  19375. * <script type="text/javascript" src="{cdn}"></script>
  19376. * <script>
  19377. * const result = {namespace}.WebScaleUnit.METER;
  19378. *
  19379. * </script>
  19380. * // ES6 Import
  19381. * import { WebScaleUnit } from '{npm}';
  19382. *
  19383. * const result = WebScaleUnit.METER;
  19384. * ```
  19385. */
  19386. var WebScaleUnit = {
  19387. /** 米。 */
  19388. METER: "METER",
  19389. /** 英尺。 */
  19390. FOOT: "FOOT",
  19391. /** 度。 */
  19392. DEGREES: "DEGREES"
  19393. }
  19394. ;// CONCATENATED MODULE: ./src/common/commontypes/Size.js
  19395. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19396. * This program are made available under the terms of the Apache License, Version 2.0
  19397. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19398. /**
  19399. * @class Size
  19400. * @deprecatedclass SuperMap.Size
  19401. * @category BaseTypes Style
  19402. * @classdesc 此类描绘一对高宽值的实例。
  19403. * @param {number} [w=0.0] - 宽度。
  19404. * @param {number} [h=0.0] - 高度。
  19405. *
  19406. * @example
  19407. * var size = new Size(31,46);
  19408. * @usage
  19409. */
  19410. class Size {
  19411. constructor(w, h) {
  19412. /**
  19413. * @member {number} [Size.prototype.w=0.0]
  19414. * @description 宽度。
  19415. */
  19416. this.w = w ? parseFloat(w) : 0.0;
  19417. /**
  19418. * @member {number} [Size.prototype.h=0.0]
  19419. * @description 高度。
  19420. */
  19421. this.h = w ? parseFloat(h) : 0.0;
  19422. this.CLASS_NAME = "SuperMap.Size";
  19423. }
  19424. /**
  19425. * @function Size.prototype.toString
  19426. * @description 返回字符串形式。
  19427. * @example
  19428. * var size = new Size(10,5);
  19429. * var str = size.toString();
  19430. * @returns {string} 例如:"w=10,h=5"。
  19431. */
  19432. toString() {
  19433. return ("w=" + this.w + ",h=" + this.h);
  19434. }
  19435. /**
  19436. * @function Size.prototype.clone
  19437. * @description 克隆当前size对象。
  19438. * @example
  19439. * var size = new Size(31,46);
  19440. * var size2 = size.clone();
  19441. * @returns {Size} 新的与当前 size 对象有相同宽、高的 Size 对象。
  19442. */
  19443. clone() {
  19444. return new Size(this.w, this.h);
  19445. }
  19446. /**
  19447. *
  19448. * @function Size.prototype.equals
  19449. * @description 比较两个 size 对象是否相等。
  19450. * @example
  19451. * var size = new Size(31,46);
  19452. * var size2 = new Size(31,46);
  19453. * var isEquals = size.equals(size2);
  19454. *
  19455. * @param {Size} sz - 用于比较相等的 Size 对象。
  19456. * @returns {boolean} 传入的 size 和当前 size 高宽相等,注意:如果传入的 size 为空则返回 false。
  19457. *
  19458. */
  19459. equals(sz) {
  19460. var equals = false;
  19461. if (sz != null) {
  19462. equals = ((this.w === sz.w && this.h === sz.h) ||
  19463. (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
  19464. }
  19465. return equals;
  19466. }
  19467. /**
  19468. *
  19469. * @function Size.prototype.destroy
  19470. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  19471. * @example
  19472. * var size = new Size(31,46);
  19473. * size.destroy();
  19474. */
  19475. destroy() {
  19476. this.w = null;
  19477. this.h = null;
  19478. }
  19479. }
  19480. ;// CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  19481. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19482. * This program are made available under the terms of the Apache License, Version 2.0
  19483. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19484. /**
  19485. * @class Pixel
  19486. * @deprecatedclass SuperMap.Pixel
  19487. * @category BaseTypes Geometry
  19488. * @classdesc 用 x,y 坐标描绘屏幕坐标(像素点)。
  19489. * @param {number} [x=0.0] - x 坐标。
  19490. * @param {number} [y=0.0] - y 坐标。
  19491. * @param {Pixel.Mode} [mode=Pixel.Mode.LeftTop] - 坐标模式。
  19492. *
  19493. * @example
  19494. * //单独创建一个对象
  19495. * var pixcel = new Pixel(100,50);
  19496. *
  19497. * //依据 size 创建
  19498. * var size = new Size(21,25);
  19499. * var offset = new Pixel(-(size.w/2), -size.h);
  19500. * @usage
  19501. */
  19502. class Pixel {
  19503. constructor(x, y, mode) {
  19504. /**
  19505. * @member {number} [Pixel.prototype.x=0.0]
  19506. * @description x 坐标。
  19507. */
  19508. this.x = x ? parseFloat(x) : 0.0;
  19509. /**
  19510. * @member {number} [Pixel.prototype.y=0.0]
  19511. * @description y 坐标。
  19512. */
  19513. this.y = y ? parseFloat(y) : 0.0;
  19514. /**
  19515. * @member {Pixel.Mode} [Pixel.prototype.mode=Pixel.Mode.LeftTop]
  19516. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  19517. */
  19518. this.mode = mode;
  19519. this.CLASS_NAME = 'SuperMap.Pixel';
  19520. }
  19521. /**
  19522. * @function Pixel.prototype.toString
  19523. * @description 返回此对象的字符串形式。
  19524. * @example
  19525. *
  19526. * var pixcel = new Pixel(100,50);
  19527. * var str = pixcel.toString();
  19528. *
  19529. * @returns {string} 例如: "x=200.4,y=242.2"
  19530. */
  19531. toString() {
  19532. return 'x=' + this.x + ',y=' + this.y;
  19533. }
  19534. /**
  19535. * @function Pixel.prototype.clone
  19536. * @description 克隆当前的 pixel 对象。
  19537. * @example
  19538. * var pixcel = new Pixel(100,50);
  19539. * var pixcel2 = pixcel.clone();
  19540. * @returns {Pixel} 新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  19541. */
  19542. clone() {
  19543. return new Pixel(this.x, this.y, this.mode);
  19544. }
  19545. /**
  19546. * @function Pixel.prototype.equals
  19547. * @description 比较两 pixel 是否相等。
  19548. * @example
  19549. * var pixcel = new Pixel(100,50);
  19550. * var pixcel2 = new Pixel(100,50);
  19551. * var isEquals = pixcel.equals(pixcel2);
  19552. *
  19553. * @param {Pixel} px - 用于比较相等的 pixel 对象。
  19554. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  19555. */
  19556. equals(px) {
  19557. var equals = false;
  19558. if (px != null) {
  19559. equals = (this.x == px.x && this.y == px.y) || (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y));
  19560. }
  19561. return equals;
  19562. }
  19563. /**
  19564. * @function Pixel.prototype.distanceTo
  19565. * @description 返回两个 pixel 的距离。
  19566. * @example
  19567. * var pixcel = new Pixel(100,50);
  19568. * var pixcel2 = new Pixel(110,30);
  19569. * var distance = pixcel.distanceTo(pixcel2);
  19570. *
  19571. * @param {Pixel} px - 需要计算的 pixel。
  19572. * @returns {number} 作为参数传入的像素与当前像素点的距离。
  19573. */
  19574. distanceTo(px) {
  19575. return Math.sqrt(Math.pow(this.x - px.x, 2) + Math.pow(this.y - px.y, 2));
  19576. }
  19577. /**
  19578. * @function Pixel.prototype.add
  19579. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  19580. * @example
  19581. * var pixcel = new Pixel(100,50);
  19582. * //pixcel2是新的对象
  19583. * var pixcel2 = pixcel.add(20,30);
  19584. *
  19585. * @param {number} x - 传入的 x 值。
  19586. * @param {number} y - 传入的 y 值。
  19587. * @returns {Pixel} 新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  19588. */
  19589. add(x, y) {
  19590. if (x == null || y == null) {
  19591. throw new TypeError('Pixel.add cannot receive null values');
  19592. }
  19593. return new Pixel(this.x + x, this.y + y);
  19594. }
  19595. /**
  19596. * @function Pixel.prototype.offset
  19597. * @description 通过传入的 {@link Pixel} 参数对原屏幕坐标进行偏移。
  19598. * @example
  19599. * var pixcel = new Pixel(100,50);
  19600. * var pixcel2 = new Pixel(130,20);
  19601. * //pixcel3 是新的对象
  19602. * var pixcel3 = pixcel.offset(pixcel2);
  19603. *
  19604. * @param {Pixel} px - 传入的 {@link Pixel} 对象。
  19605. * @returns {Pixel} 新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  19606. */
  19607. offset(px) {
  19608. var newPx = this.clone();
  19609. if (px) {
  19610. newPx = this.add(px.x, px.y);
  19611. }
  19612. return newPx;
  19613. }
  19614. /**
  19615. *
  19616. * @function Pixel.prototype.destroy
  19617. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  19618. * @example
  19619. * var pixcel = new Pixel(100,50);
  19620. * pixcel.destroy();
  19621. */
  19622. destroy() {
  19623. this.x = null;
  19624. this.y = null;
  19625. this.mode = null;
  19626. }
  19627. }
  19628. /**
  19629. * @enum Mode
  19630. * @memberOf Pixel
  19631. * @readonly
  19632. * @description 模式。
  19633. * @type {string}
  19634. */
  19635. Pixel.Mode = {
  19636. /** 左上模式。*/
  19637. LeftTop: 'lefttop',
  19638. /** 右上模式。 */
  19639. RightTop: 'righttop',
  19640. /** 右下模式。 */
  19641. RightBottom: 'rightbottom',
  19642. /** 左下模式。 */
  19643. LeftBottom: 'leftbottom'
  19644. };
  19645. ;// CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  19646. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19647. * This program are made available under the terms of the Apache License, Version 2.0
  19648. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19649. /**
  19650. * @function inherit
  19651. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  19652. * @param {Object} C - 继承的类。
  19653. * @param {Object} P - 被继承的父类。
  19654. * @private
  19655. */
  19656. var inheritExt = function (C, P) {
  19657. var F = function () {
  19658. };
  19659. F.prototype = P.prototype;
  19660. C.prototype = new F;
  19661. var i, l, o;
  19662. for (i = 2, l = arguments.length; i < l; i++) {
  19663. o = arguments[i];
  19664. if (typeof o === "function") {
  19665. o = o.prototype;
  19666. }
  19667. Util_Util.extend(C.prototype, o);
  19668. }
  19669. };
  19670. /**
  19671. * @function mixinExt
  19672. * @description 实现多重继承。
  19673. * @param {Class|Object} ...mixins - 继承的类。
  19674. * @private
  19675. */
  19676. var mixinExt = function (...mixins) {
  19677. class Mix {
  19678. constructor(options) {
  19679. for (var index = 0; index < mixins.length; index++) {
  19680. copyProperties(this, new mixins[index](options));
  19681. }
  19682. }
  19683. }
  19684. for (var index = 0; index < mixins.length; index++) {
  19685. var mixin = mixins[index];
  19686. copyProperties(Mix, mixin);
  19687. copyProperties(Mix.prototype, mixin.prototype);
  19688. copyProperties(Mix.prototype, new mixin());
  19689. }
  19690. return Mix;
  19691. function copyProperties(target, source) {
  19692. var ownKeys = Object.getOwnPropertyNames(source);
  19693. if (Object.getOwnPropertySymbols) {
  19694. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  19695. }
  19696. for (var index = 0; index < ownKeys.length; index++) {
  19697. var key = ownKeys[index];
  19698. if (key !== "constructor"
  19699. && key !== "prototype"
  19700. && key !== "name" && key !== "length") {
  19701. let desc = Object.getOwnPropertyDescriptor(source, key);
  19702. if (window["ActiveXObject"]) {
  19703. Object.defineProperty(target, key, desc || {});
  19704. } else {
  19705. Object.defineProperty(target, key, desc);
  19706. }
  19707. }
  19708. }
  19709. }
  19710. };
  19711. /**
  19712. * @name String
  19713. * @namespace
  19714. * @category BaseTypes Util
  19715. * @description 字符串操作的一系列常用扩展函数。
  19716. * @private
  19717. */
  19718. var StringExt = {
  19719. /**
  19720. * @function StringExt.startsWith
  19721. * @description 判断目标字符串是否以指定的子字符串开头。
  19722. * @param {string} str - 目标字符串。
  19723. * @param {string} sub - 查找的子字符串。
  19724. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  19725. */
  19726. startsWith: function (str, sub) {
  19727. return (str.indexOf(sub) == 0);
  19728. },
  19729. /**
  19730. * @function StringExt.contains
  19731. * @description 判断目标字符串是否包含指定的子字符串。
  19732. * @param {string} str - 目标字符串。
  19733. * @param {string} sub - 查找的子字符串。
  19734. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  19735. */
  19736. contains: function (str, sub) {
  19737. return (str.indexOf(sub) != -1);
  19738. },
  19739. /**
  19740. * @function StringExt.trim
  19741. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  19742. * @param {string} str - (可能)存在空白字符填塞的字符串。
  19743. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  19744. */
  19745. trim: function (str) {
  19746. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  19747. },
  19748. /**
  19749. * @function StringExt.camelize
  19750. * @description 骆驼式("-")连字符的字符串处理。
  19751. * 例如:"chicken-head" becomes "chickenHead",
  19752. * "-chicken-head" becomes "ChickenHead"。
  19753. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  19754. * @returns {string}
  19755. */
  19756. camelize: function (str) {
  19757. var oStringList = str.split('-');
  19758. var camelizedString = oStringList[0];
  19759. for (var i = 1, len = oStringList.length; i < len; i++) {
  19760. var s = oStringList[i];
  19761. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  19762. }
  19763. return camelizedString;
  19764. },
  19765. /**
  19766. * @function StringExt.format
  19767. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  19768. * @example
  19769. * 示例:
  19770. * (code)
  19771. * 1、template = "${value,getValue}";
  19772. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  19773. * args = [2,23,12,36,21];
  19774. * 返回值:36
  19775. * (end)
  19776. * 示例:
  19777. * (code)
  19778. * 2、template = "$${{value,getValue}}";
  19779. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  19780. * args = [2,23,12,36,21];
  19781. * 返回值:"${36}"
  19782. * (end)
  19783. * 示例:
  19784. * (code)
  19785. * 3、template = "${a,b}";
  19786. * context = {a: {b:"format"}};
  19787. * args = null;
  19788. * 返回值:"format"
  19789. * (end)
  19790. * 示例:
  19791. * (code)
  19792. * 3、template = "${a,b}";
  19793. * context = null;
  19794. * args = null;
  19795. * 返回值:"${a.b}"
  19796. * (end)
  19797. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  19798. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  19799. * @param {Array.<number>} [args] - 可选参数传递给在 context 对象上找到的函数。
  19800. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  19801. */
  19802. format: function (template, context, args) {
  19803. if (!context) {
  19804. context = window;
  19805. }
  19806. // Example matching:
  19807. // str = ${foo.bar}
  19808. // match = foo.bar
  19809. var replacer = function (str, match) {
  19810. var replacement;
  19811. // Loop through all subs. Example: ${a.b.c}
  19812. // 0 -> replacement = context[a];
  19813. // 1 -> replacement = context[a][b];
  19814. // 2 -> replacement = context[a][b][c];
  19815. var subs = match.split(/\.+/);
  19816. for (var i = 0; i < subs.length; i++) {
  19817. if (i == 0) {
  19818. replacement = context;
  19819. }
  19820. replacement = replacement[subs[i]];
  19821. }
  19822. if (typeof replacement === "function") {
  19823. replacement = args ?
  19824. replacement.apply(null, args) :
  19825. replacement();
  19826. }
  19827. // If replacement is undefined, return the string 'undefined'.
  19828. // This is a workaround for a bugs in browsers not properly
  19829. // dealing with non-participating groups in regular expressions:
  19830. // http://blog.stevenlevithan.com/archives/npcg-javascript
  19831. if (typeof replacement == 'undefined') {
  19832. return 'undefined';
  19833. } else {
  19834. return replacement;
  19835. }
  19836. };
  19837. return template.replace(StringExt.tokenRegEx, replacer);
  19838. },
  19839. /**
  19840. * @member {RegExp} [StringExt.tokenRegEx]
  19841. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  19842. * @example
  19843. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  19844. */
  19845. tokenRegEx: /\$\{([\w.]+?)\}/g,
  19846. /**
  19847. * @member {RegExp} [StringExt.numberRegEx]
  19848. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  19849. */
  19850. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  19851. /**
  19852. * @function StringExt.isNumeric
  19853. * @description 判断一个字符串是否只包含一个数值。
  19854. * @example
  19855. * (code)
  19856. * StringExt.isNumeric("6.02e23") // true
  19857. * StringExt.isNumeric("12 dozen") // false
  19858. * StringExt.isNumeric("4") // true
  19859. * StringExt.isNumeric(" 4 ") // false
  19860. * (end)
  19861. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  19862. */
  19863. isNumeric: function (value) {
  19864. return StringExt.numberRegEx.test(value);
  19865. },
  19866. /**
  19867. * @function StringExt.numericIf
  19868. * @description 把一个看似数值型的字符串转化为一个数值。
  19869. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  19870. */
  19871. numericIf: function (value) {
  19872. return StringExt.isNumeric(value) ? parseFloat(value) : value;
  19873. }
  19874. };
  19875. /**
  19876. * @name Number
  19877. * @namespace
  19878. * @category BaseTypes Util
  19879. * @description 数值操作的一系列常用扩展函数。
  19880. * @private
  19881. */
  19882. var NumberExt = {
  19883. /**
  19884. * @member {string} [NumberExt.decimalSeparator='.']
  19885. * @description 格式化数字时默认的小数点分隔符。
  19886. * @constant
  19887. */
  19888. decimalSeparator: ".",
  19889. /**
  19890. * @member {string} [NumberExt.thousandsSeparator=',']
  19891. * @description 格式化数字时默认的千位分隔符。
  19892. * @constant
  19893. */
  19894. thousandsSeparator: ",",
  19895. /**
  19896. * @function NumberExt.limitSigDigs
  19897. * @description 限制浮点数的有效数字位数。
  19898. * @param {number} num - 浮点数。
  19899. * @param {number} sig - 有效位数。
  19900. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  19901. */
  19902. limitSigDigs: function (num, sig) {
  19903. var fig = 0;
  19904. if (sig > 0) {
  19905. fig = parseFloat(num.toPrecision(sig));
  19906. }
  19907. return fig;
  19908. },
  19909. /**
  19910. * @function NumberExt.format
  19911. * @description 数字格式化输出。
  19912. * @param {number} num - 数字。
  19913. * @param {number} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  19914. * @param {string} [tsep=','] - 千位分隔符。
  19915. * @param {string} [dsep='.'] - 小数点分隔符。
  19916. * @returns {string} 数字格式化后的字符串。
  19917. */
  19918. format: function (num, dec, tsep, dsep) {
  19919. dec = (typeof dec != "undefined") ? dec : 0;
  19920. tsep = (typeof tsep != "undefined") ? tsep :
  19921. NumberExt.thousandsSeparator;
  19922. dsep = (typeof dsep != "undefined") ? dsep :
  19923. NumberExt.decimalSeparator;
  19924. if (dec != null) {
  19925. num = parseFloat(num.toFixed(dec));
  19926. }
  19927. var parts = num.toString().split(".");
  19928. if (parts.length === 1 && dec == null) {
  19929. // integer where we do not want to touch the decimals
  19930. dec = 0;
  19931. }
  19932. var integer = parts[0];
  19933. if (tsep) {
  19934. var thousands = /(-?[0-9]+)([0-9]{3})/;
  19935. while (thousands.test(integer)) {
  19936. integer = integer.replace(thousands, "$1" + tsep + "$2");
  19937. }
  19938. }
  19939. var str;
  19940. if (dec == 0) {
  19941. str = integer;
  19942. } else {
  19943. var rem = parts.length > 1 ? parts[1] : "0";
  19944. if (dec != null) {
  19945. rem = rem + new Array(dec - rem.length + 1).join("0");
  19946. }
  19947. str = integer + dsep + rem;
  19948. }
  19949. return str;
  19950. }
  19951. };
  19952. if (!Number.prototype.limitSigDigs) {
  19953. /**
  19954. * APIMethod: Number.limitSigDigs
  19955. * 限制浮点数的有效数字位数.
  19956. * @param {number} sig -有效位数。
  19957. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  19958. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  19959. */
  19960. Number.prototype.limitSigDigs = function (sig) {
  19961. return NumberExt.limitSigDigs(this, sig);
  19962. };
  19963. }
  19964. /**
  19965. * @name Function
  19966. * @namespace
  19967. * @category BaseTypes Util
  19968. * @description 函数操作的一系列常用扩展函数。
  19969. * @private
  19970. */
  19971. var FunctionExt = {
  19972. /**
  19973. * @function FunctionExt.bind
  19974. * @description 绑定函数到对象。方便创建 this 的作用域。
  19975. * @param {function} func - 输入函数。
  19976. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  19977. * @returns {function} object 参数作为 func 函数的 this 对象。
  19978. */
  19979. bind: function (func, object) {
  19980. // create a reference to all arguments past the second one
  19981. var args = Array.prototype.slice.apply(arguments, [2]);
  19982. return function () {
  19983. // Push on any additional arguments from the actual function call.
  19984. // These will come after those sent to the bind call.
  19985. var newArgs = args.concat(
  19986. Array.prototype.slice.apply(arguments, [0])
  19987. );
  19988. return func.apply(object, newArgs);
  19989. };
  19990. },
  19991. /**
  19992. * @function FunctionExt.bindAsEventListener
  19993. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  19994. * @param {function} func - 用于监听事件的函数。
  19995. * @param {Object} object - this 对象的引用。
  19996. * @returns {function}
  19997. */
  19998. bindAsEventListener: function (func, object) {
  19999. return function (event) {
  20000. return func.call(object, event || window.event);
  20001. };
  20002. },
  20003. /**
  20004. * @function FunctionExt.False
  20005. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  20006. * @example
  20007. * document.onclick = FunctionExt.False;
  20008. * @returns {boolean}
  20009. */
  20010. False: function () {
  20011. return false;
  20012. },
  20013. /**
  20014. * @function FunctionExt.True
  20015. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  20016. * @example
  20017. * document.onclick = FunctionExt.True;
  20018. * @returns {boolean}
  20019. */
  20020. True: function () {
  20021. return true;
  20022. },
  20023. /**
  20024. * @function FunctionExt.Void
  20025. * @description 可重用函数,仅仅返回 "undefined"。
  20026. * @returns {undefined}
  20027. */
  20028. Void: function () {
  20029. }
  20030. };
  20031. /**
  20032. * @name Array
  20033. * @namespace
  20034. * @category BaseTypes Util
  20035. * @description 数组操作的一系列常用扩展函数。
  20036. * @private
  20037. */
  20038. var ArrayExt = {
  20039. /**
  20040. * @function ArrayExt.filter
  20041. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  20042. * @param {Array} array - 要过滤的数组。
  20043. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  20044. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  20045. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  20046. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  20047. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  20048. */
  20049. filter: function (array, callback, caller) {
  20050. var selected = [];
  20051. if (Array.prototype.filter) {
  20052. selected = array.filter(callback, caller);
  20053. } else {
  20054. var len = array.length;
  20055. if (typeof callback != "function") {
  20056. throw new TypeError();
  20057. }
  20058. for (var i = 0; i < len; i++) {
  20059. if (i in array) {
  20060. var val = array[i];
  20061. if (callback.call(caller, val, i, array)) {
  20062. selected.push(val);
  20063. }
  20064. }
  20065. }
  20066. }
  20067. return selected;
  20068. }
  20069. };
  20070. ;// CONCATENATED MODULE: ./src/common/commontypes/Geometry.js
  20071. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20072. * This program are made available under the terms of the Apache License, Version 2.0
  20073. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20074. // import {WKT} from '../format/WKT';
  20075. // import {Vector} from './Vector';
  20076. /**
  20077. * @class Geometry
  20078. * @deprecatedclass SuperMap.Geometry
  20079. * @category BaseTypes Geometry
  20080. * @classdesc 几何对象类,描述地理对象的几何图形。
  20081. * @usage
  20082. */
  20083. class Geometry_Geometry {
  20084. constructor() {
  20085. this.CLASS_NAME = "SuperMap.Geometry";
  20086. /**
  20087. * @member {string} Geometry.prototype.id
  20088. * @description 几何对象的唯一标识符。
  20089. *
  20090. */
  20091. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  20092. /**
  20093. * @member {Geometry} Geometry.prototype.parent
  20094. * @description 父类几何对象。
  20095. */
  20096. this.parent = null;
  20097. /**
  20098. * @member {Bounds} Geometry.prototype.bounds
  20099. * @description 几何对象的范围。
  20100. *
  20101. */
  20102. this.bounds = null;
  20103. /**
  20104. * @member {number} Geometry.prototype.SRID
  20105. * @description 投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
  20106. * @example
  20107. * var geometry= new Geometry();
  20108. * geometry. SRID=4326;
  20109. *
  20110. */
  20111. this.SRID = null;
  20112. }
  20113. /**
  20114. * @function Geometry.prototype.destroy
  20115. * @description 解构 Geometry 类,释放资源。
  20116. */
  20117. destroy() {
  20118. this.id = null;
  20119. this.bounds = null;
  20120. this.SRID = null;
  20121. }
  20122. /**
  20123. * @function Geometry.prototype.clone
  20124. * @description 克隆几何图形。克隆的几何图形不设置非标准的属性。
  20125. * @returns {Geometry} 克隆的几何图形。
  20126. */
  20127. clone() {
  20128. return new Geometry_Geometry();
  20129. }
  20130. /**
  20131. * @function Geometry.prototype.setBounds
  20132. * @description 设置几何对象的 bounds。
  20133. * @param {Bounds} bounds - 范围。
  20134. */
  20135. setBounds(bounds) {
  20136. if (bounds) {
  20137. this.bounds = bounds.clone();
  20138. }
  20139. }
  20140. /**
  20141. * @function Geometry.prototype.clearBounds
  20142. * @description 清除几何对象的 bounds。
  20143. * 如果该对象有父类,也会清除父类几何对象的 bounds。
  20144. */
  20145. clearBounds() {
  20146. this.bounds = null;
  20147. if (this.parent) {
  20148. this.parent.clearBounds();
  20149. }
  20150. }
  20151. /**
  20152. * @function Geometry.prototype.extendBounds
  20153. * @description 扩展现有边界以包含新边界。如果尚未设置几何边界,则设置新边界。
  20154. * @param {Bounds} newBounds - 几何对象的 bounds。
  20155. */
  20156. extendBounds(newBounds) {
  20157. var bounds = this.getBounds();
  20158. if (!bounds) {
  20159. this.setBounds(newBounds);
  20160. } else {
  20161. this.bounds.extend(newBounds);
  20162. }
  20163. }
  20164. /**
  20165. * @function Geometry.prototype.getBounds
  20166. * @description 获得几何图形的边界。如果没有设置边界,可通过计算获得。
  20167. * @returns {Bounds} 几何对象的边界。
  20168. */
  20169. getBounds() {
  20170. if (this.bounds == null) {
  20171. this.calculateBounds();
  20172. }
  20173. return this.bounds;
  20174. }
  20175. /**
  20176. * @function Geometry.prototype.calculateBounds
  20177. * @description 重新计算几何图形的边界(需要在子类中实现此方法)。
  20178. */
  20179. calculateBounds() {
  20180. //
  20181. // This should be overridden by subclasses.
  20182. //
  20183. }
  20184. /**
  20185. * @function Geometry.prototype.getVertices
  20186. * @description 返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
  20187. * @param {boolean} [nodes] - 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
  20188. * @returns {Array} 几何图形的顶点列表。
  20189. */
  20190. getVertices(nodes) { // eslint-disable-line no-unused-vars
  20191. }
  20192. /**
  20193. * @function Geometry.prototype.getArea
  20194. * @description 计算几何对象的面积 ,此方法需要在子类中定义。
  20195. * @returns {number} 计算后的对象面积。
  20196. */
  20197. getArea() {
  20198. //to be overridden by geometries that actually have an area
  20199. //
  20200. return 0.0;
  20201. }
  20202. // /**
  20203. // * @function Geometry.prototype.toString
  20204. // * @description 返回geometry对象的字符串表述,需要引入{@link WKTFormat}。此方法只能在子类实现,在父类使用会报错。
  20205. // * @returns {string} geometry对象的字符串表述(Well-Known Text)
  20206. // */
  20207. // toString() {
  20208. // var string;
  20209. // if (WKT) {
  20210. // var wkt = new WKT();
  20211. // string = wkt.write(new Vector(this));
  20212. // } else {
  20213. // string = Object.prototype.toString.call(this);
  20214. // }
  20215. // return string;
  20216. // }
  20217. }
  20218. ;// CONCATENATED MODULE: ./src/common/commontypes/Util.js
  20219. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20220. * This program are made available under the terms of the Apache License, Version 2.0
  20221. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20222. /**
  20223. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  20224. * * "opera" -- Opera
  20225. * * "msie" -- Internet Explorer
  20226. * * "safari" -- Safari
  20227. * * "firefox" -- Firefox
  20228. * * "mozilla" -- Mozilla
  20229. * @category BaseTypes Constant
  20230. * @constant {Object}
  20231. * @usage
  20232. * ```
  20233. * // 浏览器
  20234. * <script type="text/javascript" src="{cdn}"></script>
  20235. * <script>
  20236. * const result = {namespace}.Browser.name;
  20237. *
  20238. * </script>
  20239. * // ES6 Import
  20240. * import { Browser } from '{npm}';
  20241. *
  20242. * const result = Browser.name;
  20243. * ```
  20244. */
  20245. const Browser = (function () {
  20246. var name = '',
  20247. version = '',
  20248. device = 'pc',
  20249. uaMatch;
  20250. //以下进行测试
  20251. var ua = navigator.userAgent.toLowerCase();
  20252. if (ua.indexOf('msie') > -1 || (ua.indexOf('trident') > -1 && ua.indexOf('rv') > -1)) {
  20253. name = 'msie';
  20254. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  20255. } else if (ua.indexOf('chrome') > -1) {
  20256. name = 'chrome';
  20257. uaMatch = ua.match(/chrome\/([\d.]+)/);
  20258. } else if (ua.indexOf('firefox') > -1) {
  20259. name = 'firefox';
  20260. uaMatch = ua.match(/firefox\/([\d.]+)/);
  20261. } else if (ua.indexOf('opera') > -1) {
  20262. name = 'opera';
  20263. uaMatch = ua.match(/version\/([\d.]+)/);
  20264. } else if (ua.indexOf('safari') > -1) {
  20265. name = 'safari';
  20266. uaMatch = ua.match(/version\/([\d.]+)/);
  20267. }
  20268. version = uaMatch ? uaMatch[1] : '';
  20269. if (ua.indexOf('ipad') > -1 || ua.indexOf('ipod') > -1 || ua.indexOf('iphone') > -1) {
  20270. device = 'apple';
  20271. } else if (ua.indexOf('android') > -1) {
  20272. uaMatch = ua.match(/version\/([\d.]+)/);
  20273. version = uaMatch ? uaMatch[1] : '';
  20274. device = 'android';
  20275. }
  20276. return { name: name, version: version, device: device };
  20277. })();
  20278. const isSupportCanvas = (function () {
  20279. var checkRes = true,
  20280. broz = Browser;
  20281. if (document.createElement('canvas').getContext) {
  20282. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  20283. checkRes = false;
  20284. }
  20285. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  20286. checkRes = false;
  20287. }
  20288. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  20289. checkRes = false;
  20290. }
  20291. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  20292. checkRes = false;
  20293. }
  20294. } else {
  20295. checkRes = false;
  20296. }
  20297. return checkRes;
  20298. })();
  20299. /**
  20300. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  20301. * @constant {number}
  20302. * @private
  20303. */
  20304. const IS_GECKO = (function () {
  20305. var ua = navigator.userAgent.toLowerCase();
  20306. return ua.indexOf('webkit') === -1 && ua.indexOf('gecko') !== -1;
  20307. })();
  20308. /**
  20309. * @constant {number}
  20310. * @default
  20311. * @description 分辨率与比例尺之间转换的常量。
  20312. * @private
  20313. */
  20314. const DOTS_PER_INCH = 96;
  20315. /**
  20316. * @name CommonUtil
  20317. * @namespace
  20318. * @category BaseTypes Util
  20319. * @description common 工具类。
  20320. * @usage
  20321. * ```
  20322. * // 浏览器
  20323. * <script type="text/javascript" src="{cdn}"></script>
  20324. * <script>
  20325. * const result = {namespace}.CommonUtil.getElement();
  20326. *
  20327. * // 弃用的写法
  20328. * const result = SuperMap.Util.getElement();
  20329. *
  20330. * </script>
  20331. *
  20332. * // ES6 Import
  20333. * import { CommonUtil } from '{npm}';
  20334. *
  20335. * const result = CommonUtil.getElement();
  20336. * ```
  20337. */
  20338. const Util_Util = {
  20339. /**
  20340. * @function Util.extend
  20341. * @description 对象拷贝赋值。
  20342. * @param {Object} dest - 目标对象。
  20343. * @param {Object} arguments - 待拷贝的对象。
  20344. * @returns {Object} 赋值后的目标对象。
  20345. */
  20346. assign(dest) {
  20347. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  20348. var arg = Object.getOwnPropertyNames(arguments)[index];
  20349. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  20350. continue;
  20351. }
  20352. var obj = arguments[arg];
  20353. if (obj) {
  20354. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  20355. var key = Object.getOwnPropertyNames(obj)[j];
  20356. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  20357. continue;
  20358. }
  20359. dest[key] = obj[key];
  20360. }
  20361. }
  20362. }
  20363. return dest;
  20364. },
  20365. /**
  20366. * @memberOf CommonUtil
  20367. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  20368. * @example
  20369. * 要复制 Size 对象的所有属性到自定义对象上,使用方法如下:
  20370. * var size = new Size(100, 100);
  20371. * var obj = {};
  20372. * CommonUtil.extend(obj, size);
  20373. * @param {Object} [destination] - 目标对象。
  20374. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  20375. * @returns {Object} 目标对象。
  20376. */
  20377. extend: function (destination, source) {
  20378. destination = destination || {};
  20379. if (source) {
  20380. for (var property in source) {
  20381. var value = source[property];
  20382. if (value !== undefined) {
  20383. destination[property] = value;
  20384. }
  20385. }
  20386. /**
  20387. * IE doesn't include the toString property when iterating over an object's
  20388. * properties with the for(property in object) syntax. Explicitly check if
  20389. * the source has its own toString property.
  20390. */
  20391. /*
  20392. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  20393. * prototype object" when calling hawOwnProperty if the source object
  20394. * is an instance of window.Event.
  20395. */
  20396. var sourceIsEvt = typeof window.Event === 'function' && source instanceof window.Event;
  20397. if (!sourceIsEvt && source.hasOwnProperty && source.hasOwnProperty('toString')) {
  20398. destination.toString = source.toString;
  20399. }
  20400. }
  20401. return destination;
  20402. },
  20403. /**
  20404. * @memberOf CommonUtil
  20405. * @description 对象拷贝。
  20406. * @param {Object} [des] - 目标对象。
  20407. * @param {Object} soc - 源对象。
  20408. */
  20409. copy: function (des, soc) {
  20410. des = des || {};
  20411. var v;
  20412. if (soc) {
  20413. for (var p in des) {
  20414. v = soc[p];
  20415. if (typeof v !== 'undefined') {
  20416. des[p] = v;
  20417. }
  20418. }
  20419. }
  20420. },
  20421. /**
  20422. * @memberOf CommonUtil
  20423. * @description 销毁对象,将其属性置空。
  20424. * @param {Object} [obj] - 目标对象。
  20425. */
  20426. reset: function (obj) {
  20427. obj = obj || {};
  20428. for (var p in obj) {
  20429. if (obj.hasOwnProperty(p)) {
  20430. if (typeof obj[p] === 'object' && obj[p] instanceof Array) {
  20431. for (var i in obj[p]) {
  20432. if (obj[p][i].destroy) {
  20433. obj[p][i].destroy();
  20434. }
  20435. }
  20436. obj[p].length = 0;
  20437. } else if (typeof obj[p] === 'object' && obj[p] instanceof Object) {
  20438. if (obj[p].destroy) {
  20439. obj[p].destroy();
  20440. }
  20441. }
  20442. obj[p] = null;
  20443. }
  20444. }
  20445. },
  20446. /**
  20447. * @memberOf CommonUtil
  20448. * @description 获取 HTML 元素数组。
  20449. * @returns {Array.<HTMLElement>} HTML 元素数组。
  20450. */
  20451. getElement: function () {
  20452. var elements = [];
  20453. for (var i = 0, len = arguments.length; i < len; i++) {
  20454. var element = arguments[i];
  20455. if (typeof element === 'string') {
  20456. element = document.getElementById(element);
  20457. }
  20458. if (arguments.length === 1) {
  20459. return element;
  20460. }
  20461. elements.push(element);
  20462. }
  20463. return elements;
  20464. },
  20465. /**
  20466. * @memberOf CommonUtil
  20467. * @description instance of 的跨浏览器实现。
  20468. * @param {Object} o - 对象。
  20469. * @returns {boolean} 是否是页面元素。
  20470. */
  20471. isElement: function (o) {
  20472. return !!(o && o.nodeType === 1);
  20473. },
  20474. /**
  20475. * @memberOf CommonUtil
  20476. * @description 判断一个对象是否是数组。
  20477. * @param {Object} a - 对象。
  20478. * @returns {boolean} 是否是数组。
  20479. */
  20480. isArray: function (a) {
  20481. return Object.prototype.toString.call(a) === '[object Array]';
  20482. },
  20483. /**
  20484. * @memberOf CommonUtil
  20485. * @description 从数组中删除某一项。
  20486. * @param {Array} array - 数组。
  20487. * @param {Object} item - 数组中要删除的一项。
  20488. * @returns {Array} 执行删除操作后的数组。
  20489. */
  20490. removeItem: function (array, item) {
  20491. for (var i = array.length - 1; i >= 0; i--) {
  20492. if (array[i] === item) {
  20493. array.splice(i, 1);
  20494. //break;more than once??
  20495. }
  20496. }
  20497. return array;
  20498. },
  20499. /**
  20500. * @memberOf CommonUtil
  20501. * @description 获取某对象在数组中的索引值。
  20502. * @param {Array.<Object>} array - 数组。
  20503. * @param {Object} obj - 对象。
  20504. * @returns {number} 某对象在数组中的索引值。
  20505. */
  20506. indexOf: function (array, obj) {
  20507. if (array == null) {
  20508. return -1;
  20509. } else {
  20510. // use the build-in function if available.
  20511. if (typeof array.indexOf === 'function') {
  20512. return array.indexOf(obj);
  20513. } else {
  20514. for (var i = 0, len = array.length; i < len; i++) {
  20515. if (array[i] === obj) {
  20516. return i;
  20517. }
  20518. }
  20519. return -1;
  20520. }
  20521. }
  20522. },
  20523. /**
  20524. * @memberOf CommonUtil
  20525. * @description 修改某 DOM 元素的许多属性。
  20526. * @param {HTMLElement} element - 待修改的 DOM 元素。
  20527. * @param {string} [id] - DOM 元素的 ID。
  20528. * @param {Pixel} [px] - DOM 元素的 style 属性的 left 和 top 属性。
  20529. * @param {Size} [sz] - DOM 元素的 width 和 height 属性。
  20530. * @param {string} [position] - DOM 元素的 position 属性。
  20531. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  20532. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  20533. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  20534. */
  20535. modifyDOMElement: function (element, id, px, sz, position, border, overflow, opacity) {
  20536. if (id) {
  20537. element.id = id;
  20538. }
  20539. if (px) {
  20540. element.style.left = px.x + 'px';
  20541. element.style.top = px.y + 'px';
  20542. }
  20543. if (sz) {
  20544. element.style.width = sz.w + 'px';
  20545. element.style.height = sz.h + 'px';
  20546. }
  20547. if (position) {
  20548. element.style.position = position;
  20549. }
  20550. if (border) {
  20551. element.style.border = border;
  20552. }
  20553. if (overflow) {
  20554. element.style.overflow = overflow;
  20555. }
  20556. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  20557. element.style.filter = 'alpha(opacity=' + opacity * 100 + ')';
  20558. element.style.opacity = opacity;
  20559. } else if (parseFloat(opacity) === 1.0) {
  20560. element.style.filter = '';
  20561. element.style.opacity = '';
  20562. }
  20563. },
  20564. /**
  20565. * @memberOf CommonUtil
  20566. * @description 比较两个对象并合并。
  20567. * @param {Object} [to] - 目标对象。
  20568. * @param {Object} from - 源对象。
  20569. * @returns {Object} 返回合并后的对象。
  20570. */
  20571. applyDefaults: function (to, from) {
  20572. to = to || {};
  20573. /*
  20574. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  20575. * prototype object" when calling hawOwnProperty if the source object is an
  20576. * instance of window.Event.
  20577. */
  20578. var fromIsEvt = typeof window.Event === 'function' && from instanceof window.Event;
  20579. for (var key in from) {
  20580. if (
  20581. to[key] === undefined ||
  20582. (!fromIsEvt && from.hasOwnProperty && from.hasOwnProperty(key) && !to.hasOwnProperty(key))
  20583. ) {
  20584. to[key] = from[key];
  20585. }
  20586. }
  20587. /**
  20588. * IE doesn't include the toString property when iterating over an object's
  20589. * properties with the for(property in object) syntax. Explicitly check if
  20590. * the source has its own toString property.
  20591. */
  20592. if (
  20593. !fromIsEvt &&
  20594. from &&
  20595. from.hasOwnProperty &&
  20596. from.hasOwnProperty('toString') &&
  20597. !to.hasOwnProperty('toString')
  20598. ) {
  20599. to.toString = from.toString;
  20600. }
  20601. return to;
  20602. },
  20603. /**
  20604. * @memberOf CommonUtil
  20605. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  20606. * @param {Object} params - 参数对象。
  20607. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  20608. */
  20609. getParameterString: function (params) {
  20610. var paramsArray = [];
  20611. for (var key in params) {
  20612. var value = params[key];
  20613. if (value != null && typeof value !== 'function') {
  20614. var encodedValue;
  20615. if (Array.isArray(value) || value.toString() === '[object Object]') {
  20616. encodedValue = encodeURIComponent(JSON.stringify(value));
  20617. } else {
  20618. /* value is a string; simply encode */
  20619. encodedValue = encodeURIComponent(value);
  20620. }
  20621. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  20622. }
  20623. }
  20624. return paramsArray.join('&');
  20625. },
  20626. /**
  20627. * @memberOf CommonUtil
  20628. * @description 给 URL 追加查询参数。
  20629. * @param {string} url - 待追加参数的 URL 字符串。
  20630. * @param {string} paramStr - 待追加的查询参数。
  20631. * @returns {string} 新的 URL。
  20632. */
  20633. urlAppend: function (url, paramStr) {
  20634. var newUrl = url;
  20635. if (paramStr) {
  20636. if (paramStr.indexOf('?') === 0) {
  20637. paramStr = paramStr.substring(1);
  20638. }
  20639. var parts = (url + ' ').split(/[?&]/);
  20640. newUrl += parts.pop() === ' ' ? paramStr : parts.length ? '&' + paramStr : '?' + paramStr;
  20641. }
  20642. return newUrl;
  20643. },
  20644. /**
  20645. * @memberOf CommonUtil
  20646. * @description 给 URL 追加 path 参数。
  20647. * @param {string} url - 待追加参数的 URL 字符串。
  20648. * @param {string} paramStr - 待追加的path参数。
  20649. * @returns {string} 新的 URL。
  20650. */
  20651. urlPathAppend: function (url, pathStr) {
  20652. let newUrl = url;
  20653. if (!pathStr) {
  20654. return newUrl;
  20655. }
  20656. if (pathStr.indexOf('/') === 0) {
  20657. pathStr = pathStr.substring(1);
  20658. }
  20659. const parts = url.split('?');
  20660. if (parts[0].indexOf('/', parts[0].length - 1) < 0) {
  20661. parts[0] += '/';
  20662. }
  20663. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  20664. return newUrl;
  20665. },
  20666. /**
  20667. * @memberOf CommonUtil
  20668. * @description 为了避免浮点精度错误而保留的有效位数。
  20669. * @type {number}
  20670. * @default 14
  20671. */
  20672. DEFAULT_PRECISION: 14,
  20673. /**
  20674. * @memberOf CommonUtil
  20675. * @description 将字符串以接近的精度转换为数字。
  20676. * @param {string} number - 字符串。
  20677. * @param {number} [precision=14] - 精度。
  20678. * @returns {number} 转化后的数字。
  20679. */
  20680. toFloat: function (number, precision) {
  20681. if (precision == null) {
  20682. precision = Util_Util.DEFAULT_PRECISION;
  20683. }
  20684. if (typeof number !== 'number') {
  20685. number = parseFloat(number);
  20686. }
  20687. return precision === 0 ? number : parseFloat(number.toPrecision(precision));
  20688. },
  20689. /**
  20690. * @memberOf CommonUtil
  20691. * @description 角度转弧度。
  20692. * @param {number} x - 角度。
  20693. * @returns {number} 转化后的弧度。
  20694. */
  20695. rad: function (x) {
  20696. return (x * Math.PI) / 180;
  20697. },
  20698. /**
  20699. * @memberOf CommonUtil
  20700. * @description 从 URL 字符串中解析出参数对象。
  20701. * @param {string} url - URL。
  20702. * @returns {Object} 解析出的参数对象。
  20703. */
  20704. getParameters: function (url) {
  20705. // if no url specified, take it from the location bar
  20706. url = url === null || url === undefined ? window.location.href : url;
  20707. //parse out parameters portion of url string
  20708. var paramsString = '';
  20709. if (StringExt.contains(url, '?')) {
  20710. var start = url.indexOf('?') + 1;
  20711. var end = StringExt.contains(url, '#') ? url.indexOf('#') : url.length;
  20712. paramsString = url.substring(start, end);
  20713. }
  20714. var parameters = {};
  20715. var pairs = paramsString.split(/[&;]/);
  20716. for (var i = 0, len = pairs.length; i < len; ++i) {
  20717. var keyValue = pairs[i].split('=');
  20718. if (keyValue[0]) {
  20719. var key = keyValue[0];
  20720. try {
  20721. key = decodeURIComponent(key);
  20722. } catch (err) {
  20723. key = unescape(key);
  20724. }
  20725. // being liberal by replacing "+" with " "
  20726. var value = (keyValue[1] || '').replace(/\+/g, ' ');
  20727. try {
  20728. value = decodeURIComponent(value);
  20729. } catch (err) {
  20730. value = unescape(value);
  20731. }
  20732. // follow OGC convention of comma delimited values
  20733. value = value.split(',');
  20734. //if there's only one value, do not return as array
  20735. if (value.length == 1) {
  20736. value = value[0];
  20737. }
  20738. parameters[key] = value;
  20739. }
  20740. }
  20741. return parameters;
  20742. },
  20743. /**
  20744. * @memberOf CommonUtil
  20745. * @description 不断递增计数变量,用于生成唯一 ID。
  20746. * @type {number}
  20747. * @default 0
  20748. */
  20749. lastSeqID: 0,
  20750. /**
  20751. * @memberOf CommonUtil
  20752. * @description 创建唯一 ID 值。
  20753. * @param {string} [prefix] - 前缀。
  20754. * @returns {string} 唯一的 ID 值。
  20755. */
  20756. createUniqueID: function (prefix) {
  20757. if (prefix == null) {
  20758. prefix = 'id_';
  20759. }
  20760. Util_Util.lastSeqID += 1;
  20761. return prefix + Util_Util.lastSeqID;
  20762. },
  20763. /**
  20764. * @memberOf CommonUtil
  20765. * @description 判断并转化比例尺。
  20766. * @param {number} scale - 比例尺。
  20767. * @returns {number} 正常的 scale 值。
  20768. */
  20769. normalizeScale: function (scale) {
  20770. var normScale = scale > 1.0 ? 1.0 / scale : scale;
  20771. return normScale;
  20772. },
  20773. /**
  20774. * @memberOf CommonUtil
  20775. * @description 比例尺转分辨率。
  20776. * @param {number} scale - 比例尺。
  20777. * @param {string} [units='degrees'] - 比例尺单位。
  20778. * @returns {number} 转化后的分辨率。
  20779. */
  20780. getResolutionFromScale: function (scale, units) {
  20781. var resolution;
  20782. if (scale) {
  20783. if (units == null) {
  20784. units = 'degrees';
  20785. }
  20786. var normScale = Util_Util.normalizeScale(scale);
  20787. resolution = 1 / (normScale * INCHES_PER_UNIT[units] * DOTS_PER_INCH);
  20788. }
  20789. return resolution;
  20790. },
  20791. /**
  20792. * @memberOf CommonUtil
  20793. * @description 分辨率转比例尺。
  20794. * @param {number} resolution - 分辨率。
  20795. * @param {string} [units='degrees'] - 分辨率单位。
  20796. * @returns {number} 转化后的比例尺。
  20797. */
  20798. getScaleFromResolution: function (resolution, units) {
  20799. if (units == null) {
  20800. units = 'degrees';
  20801. }
  20802. var scale = resolution * INCHES_PER_UNIT[units] * DOTS_PER_INCH;
  20803. return scale;
  20804. },
  20805. /**
  20806. * @memberOf CommonUtil
  20807. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  20808. * @returns {Object} 浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  20809. */
  20810. getBrowser: function () {
  20811. return Browser;
  20812. },
  20813. /**
  20814. * @memberOf CommonUtil
  20815. * @description 浏览器是否支持 Canvas。
  20816. * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas。
  20817. */
  20818. isSupportCanvas,
  20819. /**
  20820. * @memberOf CommonUtil
  20821. * @description 判断浏览器是否支持 Canvas。
  20822. * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas 。
  20823. */
  20824. supportCanvas: function () {
  20825. return Util_Util.isSupportCanvas;
  20826. },
  20827. /**
  20828. * @memberOf CommonUtil
  20829. * @description 判断一个 URL 请求是否在当前域中。
  20830. * @param {string} url - URL 请求字符串。
  20831. * @returns {boolean} URL 请求是否在当前域中。
  20832. */
  20833. isInTheSameDomain: function (url) {
  20834. if (!url) {
  20835. return true;
  20836. }
  20837. var index = url.indexOf('//');
  20838. var documentUrl = document.location.toString();
  20839. var documentIndex = documentUrl.indexOf('//');
  20840. if (index === -1) {
  20841. return true;
  20842. } else {
  20843. var protocol;
  20844. var substring = (protocol = url.substring(0, index));
  20845. var documentSubString = documentUrl.substring(documentIndex + 2);
  20846. documentIndex = documentSubString.indexOf('/');
  20847. var documentPortIndex = documentSubString.indexOf(':');
  20848. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  20849. //var documentPort;
  20850. var documentprotocol = document.location.protocol;
  20851. if (documentPortIndex !== -1) {
  20852. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  20853. } else {
  20854. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  20855. }
  20856. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  20857. return false;
  20858. }
  20859. substring = url.substring(index + 2);
  20860. var portIndex = substring.indexOf(':');
  20861. index = substring.indexOf('/');
  20862. var domainWithPort = substring.substring(0, index);
  20863. var domain;
  20864. if (portIndex !== -1) {
  20865. domain = substring.substring(0, portIndex);
  20866. } else {
  20867. domain = substring.substring(0, index);
  20868. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  20869. }
  20870. var documentDomain = document.domain;
  20871. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  20872. return true;
  20873. }
  20874. }
  20875. return false;
  20876. },
  20877. /**
  20878. * @memberOf CommonUtil
  20879. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  20880. * @param {Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  20881. * @param {Size} viewer - 地图初始化时默认的地图图片的尺寸。
  20882. * @param {number} scale - 地图初始化时默认的显示比例尺。
  20883. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  20884. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  20885. * @returns {number} 图层显示分辨率。
  20886. */
  20887. calculateDpi: function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  20888. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  20889. if (!viewBounds || !viewer || !scale) {
  20890. return;
  20891. }
  20892. var ratio = 10000,
  20893. rvbWidth = viewBounds.getWidth(),
  20894. rvbHeight = viewBounds.getHeight(),
  20895. rvWidth = viewer.w,
  20896. rvHeight = viewer.h;
  20897. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  20898. datumAxis = datumAxis || 6378137;
  20899. coordUnit = coordUnit || 'degrees';
  20900. var dpi;
  20901. if (
  20902. coordUnit.toLowerCase() === 'degree' ||
  20903. coordUnit.toLowerCase() === 'degrees' ||
  20904. coordUnit.toLowerCase() === 'dd'
  20905. ) {
  20906. let num1 = rvbWidth / rvWidth,
  20907. num2 = rvbHeight / rvHeight,
  20908. resolution = num1 > num2 ? num1 : num2;
  20909. dpi = (0.0254 * ratio) / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  20910. } else {
  20911. let resolution = rvbWidth / rvWidth;
  20912. dpi = (0.0254 * ratio) / resolution / scale / ratio;
  20913. }
  20914. return dpi;
  20915. },
  20916. /**
  20917. * @memberOf CommonUtil
  20918. * @description 将对象转换成 JSON 字符串。
  20919. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  20920. * @returns {string} 转换后的 JSON 对象。
  20921. */
  20922. toJSON: function (obj) {
  20923. var objInn = obj;
  20924. if (objInn == null) {
  20925. return null;
  20926. }
  20927. switch (objInn.constructor) {
  20928. case String:
  20929. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  20930. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  20931. objInn = objInn.replace(/\n/g, '\\n');
  20932. objInn = objInn.replace(/\r/g, '\\r');
  20933. objInn = objInn.replace('<', '&lt;');
  20934. objInn = objInn.replace('>', '&gt;');
  20935. objInn = objInn.replace(/%/g, '%25');
  20936. objInn = objInn.replace(/&/g, '%26');
  20937. return objInn;
  20938. case Array:
  20939. var arr = '';
  20940. for (var i = 0, len = objInn.length; i < len; i++) {
  20941. arr += Util_Util.toJSON(objInn[i]);
  20942. if (i !== objInn.length - 1) {
  20943. arr += ',';
  20944. }
  20945. }
  20946. return "[" + arr + "]";
  20947. case Number:
  20948. return isFinite(objInn) ? String(objInn) : null;
  20949. case Boolean:
  20950. return String(objInn);
  20951. case Date:
  20952. var dateStr =
  20953. '{' +
  20954. '\'__type\':"System.DateTime",' +
  20955. "'Year':" +
  20956. objInn.getFullYear() +
  20957. ',' +
  20958. "'Month':" +
  20959. (objInn.getMonth() + 1) +
  20960. ',' +
  20961. "'Day':" +
  20962. objInn.getDate() +
  20963. ',' +
  20964. "'Hour':" +
  20965. objInn.getHours() +
  20966. ',' +
  20967. "'Minute':" +
  20968. objInn.getMinutes() +
  20969. ',' +
  20970. "'Second':" +
  20971. objInn.getSeconds() +
  20972. ',' +
  20973. "'Millisecond':" +
  20974. objInn.getMilliseconds() +
  20975. ',' +
  20976. "'TimezoneOffset':" +
  20977. objInn.getTimezoneOffset() +
  20978. '}';
  20979. return dateStr;
  20980. default:
  20981. if (objInn['toJSON'] != null && typeof objInn['toJSON'] === 'function') {
  20982. return objInn.toJSON();
  20983. }
  20984. if (typeof objInn === 'object') {
  20985. if (objInn.length) {
  20986. let arr = [];
  20987. for (let i = 0, len = objInn.length; i < len; i++) {
  20988. arr.push(Util_Util.toJSON(objInn[i]));
  20989. }
  20990. return '[' + arr.join(',') + ']';
  20991. }
  20992. let arr = [];
  20993. for (let attr in objInn) {
  20994. //为解决Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  20995. if (typeof objInn[attr] !== 'function' && attr !== 'CLASS_NAME' && attr !== 'parent') {
  20996. arr.push("'" + attr + "':" + Util_Util.toJSON(objInn[attr]));
  20997. }
  20998. }
  20999. if (arr.length > 0) {
  21000. return '{' + arr.join(',') + '}';
  21001. } else {
  21002. return '{}';
  21003. }
  21004. }
  21005. return objInn.toString();
  21006. }
  21007. },
  21008. /**
  21009. * @memberOf CommonUtil
  21010. * @description 根据比例尺和 DPI 计算屏幕分辨率。
  21011. * @category BaseTypes Util
  21012. * @param {number} scale - 比例尺。
  21013. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  21014. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  21015. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  21016. * @returns {number} 当前比例尺下的屏幕分辨率。
  21017. */
  21018. getResolutionFromScaleDpi: function (scale, dpi, coordUnit, datumAxis) {
  21019. var resolution = null,
  21020. ratio = 10000;
  21021. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  21022. datumAxis = datumAxis || 6378137;
  21023. coordUnit = coordUnit || '';
  21024. if (scale > 0 && dpi > 0) {
  21025. scale = Util_Util.normalizeScale(scale);
  21026. if (
  21027. coordUnit.toLowerCase() === 'degree' ||
  21028. coordUnit.toLowerCase() === 'degrees' ||
  21029. coordUnit.toLowerCase() === 'dd'
  21030. ) {
  21031. //scale = Util.normalizeScale(scale);
  21032. resolution = (0.0254 * ratio) / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  21033. return resolution;
  21034. } else {
  21035. resolution = (0.0254 * ratio) / dpi / scale / ratio;
  21036. return resolution;
  21037. }
  21038. }
  21039. return -1;
  21040. },
  21041. /**
  21042. * @memberOf CommonUtil
  21043. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  21044. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  21045. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  21046. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  21047. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  21048. * @returns {number} 当前屏幕分辨率下的比例尺。
  21049. */
  21050. getScaleFromResolutionDpi: function (resolution, dpi, coordUnit, datumAxis) {
  21051. var scale = null,
  21052. ratio = 10000;
  21053. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  21054. datumAxis = datumAxis || 6378137;
  21055. coordUnit = coordUnit || '';
  21056. if (resolution > 0 && dpi > 0) {
  21057. if (
  21058. coordUnit.toLowerCase() === 'degree' ||
  21059. coordUnit.toLowerCase() === 'degrees' ||
  21060. coordUnit.toLowerCase() === 'dd'
  21061. ) {
  21062. scale = (0.0254 * ratio) / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  21063. return scale;
  21064. } else {
  21065. scale = (0.0254 * ratio) / dpi / resolution / ratio;
  21066. return scale;
  21067. }
  21068. }
  21069. return -1;
  21070. },
  21071. /**
  21072. * @memberOf CommonUtil
  21073. * @description 转换查询结果。
  21074. * @param {Object} result - 查询结果。
  21075. * @returns {Object} 转换后的查询结果。
  21076. */
  21077. transformResult: function (result) {
  21078. if (result.responseText && typeof result.responseText === 'string') {
  21079. result = JSON.parse(result.responseText);
  21080. }
  21081. return result;
  21082. },
  21083. /**
  21084. * @memberOf CommonUtil
  21085. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  21086. * @param {Object} [destination] - 拷贝目标。
  21087. * @param {Object} source - 源对象。
  21088. *
  21089. */
  21090. copyAttributes: function (destination, source) {
  21091. destination = destination || {};
  21092. if (source) {
  21093. for (var property in source) {
  21094. var value = source[property];
  21095. if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
  21096. destination[property] = value;
  21097. }
  21098. }
  21099. }
  21100. return destination;
  21101. },
  21102. /**
  21103. * @memberOf CommonUtil
  21104. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  21105. * @param {Object} [destination] - 目标对象。
  21106. * @param {Object} source - 源对象。
  21107. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  21108. *
  21109. */
  21110. copyAttributesWithClip: function (destination, source, clip) {
  21111. destination = destination || {};
  21112. if (source) {
  21113. for (var property in source) {
  21114. //去掉禁止拷贝的属性
  21115. var isInClip = false;
  21116. if (clip && clip.length) {
  21117. for (var i = 0, len = clip.length; i < len; i++) {
  21118. if (property === clip[i]) {
  21119. isInClip = true;
  21120. break;
  21121. }
  21122. }
  21123. }
  21124. if (isInClip === true) {
  21125. continue;
  21126. }
  21127. var value = source[property];
  21128. if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
  21129. destination[property] = value;
  21130. }
  21131. }
  21132. }
  21133. return destination;
  21134. },
  21135. /**
  21136. * @memberOf CommonUtil
  21137. * @description 克隆一个 Object 对象。
  21138. * @param {Object} obj - 需要克隆的对象。
  21139. * @returns {Object} 对象的拷贝对象,注意是新的对象,不是指向。
  21140. */
  21141. cloneObject: function (obj) {
  21142. // Handle the 3 simple types, and null or undefined
  21143. if (null === obj || 'object' !== typeof obj) {
  21144. return obj;
  21145. }
  21146. // Handle Date
  21147. if (obj instanceof Date) {
  21148. let copy = new Date();
  21149. copy.setTime(obj.getTime());
  21150. return copy;
  21151. }
  21152. // Handle Array
  21153. if (obj instanceof Array) {
  21154. let copy = obj.slice(0);
  21155. return copy;
  21156. }
  21157. // Handle Object
  21158. if (obj instanceof Object) {
  21159. let copy = {};
  21160. for (var attr in obj) {
  21161. if (obj.hasOwnProperty(attr)) {
  21162. copy[attr] = Util_Util.cloneObject(obj[attr]);
  21163. }
  21164. }
  21165. return copy;
  21166. }
  21167. throw new Error("Unable to copy obj! Its type isn't supported.");
  21168. },
  21169. /**
  21170. * @memberOf CommonUtil
  21171. * @description 判断两条线段是不是有交点。
  21172. * @param {GeometryPoint} a1 - 第一条线段的起始节点。
  21173. * @param {GeometryPoint} a2 - 第一条线段的结束节点。
  21174. * @param {GeometryPoint} b1 - 第二条线段的起始节点。
  21175. * @param {GeometryPoint} b2 - 第二条线段的结束节点。
  21176. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  21177. */
  21178. lineIntersection: function (a1, a2, b1, b2) {
  21179. var intersectValue = null;
  21180. var k1;
  21181. var k2;
  21182. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  21183. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  21184. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  21185. //ab==0代表两条线断的斜率一样
  21186. if (ab != 0) {
  21187. k1 = b / ab;
  21188. k2 = a / ab;
  21189. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  21190. intersectValue = new Geometry_Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  21191. } else {
  21192. intersectValue = 'No Intersection';
  21193. }
  21194. } else {
  21195. if (b == 0 && a == 0) {
  21196. var maxy = Math.max(a1.y, a2.y);
  21197. var miny = Math.min(a1.y, a2.y);
  21198. var maxx = Math.max(a1.x, a2.x);
  21199. var minx = Math.min(a1.x, a2.x);
  21200. if (
  21201. (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) && b1.x >= minx && b1.x <= maxx) ||
  21202. (b2.x >= minx && b2.x <= maxx)
  21203. ) {
  21204. intersectValue = 'Coincident'; //重合
  21205. } else {
  21206. intersectValue = 'Parallel'; //平行
  21207. }
  21208. } else {
  21209. intersectValue = 'Parallel'; //平行
  21210. }
  21211. }
  21212. return intersectValue;
  21213. },
  21214. /**
  21215. * @memberOf CommonUtil
  21216. * @description 获取文本外接矩形宽度与高度。
  21217. * @param {ThemeStyle} style - 文本样式。
  21218. * @param {string} text - 文本内容。
  21219. * @param {Object} element - DOM 元素。
  21220. * @returns {Object} 裁剪后的宽度,高度信息。
  21221. */
  21222. getTextBounds: function (style, text, element) {
  21223. document.body.appendChild(element);
  21224. element.style.width = 'auto';
  21225. element.style.height = 'auto';
  21226. if (style.fontSize) {
  21227. element.style.fontSize = style.fontSize;
  21228. }
  21229. if (style.fontFamily) {
  21230. element.style.fontFamily = style.fontFamily;
  21231. }
  21232. if (style.fontWeight) {
  21233. element.style.fontWeight = style.fontWeight;
  21234. }
  21235. element.style.position = 'relative';
  21236. element.style.visibility = 'hidden';
  21237. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  21238. element.style.display = 'inline-block';
  21239. element.innerHTML = text;
  21240. var textWidth = element.clientWidth;
  21241. var textHeight = element.clientHeight;
  21242. document.body.removeChild(element);
  21243. return {
  21244. textWidth: textWidth,
  21245. textHeight: textHeight
  21246. };
  21247. },
  21248. /**
  21249. * @memberOf CommonUtil
  21250. * @description 获取转换后的path路径。
  21251. * @param {string} path - 待转换的path,包含`{param}`。
  21252. * @param {Object} pathParams - path中待替换的参数。
  21253. * @returns {string} 转换后的path路径。
  21254. */
  21255. convertPath: function (path, pathParams) {
  21256. if (!pathParams) {
  21257. return path;
  21258. }
  21259. return path.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => {
  21260. var value;
  21261. if (pathParams.hasOwnProperty(key)) {
  21262. value = paramToString(pathParams[key]);
  21263. } else {
  21264. value = fullMatch;
  21265. }
  21266. return encodeURIComponent(value);
  21267. });
  21268. }
  21269. };
  21270. /**
  21271. * @enum INCHES_PER_UNIT
  21272. * @description 每单位的英尺数。
  21273. * @type {number}
  21274. * @private
  21275. */
  21276. const INCHES_PER_UNIT = {
  21277. inches: 1.0,
  21278. ft: 12.0,
  21279. mi: 63360.0,
  21280. m: 39.3701,
  21281. km: 39370.1,
  21282. dd: 4374754,
  21283. yd: 36
  21284. };
  21285. INCHES_PER_UNIT['in'] = INCHES_PER_UNIT.inches;
  21286. INCHES_PER_UNIT['degrees'] = INCHES_PER_UNIT.dd;
  21287. INCHES_PER_UNIT['nmi'] = 1852 * INCHES_PER_UNIT.m;
  21288. // Units from CS-Map
  21289. const METERS_PER_INCH = 0.0254000508001016002;
  21290. Util_Util.extend(INCHES_PER_UNIT, {
  21291. Inch: INCHES_PER_UNIT.inches,
  21292. Meter: 1.0 / METERS_PER_INCH, //EPSG:9001
  21293. Foot: 0.30480060960121920243 / METERS_PER_INCH, //EPSG:9003
  21294. IFoot: 0.3048 / METERS_PER_INCH, //EPSG:9002
  21295. ClarkeFoot: 0.3047972651151 / METERS_PER_INCH, //EPSG:9005
  21296. SearsFoot: 0.30479947153867624624 / METERS_PER_INCH, //EPSG:9041
  21297. GoldCoastFoot: 0.30479971018150881758 / METERS_PER_INCH, //EPSG:9094
  21298. IInch: 0.0254 / METERS_PER_INCH,
  21299. MicroInch: 0.0000254 / METERS_PER_INCH,
  21300. Mil: 0.0000000254 / METERS_PER_INCH,
  21301. Centimeter: 0.01 / METERS_PER_INCH,
  21302. Kilometer: 1000.0 / METERS_PER_INCH, //EPSG:9036
  21303. Yard: 0.91440182880365760731 / METERS_PER_INCH,
  21304. SearsYard: 0.914398414616029 / METERS_PER_INCH, //EPSG:9040
  21305. IndianYard: 0.91439853074444079983 / METERS_PER_INCH, //EPSG:9084
  21306. IndianYd37: 0.91439523 / METERS_PER_INCH, //EPSG:9085
  21307. IndianYd62: 0.9143988 / METERS_PER_INCH, //EPSG:9086
  21308. IndianYd75: 0.9143985 / METERS_PER_INCH, //EPSG:9087
  21309. IndianFoot: 0.30479951 / METERS_PER_INCH, //EPSG:9080
  21310. IndianFt37: 0.30479841 / METERS_PER_INCH, //EPSG:9081
  21311. IndianFt62: 0.3047996 / METERS_PER_INCH, //EPSG:9082
  21312. IndianFt75: 0.3047995 / METERS_PER_INCH, //EPSG:9083
  21313. Mile: 1609.34721869443738887477 / METERS_PER_INCH,
  21314. IYard: 0.9144 / METERS_PER_INCH, //EPSG:9096
  21315. IMile: 1609.344 / METERS_PER_INCH, //EPSG:9093
  21316. NautM: 1852.0 / METERS_PER_INCH, //EPSG:9030
  21317. 'Lat-66': 110943.316488932731 / METERS_PER_INCH,
  21318. 'Lat-83': 110946.25736872234125 / METERS_PER_INCH,
  21319. Decimeter: 0.1 / METERS_PER_INCH,
  21320. Millimeter: 0.001 / METERS_PER_INCH,
  21321. Dekameter: 10.0 / METERS_PER_INCH,
  21322. Decameter: 10.0 / METERS_PER_INCH,
  21323. Hectometer: 100.0 / METERS_PER_INCH,
  21324. GermanMeter: 1.0000135965 / METERS_PER_INCH, //EPSG:9031
  21325. CaGrid: 0.999738 / METERS_PER_INCH,
  21326. ClarkeChain: 20.1166194976 / METERS_PER_INCH, //EPSG:9038
  21327. GunterChain: 20.11684023368047 / METERS_PER_INCH, //EPSG:9033
  21328. BenoitChain: 20.116782494375872 / METERS_PER_INCH, //EPSG:9062
  21329. SearsChain: 20.11676512155 / METERS_PER_INCH, //EPSG:9042
  21330. ClarkeLink: 0.201166194976 / METERS_PER_INCH, //EPSG:9039
  21331. GunterLink: 0.2011684023368047 / METERS_PER_INCH, //EPSG:9034
  21332. BenoitLink: 0.20116782494375872 / METERS_PER_INCH, //EPSG:9063
  21333. SearsLink: 0.2011676512155 / METERS_PER_INCH, //EPSG:9043
  21334. Rod: 5.02921005842012 / METERS_PER_INCH,
  21335. IntnlChain: 20.1168 / METERS_PER_INCH, //EPSG:9097
  21336. IntnlLink: 0.201168 / METERS_PER_INCH, //EPSG:9098
  21337. Perch: 5.02921005842012 / METERS_PER_INCH,
  21338. Pole: 5.02921005842012 / METERS_PER_INCH,
  21339. Furlong: 201.1684023368046 / METERS_PER_INCH,
  21340. Rood: 3.778266898 / METERS_PER_INCH,
  21341. CapeFoot: 0.3047972615 / METERS_PER_INCH,
  21342. Brealey: 375.0 / METERS_PER_INCH,
  21343. ModAmFt: 0.304812252984505969011938 / METERS_PER_INCH,
  21344. Fathom: 1.8288 / METERS_PER_INCH,
  21345. 'NautM-UK': 1853.184 / METERS_PER_INCH,
  21346. '50kilometers': 50000.0 / METERS_PER_INCH,
  21347. '150kilometers': 150000.0 / METERS_PER_INCH
  21348. });
  21349. //unit abbreviations supported by PROJ.4
  21350. Util_Util.extend(INCHES_PER_UNIT, {
  21351. mm: INCHES_PER_UNIT['Meter'] / 1000.0,
  21352. cm: INCHES_PER_UNIT['Meter'] / 100.0,
  21353. dm: INCHES_PER_UNIT['Meter'] * 100.0,
  21354. km: INCHES_PER_UNIT['Meter'] * 1000.0,
  21355. kmi: INCHES_PER_UNIT['nmi'], //International Nautical Mile
  21356. fath: INCHES_PER_UNIT['Fathom'], //International Fathom
  21357. ch: INCHES_PER_UNIT['IntnlChain'], //International Chain
  21358. link: INCHES_PER_UNIT['IntnlLink'], //International Link
  21359. 'us-in': INCHES_PER_UNIT['inches'], //U.S. Surveyor's Inch
  21360. 'us-ft': INCHES_PER_UNIT['Foot'], //U.S. Surveyor's Foot
  21361. 'us-yd': INCHES_PER_UNIT['Yard'], //U.S. Surveyor's Yard
  21362. 'us-ch': INCHES_PER_UNIT['GunterChain'], //U.S. Surveyor's Chain
  21363. 'us-mi': INCHES_PER_UNIT['Mile'], //U.S. Surveyor's Statute Mile
  21364. 'ind-yd': INCHES_PER_UNIT['IndianYd37'], //Indian Yard
  21365. 'ind-ft': INCHES_PER_UNIT['IndianFt37'], //Indian Foot
  21366. 'ind-ch': 20.11669506 / METERS_PER_INCH //Indian Chain
  21367. });
  21368. //将服务端的地图单位转成SuperMap的地图单位
  21369. INCHES_PER_UNIT['degree'] = INCHES_PER_UNIT.dd;
  21370. INCHES_PER_UNIT['meter'] = INCHES_PER_UNIT.m;
  21371. INCHES_PER_UNIT['foot'] = INCHES_PER_UNIT.ft;
  21372. INCHES_PER_UNIT['inch'] = INCHES_PER_UNIT.inches;
  21373. INCHES_PER_UNIT['mile'] = INCHES_PER_UNIT.mi;
  21374. INCHES_PER_UNIT['kilometer'] = INCHES_PER_UNIT.km;
  21375. INCHES_PER_UNIT['yard'] = INCHES_PER_UNIT.yd;
  21376. function paramToString(param) {
  21377. if (param == undefined || param == null) {
  21378. return '';
  21379. }
  21380. if (param instanceof Date) {
  21381. return param.toJSON();
  21382. }
  21383. if (canBeJsonified(param)) {
  21384. return JSON.stringify(param);
  21385. }
  21386. return param.toString();
  21387. }
  21388. function canBeJsonified(str) {
  21389. if (typeof str !== 'string' && typeof str !== 'object') {
  21390. return false;
  21391. }
  21392. try {
  21393. const type = str.toString();
  21394. return type === '[object Object]' || type === '[object Array]';
  21395. } catch (err) {
  21396. return false;
  21397. }
  21398. }
  21399. ;// CONCATENATED MODULE: ./src/common/commontypes/LonLat.js
  21400. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21401. * This program are made available under the terms of the Apache License, Version 2.0
  21402. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21403. /**
  21404. * @class LonLat
  21405. * @category BaseTypes Geometry
  21406. * @classdesc 这个类用来表示经度和纬度对。
  21407. * @param {number|Array.<number>} [lon=0.0] - 地图单位上的 X 轴坐标或者横纵坐标组成的数组;如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。
  21408. * @param {number} [lat=0.0] - 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。
  21409. * @example
  21410. * var lonLat = new LonLat(30,45);
  21411. * @usage
  21412. */
  21413. class LonLat {
  21414. constructor(lon, lat) {
  21415. if (Util_Util.isArray(lon)) {
  21416. lat = lon[1];
  21417. lon = lon[0];
  21418. }
  21419. /**
  21420. * @member {number} [LonLat.prototype.lon=0.0]
  21421. * @description 地图的单位的 X 轴(横轴)坐标。
  21422. */
  21423. this.lon = lon ? Util_Util.toFloat(lon) : 0.0;
  21424. /**
  21425. * @member {number} [LonLat.prototype.lat=0.0]
  21426. * @description 地图的单位的 Y 轴(纵轴)坐标。
  21427. */
  21428. this.lat = lat ? Util_Util.toFloat(lat) : 0.0;
  21429. this.CLASS_NAME = "SuperMap.LonLat";
  21430. }
  21431. /**
  21432. * @function LonLat.prototype.toString
  21433. * @description 返回此对象的字符串形式。
  21434. * @example
  21435. * var lonLat = new LonLat(100,50);
  21436. * var str = lonLat.toString();
  21437. * @returns {string} 例如: "lon=100,lat=50"。
  21438. */
  21439. toString() {
  21440. return ("lon=" + this.lon + ",lat=" + this.lat);
  21441. }
  21442. /**
  21443. * @function LonLat.prototype.toShortString
  21444. * @description 将经度纬度转换成简单字符串。
  21445. * @example
  21446. * var lonLat = new LonLat(100,50);
  21447. * var str = lonLat.toShortString();
  21448. * @returns {string} 处理后的经纬度字符串。例如:"100,50"。
  21449. */
  21450. toShortString() {
  21451. return (this.lon + "," + this.lat);
  21452. }
  21453. /**
  21454. * @function LonLat.prototype.clone
  21455. * @description 复制坐标对象,并返回复制后的新对象。
  21456. * @example
  21457. * var lonLat1 = new LonLat(100,50);
  21458. * var lonLat2 = lonLat1.clone();
  21459. * @returns {LonLat} 相同坐标值的新的坐标对象。
  21460. */
  21461. clone() {
  21462. return new LonLat(this.lon, this.lat);
  21463. }
  21464. /**
  21465. * @function LonLat.prototype.add
  21466. * @description 在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。
  21467. * @example
  21468. * var lonLat1 = new LonLat(100,50);
  21469. * //lonLat2 是新的对象
  21470. * var lonLat2 = lonLat1.add(100,50);
  21471. * @param {number} lon - 经度参数。
  21472. * @param {number} lat - 纬度参数。
  21473. * @returns {LonLat} 新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。
  21474. */
  21475. add(lon, lat) {
  21476. if ((lon == null) || (lat == null)) {
  21477. throw new TypeError('LonLat.add cannot receive null values');
  21478. }
  21479. return new LonLat(this.lon + Util_Util.toFloat(lon),
  21480. this.lat + Util_Util.toFloat(lat));
  21481. }
  21482. /**
  21483. * @function LonLat.prototype.equals
  21484. * @description 判断两个坐标对象是否相等。
  21485. * @example
  21486. * var lonLat1 = new LonLat(100,50);
  21487. * var lonLat2 = new LonLat(100,50);
  21488. * var isEquals = lonLat1.equals(lonLat2);
  21489. * @param {LonLat} ll - 需要进行比较的坐标对象。
  21490. * @returns {boolean} 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一
  21491. * 致或传入的ll参数为NULL则返回false。
  21492. */
  21493. equals(ll) {
  21494. var equals = false;
  21495. if (ll != null) {
  21496. equals = ((this.lon === ll.lon && this.lat === ll.lat) ||
  21497. (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));
  21498. }
  21499. return equals;
  21500. }
  21501. /**
  21502. * @function LonLat.prototype.wrapDateLine
  21503. * @description 通过传入的范围对象对坐标对象转换到该范围内。
  21504. * 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。
  21505. * 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。
  21506. * @example
  21507. * var lonLat1 = new LonLat(420,50);
  21508. * var lonLat2 = lonLat1.wrapDateLine(
  21509. * new Bounds(-180,-90,180,90)
  21510. * );
  21511. * @param {Bounds} maxExtent - 最大边界的范围。
  21512. * @returns {LonLat} 将坐标转换到范围对象以内,并返回新的坐标。
  21513. */
  21514. wrapDateLine(maxExtent) {
  21515. var newLonLat = this.clone();
  21516. if (maxExtent) {
  21517. //shift right?
  21518. while (newLonLat.lon < maxExtent.left) {
  21519. newLonLat.lon += maxExtent.getWidth();
  21520. }
  21521. //shift left?
  21522. while (newLonLat.lon > maxExtent.right) {
  21523. newLonLat.lon -= maxExtent.getWidth();
  21524. }
  21525. }
  21526. return newLonLat;
  21527. }
  21528. /**
  21529. *
  21530. * @function LonLat.prototype.destroy
  21531. * @description 销毁此对象。
  21532. * 销毁后此对象的所有属性为 null,而不是初始值。
  21533. * @example
  21534. * var lonLat = new LonLat(100,50);
  21535. * lonLat.destroy();
  21536. */
  21537. destroy() {
  21538. this.lon = null;
  21539. this.lat = null;
  21540. }
  21541. /**
  21542. * @function LonLat.fromString
  21543. * @description 通过字符串生成一个 {@link LonLat} 对象。
  21544. * @example
  21545. * var str = "100,50";
  21546. * var lonLat = LonLat.fromString(str);
  21547. * @param {string} str - 字符串的格式:Lon+","+Lat。如:"100,50"。
  21548. * @returns {LonLat} {@link LonLat} 对象。
  21549. */
  21550. static fromString(str) {
  21551. var pair = str.split(",");
  21552. return new LonLat(pair[0], pair[1]);
  21553. }
  21554. /**
  21555. * @function LonLat.fromArray
  21556. * @description 通过数组生成一个 {@link LonLat} 对象。
  21557. * @param {Array.<number>} arr - 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。
  21558. * @returns {LonLat} {@link LonLat} 对象。
  21559. */
  21560. static fromArray(arr) {
  21561. var gotArr = Util_Util.isArray(arr),
  21562. lon = gotArr && arr[0],
  21563. lat = gotArr && arr[1];
  21564. return new LonLat(lon, lat);
  21565. }
  21566. }
  21567. ;// CONCATENATED MODULE: ./src/common/commontypes/Bounds.js
  21568. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21569. * This program are made available under the terms of the Apache License, Version 2.0
  21570. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21571. /**
  21572. * @class Bounds
  21573. * @deprecatedclass SuperMap.Bounds
  21574. * @category BaseTypes Geometry
  21575. * @classdesc 表示边界类实例。使用 bounds 之前需要设置 left,bottom,right,top 四个属性,这些属性的初始值为 null。
  21576. * @param {number|Array.<number>} [left] - 如果是number,则表示左边界,注意考虑宽度,理论上小于 right 值。如果是数组,则表示 [left, bottom, right, top] 左下右上组成的数组。
  21577. * @param {number} [bottom] - 下边界。考虑高度,理论上小于 top 值。
  21578. * @param {number} [right] - 右边界。
  21579. * @param {number} [top] - 上边界。
  21580. * @example
  21581. * var bounds = new Bounds();
  21582. * bounds.extend(new LonLat(4,5));
  21583. * bounds.extend(new LonLat(5,6));
  21584. * bounds.toBBOX(); // returns 4,5,5,6
  21585. * @usage
  21586. */
  21587. class Bounds {
  21588. constructor(left, bottom, right, top) {
  21589. if (Util_Util.isArray(left)) {
  21590. top = left[3];
  21591. right = left[2];
  21592. bottom = left[1];
  21593. left = left[0];
  21594. }
  21595. /**
  21596. * @member {number} Bounds.prototype.left
  21597. * @description 最小的水平坐标系。
  21598. */
  21599. this.left = left != null ? Util_Util.toFloat(left) : this.left;
  21600. /**
  21601. * @member {number} Bounds.prototype.bottom
  21602. * @description 最小的垂直坐标系。
  21603. */
  21604. this.bottom = bottom != null ? Util_Util.toFloat(bottom) : this.bottom;
  21605. /**
  21606. * @member {number} Bounds.prototype.right
  21607. * @description 最大的水平坐标系。
  21608. */
  21609. this.right = right != null ? Util_Util.toFloat(right) : this.right;
  21610. /**
  21611. * @member {number} Bounds.prototype.top
  21612. * @description 最大的垂直坐标系。
  21613. */
  21614. this.top = top != null ? Util_Util.toFloat(top) : this.top;
  21615. /**
  21616. * @member {LonLat} Bounds.prototype.centerLonLat
  21617. * @description bounds 的地图空间的中心点。用 getCenterLonLat() 获得。
  21618. */
  21619. this.centerLonLat = null;
  21620. this.CLASS_NAME = "SuperMap.Bounds";
  21621. }
  21622. /**
  21623. * @function Bounds.prototype.clone
  21624. * @description 复制当前 bounds 对象。
  21625. * @example
  21626. * var bounds1 = new Bounds(-180,-90,180,90);
  21627. * var bounds2 = bounds1.clone();
  21628. * @returns {Bounds} 克隆后的 bounds。
  21629. */
  21630. clone() {
  21631. return new Bounds(this.left, this.bottom,
  21632. this.right, this.top);
  21633. }
  21634. /**
  21635. * @function Bounds.prototype.equals
  21636. * @description 判断两个 bounds 对象是否相等。
  21637. * @example
  21638. * var bounds1 = new Bounds(-180,-90,180,90);
  21639. * var bounds2 = new Bounds(-180,-90,180,90);
  21640. * var isEquals = bounds1.equals(bounds2);
  21641. * @param {Bounds} bounds - 需要进行计较的 bounds。
  21642. * @returns {boolean} 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。
  21643. */
  21644. equals(bounds) {
  21645. var equals = false;
  21646. if (bounds != null) {
  21647. equals = ((this.left === bounds.left) &&
  21648. (this.right === bounds.right) &&
  21649. (this.top === bounds.top) &&
  21650. (this.bottom === bounds.bottom));
  21651. }
  21652. return equals;
  21653. }
  21654. /**
  21655. * @function Bounds.prototype.toString
  21656. * @description 返回此对象的字符串形式。
  21657. * @example
  21658. * var bounds = new Bounds(-180,-90,180,90);
  21659. * var str = bounds.toString();
  21660. * @returns {string} 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。
  21661. */
  21662. toString() {
  21663. return [this.left, this.bottom, this.right, this.top].join(",");
  21664. }
  21665. /**
  21666. * @function Bounds.prototype.toArray
  21667. * @description 边界对象的数组表示形式。
  21668. * @example
  21669. * var bounds = new Bounds(-180,-90,100,80);
  21670. * //array1 = [-180,-90,100,80];
  21671. * var array1 = bounds.toArray();
  21672. * //array1 = [-90,-180,80,100];
  21673. * var array2 = bounds.toArray(true);
  21674. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  21675. * 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  21676. * @returns {Array.<number>} left, bottom, right, top 数组。
  21677. */
  21678. toArray(reverseAxisOrder) {
  21679. if (reverseAxisOrder === true) {
  21680. return [this.bottom, this.left, this.top, this.right];
  21681. } else {
  21682. return [this.left, this.bottom, this.right, this.top];
  21683. }
  21684. }
  21685. /**
  21686. * @function Bounds.prototype.toBBOX
  21687. * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。
  21688. * @example
  21689. * var bounds = new Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555);
  21690. * //str1 = "-1.123457,-1.765432,1.444444,1.555556";
  21691. * var str1 = bounds.toBBOX();
  21692. * //str2 = "-1.1,-1.8,1.4,1.6";
  21693. * var str2 = bounds.toBBOX(1);
  21694. * //str2 = "-1.8,-1.1,1.6,1.4";
  21695. * var str2 = bounds.toBBOX(1,true);
  21696. * @param {number} [decimal=6] - 边界方位坐标的有效数字个数。
  21697. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。
  21698. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  21699. * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"。
  21700. */
  21701. toBBOX(decimal, reverseAxisOrder) {
  21702. if (decimal == null) {
  21703. decimal = 6;
  21704. }
  21705. var mult = Math.pow(10, decimal);
  21706. var xmin = Math.round(this.left * mult) / mult;
  21707. var ymin = Math.round(this.bottom * mult) / mult;
  21708. var xmax = Math.round(this.right * mult) / mult;
  21709. var ymax = Math.round(this.top * mult) / mult;
  21710. if (reverseAxisOrder === true) {
  21711. return ymin + "," + xmin + "," + ymax + "," + xmax;
  21712. } else {
  21713. return xmin + "," + ymin + "," + xmax + "," + ymax;
  21714. }
  21715. }
  21716. ///**
  21717. // * @function Bounds.prototype.toGeometry
  21718. // * @description 基于当前边界范围创建一个新的多边形对象。
  21719. // * @example
  21720. // * var bounds = new Bounds(-180,-90,100,80);
  21721. // * // Polygon对象
  21722. // * var geo = bounds.toGeometry();
  21723. // * @returns {GeometryPolygon} 基于当前 bounds 坐标创建的新的多边形。
  21724. // */
  21725. // toGeometry() {
  21726. // return new Polygon([
  21727. // new LinearRing([
  21728. // new Point(this.left, this.bottom),
  21729. // new Point(this.right, this.bottom),
  21730. // new Point(this.right, this.top),
  21731. // new Point(this.left, this.top)
  21732. // ])
  21733. // ]);
  21734. // }
  21735. /**
  21736. * @function Bounds.prototype.getWidth
  21737. * @description 获取 bounds 的宽度。
  21738. * @example
  21739. * var bounds = new Bounds(-180,-90,100,80);
  21740. * //width = 280;
  21741. * var width = bounds.getWidth();
  21742. * @returns {number} 获取当前 bounds 的宽度(right 减去 left)。
  21743. */
  21744. getWidth() {
  21745. return (this.right - this.left);
  21746. }
  21747. /**
  21748. * @function Bounds.prototype.getHeight
  21749. * @description 获取 bounds 的高度。
  21750. * @example
  21751. * var bounds = new Bounds(-180,-90,100,80);
  21752. * //height = 170;
  21753. * var height = bounds.getHeight();
  21754. * @returns {number} 边界高度(top 减去 bottom)。
  21755. */
  21756. getHeight() {
  21757. return (this.top - this.bottom);
  21758. }
  21759. /**
  21760. * @function Bounds.prototype.getSize
  21761. * @description 获取边框大小。
  21762. * @example
  21763. * var bounds = new Bounds(-180,-90,100,80);
  21764. * var size = bounds.getSize();
  21765. * @returns {Size} 边框大小。
  21766. */
  21767. getSize() {
  21768. return new Size(this.getWidth(), this.getHeight());
  21769. }
  21770. /**
  21771. * @function Bounds.prototype.getCenterPixel
  21772. * @description 获取像素格式的范围中心点。
  21773. * @example
  21774. * var bounds = new Bounds(-180,-90,100,80);
  21775. * var pixel = bounds.getCenterPixel();
  21776. * @returns {Pixel} 像素格式的当前范围的中心点。
  21777. */
  21778. getCenterPixel() {
  21779. return new Pixel((this.left + this.right) / 2,
  21780. (this.bottom + this.top) / 2);
  21781. }
  21782. /**
  21783. * @function Bounds.prototype.getCenterLonLat
  21784. * @description 获取地理格式的范围中心点。
  21785. * @example
  21786. * var bounds = new Bounds(-180,-90,100,80);
  21787. * var lonlat = bounds.getCenterLonLat();
  21788. * @returns {LonLat} 当前地理范围的中心点。
  21789. */
  21790. getCenterLonLat() {
  21791. if (!this.centerLonLat) {
  21792. this.centerLonLat = new LonLat(
  21793. (this.left + this.right) / 2, (this.bottom + this.top) / 2
  21794. );
  21795. }
  21796. return this.centerLonLat;
  21797. }
  21798. /**
  21799. * @function Bounds.prototype.scale
  21800. * @description 按照比例扩大/缩小出一个新的 bounds。
  21801. * @example
  21802. * var bounds = new Bounds(-50,-50,40,40);
  21803. * var bounds2 = bounds.scale(2);
  21804. * @param {number} [ratio=1] - 需要扩大的比例。
  21805. * @param {(Pixel|LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。
  21806. * @returns {Bounds} 通过 ratio、origin 计算得到的新的边界范围。
  21807. */
  21808. scale(ratio, origin) {
  21809. ratio = ratio ? ratio : 1;
  21810. if (origin == null) {
  21811. origin = this.getCenterLonLat();
  21812. }
  21813. var origx, origy;
  21814. // get origin coordinates
  21815. if (origin.CLASS_NAME === "SuperMap.LonLat") {
  21816. origx = origin.lon;
  21817. origy = origin.lat;
  21818. } else {
  21819. origx = origin.x;
  21820. origy = origin.y;
  21821. }
  21822. var left = (this.left - origx) * ratio + origx;
  21823. var bottom = (this.bottom - origy) * ratio + origy;
  21824. var right = (this.right - origx) * ratio + origx;
  21825. var top = (this.top - origy) * ratio + origy;
  21826. return new Bounds(left, bottom, right, top);
  21827. }
  21828. /**
  21829. * @function Bounds.prototype.add
  21830. * @description 在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。
  21831. * @example
  21832. * var bounds1 = new Bounds(-50,-50,40,40);
  21833. * //bounds2 是新的 bounds
  21834. * var bounds2 = bounds.add(20,10);
  21835. * @param {number} x - 坐标点的 x 坐标。
  21836. * @param {number} y - 坐标点的 y 坐标。
  21837. * @returns {Bounds} 新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。
  21838. */
  21839. add(x, y) {
  21840. if ((x == null) || (y == null)) {
  21841. throw new TypeError('Bounds.add cannot receive null values');
  21842. }
  21843. return new Bounds(this.left + x, this.bottom + y,
  21844. this.right + x, this.top + y);
  21845. }
  21846. /**
  21847. * @function Bounds.prototype.extend
  21848. * @description 在当前 bounds 上扩展 bounds,支持 point,lonlat 和 bounds。扩展后的 bounds 的范围是两者的结合。
  21849. * @example
  21850. * var bounds1 = new Bounds(-50,-50,40,40);
  21851. * //bounds 改变
  21852. * bounds.extend(new LonLat(50,60));
  21853. * @param {GeometryPoint|LonLat|Bounds} object - 可以是 point、lonlat 和 bounds。
  21854. */
  21855. extend(object) {
  21856. var bounds = null;
  21857. if (object) {
  21858. // clear cached center location
  21859. switch (object.CLASS_NAME) {
  21860. case "SuperMap.LonLat":
  21861. bounds = new Bounds(object.lon, object.lat,
  21862. object.lon, object.lat);
  21863. break;
  21864. case "SuperMap.Geometry.Point":
  21865. bounds = new Bounds(object.x, object.y,
  21866. object.x, object.y);
  21867. break;
  21868. case "SuperMap.Bounds":
  21869. bounds = object;
  21870. break;
  21871. }
  21872. if (bounds) {
  21873. this.centerLonLat = null;
  21874. if ((this.left == null) || (bounds.left < this.left)) {
  21875. this.left = bounds.left;
  21876. }
  21877. if ((this.bottom == null) || (bounds.bottom < this.bottom)) {
  21878. this.bottom = bounds.bottom;
  21879. }
  21880. if ((this.right == null) || (bounds.right > this.right)) {
  21881. this.right = bounds.right;
  21882. }
  21883. if ((this.top == null) || (bounds.top > this.top)) {
  21884. this.top = bounds.top;
  21885. }
  21886. }
  21887. }
  21888. }
  21889. /**
  21890. * @function Bounds.prototype.containsLonLat
  21891. * @description 判断传入的坐标是否在范围内。
  21892. * @example
  21893. * var bounds1 = new Bounds(-50,-50,40,40);
  21894. * //isContains1 = true
  21895. * //这里的第二个参数可以直接为 boolean 类型,也就是inclusive
  21896. * var isContains1 = bounds.containsLonLat(new LonLat(40,40),true);
  21897. *
  21898. * //(40,40)在范围内,同样(40+360,40)也在范围内
  21899. * var bounds2 = new Bounds(-50,-50,40,40);
  21900. * //isContains2 = true;
  21901. * var isContains2 = bounds2.containsLonLat(
  21902. * new LonLat(400,40),
  21903. * {
  21904. * inclusive:true,
  21905. * //全球的范围
  21906. * worldBounds: new Bounds(-180,-90,180,90)
  21907. * }
  21908. * );
  21909. * @param {(LonLat|Object)} ll - <LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。
  21910. * @param {Object} options - 可选参数。
  21911. * @param {boolean} [options.inclusive=true] - 是否包含边界。
  21912. * @param {Bounds} [options.worldBounds] - 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds),
  21913. * 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。
  21914. * @returns {boolean} 传入坐标是否包含在范围内。
  21915. */
  21916. containsLonLat(ll, options) {
  21917. if (typeof options === "boolean") {
  21918. options = {inclusive: options};
  21919. }
  21920. options = options || {};
  21921. var contains = this.contains(ll.lon, ll.lat, options.inclusive),
  21922. worldBounds = options.worldBounds;
  21923. //日界线以外的也有可能算包含,
  21924. if (worldBounds && !contains) {
  21925. var worldWidth = worldBounds.getWidth();
  21926. var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
  21927. //这一步很关键
  21928. var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
  21929. contains = this.containsLonLat({
  21930. lon: ll.lon - worldsAway * worldWidth,
  21931. lat: ll.lat
  21932. }, {inclusive: options.inclusive});
  21933. }
  21934. return contains;
  21935. }
  21936. /**
  21937. * @function Bounds.prototype.containsPixel
  21938. * @description 判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。
  21939. * @example
  21940. * var bounds = new Bounds(-50,-50,40,40);
  21941. * //isContains = true
  21942. * var isContains = bounds.containsPixel(new Pixel(40,40),true);
  21943. * @param {Pixel} px - 提供的像素参数。
  21944. * @param {boolean} [inclusive=true] - 是否包含边界。
  21945. * @returns {boolean} 传入的 pixel 在当前边界范围之内。
  21946. */
  21947. containsPixel(px, inclusive) {
  21948. return this.contains(px.x, px.y, inclusive);
  21949. }
  21950. /**
  21951. * @function Bounds.prototype.contains
  21952. * @description 判断传入的 x,y 坐标值是否在范围内。
  21953. * @example
  21954. * var bounds = new Bounds(-50,-50,40,40);
  21955. * //isContains = true
  21956. * var isContains = bounds.contains(40,40,true);
  21957. * @param {number} x - x 坐标值。
  21958. * @param {number} y - y 坐标值。
  21959. * @param {boolean} [inclusive=true] - 是否包含边界。
  21960. * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
  21961. */
  21962. contains(x, y, inclusive) {
  21963. //set default
  21964. if (inclusive == null) {
  21965. inclusive = true;
  21966. }
  21967. if (x == null || y == null) {
  21968. return false;
  21969. }
  21970. //x = Util.toFloat(x);
  21971. //y = Util.toFloat(y);
  21972. var contains = false;
  21973. if (inclusive) {
  21974. contains = ((x >= this.left) && (x <= this.right) &&
  21975. (y >= this.bottom) && (y <= this.top));
  21976. } else {
  21977. contains = ((x > this.left) && (x < this.right) &&
  21978. (y > this.bottom) && (y < this.top));
  21979. }
  21980. return contains;
  21981. }
  21982. /**
  21983. * @function Bounds.prototype.intersectsBounds
  21984. * @description 判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意边缘相交或者一个边界包含了另外一个就认为这两个边界相交。
  21985. * @example
  21986. * var bounds = new Bounds(-180,-90,100,80);
  21987. * var isIntersects = bounds.intersectsBounds(
  21988. * new Bounds(-170,-90,120,80)
  21989. * );
  21990. * @param {Bounds} bounds - 目标边界。
  21991. * @param {Object} options - 参数。
  21992. * @param {boolean} [options.inclusive=true] - 边缘重合也看成相交。如果是false,两个边界范围没有重叠部分仅仅是在边缘相接(重合),这种情况被认为没有相交。
  21993. * @param {Bounds} [options.worldBounds] - 提供了 worldBounds 参数,如果他们相交时是在全球范围内,两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。
  21994. * @returns {boolean} 传入的 bounds 对象与当前 bounds 相交。
  21995. */
  21996. intersectsBounds(bounds, options) {
  21997. if (typeof options === "boolean") {
  21998. options = {inclusive: options};
  21999. }
  22000. options = options || {};
  22001. if (options.worldBounds) {
  22002. var self = this.wrapDateLine(options.worldBounds);
  22003. bounds = bounds.wrapDateLine(options.worldBounds);
  22004. } else {
  22005. self = this;
  22006. }
  22007. if (options.inclusive == null) {
  22008. options.inclusive = true;
  22009. }
  22010. var intersects = false;
  22011. var mightTouch = (
  22012. self.left === bounds.right ||
  22013. self.right === bounds.left ||
  22014. self.top === bounds.bottom ||
  22015. self.bottom === bounds.top
  22016. );
  22017. // if the two bounds only touch at an edge, and inclusive is false,
  22018. // then the bounds don't *really* intersect.
  22019. if (options.inclusive || !mightTouch) {
  22020. // otherwise, if one of the boundaries even partially contains another,
  22021. // inclusive of the edges, then they do intersect.
  22022. var inBottom = (
  22023. ((bounds.bottom >= self.bottom) && (bounds.bottom <= self.top)) ||
  22024. ((self.bottom >= bounds.bottom) && (self.bottom <= bounds.top))
  22025. );
  22026. var inTop = (
  22027. ((bounds.top >= self.bottom) && (bounds.top <= self.top)) ||
  22028. ((self.top > bounds.bottom) && (self.top < bounds.top))
  22029. );
  22030. var inLeft = (
  22031. ((bounds.left >= self.left) && (bounds.left <= self.right)) ||
  22032. ((self.left >= bounds.left) && (self.left <= bounds.right))
  22033. );
  22034. var inRight = (
  22035. ((bounds.right >= self.left) && (bounds.right <= self.right)) ||
  22036. ((self.right >= bounds.left) && (self.right <= bounds.right))
  22037. );
  22038. intersects = ((inBottom || inTop) && (inLeft || inRight));
  22039. }
  22040. // document me
  22041. if (options.worldBounds && !intersects) {
  22042. var world = options.worldBounds;
  22043. var width = world.getWidth();
  22044. var selfCrosses = !world.containsBounds(self);
  22045. var boundsCrosses = !world.containsBounds(bounds);
  22046. if (selfCrosses && !boundsCrosses) {
  22047. bounds = bounds.add(-width, 0);
  22048. intersects = self.intersectsBounds(bounds, {inclusive: options.inclusive});
  22049. } else if (boundsCrosses && !selfCrosses) {
  22050. self = self.add(-width, 0);
  22051. intersects = bounds.intersectsBounds(self, {inclusive: options.inclusive});
  22052. }
  22053. }
  22054. return intersects;
  22055. }
  22056. /**
  22057. * @function Bounds.prototype.containsBounds
  22058. * @description 判断目标边界是否被当前边界包含在内。
  22059. * @example
  22060. * var bounds = new Bounds(-180,-90,100,80);
  22061. * var isContains = bounds.containsBounds(
  22062. * new Bounds(-170,-90,100,80),true,true
  22063. * );
  22064. * @param {Bounds} bounds - 目标边界。
  22065. * @param {boolean} [partial=false] - 目标边界的任意部分都包含在当前边界中则被认为是包含关系。
  22066. * 如果设为 false,整个目标边界全部被包含在当前边界范围内。
  22067. * @param {boolean} [inclusive=true] - 边缘共享是否被视为包含。
  22068. * @returns {boolean} 传入的边界是否被当前边界包含。
  22069. */
  22070. containsBounds(bounds, partial, inclusive) {
  22071. if (partial == null) {
  22072. partial = false;
  22073. }
  22074. if (inclusive == null) {
  22075. inclusive = true;
  22076. }
  22077. var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);
  22078. var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
  22079. var topLeft = this.contains(bounds.left, bounds.top, inclusive);
  22080. var topRight = this.contains(bounds.right, bounds.top, inclusive);
  22081. return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
  22082. : (bottomLeft && bottomRight && topLeft && topRight);
  22083. }
  22084. /**
  22085. * @function Bounds.prototype.determineQuadrant
  22086. * @description 判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。
  22087. * @example
  22088. * var bounds = new Bounds(-180,-90,100,80);
  22089. * //str = "tr";
  22090. * var str = bounds.determineQuadrant(
  22091. * new LonLat(20,20)
  22092. * );
  22093. * @param {LonLat} lonlat - 传入的坐标对象。
  22094. * @returns {string} 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。
  22095. */
  22096. determineQuadrant(lonlat) {
  22097. var quadrant = "";
  22098. var center = this.getCenterLonLat();
  22099. quadrant += (lonlat.lat < center.lat) ? "b" : "t";
  22100. quadrant += (lonlat.lon < center.lon) ? "l" : "r";
  22101. return quadrant;
  22102. }
  22103. /**
  22104. * @function Bounds.prototype.wrapDateLine
  22105. * @description 将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。
  22106. * @example
  22107. * var bounds = new Bounds(380,-40,400,-20);
  22108. * var maxExtent = new Bounds(-180,-90,100,80);
  22109. * //新的bounds
  22110. * var newBounds = bounds.wrapDateLine(maxExtent);
  22111. * @param {Bounds} maxExtent - 最大的边界范围(一般是全球范围)。
  22112. * @param {Object} options - 可选选项参数。
  22113. * @param {number} [options.leftTolerance=0] - left 允许的误差。
  22114. * @param {number} [options.rightTolerance=0] - right 允许的误差。
  22115. * @returns {Bounds} 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界,
  22116. * 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动,
  22117. * 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。
  22118. */
  22119. wrapDateLine(maxExtent, options) {
  22120. options = options || {};
  22121. var leftTolerance = options.leftTolerance || 0;
  22122. var rightTolerance = options.rightTolerance || 0;
  22123. var newBounds = this.clone();
  22124. if (maxExtent) {
  22125. var width = maxExtent.getWidth();
  22126. //如果 newBounds 在 maxExtent 的左边,那么一直向右移动,直到相交或者包含为止,每次移动width
  22127. //shift right?
  22128. while (newBounds.left < maxExtent.left &&
  22129. newBounds.right - rightTolerance <= maxExtent.left) {
  22130. newBounds = newBounds.add(width, 0);
  22131. }
  22132. //如果 newBounds 在 maxExtent 的右边,那么一直向左移动,直到相交或者包含为止,每次移动width
  22133. //shift left?
  22134. while (newBounds.left + leftTolerance >= maxExtent.right &&
  22135. newBounds.right > maxExtent.right) {
  22136. newBounds = newBounds.add(-width, 0);
  22137. }
  22138. //如果和右边相交,左边又在内部,那么再次向左边移动一次
  22139. // crosses right only? force left
  22140. var newLeft = newBounds.left + leftTolerance;
  22141. if (newLeft < maxExtent.right && newLeft > maxExtent.left &&
  22142. newBounds.right - rightTolerance > maxExtent.right) {
  22143. newBounds = newBounds.add(-width, 0);
  22144. }
  22145. }
  22146. return newBounds;
  22147. }
  22148. /**
  22149. * @function Bounds.prototype.toServerJSONObject
  22150. * @description 转换成对应的 JSON 格式对象。
  22151. * @example
  22152. * var bounds = new Bounds(-180,-90,100,80);
  22153. * var obj = bounds.toServerJSONObject();
  22154. * @returns {Object} JSON 格式的 Object 对象。
  22155. */
  22156. toServerJSONObject() {
  22157. var jsonObject = {
  22158. rightTop: {x: this.right, y: this.top},
  22159. leftBottom: {x: this.left, y: this.bottom},
  22160. left: this.left,
  22161. right: this.right,
  22162. top: this.top,
  22163. bottom: this.bottom
  22164. }
  22165. return jsonObject;
  22166. }
  22167. /**
  22168. *
  22169. * @function Bounds.prototype.destroy
  22170. * @description 销毁此对象。
  22171. * 销毁后此对象的所有属性为 null,而不是初始值。
  22172. * @example
  22173. * var bounds = new Bounds(-180,-90,100,80);
  22174. * bounds.destroy();
  22175. */
  22176. destroy() {
  22177. this.left = null;
  22178. this.right = null;
  22179. this.top = null;
  22180. this.bottom = null;
  22181. this.centerLonLat = null;
  22182. }
  22183. /**
  22184. * @function Bounds.fromString
  22185. * @description 通过字符串参数创建新的 bounds 的构造函数。
  22186. * @example
  22187. * var bounds = Bounds.fromString("-180,-90,100,80");
  22188. * @param {string} str - 边界字符串,用逗号隔开(e.g. <i>"5,42,10,45"</i>)。
  22189. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  22190. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  22191. * @returns {Bounds} 给定的字符串创建的新的边界对象。
  22192. */
  22193. static fromString(str, reverseAxisOrder) {
  22194. var bounds = str.split(",");
  22195. return Bounds.fromArray(bounds, reverseAxisOrder);
  22196. }
  22197. /**
  22198. * @function Bounds.fromArray
  22199. * @description 通过边界框数组创建 Bounds。
  22200. * @example
  22201. * var bounds = Bounds.fromArray([-180,-90,100,80]);
  22202. * @param {Array.<number>} bbox - 边界值数组。(e.g. <i>[5,42,10,45]</i>)。
  22203. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  22204. * @returns {Bounds} 根据传入的数组创建的新的边界对象。
  22205. */
  22206. static fromArray(bbox, reverseAxisOrder) {
  22207. return reverseAxisOrder === true ?
  22208. new Bounds(bbox[1], bbox[0], bbox[3], bbox[2]) :
  22209. new Bounds(bbox[0], bbox[1], bbox[2], bbox[3]);
  22210. }
  22211. /**
  22212. * @function Bounds.fromSize
  22213. * @description 通过传入的边界大小来创建新的边界。
  22214. * @example
  22215. * var bounds = Bounds.fromSize(new Size(20,10));
  22216. * @param {Size} size - 边界大小。
  22217. * @returns {Bounds} 根据传入的边界大小的创建新的边界。
  22218. */
  22219. static fromSize(size) {
  22220. return new Bounds(0,
  22221. size.h,
  22222. size.w,
  22223. 0);
  22224. }
  22225. /**
  22226. * @function Bounds.oppositeQuadrant
  22227. * @description 反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。
  22228. * @param {string} quadrant - 代表象限的字符串,如:"tl"。
  22229. * @returns {string} 反转后的象限。
  22230. */
  22231. static oppositeQuadrant(quadrant) {
  22232. var opp = "";
  22233. opp += (quadrant.charAt(0) === 't') ? 'b' : 't';
  22234. opp += (quadrant.charAt(1) === 'l') ? 'r' : 'l';
  22235. return opp;
  22236. }
  22237. }
  22238. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Collection.js
  22239. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22240. * This program are made available under the terms of the Apache License, Version 2.0
  22241. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22242. /**
  22243. * @class GeometryCollection
  22244. * @aliasclass Geometry.Collection
  22245. * @deprecatedclass SuperMap.Geometry.Collection
  22246. * @classdesc 几何对象集合类,存储在本地的 components 属性中(可作为参数传递给构造函数)。<br>
  22247. * 随着新的几何图形添加到集合中,将不能被克隆,当移动几何图形时,需要指定参照物。<br>
  22248. * getArea 和 getLength 函数只能通过遍历存储几何对象的 components 数组,总计所有几何图形的面积和长度。
  22249. * @category BaseTypes Geometry
  22250. * @extends {Geometry}
  22251. * @param {Array.<Geometry>} components - 几何对象数组。
  22252. * @example
  22253. * var point1 = new GeometryPoint(10,20);
  22254. * var point2 = new GeometryPoint(30,40);
  22255. * var col = new GeometryCollection([point1,point2]);
  22256. * @usage
  22257. */
  22258. class Collection extends Geometry_Geometry {
  22259. constructor(components) {
  22260. super();
  22261. /**
  22262. * @description 存储几何对象的数组。
  22263. * @member {Array.<Geometry>} GeometryCollection.prototype.components
  22264. */
  22265. this.components = [];
  22266. /**
  22267. * @member {Array.<string>} GeometryCollection.prototype.componentTypes
  22268. * @description components 存储的几何对象所支持的几何类型数组,为空表示类型不受限制。
  22269. */
  22270. this.componentTypes = null;
  22271. if (components != null) {
  22272. this.addComponents(components);
  22273. }
  22274. this.CLASS_NAME = "SuperMap.Geometry.Collection";
  22275. this.geometryType = "Collection";
  22276. }
  22277. /**
  22278. * @function GeometryCollection.prototype.destroy
  22279. * @description 销毁几何图形。
  22280. */
  22281. destroy() {
  22282. this.components.length = 0;
  22283. this.components = null;
  22284. super.destroy();
  22285. }
  22286. /**
  22287. * @function GeometryCollection.prototype.clone
  22288. * @description 克隆当前几何对象。
  22289. * @returns {GeometryCollection} 克隆的几何对象集合。
  22290. */
  22291. clone() {
  22292. var geometry = new Collection();
  22293. for (var i = 0, len = this.components.length; i < len; i++) {
  22294. geometry.addComponent(this.components[i].clone());
  22295. }
  22296. // catch any randomly tagged-on properties
  22297. Util_Util.applyDefaults(geometry, this);
  22298. return geometry;
  22299. }
  22300. /**
  22301. * @function GeometryCollection.prototype.getComponentsString
  22302. * @description 获取 components 字符串。
  22303. * @returns {string} components 字符串。
  22304. */
  22305. getComponentsString() {
  22306. var strings = [];
  22307. for (var i = 0, len = this.components.length; i < len; i++) {
  22308. strings.push(this.components[i].toShortString());
  22309. }
  22310. return strings.join(",");
  22311. }
  22312. /**
  22313. * @function GeometryCollection.prototype.calculateBounds
  22314. * @description 通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
  22315. */
  22316. calculateBounds() {
  22317. this.bounds = null;
  22318. var bounds = new Bounds();
  22319. var components = this.components;
  22320. if (components) {
  22321. for (var i = 0, len = components.length; i < len; i++) {
  22322. bounds.extend(components[i].getBounds());
  22323. }
  22324. }
  22325. // to preserve old behavior, we only set bounds if non-null
  22326. // in the future, we could add bounds.isEmpty()
  22327. if (bounds.left != null && bounds.bottom != null &&
  22328. bounds.right != null && bounds.top != null) {
  22329. this.setBounds(bounds);
  22330. }
  22331. }
  22332. /**
  22333. * @function GeometryCollection.prototype.addComponents
  22334. * @description 给几何图形对象添加元素。
  22335. * @param {Array.<Geometry>} components - 几何对象组件。
  22336. * @example
  22337. * var geometryCollection = new GeometryCollection();
  22338. * geometryCollection.addComponents(new SuerpMap.Geometry.Point(10,10));
  22339. */
  22340. addComponents(components) {
  22341. if (!(Util_Util.isArray(components))) {
  22342. components = [components];
  22343. }
  22344. for (var i = 0, len = components.length; i < len; i++) {
  22345. this.addComponent(components[i]);
  22346. }
  22347. }
  22348. /**
  22349. * @function GeometryCollection.prototype.addComponent
  22350. * @description 添加几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
  22351. * @param {Geometry} component - 待添加的几何对象。
  22352. * @param {number} [index] - 几何对象插入的位置。
  22353. * @returns {boolean} 是否添加成功。
  22354. */
  22355. addComponent(component, index) {
  22356. var added = false;
  22357. if (component) {
  22358. if (this.componentTypes == null ||
  22359. (Util_Util.indexOf(this.componentTypes,
  22360. component.CLASS_NAME) > -1)) {
  22361. if (index != null && (index < this.components.length)) {
  22362. var components1 = this.components.slice(0, index);
  22363. var components2 = this.components.slice(index,
  22364. this.components.length);
  22365. components1.push(component);
  22366. this.components = components1.concat(components2);
  22367. } else {
  22368. this.components.push(component);
  22369. }
  22370. component.parent = this;
  22371. this.clearBounds();
  22372. added = true;
  22373. }
  22374. }
  22375. return added;
  22376. }
  22377. /**
  22378. * @function GeometryCollection.prototype.removeComponents
  22379. * @description 清除几何对象。
  22380. * @param {Array.<Geometry>} components - 需要清除的几何对象。
  22381. * @returns {boolean} 元素是否被删除。
  22382. */
  22383. removeComponents(components) {
  22384. var removed = false;
  22385. if (!(Util_Util.isArray(components))) {
  22386. components = [components];
  22387. }
  22388. for (var i = components.length - 1; i >= 0; --i) {
  22389. removed = this.removeComponent(components[i]) || removed;
  22390. }
  22391. return removed;
  22392. }
  22393. /**
  22394. * @function GeometryCollection.prototype.removeComponent
  22395. * @description 从集合中移除几何对象。
  22396. * @param {Geometry} component - 要移除的几何对象。
  22397. * @returns {boolean} 几何对象是否移除成功。
  22398. */
  22399. removeComponent(component) {
  22400. Util_Util.removeItem(this.components, component);
  22401. // clearBounds() so that it gets recalculated on the next call
  22402. // to this.getBounds();
  22403. this.clearBounds();
  22404. return true;
  22405. }
  22406. /**
  22407. * @function GeometryCollection.prototype.getArea
  22408. * @description 计算几何对象的面积。注意,这个方法在 {@link GeometryPolygon} 类中需要重写。
  22409. * @returns {number} 几何图形的面积,是几何对象中所有组成部分的面积之和。
  22410. */
  22411. getArea() {
  22412. var area = 0.0;
  22413. for (var i = 0, len = this.components.length; i < len; i++) {
  22414. area += this.components[i].getArea();
  22415. }
  22416. return area;
  22417. }
  22418. /**
  22419. * @function GeometryCollection.prototype.equals
  22420. * @description 判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
  22421. * @param {Geometry} geometry - 需要判断的几何图形。
  22422. * @returns {boolean} 输入的几何图形与当前几何图形是否相等。
  22423. */
  22424. equals(geometry) {
  22425. var equivalent = true;
  22426. if (!geometry || !geometry.CLASS_NAME ||
  22427. (this.CLASS_NAME !== geometry.CLASS_NAME)) {
  22428. equivalent = false;
  22429. } else if (!(Util_Util.isArray(geometry.components)) ||
  22430. (geometry.components.length !== this.components.length)) {
  22431. equivalent = false;
  22432. } else {
  22433. for (var i = 0, len = this.components.length; i < len; ++i) {
  22434. if (!this.components[i].equals(geometry.components[i])) {
  22435. equivalent = false;
  22436. break;
  22437. }
  22438. }
  22439. }
  22440. return equivalent;
  22441. }
  22442. /**
  22443. * @function GeometryCollection.prototype.getVertices
  22444. * @description 返回几何对象的所有结点的列表。
  22445. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  22446. * @returns {Array} 几何对象的顶点列表。
  22447. */
  22448. getVertices(nodes) {
  22449. var vertices = [];
  22450. for (var i = 0, len = this.components.length; i < len; ++i) {
  22451. Array.prototype.push.apply(
  22452. vertices, this.components[i].getVertices(nodes)
  22453. );
  22454. }
  22455. return vertices;
  22456. }
  22457. }
  22458. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPoint.js
  22459. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22460. * This program are made available under the terms of the Apache License, Version 2.0
  22461. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22462. /**
  22463. * @class GeometryMultiPoint
  22464. * @aliasclass Geometry.MultiPoint
  22465. * @deprecatedclass SuperMap.Geometry.MultiPoint
  22466. * @classdesc 几何对象多点类。
  22467. * @category BaseTypes Geometry
  22468. * @extends GeometryCollection
  22469. * @param {Array.<GeometryPoint>} components - 点对象数组。
  22470. * @example
  22471. * var point1 = new GeometryPoint(5,6);
  22472. * var poine2 = new GeometryMultiPoint(7,8);
  22473. * var multiPoint = new MultiPoint([point1,point2]);
  22474. * @usage
  22475. */
  22476. class MultiPoint extends Collection {
  22477. constructor(components) {
  22478. super(components);
  22479. /**
  22480. * @member {Array.<string>} [GeometryMultiPoint.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  22481. * @description components 存储的几何对象所支持的几何类型数组。
  22482. * @readonly
  22483. */
  22484. this.componentTypes = ["SuperMap.Geometry.Point"];
  22485. this.CLASS_NAME = "SuperMap.Geometry.MultiPoint";
  22486. this.geometryType = "MultiPoint";
  22487. }
  22488. /**
  22489. * @function GeometryMultiPoint.prototype.addPoint
  22490. * @description 添加点,封装了 {@link GeometryCollection|GeometryCollection.addComponent} 方法。
  22491. * @param {GeometryPoint} point - 添加的点。
  22492. * @param {number} [index] - 下标。
  22493. */
  22494. addPoint(point, index) {
  22495. this.addComponent(point, index);
  22496. }
  22497. /**
  22498. * @function GeometryMultiPoint.prototype.removePoint
  22499. * @description 移除点,封装了 {@link GeometryCollection|GeometryCollection.removeComponent} 方法。
  22500. * @param {GeometryPoint} point - 移除的点对象。
  22501. */
  22502. removePoint(point) {
  22503. this.removeComponent(point);
  22504. }
  22505. }
  22506. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Curve.js
  22507. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22508. * This program are made available under the terms of the Apache License, Version 2.0
  22509. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22510. /**
  22511. * @class GeometryCurve
  22512. * @aliasclass Geometry.Curve
  22513. * @deprecatedclass SuperMap.Geometry.Curve
  22514. * @classdesc 几何对象曲线类。
  22515. * @category BaseTypes Geometry
  22516. * @extends GeometryMultiPoint
  22517. * @param {Array.<GeometryPoint>} components - 几何对象数组。
  22518. * @example
  22519. * var point1 = new GeometryPoint(10,20);
  22520. * var point2 = new GeometryPoint(30,40);
  22521. * var curve = new Curve([point1,point2]);
  22522. * @usage
  22523. */
  22524. class Curve extends MultiPoint {
  22525. constructor(components) {
  22526. super(components);
  22527. /**
  22528. * @member {Array.<string>} [GeometryCurve.prototype.componentTypes=["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]]
  22529. * @description components 存储的几何对象所支持的几何类型数组。
  22530. * @readonly
  22531. */
  22532. this.componentTypes = ["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"];
  22533. this.CLASS_NAME = "SuperMap.Geometry.Curve";
  22534. this.geometryType = "Curve";
  22535. }
  22536. }
  22537. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Point.js
  22538. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22539. * This program are made available under the terms of the Apache License, Version 2.0
  22540. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22541. /**
  22542. * @class GeometryPoint
  22543. * @aliasclass Geometry.Point
  22544. * @deprecatedclass SuperMap.Geometry.Point
  22545. * @classdesc 点几何对象类。
  22546. * @category BaseTypes Geometry
  22547. * @extends {Geometry}
  22548. * @param {number} x - x 坐标。
  22549. * @param {number} y - y 坐标。
  22550. * @param {string} [type = 'Point'] - 点的类型。
  22551. * @param {number} [tag] - 额外的属性,比如插值分析中的 Z 值。
  22552. * @example
  22553. * var point = new GeometryPoint(-111.04, 45.68);
  22554. * @usage
  22555. */
  22556. class Point extends Geometry_Geometry {
  22557. constructor(x, y, type, tag) {
  22558. super(x, y, type, tag);
  22559. /**
  22560. * @member {number} GeometryPoint.prototype.x
  22561. * @description 横坐标。
  22562. */
  22563. this.x = parseFloat(x);
  22564. /**
  22565. * @member {number} GeometryPoint.prototype.y
  22566. * @description 纵坐标。
  22567. */
  22568. this.y = parseFloat(y);
  22569. /**
  22570. * @member {string} GeometryPoint.prototype.tag
  22571. * @description 用来存储额外的属性,比如插值分析中的 Z 值。
  22572. */
  22573. this.tag = (tag || tag == 0) ? parseFloat(tag) : null;
  22574. /**
  22575. * @member {string} GeometryPoint.prototype.type
  22576. * @description 用来存储点的类型。
  22577. */
  22578. this.type = type || "Point";
  22579. this.CLASS_NAME = "SuperMap.Geometry.Point";
  22580. this.geometryType = "Point";
  22581. }
  22582. /**
  22583. * @function GeometryPoint.prototype.clone
  22584. * @description 克隆点对象。
  22585. * @returns {GeometryPoint} 克隆后的点对象。
  22586. */
  22587. clone(obj) {
  22588. if (obj == null) {
  22589. obj = new Point(this.x, this.y);
  22590. }
  22591. // catch any randomly tagged-on properties
  22592. Util_Util.applyDefaults(obj, this);
  22593. return obj;
  22594. }
  22595. /**
  22596. * @function GeometryPoint.prototype.calculateBounds
  22597. * @description 计算点对象的范围。
  22598. */
  22599. calculateBounds() {
  22600. this.bounds = new Bounds(this.x, this.y,
  22601. this.x, this.y);
  22602. }
  22603. /**
  22604. * @function GeometryPoint.prototype.equals
  22605. * @description 判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。
  22606. * @example
  22607. * var point= new GeometryPoint(0,0);
  22608. * var point1={x:0,y:0};
  22609. * var result= point.equals(point1);
  22610. * @param {GeometryPoint} geom - 需要判断的点对象。
  22611. * @returns {boolean} 两个点对象是否相等(true 为相等,false 为不等)。
  22612. */
  22613. equals(geom) {
  22614. var equals = false;
  22615. if (geom != null) {
  22616. equals = ((this.x === geom.x && this.y === geom.y) ||
  22617. (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
  22618. }
  22619. return equals;
  22620. }
  22621. /**
  22622. * @function GeometryPoint.prototype.move
  22623. * @description 沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。
  22624. * @param {number} x - x 轴正方向上的偏移量。
  22625. * @param {number} y - y 轴正方向上偏移量。
  22626. */
  22627. move(x, y) {
  22628. this.x = this.x + x;
  22629. this.y = this.y + y;
  22630. this.clearBounds();
  22631. }
  22632. /**
  22633. * @function GeometryPoint.prototype.toShortString
  22634. * @description 将 x/y 坐标转换成简单字符串。
  22635. * @returns {string} 字符串代表点对象。(ex. <i>"5, 42"</i>)
  22636. */
  22637. toShortString() {
  22638. return (this.x + ", " + this.y);
  22639. }
  22640. /**
  22641. * @function GeometryPoint.prototype.destroy
  22642. * @description 释放点对象的资源。
  22643. */
  22644. destroy() {
  22645. this.x = null;
  22646. this.y = null;
  22647. this.tag = null;
  22648. super.destroy();
  22649. }
  22650. /**
  22651. * @function GeometryPoint.prototype.getVertices
  22652. * @description 获取几何图形所有顶点的列表。
  22653. * @returns {Array} 几何图形的顶点列表。
  22654. */
  22655. getVertices() {
  22656. return [this];
  22657. }
  22658. }
  22659. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LineString.js
  22660. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22661. * This program are made available under the terms of the Apache License, Version 2.0
  22662. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22663. /**
  22664. * @class GeometryLineString
  22665. * @aliasclass Geometry.LineString
  22666. * @deprecatedclass SuperMap.Geometry.LineString
  22667. * @classdesc 几何对象线串类。
  22668. * @category BaseTypes Geometry
  22669. * @param {Array.<GeometryPoint>} points - 用来生成线串的点数组。
  22670. * @extends GeometryCurve
  22671. * @example
  22672. * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
  22673. * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
  22674. * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
  22675. * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
  22676. * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
  22677. * var roadLine = new GeometryLineString(points);
  22678. * @usage
  22679. */
  22680. class LineString extends Curve {
  22681. constructor(points) {
  22682. super(points);
  22683. this.CLASS_NAME = "SuperMap.Geometry.LineString";
  22684. this.geometryType = "LineString";
  22685. }
  22686. /**
  22687. * @function GeometryLineString.prototype.removeComponent
  22688. * @description 只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。
  22689. * @param {GeometryPoint} point - 将被删除的点。
  22690. * @returns {boolean} 删除的点。
  22691. */
  22692. removeComponent(point) { // eslint-disable-line no-unused-vars
  22693. var removed = this.components && (this.components.length > 2);
  22694. if (removed) {
  22695. super.removeComponent.apply(this, arguments);
  22696. }
  22697. return removed;
  22698. }
  22699. /**
  22700. * @function GeometryLineString.prototype.getSortedSegments
  22701. * @description 获取升序排列的点坐标对象数组。
  22702. * @returns {Array} 升序排列的点坐标对象数组。
  22703. */
  22704. getSortedSegments() {
  22705. var numSeg = this.components.length - 1;
  22706. var segments = new Array(numSeg), point1, point2;
  22707. for (var i = 0; i < numSeg; ++i) {
  22708. point1 = this.components[i];
  22709. point2 = this.components[i + 1];
  22710. if (point1.x < point2.x) {
  22711. segments[i] = {
  22712. x1: point1.x,
  22713. y1: point1.y,
  22714. x2: point2.x,
  22715. y2: point2.y
  22716. };
  22717. } else {
  22718. segments[i] = {
  22719. x1: point2.x,
  22720. y1: point2.y,
  22721. x2: point1.x,
  22722. y2: point1.y
  22723. };
  22724. }
  22725. }
  22726. // more efficient to define this somewhere static
  22727. function byX1(seg1, seg2) {
  22728. return seg1.x1 - seg2.x1;
  22729. }
  22730. return segments.sort(byX1);
  22731. }
  22732. /**
  22733. * @function GeometryLineString.prototype.getVertices
  22734. * @description 返回几何图形的所有顶点的列表。
  22735. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  22736. * @returns {Array} 几何图形的顶点列表。
  22737. */
  22738. getVertices(nodes) {
  22739. var vertices;
  22740. if (nodes === true) {
  22741. vertices = [
  22742. this.components[0],
  22743. this.components[this.components.length - 1]
  22744. ];
  22745. } else if (nodes === false) {
  22746. vertices = this.components.slice(1, this.components.length - 1);
  22747. } else {
  22748. vertices = this.components.slice();
  22749. }
  22750. return vertices;
  22751. }
  22752. /**
  22753. * @function GeometryLineString.calculateCircle
  22754. * @description 三点画圆弧。
  22755. * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
  22756. * @returns {Array.<GeometryPoint>} 计算出相应的圆弧控制点。
  22757. * @example
  22758. * var points = [];
  22759. * points.push(new GeometryPoint(-50,30));
  22760. * points.push(new GeometryPoint(-30,50));
  22761. * points.push(new GeometryPoint(2,60));
  22762. * var circle = GeometryLineString.calculateCircle(points);
  22763. */
  22764. static calculateCircle(points) {
  22765. if (points.length < 3) {
  22766. return points
  22767. }
  22768. var centerPoint = {},
  22769. p1 = points[0],
  22770. p2 = points[1],
  22771. p3 = points[2];
  22772. var R = 0,
  22773. dStep = 0,
  22774. direc = true,
  22775. dRotation = 0,
  22776. dRotationBegin = 0,
  22777. dRotationAngle = 0,
  22778. nSegmentCount = 72,
  22779. circlePoints = [];
  22780. var KTan13 = (p3.y - p1.y) / (p3.x - p1.x);
  22781. var B13 = p3.y - KTan13 * p3.x;
  22782. if ((((p3.x != p1.x) && (p3.y != p1.y)) && (p2.y == KTan13 * p2.x + B13)) ||
  22783. ((p3.x == p1.x) && (p2.x == p1.x)) || ((p3.y == p1.y) && (p2.y == p1.y)) ||
  22784. ((p3.x == p1.x) && (p3.y == p1.y)) || ((p3.x == p2.x) && (p3.y == p2.y)) || ((p1.x == p2.x) && (p1.y == p2.y))) {
  22785. circlePoints.push(p1);
  22786. circlePoints.push(p2);
  22787. circlePoints.push(p3);
  22788. } else {
  22789. var D = ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y)) * (2 * (p3.y - p1.y)) - ((p3.x * p3.x + p3.y * p3.y) -
  22790. (p1.x * p1.x + p1.y * p1.y)) * (2 * (p2.y - p1.y));
  22791. var E = (2 * (p2.x - p1.x)) * ((p3.x * p3.x + p3.y * p3.y) - (p1.x * p1.x + p1.y * p1.y)) -
  22792. (2 * (p3.x - p1.x)) * ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y));
  22793. var F = 4 * ((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
  22794. centerPoint.x = D / F;
  22795. centerPoint.y = E / F;
  22796. R = Math.sqrt((p1.x - centerPoint.x) * (p1.x - centerPoint.x) + (p1.y - centerPoint.y) * (p1.y - centerPoint.y));
  22797. var dis = (p1.x - p3.x) * (p1.x - p3.x) + (p1.y - p3.y) * (p1.y - p3.y);
  22798. var cons = (2 * R * R - dis) / (2 * R * R);
  22799. cons = cons >= 1 ? 1 : cons;
  22800. cons = cons <= -1 ? -1 : cons;
  22801. dRotationAngle = Math.acos(cons) * 180 / Math.PI;
  22802. if (p3.x == p1.x) {
  22803. dRotationAngle = ((centerPoint.x > p1.x && p2.x > p1.x) || (centerPoint.x < p1.x && p2.x < p1.x)) ? (360 - dRotationAngle) : dRotationAngle;
  22804. } else {
  22805. dRotationAngle = ((centerPoint.y > (KTan13 * centerPoint.x + B13) && p2.y > (KTan13 * p2.x + B13)) ||
  22806. (centerPoint.y < (KTan13 * centerPoint.x + B13) && p2.y < (KTan13 * p2.x + B13))) ? (360 - dRotationAngle) : dRotationAngle;
  22807. }
  22808. dStep = dRotationAngle / 72;
  22809. if (p3.y != p1.y) {
  22810. if (p3.x == p1.x) {
  22811. if (p3.y > p1.y) {
  22812. if (p2.x < p1.x) {
  22813. direc = false;
  22814. }
  22815. } else {
  22816. if (p2.x > p1.x) {
  22817. direc = false;
  22818. }
  22819. }
  22820. } else if (p3.x < p1.x) {
  22821. if (p2.y < KTan13 * p2.x + B13) {
  22822. direc = false;
  22823. }
  22824. } else {
  22825. if (p2.y > KTan13 * p2.x + B13) {
  22826. direc = false;
  22827. }
  22828. }
  22829. } else {
  22830. if (p3.x > p1.x) {
  22831. if (p2.y > p1.y) {
  22832. direc = false;
  22833. }
  22834. } else {
  22835. if (p2.y < p1.y) {
  22836. direc = false;
  22837. }
  22838. }
  22839. }
  22840. var K10 = (p1.y - centerPoint.y) / (p1.x - centerPoint.x);
  22841. var atan10 = K10 >= 0 ? Math.atan(K10) * 180 / Math.PI : Math.abs(Math.atan(K10) * 180 / Math.PI) + 90;
  22842. var CY = Math.abs(centerPoint.y);
  22843. if ((p1.y == CY) && (CY == p3.y)) {
  22844. if (p1.x < p3.x) {
  22845. atan10 = atan10 + 180;
  22846. }
  22847. }
  22848. var newPY = p1.y - centerPoint.y;
  22849. circlePoints.push(p1);
  22850. for (var i = 1; i < nSegmentCount; i++) {
  22851. dRotation = dStep * i;
  22852. dRotationBegin = atan10;
  22853. if (direc) {
  22854. if (newPY >= 0) {
  22855. if (K10 >= 0) {
  22856. dRotationBegin = dRotationBegin + dRotation;
  22857. } else {
  22858. dRotationBegin = (180 - (dRotationBegin - 90)) + dRotation;
  22859. }
  22860. } else {
  22861. if (K10 > 0) {
  22862. dRotationBegin = (dRotationBegin - 180) + dRotation;
  22863. } else {
  22864. dRotationBegin = (90 - dRotationBegin) + dRotation;
  22865. }
  22866. }
  22867. } else {
  22868. if (newPY >= 0) {
  22869. if (K10 >= 0) {
  22870. dRotationBegin = dRotationBegin - dRotation;
  22871. } else {
  22872. dRotationBegin = (180 - (dRotationBegin - 90)) - dRotation;
  22873. }
  22874. } else {
  22875. if (K10 >= 0) {
  22876. dRotationBegin = (dRotationBegin - 180) - dRotation;
  22877. } else {
  22878. dRotationBegin = (90 - dRotationBegin) - dRotation;
  22879. }
  22880. }
  22881. }
  22882. dRotationBegin = dRotationBegin * Math.PI / 180;
  22883. var x = centerPoint.x + R * Math.cos(dRotationBegin);
  22884. var y = centerPoint.y + R * Math.sin(dRotationBegin);
  22885. circlePoints.push(new Point(x, y));
  22886. }
  22887. circlePoints.push(p3);
  22888. }
  22889. return circlePoints;
  22890. }
  22891. /**
  22892. * @function GeometryLineString.createLineEPS
  22893. * @description 根据点的类型画出不同类型的曲线。
  22894. * 点的类型有三种:LTypeArc,LTypeCurve,NONE。
  22895. * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
  22896. * @returns {Array.<GeometryPoint>} 计算出相应的 lineEPS 控制点。
  22897. * @example
  22898. * var points = [];
  22899. * points.push(new GeometryPoint(-50,30));
  22900. * points.push(new GeometryPoint(-30,50,"LTypeArc"));
  22901. * points.push(new GeometryPoint(2,60));
  22902. * points.push(new GeometryPoint(8,20));
  22903. * var lineEPS = GeometryLineString.createLineEPS(points);
  22904. */
  22905. static createLineEPS(points) {
  22906. var list = [],
  22907. len = points.length;
  22908. if (len < 2) {
  22909. return points;
  22910. }
  22911. for (var i = 0; i < len;) {
  22912. var type = points[i].type;
  22913. if (type == 'LTypeArc') {
  22914. var listObj = LineString.createLineArc(list, i, len, points);
  22915. list = listObj[0];
  22916. i = listObj[1];
  22917. } else {
  22918. list.push(points[i]);
  22919. i++;
  22920. }
  22921. }
  22922. return list;
  22923. }
  22924. static createLineArc(list, i, len, points) {
  22925. if (i == 0) {
  22926. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  22927. Array.prototype.push.apply(list, bezierPtsObj[0]);
  22928. i = bezierPtsObj[1] + 1;
  22929. } else if (i == len - 1) {
  22930. var bezierP = [points[i - 1], points[i]],
  22931. bezierPts = LineString.calculateCircle(bezierP);
  22932. Array.prototype.push.apply(list, bezierPts);
  22933. i++;
  22934. } else {
  22935. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  22936. list.pop();
  22937. Array.prototype.push.apply(list, bezierPtsObj[0]);
  22938. i = bezierPtsObj[1] + 1;
  22939. }
  22940. return [list, i];
  22941. }
  22942. static addPointEPS(points, i, len, type) {
  22943. var bezierP = [], j = i + 1;
  22944. if (i == 0) {
  22945. Array.prototype.push.apply(bezierP, [points[i], points[i + 1]]);
  22946. } else if (i == len - 1) {
  22947. Array.prototype.push.apply(bezierP, [points[i - 1], points[i]]);
  22948. } else {
  22949. Array.prototype.push.apply(bezierP, [points[i - 1], points[i], points[i + 1]]);
  22950. }
  22951. var bezierPts;
  22952. if (type == 'LTypeCurve') {
  22953. bezierPts = LineString.calculatePointsFBZN(bezierP);
  22954. } else if (type == 'LTypeArc') {
  22955. bezierPts = LineString.calculateCircle(bezierP);
  22956. }
  22957. return [bezierPts, j];
  22958. }
  22959. }
  22960. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/GeoText.js
  22961. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22962. * This program are made available under the terms of the Apache License, Version 2.0
  22963. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22964. /**
  22965. * @class GeometryGeoText
  22966. * @aliasclass Geometry.GeoText
  22967. * @deprecatedclass SuperMap.Geometry.GeoText
  22968. * @classdesc 文本标签类。
  22969. * @category BaseTypes Geometry
  22970. * @extends {Geometry}
  22971. * @param {number} x - x 坐标。
  22972. * @param {number} y - y 坐标。
  22973. * @param {string} text - 标签中的文本内容。
  22974. * @usage
  22975. */
  22976. class GeoText extends Geometry_Geometry {
  22977. constructor(x, y, text) {
  22978. super(x, y, text);
  22979. /**
  22980. * @member {number} GeometryGeoText.prototype.x
  22981. * @description 横坐标。
  22982. */
  22983. this.x = parseFloat(x);
  22984. /**
  22985. * @member {number} GeometryGeoText.prototype.y
  22986. * @description 纵坐标。
  22987. */
  22988. this.y = parseFloat(y);
  22989. /**
  22990. * @member {string} GeometryGeoText.prototype.text
  22991. * @description 标签中的文本内容。
  22992. */
  22993. this.text = text.toString();
  22994. /**
  22995. * @member {Object} GeometryGeoText.prototype.bsInfo
  22996. * @description 标签范围的基础信息。
  22997. * @property {number} w - bounds 的宽度。
  22998. * @property {number} h - bounds 的高度。
  22999. */
  23000. this.bsInfo = {
  23001. "h": null,
  23002. "w": null
  23003. };
  23004. this.element = document.createElement('span');
  23005. this.CLASS_NAME = "SuperMap.Geometry.GeoText";
  23006. this.geometryType = "GeoText";
  23007. }
  23008. /**
  23009. * @function GeometryGeoText.prototype.destroy
  23010. * @description 销毁文本标签类。
  23011. */
  23012. destroy() {
  23013. super.destroy();
  23014. this.x = null;
  23015. this.y = null;
  23016. this.text = null;
  23017. }
  23018. /**
  23019. * @function GeometryGeoText.prototype.getCentroid
  23020. * @description 获取标签对象的质心。
  23021. * @returns {GeometryPoint} 标签对象的质心。
  23022. */
  23023. getCentroid() {
  23024. return new Point(this.x, this.y);
  23025. }
  23026. /**
  23027. * @function GeometryGeoText.prototype.clone
  23028. * @description 克隆标签对象。
  23029. * @returns {GeometryGeoText} 克隆后的标签对象。
  23030. */
  23031. clone(obj) {
  23032. if (obj == null) {
  23033. obj = new GeoText(this.x, this.y, this.text);
  23034. }
  23035. Util_Util.applyDefaults(obj, this);
  23036. return obj;
  23037. }
  23038. /**
  23039. * @function GeometryGeoText.prototype.calculateBounds
  23040. * @description 计算标签对象的范围。
  23041. */
  23042. calculateBounds() {
  23043. this.bounds = new Bounds(this.x, this.y,
  23044. this.x, this.y);
  23045. }
  23046. /**
  23047. * @function GeometryGeoText.prototype.getLabelPxBoundsByLabel
  23048. * @description 根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
  23049. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  23050. * @param {string} labelWidth - 标签的宽度,如:“90px”。
  23051. * @param {string} labelHeight - 标签的高度。
  23052. * @param {Object} style - 标签的 style。
  23053. * @returns {Bounds} 标签的像素范围。
  23054. */
  23055. getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style) {
  23056. var labelPxBounds, left, bottom, top, right;
  23057. var locationPx = Util_Util.cloneObject(locationPixel);
  23058. //计算文本行数
  23059. var theText = style.label || this.text;
  23060. var textRows = theText.split('\n');
  23061. var laberRows = textRows.length;
  23062. //处理文字对齐
  23063. labelWidth = parseFloat(labelWidth);
  23064. labelHeight = parseFloat(labelHeight);
  23065. if (laberRows > 1) {
  23066. labelHeight = parseFloat(labelHeight) * laberRows;
  23067. }
  23068. if (style.labelAlign && style.labelAlign !== "cm") {
  23069. switch (style.labelAlign) {
  23070. case "lt":
  23071. locationPx.x += labelWidth / 2;
  23072. locationPx.y += labelHeight / 2;
  23073. break;
  23074. case "lm":
  23075. locationPx.x += labelWidth / 2;
  23076. break;
  23077. case "lb":
  23078. locationPx.x += labelWidth / 2;
  23079. locationPx.y -= labelHeight / 2;
  23080. break;
  23081. case "ct":
  23082. locationPx.y += labelHeight / 2;
  23083. break;
  23084. case "cb":
  23085. locationPx.y -= labelHeight / 2;
  23086. break;
  23087. case "rt":
  23088. locationPx.x -= labelWidth / 2;
  23089. locationPx.y += labelHeight / 2;
  23090. break;
  23091. case "rm":
  23092. locationPx.x -= labelWidth / 2;
  23093. break;
  23094. case "rb":
  23095. locationPx.x -= labelWidth / 2;
  23096. locationPx.y -= labelHeight / 2;
  23097. break;
  23098. default:
  23099. break;
  23100. }
  23101. }
  23102. this.bsInfo.h = labelHeight;
  23103. this.bsInfo.w = labelWidth;
  23104. //bounds的四边
  23105. left = locationPx.x - parseFloat(labelWidth) / 2;
  23106. bottom = locationPx.y + parseFloat(labelHeight) / 2;
  23107. right = locationPx.x + parseFloat(labelWidth) / 2;
  23108. top = locationPx.y - parseFloat(labelHeight) / 2;
  23109. labelPxBounds = new Bounds(left, bottom, right, top);
  23110. return labelPxBounds;
  23111. }
  23112. /**
  23113. * @function GeometryGeoText.prototype.getLabelPxBoundsByText
  23114. * @description 根据文本内容获取文字标签的像素范围。
  23115. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  23116. * @param {Object} style - 标签的样式。
  23117. * @returns {Bounds} 标签的像素范围。
  23118. */
  23119. getLabelPxBoundsByText(locationPixel, style) {
  23120. var labelPxBounds, left, bottom, top, right;
  23121. var labelSize = this.getLabelPxSize(style);
  23122. var locationPx = Util_Util.cloneObject(locationPixel);
  23123. //处理文字对齐
  23124. if (style.labelAlign && style.labelAlign !== "cm") {
  23125. switch (style.labelAlign) {
  23126. case "lt":
  23127. locationPx.x += labelSize.w / 2;
  23128. locationPx.y += labelSize.h / 2;
  23129. break;
  23130. case "lm":
  23131. locationPx.x += labelSize.w / 2;
  23132. break;
  23133. case "lb":
  23134. locationPx.x += labelSize.w / 2;
  23135. locationPx.y -= labelSize.h / 2;
  23136. break;
  23137. case "ct":
  23138. locationPx.y += labelSize.h / 2;
  23139. break;
  23140. case "cb":
  23141. locationPx.y -= labelSize.h / 2;
  23142. break;
  23143. case "rt":
  23144. locationPx.x -= labelSize.w / 2;
  23145. locationPx.y += labelSize.h / 2;
  23146. break;
  23147. case "rm":
  23148. locationPx.x -= labelSize.w / 2;
  23149. break;
  23150. case "rb":
  23151. locationPx.x -= labelSize.w / 2;
  23152. locationPx.y -= labelSize.h / 2;
  23153. break;
  23154. default:
  23155. break;
  23156. }
  23157. }
  23158. this.bsInfo.h = labelSize.h;
  23159. this.bsInfo.w = labelSize.w;
  23160. left = locationPx.x - labelSize.w / 2;
  23161. bottom = locationPx.y + labelSize.h / 2;
  23162. //处理斜体字
  23163. if (style.fontStyle && style.fontStyle === "italic") {
  23164. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  23165. } else {
  23166. right = locationPx.x + labelSize.w / 2;
  23167. }
  23168. top = locationPx.y - labelSize.h / 2;
  23169. labelPxBounds = new Bounds(left, bottom, right, top);
  23170. return labelPxBounds;
  23171. }
  23172. /**
  23173. * @function GeometryGeoText.prototype.getLabelPxSize
  23174. * @description 获取 label 的像素大小。
  23175. * @param {Object} style - 标签样式。
  23176. * @returns {Object} 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。
  23177. */
  23178. getLabelPxSize(style) {
  23179. var text,//文本内容
  23180. fontSize,//字体大小
  23181. spacing = 1,//两个字符间的间距(单位:px)
  23182. lineSpacing = 0.2,
  23183. bgstrokeWidth = parseFloat(style.strokeWidth);//标签背景框边框的宽度
  23184. text = style.label || this.text;
  23185. if (style.fontSize) {
  23186. fontSize = parseFloat(style.fontSize);
  23187. } else {
  23188. fontSize = parseFloat("12px");
  23189. }
  23190. //标签宽高
  23191. var labelW, labelH;
  23192. var textRows = text.split('\n');
  23193. var numRows = textRows.length;
  23194. if (numRows > 1) {
  23195. labelH = fontSize * numRows + numRows + bgstrokeWidth + lineSpacing * fontSize;
  23196. } else {
  23197. labelH = fontSize + bgstrokeWidth + lineSpacing * fontSize + 1;
  23198. }
  23199. //取最大宽度
  23200. labelW = 0;
  23201. if (this.labelWTmp && labelW < this.labelWTmp) {
  23202. labelW = this.labelWTmp;
  23203. }
  23204. for (var i = 0; i < numRows; i++) {
  23205. var textCharC = this.getTextCount(textRows[i]);
  23206. var labelWTmp = this.labelWTmp = Util_Util.getTextBounds(style, textRows[i], this.element).textWidth + textCharC.textC * spacing + bgstrokeWidth;
  23207. if (labelW < labelWTmp) {
  23208. labelW = labelWTmp;
  23209. }
  23210. }
  23211. var labelSize = new Object(); //标签大小
  23212. labelSize.h = labelH;
  23213. labelSize.w = labelW;
  23214. return labelSize;
  23215. }
  23216. /**
  23217. * @function GeometryGeoText.prototype.getTextCount
  23218. * @description 获取 text 中的字符个数。
  23219. * @param {string} text - 字符串。
  23220. * @returns {Object} 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。
  23221. */
  23222. getTextCount(text) {
  23223. var textCharCount = {};
  23224. var cnCount = 0;
  23225. var enCount = 0;
  23226. for (var i = 0; i < text.length; i++) {
  23227. if (text.charCodeAt(i) > 255) { //遍历判断字符串中每个字符的Unicode码,大于255则为中文
  23228. cnCount++;
  23229. } else {
  23230. enCount++;
  23231. }
  23232. }
  23233. //中午字符个数
  23234. textCharCount.cnC = cnCount;
  23235. //英文字符个数
  23236. textCharCount.enC = enCount;
  23237. //字符总个数
  23238. textCharCount.textC = text.length;
  23239. return textCharCount;
  23240. }
  23241. }
  23242. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LinearRing.js
  23243. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23244. * This program are made available under the terms of the Apache License, Version 2.0
  23245. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23246. /**
  23247. * @class GeometryLinearRing
  23248. * @aliasclass Geometry.LinearRing
  23249. * @deprecatedclass SuperMap.Geometry.LinearRing
  23250. * @classdesc 几何对象线环类,是一个特殊的封闭的线串,在每次 addPoint/removePoint 之后会通过添加一个点(此点是复制的第一个点得到的)
  23251. * 作为最后的一个点来自动关闭线环。
  23252. * @category BaseTypes Geometry
  23253. * @extends GeometryLineString
  23254. * @param {Array.<GeometryPoint>} points - 组成线性环的点。
  23255. * @example
  23256. * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
  23257. * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
  23258. * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
  23259. * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
  23260. * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
  23261. * var linearRing = new GeometryLinearRing(points);
  23262. * @usage
  23263. */
  23264. class LinearRing_LinearRing extends LineString {
  23265. constructor(points) {
  23266. super(points);
  23267. /**
  23268. * @member {Array.<string>} [GeometryLinearRing.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  23269. * @description components 存储的几何对象所支持的几何类型数组,为空表示类型不受限制。
  23270. * @readonly
  23271. */
  23272. this.componentTypes = ["SuperMap.Geometry.Point"];
  23273. this.CLASS_NAME = "SuperMap.Geometry.LinearRing";
  23274. this.geometryType = "LinearRing";
  23275. }
  23276. /**
  23277. * @function GeometryLinearRing.prototype.addComponent
  23278. * @description 添加一个点到几何图形数组中,如果这个点将要被添加到组件数组的末端,并且与数组中已经存在的最后一个点相同,
  23279. * 重复的点是不能被添加的。这将影响未关闭环的关闭。
  23280. * 这个方法可以通过将非空索引(组件数组的下标)作为第二个参数重写。
  23281. * @param {GeometryPoint} point - 点对象。
  23282. * @param {number} [index] - 插入组件数组的下标。
  23283. * @returns {boolean} 点对象是否添加成功。
  23284. */
  23285. addComponent(point, index) {
  23286. var added = false;
  23287. //remove last point
  23288. var lastPoint = this.components.pop();
  23289. // given an index, add the point
  23290. // without an index only add non-duplicate points
  23291. if (index != null || !point.equals(lastPoint)) {
  23292. added = super.addComponent.apply(this, arguments);
  23293. }
  23294. //append copy of first point
  23295. var firstPoint = this.components[0];
  23296. super.addComponent.apply(this, [firstPoint]);
  23297. return added;
  23298. }
  23299. /**
  23300. * @function GeometryLinearRing.prototype.removeComponent
  23301. * @description 从几何组件中删除一个点。
  23302. * @param {GeometryPoint} point - 点对象。
  23303. * @returns {boolean} 点对象是否删除。
  23304. */
  23305. removeComponent(point) { // eslint-disable-line no-unused-vars
  23306. var removed = this.components && (this.components.length > 3);
  23307. if (removed) {
  23308. //remove last point
  23309. this.components.pop();
  23310. //remove our point
  23311. super.removeComponent.apply(this, arguments);
  23312. //append copy of first point
  23313. var firstPoint = this.components[0];
  23314. super.addComponent.apply(this, [firstPoint]);
  23315. }
  23316. return removed;
  23317. }
  23318. /**
  23319. * @function GeometryLinearRing.prototype.getArea
  23320. * @description 获得当前几何对象区域大小,如果是沿顺时针方向的环则是正值,否则为负值。
  23321. * @returns {number} 环的面积。
  23322. */
  23323. getArea() {
  23324. var area = 0.0;
  23325. if (this.components && (this.components.length > 2)) {
  23326. var sum = 0.0;
  23327. for (var i = 0, len = this.components.length; i < len - 1; i++) {
  23328. var b = this.components[i];
  23329. var c = this.components[i + 1];
  23330. sum += (b.x + c.x) * (c.y - b.y);
  23331. }
  23332. area = -sum / 2.0;
  23333. }
  23334. return area;
  23335. }
  23336. /**
  23337. * @function GeometryLinearRing.prototype.getVertices
  23338. * @description 返回几何图形的所有点的列表。
  23339. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false ,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  23340. * @returns {Array} 几何对象所有点的列表。
  23341. */
  23342. getVertices(nodes) {
  23343. return (nodes === true) ? [] : this.components.slice(0, this.components.length - 1);
  23344. }
  23345. }
  23346. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiLineString.js
  23347. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23348. * This program are made available under the terms of the Apache License, Version 2.0
  23349. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23350. /**
  23351. * @class GeometryMultiLineString
  23352. * @aliasclass Geometry.MultiLineString
  23353. * @deprecatedclass SuperMap.Geometry.MultiLineString
  23354. * @classdesc 几何对象多线类。
  23355. * @category BaseTypes Geometry
  23356. * @extends GeometryCollection
  23357. * @param {Array.<GeometryLineString>} components - GeometryLineString 数组。
  23358. * @example
  23359. * var multi = new GeometryMultiLineString([
  23360. * new GeometryLineString([
  23361. * new GeometryPoint(1, 0),
  23362. * new GeometryPoint(0, 1)
  23363. * ])
  23364. * ]);
  23365. * @usage
  23366. */
  23367. class MultiLineString extends Collection {
  23368. constructor(components) {
  23369. super(components);
  23370. /**
  23371. * @member {Array.<string>} [GeometryMultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
  23372. * @description components 存储的几何对象所支持的几何类型数组。
  23373. * @readonly
  23374. */
  23375. this.componentTypes = ["SuperMap.Geometry.LineString"];
  23376. this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
  23377. this.geometryType = "MultiLineString";
  23378. }
  23379. }
  23380. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPolygon.js
  23381. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23382. * This program are made available under the terms of the Apache License, Version 2.0
  23383. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23384. /**
  23385. * @class GeometryMultiPolygon
  23386. * @aliasclass Geometry.MultiPolygon
  23387. * @deprecatedclass SuperMap.Geometry.MultiPolygon
  23388. * @classdesc 几何对象多多边形类。
  23389. * @category BaseTypes Geometry
  23390. * @extends GeometryCollection
  23391. * @param {Array.<GeometryPolygon>} components - 形成 GeometryMultiPolygon 的多边形数组。
  23392. * @example
  23393. * var points1 = [new GeometryPoint(10,10),new GeometryPoint(0,0)];
  23394. * var points2 = [new GeometryPoint(10,10),new GeometryPoint(0,0),new GeometryPoint(3,3),new GeometryPoint(10,10)];
  23395. *
  23396. * var linearRing1 = new GeometryLinearRing(points1);
  23397. * var linearRing2 = new GeometryLinearRing(points2);
  23398. *
  23399. * var polygon1 = new GeometryPolygon([linearRing1]);
  23400. * var polygon2 = new GeometryPolygon([linearRing2]);
  23401. *
  23402. * var multiPolygon1 = new GeometryMultiPolygon([polygon1,polygon2]);
  23403. * @usage
  23404. */
  23405. class MultiPolygon extends Collection {
  23406. constructor(components) {
  23407. super(components);
  23408. /**
  23409. * @member {Array.<string>} [GeometryMultiPolygon.prototype.componentTypes=["SuperMap.Geometry.Polygon"]]
  23410. * @description components 存储的几何对象所支持的几何类型数组。
  23411. * @readonly
  23412. */
  23413. this.componentTypes = ["SuperMap.Geometry.Polygon"];
  23414. this.CLASS_NAME = "SuperMap.Geometry.MultiPolygon";
  23415. this.geometryType = "MultiPolygon";
  23416. }
  23417. }
  23418. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Polygon.js
  23419. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23420. * This program are made available under the terms of the Apache License, Version 2.0
  23421. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23422. /**
  23423. * @class GeometryPolygon
  23424. * @aliasclass Geometry.Polygon
  23425. * @deprecatedclass SuperMap.Geometry.Polygon
  23426. * @classdesc 多边形几何对象类。
  23427. * @category BaseTypes Geometry
  23428. * @extends GeometryCollection
  23429. * @param {Array.<GeometryLinearRing>} components - 多边形的线环数组。
  23430. * @example
  23431. * var points =[new GeometryPoint(0,4010338),
  23432. * new GeometryPoint(1063524,4010338),
  23433. * new GeometryPoint(1063524,3150322),
  23434. * new GeometryPoint(0,3150322)
  23435. * ],
  23436. * var linearRings = new GeometryLinearRing(points),
  23437. * var region = new GeometryPolygon([linearRings]);
  23438. * @usage
  23439. */
  23440. class Polygon_Polygon extends Collection {
  23441. constructor(components) {
  23442. super(components);
  23443. /**
  23444. * @member {Array.<string>} [GeometryPolygon.prototype.componentTypes=["SuperMap.Geometry.LinearRing"]]
  23445. * @description components 存储的几何对象所支持的几何类型数组。
  23446. * @readonly
  23447. */
  23448. this.componentTypes = ["SuperMap.Geometry.LinearRing"];
  23449. this.CLASS_NAME = "SuperMap.Geometry.Polygon";
  23450. this.geometryType = "Polygon";
  23451. }
  23452. /**
  23453. * @function GeometryMultiPoint.prototype.getArea
  23454. * @description 获得区域面积,从区域的外部口径减去计此区域内部口径算所得的面积。
  23455. * @returns {number} 几何对象的面积。
  23456. */
  23457. getArea() {
  23458. var area = 0.0;
  23459. if (this.components && (this.components.length > 0)) {
  23460. area += Math.abs(this.components[0].getArea());
  23461. for (var i = 1, len = this.components.length; i < len; i++) {
  23462. area -= Math.abs(this.components[i].getArea());
  23463. }
  23464. }
  23465. return area;
  23466. }
  23467. }
  23468. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Rectangle.js
  23469. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23470. * This program are made available under the terms of the Apache License, Version 2.0
  23471. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23472. /**
  23473. * @class GeometryRectangle
  23474. * @aliasclass Geometry.Rectangle
  23475. * @deprecatedclass SuperMap.Geometry.Rectangle
  23476. * @classdesc 矩形几何对象类。
  23477. * @category BaseTypes Geometry
  23478. * @param {number} x - 矩形左下角点的横坐标。
  23479. * @param {number} y - 矩形左下角点的纵坐标。
  23480. * @param {number} width - 矩形的宽度。
  23481. * @param {number} height - 矩形的高度。
  23482. * @extends {Geometry}
  23483. * @example
  23484. * //x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
  23485. * var x = 1;
  23486. * var y = 2;
  23487. * var w = 10;
  23488. * var h = 20;
  23489. * var recttangle = new GeometryRectangle(x, y, w, h);
  23490. * @usage
  23491. */
  23492. class Rectangle extends Geometry_Geometry {
  23493. constructor(x, y, width, height) {
  23494. super(x, y, width, height);
  23495. /**
  23496. * @member {number} GeometryRectangle.prototype.x
  23497. * @description 矩形左下角点的横坐标。
  23498. */
  23499. this.x = x;
  23500. /**
  23501. * @member {number} GeometryRectangle.prototype.y
  23502. * @description 矩形左下角点的纵坐标。
  23503. */
  23504. this.y = y;
  23505. /**
  23506. * @member {number} GeometryRectangle.prototype.width
  23507. * @description 矩形的宽度。
  23508. */
  23509. this.width = width;
  23510. /**
  23511. * @member {number} GeometryRectangle.prototype.height
  23512. * @description 矩形的高度。
  23513. */
  23514. this.height = height;
  23515. this.CLASS_NAME = "SuperMap.Geometry.Rectangle";
  23516. this.geometryType = "Rectangle";
  23517. }
  23518. /**
  23519. * @function GeometryRectangle.prototype.calculateBounds
  23520. * @description 计算出此矩形对象的 bounds。
  23521. */
  23522. calculateBounds() {
  23523. this.bounds = new Bounds(this.x, this.y,
  23524. this.x + this.width,
  23525. this.y + this.height);
  23526. }
  23527. /**
  23528. * @function GeometryRectangle.prototype.getArea
  23529. * @description 获取矩形对象的面积。
  23530. * @returns {number} 矩形对象面积。
  23531. */
  23532. getArea() {
  23533. var area = this.width * this.height;
  23534. return area;
  23535. }
  23536. }
  23537. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/index.js
  23538. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23539. * This program are made available under the terms of the Apache License, Version 2.0
  23540. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23541. ;// CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  23542. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23543. * This program are made available under the terms of the Apache License, Version 2.0
  23544. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23545. /**
  23546. * @class Credential
  23547. * @deprecatedclass SuperMap.Credential
  23548. * @category Security
  23549. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  23550. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  23551. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  23552. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  23553. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  23554. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  23555. * @example
  23556. * var pixcel = new Credential("valueString","token");
  23557. * pixcel.destroy();
  23558. * @usage
  23559. */
  23560. class Credential {
  23561. constructor(value, name) {
  23562. /**
  23563. * @member {string} Credential.prototype.value
  23564. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  23565. */
  23566. this.value = value ? value : "";
  23567. /**
  23568. * @member {string} [Credential.prototype.name='token']
  23569. * @description 验证信息前缀,name=value 部分的 name 部分。
  23570. */
  23571. this.name = name ? name : "token";
  23572. this.CLASS_NAME = "SuperMap.Credential";
  23573. }
  23574. /**
  23575. * @function Credential.prototype.getUrlParameters
  23576. * @description 获取 name=value 的表达式。
  23577. * @example
  23578. * var credential = new Credential("valueString","token");
  23579. * //这里 str = "token=valueString";
  23580. * var str = credential.getUrlParameters();
  23581. * @returns {string} 安全信息组成的 url 片段。
  23582. */
  23583. getUrlParameters() {
  23584. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  23585. return this.name + "=" + this.value;
  23586. }
  23587. /**
  23588. * @function Credential.prototype.getValue
  23589. * @description 获取 value。
  23590. * @example
  23591. * var credential = new Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  23592. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  23593. * var str = credential.getValue();
  23594. * @returns {string} value 字符串,在 iServer 服务下该 value 值即为 token 值。
  23595. */
  23596. getValue() {
  23597. return this.value;
  23598. }
  23599. /**
  23600. *
  23601. * @function Credential.prototype.destroy
  23602. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  23603. * @example
  23604. * var credential = new Credential("valueString","token");
  23605. * credential.destroy();
  23606. */
  23607. destroy() {
  23608. this.value = null;
  23609. this.name = null;
  23610. }
  23611. }
  23612. /**
  23613. * @member {Credential} Credential.CREDENTIAL
  23614. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  23615. * @example
  23616. * 代码实例:
  23617. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  23618. * var value = "(以iServer为例,这里是申请的token值)";
  23619. * var name = "token";
  23620. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  23621. * Credential.CREDENTIAL = new Credential(value, name);
  23622. *
  23623. */
  23624. Credential.CREDENTIAL = null;
  23625. ;// CONCATENATED MODULE: ./src/common/commontypes/Date.js
  23626. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23627. * This program are made available under the terms of the Apache License, Version 2.0
  23628. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23629. /**
  23630. * @name Date
  23631. * @namespace
  23632. * @category BaseTypes Util
  23633. * @description 包含 parse、toISOString 方法的实现,两个方法用来解析 RFC 3339 日期,遵循 ECMAScript 5 规范。
  23634. * @private
  23635. */
  23636. var DateExt = {
  23637. /**
  23638. * @description 生成代表一个具体的日期字符串,该日期遵循 ISO 8601 标准(详情查看{@link http://tools.ietf.org/html/rfc3339})。
  23639. * @example
  23640. * var dateString = DateExt.toISOString(new Date());
  23641. * @param {Date} date - 日期对象。
  23642. * @returns {string} 一个代表日期的字符串。(例如 "2010-08-07T16:58:23.123Z")。
  23643. */
  23644. toISOString: (function () {
  23645. //标准的Date会存在toISOString方法,可以直接调用
  23646. if ("toISOString" in Date.prototype) {
  23647. return function (date) {
  23648. return date.toISOString();
  23649. };
  23650. } else {// 部分浏览器没有,就得自己组合,组合后的字符串规则不变
  23651. function pad(num, len) {
  23652. var str = num + "";
  23653. while (str.length < len) {
  23654. str = "0" + str;
  23655. }
  23656. return str;
  23657. }
  23658. return function (date) {
  23659. var str;
  23660. if (isNaN(date.getTime())) {
  23661. // ECMA-262 says throw RangeError, Firefox returns
  23662. // "Invalid Date"
  23663. str = "Invalid Date";
  23664. } else {
  23665. str =
  23666. date.getUTCFullYear() + "-" +
  23667. pad(date.getUTCMonth() + 1, 2) + "-" +
  23668. pad(date.getUTCDate(), 2) + "T" +
  23669. pad(date.getUTCHours(), 2) + ":" +
  23670. pad(date.getUTCMinutes(), 2) + ":" +
  23671. pad(date.getUTCSeconds(), 2) + "." +
  23672. pad(date.getUTCMilliseconds(), 3) + "Z";
  23673. }
  23674. return str;
  23675. };
  23676. }
  23677. })(),
  23678. /**
  23679. * @description 从一个字符串生成一个日期对象。
  23680. * @example
  23681. * var date = DateExt.parse("2010-08-07");
  23682. * @param {string} str - 日期的字符串。(例如: "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z","2010-08-07T11:58:23.123-06")。
  23683. * @returns {Date} 日期对象,如果字符串无法被解析,则返回一个无效的日期。(例如 isNaN(date.getTime()))。
  23684. */
  23685. parse: function (str) {
  23686. var date;
  23687. var match = str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/);
  23688. if (match && (match[1] || match[7])) { // must have at least year or time
  23689. var year = parseInt(match[1], 10) || 0;
  23690. var month = (parseInt(match[2], 10) - 1) || 0;
  23691. var day = parseInt(match[3], 10) || 1;
  23692. date = new Date(Date.UTC(year, month, day));
  23693. // optional time
  23694. var type = match[7];
  23695. if (type) {
  23696. var hours = parseInt(match[4], 10);
  23697. var minutes = parseInt(match[5], 10);
  23698. var secFrac = parseFloat(match[6]);
  23699. var seconds = secFrac | 0;
  23700. var milliseconds = Math.round(1000 * (secFrac - seconds));
  23701. date.setUTCHours(hours, minutes, seconds, milliseconds);
  23702. // check offset
  23703. if (type !== "Z") {
  23704. var hoursOffset = parseInt(type, 10);
  23705. var minutesOffset = parseInt(match[8], 10) || 0;
  23706. var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
  23707. date = new Date(date.getTime() + offset);
  23708. }
  23709. }
  23710. } else {
  23711. date = new Date("invalid");
  23712. }
  23713. return date;
  23714. }
  23715. };
  23716. ;// CONCATENATED MODULE: ./src/common/commontypes/Event.js
  23717. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23718. * This program are made available under the terms of the Apache License, Version 2.0
  23719. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23720. /**
  23721. * @name Event
  23722. * @namespace
  23723. * @category BaseTypes Events
  23724. * @description 事件处理函数.
  23725. * @usage
  23726. * ```
  23727. * // 浏览器
  23728. * <script type="text/javascript" src="{cdn}"></script>
  23729. * <script>
  23730. * const element = {namespace}.Event.element();
  23731. *
  23732. * // 弃用的写法
  23733. * const result = SuperMap.Event.element();
  23734. *
  23735. * </script>
  23736. *
  23737. * // ES6 Import
  23738. * import { Event } from '{npm}';
  23739. *
  23740. * const result = Event.element();
  23741. * ```
  23742. */
  23743. var Event = {
  23744. /**
  23745. * @description 事件观察者列表。
  23746. * @type {Object}
  23747. * @default false
  23748. */
  23749. observers: false,
  23750. /**
  23751. * @description KEY_SPACE
  23752. * @type {number}
  23753. * @default 32
  23754. */
  23755. KEY_SPACE: 32,
  23756. /**
  23757. * @description KEY_BACKSPACE
  23758. * @type {number}
  23759. * @default 8
  23760. */
  23761. KEY_BACKSPACE: 8,
  23762. /**
  23763. * @description KEY_TAB
  23764. * @type {number}
  23765. * @default 9
  23766. */
  23767. KEY_TAB: 9,
  23768. /**
  23769. * @description KEY_RETURN
  23770. * @type {number}
  23771. * @default 13
  23772. */
  23773. KEY_RETURN: 13,
  23774. /**
  23775. * @description KEY_ESC
  23776. * @type {number}
  23777. * @default 27
  23778. */
  23779. KEY_ESC: 27,
  23780. /**
  23781. * @description KEY_LEFT
  23782. * @type {number}
  23783. * @default 37
  23784. */
  23785. KEY_LEFT: 37,
  23786. /**
  23787. * @description KEY_UP
  23788. * @type {number}
  23789. * @default 38
  23790. */
  23791. KEY_UP: 38,
  23792. /**
  23793. * @description KEY_RIGHT
  23794. * @type {number}
  23795. * @default 39
  23796. */
  23797. KEY_RIGHT: 39,
  23798. /**
  23799. * @description KEY_DOWN
  23800. * @type {number}
  23801. * @default 40
  23802. */
  23803. KEY_DOWN: 40,
  23804. /**
  23805. * @description KEY_DELETE
  23806. * @type {number}
  23807. * @default 46
  23808. */
  23809. KEY_DELETE: 46,
  23810. /**
  23811. * @description 监听浏览器 DOM 事件。
  23812. * @param {Event} event - Event 对象。
  23813. * @returns {HTMLElement} 触发事件的 DOM 元素。
  23814. */
  23815. element: function (event) {
  23816. return event.target || event.srcElement;
  23817. },
  23818. /**
  23819. * @description 判断事件是否由单次触摸引起。
  23820. * @param {Event} event - Event 对象。
  23821. * @returns {boolean} 是否有且只有一个当前在与触摸表面接触的 Touch 对象。
  23822. */
  23823. isSingleTouch: function (event) {
  23824. return event.touches && event.touches.length === 1;
  23825. },
  23826. /**
  23827. * @description 判断事件是否由多点触控引起。
  23828. * @param {Event} event - Event 对象。
  23829. * @returns {boolean} 是否存在多个当前在与触摸表面接触的 Touch 对象。
  23830. */
  23831. isMultiTouch: function (event) {
  23832. return event.touches && event.touches.length > 1;
  23833. },
  23834. /**
  23835. * @description 确定事件是否由左键单击引起。
  23836. * @param {Event} event - Event 对象。
  23837. * @returns {boolean} 是否点击鼠标左键。
  23838. */
  23839. isLeftClick: function (event) {
  23840. return (((event.which) && (event.which === 1)) ||
  23841. ((event.button) && (event.button === 1)));
  23842. },
  23843. /**
  23844. * @description 确定事件是否由鼠标右键单击引起。
  23845. * @param {Event} event - Event 对象。
  23846. * @returns {boolean} 是否点击鼠标右键。
  23847. */
  23848. isRightClick: function (event) {
  23849. return (((event.which) && (event.which === 3)) ||
  23850. ((event.button) && (event.button === 2)));
  23851. },
  23852. /**
  23853. * @description 阻止事件冒泡。
  23854. * @param {Event} event - Event 对象。
  23855. * @param {boolean} allowDefault - 默认为 false,表示阻止事件的默认行为。
  23856. */
  23857. stop: function (event, allowDefault) {
  23858. if (!allowDefault) {
  23859. if (event.preventDefault) {
  23860. event.preventDefault();
  23861. } else {
  23862. event.returnValue = false;
  23863. }
  23864. }
  23865. if (event.stopPropagation) {
  23866. event.stopPropagation();
  23867. } else {
  23868. event.cancelBubble = true;
  23869. }
  23870. },
  23871. /**
  23872. * @description 查询触发指定事件的 DOM 元素。
  23873. * @param {Event} event - Event 对象。
  23874. * @param {string} tagName - html 标签名。
  23875. * @returns {HTMLElement} DOM 元素。
  23876. */
  23877. findElement: function (event, tagName) {
  23878. var element = Event.element(event);
  23879. while (element.parentNode && (!element.tagName ||
  23880. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  23881. element = element.parentNode;
  23882. }
  23883. return element;
  23884. },
  23885. /**
  23886. * @description 监听事件,注册事件处理方法。
  23887. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  23888. * @param {string} name - 监听事件的类别名称。
  23889. * @param {function} observer - 注册的事件处理方法。
  23890. * @param {boolean} [useCapture=false] - 是否捕获。
  23891. */
  23892. observe: function (elementParam, name, observer, useCapture) {
  23893. var element = Util_Util.getElement(elementParam);
  23894. useCapture = useCapture || false;
  23895. if (name === 'keypress' &&
  23896. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  23897. || element.attachEvent)) {
  23898. name = 'keydown';
  23899. }
  23900. //if observers cache has not yet been created, create it
  23901. if (!this.observers) {
  23902. this.observers = {};
  23903. }
  23904. //if not already assigned, make a new unique cache ID
  23905. if (!element._eventCacheID) {
  23906. var idPrefix = "eventCacheID_";
  23907. if (element.id) {
  23908. idPrefix = element.id + "_" + idPrefix;
  23909. }
  23910. element._eventCacheID = Util_Util.createUniqueID(idPrefix);
  23911. }
  23912. var cacheID = element._eventCacheID;
  23913. //if there is not yet a hash entry for this element, add one
  23914. if (!this.observers[cacheID]) {
  23915. this.observers[cacheID] = [];
  23916. }
  23917. //add a new observer to this element's list
  23918. this.observers[cacheID].push({
  23919. 'element': element,
  23920. 'name': name,
  23921. 'observer': observer,
  23922. 'useCapture': useCapture
  23923. });
  23924. //add the actual browser event listener
  23925. if (element.addEventListener) {
  23926. if(name === 'mousewheel'){
  23927. // https://www.chromestatus.com/features/6662647093133312
  23928. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  23929. } else {
  23930. element.addEventListener(name, observer, useCapture);
  23931. }
  23932. } else if (element.attachEvent) {
  23933. element.attachEvent('on' + name, observer);
  23934. }
  23935. },
  23936. /**
  23937. * @description 移除给定 DOM 元素的监听事件。
  23938. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  23939. */
  23940. stopObservingElement: function (elementParam) {
  23941. var element = Util_Util.getElement(elementParam);
  23942. var cacheID = element._eventCacheID;
  23943. this._removeElementObservers(Event.observers[cacheID]);
  23944. },
  23945. _removeElementObservers: function (elementObservers) {
  23946. if (elementObservers) {
  23947. for (var i = elementObservers.length - 1; i >= 0; i--) {
  23948. var entry = elementObservers[i];
  23949. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  23950. Event.stopObserving.apply(this, args);
  23951. }
  23952. }
  23953. },
  23954. /**
  23955. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时保持一致才能确保事件移除成功。
  23956. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  23957. * @param {string} name - 需要移除的被监听事件名称。
  23958. * @param {function} observer - 需要移除的事件处理方法。
  23959. * @param {boolean} [useCapture=false] - 是否捕获。
  23960. * @returns {boolean} 监听事件是否被移除。
  23961. */
  23962. stopObserving: function (elementParam, name, observer, useCapture) {
  23963. useCapture = useCapture || false;
  23964. var element = Util_Util.getElement(elementParam);
  23965. var cacheID = element._eventCacheID;
  23966. if (name === 'keypress') {
  23967. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  23968. element.detachEvent) {
  23969. name = 'keydown';
  23970. }
  23971. }
  23972. // find element's entry in this.observers cache and remove it
  23973. var foundEntry = false;
  23974. var elementObservers = Event.observers[cacheID];
  23975. if (elementObservers) {
  23976. // find the specific event type in the element's list
  23977. var i = 0;
  23978. while (!foundEntry && i < elementObservers.length) {
  23979. var cacheEntry = elementObservers[i];
  23980. if ((cacheEntry.name === name) &&
  23981. (cacheEntry.observer === observer) &&
  23982. (cacheEntry.useCapture === useCapture)) {
  23983. elementObservers.splice(i, 1);
  23984. if (elementObservers.length == 0) {
  23985. delete Event.observers[cacheID];
  23986. }
  23987. foundEntry = true;
  23988. break;
  23989. }
  23990. i++;
  23991. }
  23992. }
  23993. //actually remove the event listener from browser
  23994. if (foundEntry) {
  23995. if (element.removeEventListener) {
  23996. element.removeEventListener(name, observer, useCapture);
  23997. } else if (element && element.detachEvent) {
  23998. element.detachEvent('on' + name, observer);
  23999. }
  24000. }
  24001. return foundEntry;
  24002. },
  24003. /**
  24004. * @description 移除缓存中的监听事件。
  24005. */
  24006. unloadCache: function () {
  24007. // check for Event before checking for observers, because
  24008. // Event may be undefined in IE if no map instance was
  24009. // created
  24010. if (Event && Event.observers) {
  24011. for (var cacheID in Event.observers) {
  24012. var elementObservers = Event.observers[cacheID];
  24013. Event._removeElementObservers.apply(this,
  24014. [elementObservers]);
  24015. }
  24016. Event.observers = false;
  24017. }
  24018. },
  24019. CLASS_NAME: "SuperMap.Event"
  24020. };
  24021. /* prevent memory leaks in IE */
  24022. Event.observe(window, 'resize', Event.unloadCache, false);
  24023. ;// CONCATENATED MODULE: ./src/common/commontypes/Events.js
  24024. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24025. * This program are made available under the terms of the Apache License, Version 2.0
  24026. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24027. /**
  24028. * @class Events
  24029. * @deprecatedclass SuperMap.Events
  24030. * @classdesc 事件类。
  24031. * @category BaseTypes Events
  24032. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  24033. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  24034. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  24035. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  24036. * @param {Object} options - 事件对象选项。
  24037. * @usage
  24038. */
  24039. class Events {
  24040. constructor(object, element, eventTypes, fallThrough, options) {
  24041. /**
  24042. * @member {Array.<string>} Events.prototype.BROWSER_EVENTS
  24043. * @description 支持的事件。
  24044. * @constant
  24045. * @default [
  24046. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  24047. "click", "dblclick", "rightclick", "dblrightclick","resize",
  24048. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  24049. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  24050. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  24051. ]
  24052. */
  24053. this.BROWSER_EVENTS = [
  24054. "mouseover", "mouseout",
  24055. "mousedown", "mouseup", "mousemove",
  24056. "click", "dblclick", "rightclick", "dblrightclick",
  24057. "resize", "focus", "blur",
  24058. "touchstart", "touchmove", "touchend",
  24059. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  24060. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  24061. "contextmenu"
  24062. ];
  24063. /**
  24064. * @member {Object} Events.prototype.listeners
  24065. * @description 事件监听器函数。
  24066. */
  24067. this.listeners = {};
  24068. /**
  24069. * @member {Object} Events.prototype.object
  24070. * @description 发布应用程序事件的对象。
  24071. */
  24072. this.object = object;
  24073. /**
  24074. * @member {HTMLElement} Events.prototype.element
  24075. * @description 接受浏览器事件的 DOM 节点。
  24076. */
  24077. this.element = null;
  24078. /**
  24079. * @member {Array.<string>} Events.prototype.eventTypes
  24080. * @description 支持的事件类型列表。
  24081. */
  24082. this.eventTypes = [];
  24083. /**
  24084. * @member {function} Events.prototype.eventHandler
  24085. * @description 绑定在元素上的事件处理器对象。
  24086. */
  24087. this.eventHandler = null;
  24088. /**
  24089. * @member {boolean} [Events.prototype.fallThrough=false]
  24090. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  24091. */
  24092. this.fallThrough = fallThrough;
  24093. /**
  24094. * @member {boolean} [Events.prototype.includeXY=false]
  24095. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  24096. * @example
  24097. * function named(evt) {
  24098. * this.xy = this.object.events.getMousePosition(evt);
  24099. * }
  24100. */
  24101. this.includeXY = false;
  24102. /**
  24103. * @member {Object} Events.prototype.extensions
  24104. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  24105. */
  24106. this.extensions = {};
  24107. /**
  24108. * @member {Object} Events.prototype.extensionCount
  24109. * @description 事件扩展数量。
  24110. */
  24111. this.extensionCount = {};
  24112. /**
  24113. * @member {Object} Events.prototype.clearMouseListener
  24114. * @description 待移除的鼠标监听事件。
  24115. */
  24116. this.clearMouseListener = null;
  24117. Util_Util.extend(this, options);
  24118. if (eventTypes != null) {
  24119. for (var i = 0, len = eventTypes.length; i < len; i++) {
  24120. this.addEventType(eventTypes[i]);
  24121. }
  24122. }
  24123. if (element != null) {
  24124. this.attachToElement(element);
  24125. }
  24126. this.CLASS_NAME = "SuperMap.Events";
  24127. }
  24128. /**
  24129. * @function Events.prototype.destroy
  24130. * @description 移除当前要素 element 上的所有事件监听和处理。
  24131. */
  24132. destroy() {
  24133. for (var e in this.extensions) {
  24134. if (typeof this.extensions[e] !== "boolean") {
  24135. this.extensions[e].destroy();
  24136. }
  24137. }
  24138. this.extensions = null;
  24139. if (this.element) {
  24140. Event.stopObservingElement(this.element);
  24141. if (this.element.hasScrollEvent) {
  24142. Event.stopObserving(
  24143. window, "scroll", this.clearMouseListener
  24144. );
  24145. }
  24146. }
  24147. this.element = null;
  24148. this.listeners = null;
  24149. this.object = null;
  24150. this.eventTypes = null;
  24151. this.fallThrough = null;
  24152. this.eventHandler = null;
  24153. }
  24154. /**
  24155. * @function Events.prototype.addEventType
  24156. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  24157. * @param {string} eventName - 事件名。
  24158. */
  24159. addEventType(eventName) {
  24160. if (!this.listeners[eventName]) {
  24161. this.eventTypes.push(eventName);
  24162. this.listeners[eventName] = [];
  24163. }
  24164. }
  24165. /**
  24166. * @function Events.prototype.attachToElement
  24167. * @description 给 DOM 元素绑定浏览器事件。
  24168. * @param {HTMLElement} element - 绑定浏览器事件的 DOM 元素。
  24169. */
  24170. attachToElement(element) {
  24171. if (this.element) {
  24172. Event.stopObservingElement(this.element);
  24173. } else {
  24174. // keep a bound copy of handleBrowserEvent() so that we can
  24175. // pass the same function to both Event.observe() and .stopObserving()
  24176. this.eventHandler = FunctionExt.bindAsEventListener(
  24177. this.handleBrowserEvent, this
  24178. );
  24179. // to be used with observe and stopObserving
  24180. this.clearMouseListener = FunctionExt.bind(
  24181. this.clearMouseCache, this
  24182. );
  24183. }
  24184. this.element = element;
  24185. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  24186. var eventType = this.BROWSER_EVENTS[i];
  24187. // every browser event has a corresponding application event
  24188. // (whether it's listened for or not).
  24189. this.addEventType(eventType);
  24190. // use Prototype to register the event cross-browser
  24191. Event.observe(element, eventType, this.eventHandler);
  24192. }
  24193. // disable dragstart in IE so that mousedown/move/up works normally
  24194. Event.observe(element, "dragstart", Event.stop);
  24195. }
  24196. /**
  24197. * @function Events.prototype.on
  24198. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  24199. * @example
  24200. * // 注册一个 "loadstart" 监听事件
  24201. * events.on({"loadstart": loadStartListener});
  24202. *
  24203. * // 同样注册一个 "loadstart" 监听事件
  24204. * events.register("loadstart", undefined, loadStartListener);
  24205. *
  24206. * // 同时为对象注册多个监听事件
  24207. * events.on({
  24208. * "loadstart": loadStartListener,
  24209. * "loadend": loadEndListener,
  24210. * scope: object
  24211. * });
  24212. *
  24213. * // 同时为对象注册多个监听事件,多次调用 register 方法
  24214. * events.register("loadstart", object, loadStartListener);
  24215. * events.register("loadend", object, loadEndListener);
  24216. *
  24217. *
  24218. * @param {Object} object - 添加监听的对象。
  24219. */
  24220. on(object) {
  24221. for (var type in object) {
  24222. if (type !== "scope" && object.hasOwnProperty(type)) {
  24223. this.register(type, object.scope, object[type]);
  24224. }
  24225. }
  24226. }
  24227. /**
  24228. * @function Events.prototype.register
  24229. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  24230. * 指定 Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  24231. * @param {string} type - 事件注册者的名字。
  24232. * @param {Object} [obj=this.object] - 对象绑定的回调。
  24233. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  24234. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  24235. */
  24236. register(type, obj, func, priority) {
  24237. if (type in Events && !this.extensions[type]) {
  24238. this.extensions[type] = new Events[type](this);
  24239. }
  24240. if ((func != null) &&
  24241. (Util_Util.indexOf(this.eventTypes, type) !== -1)) {
  24242. if (obj == null) {
  24243. obj = this.object;
  24244. }
  24245. var listeners = this.listeners[type];
  24246. if (!listeners) {
  24247. listeners = [];
  24248. this.listeners[type] = listeners;
  24249. this.extensionCount[type] = 0;
  24250. }
  24251. var listener = {obj: obj, func: func};
  24252. if (priority) {
  24253. listeners.splice(this.extensionCount[type], 0, listener);
  24254. if (typeof priority === "object" && priority.extension) {
  24255. this.extensionCount[type]++;
  24256. }
  24257. } else {
  24258. listeners.push(listener);
  24259. }
  24260. }
  24261. }
  24262. /**
  24263. * @function Events.prototype.registerPriority
  24264. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  24265. * @param {string} type - 事件注册者的名字。
  24266. * @param {Object} [obj=this.object] - 对象绑定的回调。
  24267. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  24268. */
  24269. registerPriority(type, obj, func) {
  24270. this.register(type, obj, func, true);
  24271. }
  24272. /**
  24273. * @function Events.prototype.un
  24274. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  24275. * @example
  24276. * // 移除 "loadstart" 事件监听
  24277. * events.un({"loadstart": loadStartListener});
  24278. *
  24279. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  24280. * events.unregister("loadstart", undefined, loadStartListener);
  24281. *
  24282. * // 取消对象多个事件监听
  24283. * events.un({
  24284. * "loadstart": loadStartListener,
  24285. * "loadend": loadEndListener,
  24286. * scope: object
  24287. * });
  24288. *
  24289. * // 取消对象多个事件监听,多次调用unregister方法。
  24290. * events.unregister("loadstart", object, loadStartListener);
  24291. * events.unregister("loadend", object, loadEndListener);
  24292. *
  24293. * @param {Object} object - 移除监听的对象。
  24294. */
  24295. un(object) {
  24296. for (var type in object) {
  24297. if (type !== "scope" && object.hasOwnProperty(type)) {
  24298. this.unregister(type, object.scope, object[type]);
  24299. }
  24300. }
  24301. }
  24302. /**
  24303. * @function Events.prototype.unregister
  24304. * @description 取消注册。
  24305. * @param {string} type - 事件类型。
  24306. * @param {Object} [obj=this.object] - 对象绑定的回调。
  24307. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  24308. */
  24309. unregister(type, obj, func) {
  24310. if (obj == null) {
  24311. obj = this.object;
  24312. }
  24313. var listeners = this.listeners[type];
  24314. if (listeners != null) {
  24315. for (var i = 0, len = listeners.length; i < len; i++) {
  24316. if (listeners[i].obj === obj && listeners[i].func === func) {
  24317. listeners.splice(i, 1);
  24318. break;
  24319. }
  24320. }
  24321. }
  24322. }
  24323. /**
  24324. * @function Events.prototype.remove
  24325. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  24326. * @param {string} type - 事件类型。
  24327. */
  24328. remove(type) {
  24329. if (this.listeners[type] != null) {
  24330. this.listeners[type] = [];
  24331. }
  24332. }
  24333. /**
  24334. * @function Events.prototype.triggerEvent
  24335. * @description 触发一个特定的注册事件。
  24336. * @param {string} type - 触发事件类型。
  24337. * @param {Event} evt - 事件对象。
  24338. * @returns {Event|boolean} 监听对象,如果返回是 false,则停止监听。
  24339. */
  24340. triggerEvent(type, evt) {
  24341. var listeners = this.listeners[type];
  24342. // fast path
  24343. if (!listeners || listeners.length == 0) {
  24344. return undefined;
  24345. }
  24346. // prep evt object with object & div references
  24347. if (evt == null) {
  24348. evt = {};
  24349. }
  24350. evt.object = this.object;
  24351. evt.element = this.element;
  24352. if (!evt.type) {
  24353. evt.type = type;
  24354. }
  24355. // execute all callbacks registered for specified type
  24356. // get a clone of the listeners array to
  24357. // allow for splicing during callbacks
  24358. listeners = listeners.slice();
  24359. var continueChain;
  24360. for (var i = 0, len = listeners.length; i < len; i++) {
  24361. var callback = listeners[i];
  24362. // bind the context to callback.obj
  24363. continueChain = callback.func.apply(callback.obj, [evt]);
  24364. if ((continueChain != undefined) && (continueChain === false)) {
  24365. // if callback returns false, execute no more callbacks.
  24366. break;
  24367. }
  24368. }
  24369. // don't fall through to other DOM elements
  24370. if (!this.fallThrough) {
  24371. Event.stop(evt, true);
  24372. }
  24373. return continueChain;
  24374. }
  24375. /**
  24376. * @function Events.prototype.handleBrowserEvent
  24377. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  24378. * @param {Event} evt - 事件对象。
  24379. */
  24380. handleBrowserEvent(evt) {
  24381. var type = evt.type, listeners = this.listeners[type];
  24382. if (!listeners || listeners.length == 0) {
  24383. // noone's listening, bail out
  24384. return;
  24385. }
  24386. // add clientX & clientY to all events - corresponds to average x, y
  24387. var touches = evt.touches;
  24388. if (touches && touches[0]) {
  24389. var x = 0;
  24390. var y = 0;
  24391. var num = touches.length;
  24392. var touch;
  24393. for (var i = 0; i < num; ++i) {
  24394. touch = touches[i];
  24395. x += touch.clientX;
  24396. y += touch.clientY;
  24397. }
  24398. evt.clientX = x / num;
  24399. evt.clientY = y / num;
  24400. }
  24401. if (this.includeXY) {
  24402. evt.xy = this.getMousePosition(evt);
  24403. }
  24404. this.triggerEvent(type, evt);
  24405. }
  24406. /**
  24407. * @function Events.prototype.clearMouseCache
  24408. * @description 清除鼠标缓存。
  24409. */
  24410. clearMouseCache() {
  24411. this.element.scrolls = null;
  24412. this.element.lefttop = null;
  24413. var body = document.body;
  24414. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  24415. navigator.userAgent.match(/iPhone/i))) {
  24416. this.element.offsets = null;
  24417. }
  24418. }
  24419. /**
  24420. * @function Events.prototype.getMousePosition
  24421. * @description 获取当前鼠标的位置。
  24422. * @param {Event} evt - 事件对象。
  24423. * @returns {Pixel} 当前的鼠标的 xy 坐标点。
  24424. */
  24425. getMousePosition(evt) {
  24426. if (!this.includeXY) {
  24427. this.clearMouseCache();
  24428. } else if (!this.element.hasScrollEvent) {
  24429. Event.observe(window, "scroll", this.clearMouseListener);
  24430. this.element.hasScrollEvent = true;
  24431. }
  24432. if (!this.element.scrolls) {
  24433. var viewportElement = Util_Util.getViewportElement();
  24434. this.element.scrolls = [
  24435. viewportElement.scrollLeft,
  24436. viewportElement.scrollTop
  24437. ];
  24438. }
  24439. if (!this.element.lefttop) {
  24440. this.element.lefttop = [
  24441. (document.documentElement.clientLeft || 0),
  24442. (document.documentElement.clientTop || 0)
  24443. ];
  24444. }
  24445. if (!this.element.offsets) {
  24446. this.element.offsets = Util_Util.pagePosition(this.element);
  24447. }
  24448. return new Pixel(
  24449. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  24450. - this.element.lefttop[0],
  24451. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  24452. - this.element.lefttop[1]
  24453. );
  24454. }
  24455. }
  24456. Events.prototype.BROWSER_EVENTS = [
  24457. "mouseover", "mouseout",
  24458. "mousedown", "mouseup", "mousemove",
  24459. "click", "dblclick", "rightclick", "dblrightclick",
  24460. "resize", "focus", "blur",
  24461. "touchstart", "touchmove", "touchend",
  24462. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  24463. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  24464. "contextmenu"
  24465. ];
  24466. ;// CONCATENATED MODULE: ./src/common/commontypes/Feature.js
  24467. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24468. * This program are made available under the terms of the Apache License, Version 2.0
  24469. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24470. /**
  24471. * @class Feature
  24472. * @deprecatedclass SuperMap.Feature
  24473. * @category BaseTypes Geometry
  24474. * @classdesc 要素类组合了地理和属性,Feature 类同时具有 marker 和 lonlat 属性。
  24475. * @param {SuperMap.Layer} layer - 图层。
  24476. * @param {LonLat} lonlat - 经纬度。
  24477. * @param {Object} data - 数据对象。
  24478. * @usage
  24479. */
  24480. class Feature_Feature {
  24481. constructor(layer, lonlat, data) {
  24482. this.CLASS_NAME = "SuperMap.Feature";
  24483. /**
  24484. * @deprecated
  24485. * @member {SuperMap.Layer} Feature.prototype.layer
  24486. * @description 图层。
  24487. */
  24488. this.layer = layer;
  24489. /**
  24490. * @member {string} Feature.prototype.id
  24491. * @description 要素 ID。
  24492. */
  24493. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  24494. /**
  24495. * @member {LonLat} Feature.prototype.lonlat
  24496. * @description 经纬度。
  24497. *
  24498. */
  24499. this.lonlat = lonlat;
  24500. /**
  24501. * @member {Object} Feature.prototype.data
  24502. * @description 数据对象。
  24503. */
  24504. this.data = (data != null) ? data : {};
  24505. }
  24506. /**
  24507. * @function Feature.prototype.destroy
  24508. * @description 释放相关资源。
  24509. */
  24510. destroy() {
  24511. this.id = null;
  24512. this.lonlat = null;
  24513. this.data = null;
  24514. }
  24515. }
  24516. ;// CONCATENATED MODULE: ./src/common/commontypes/Vector.js
  24517. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24518. * This program are made available under the terms of the Apache License, Version 2.0
  24519. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24520. /**
  24521. * @class FeatureVector
  24522. * @aliasclass Feature.Vector
  24523. * @deprecatedclass SuperMap.Feature.Vector
  24524. * @category BaseTypes Geometry
  24525. * @classdesc 矢量要素类。该类具有 Geometry 属性存放几何信息,
  24526. * attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式,
  24527. * 其中,默认的样式在 {@link FeatureVector.style} 类中定义,如果没有特别的指定将使用默认的样式。
  24528. * @extends {Feature}
  24529. * @param {Geometry} geometry - 要素的几何信息。
  24530. * @param {Object} [attributes] - 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。
  24531. * @param {Object} [style] - 样式对象。
  24532. * @example
  24533. * var geometry = new GeometryPoint(-115,10);
  24534. * var style = {
  24535. * strokeColor:"#339933",
  24536. * strokeOpacity:1,
  24537. * strokeWidth:3,
  24538. * pointRadius:6
  24539. * }
  24540. * var pointFeature = new FeatureVector(geometry,null,style);
  24541. * vectorLayer.addFeatures(pointFeature);
  24542. * @usage
  24543. */
  24544. // TRASH THIS
  24545. const State = {
  24546. /** states */
  24547. UNKNOWN: 'Unknown',
  24548. INSERT: 'Insert',
  24549. UPDATE: 'Update',
  24550. DELETE: 'Delete'
  24551. };
  24552. class Vector extends Feature_Feature {
  24553. constructor(geometry, attributes, style) {
  24554. super(null, null, attributes);
  24555. /**
  24556. * @member {string} FeatureVector.prototype.fid
  24557. * @description fid。
  24558. */
  24559. this.fid = null;
  24560. /**
  24561. * @member {Geometry} FeatureVector.prototype.geometry
  24562. * @description 存放几何信息。
  24563. */
  24564. this.geometry = geometry ? geometry : null;
  24565. /**
  24566. * @member {Object} FeatureVector.prototype.attributes
  24567. * @description 描述要素的任意的可序列化属性。
  24568. */
  24569. this.attributes = {};
  24570. if (attributes) {
  24571. this.attributes = Util_Util.extend(this.attributes, attributes);
  24572. }
  24573. /**
  24574. * @member {Bounds} FeatureVector.prototype.bounds
  24575. * @description 限制要素几何的边界。
  24576. */
  24577. this.bounds = null;
  24578. /**
  24579. * @member {string} FeatureVector.prototype.state
  24580. * @description state。
  24581. */
  24582. this.state = null;
  24583. /**
  24584. * @member {Object} FeatureVector.prototype.style
  24585. * @description 要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。
  24586. */
  24587. this.style = style ? style : null;
  24588. /**
  24589. * @member {string} FeatureVector.prototype.url
  24590. * @description 如果设置了这个属性,在更新或者删除要素时需要考虑 {@link HTTP} 。
  24591. */
  24592. this.url = null;
  24593. this.lonlat = null;
  24594. this.CLASS_NAME = "SuperMap.Feature.Vector";
  24595. Vector.style = {
  24596. 'default': {
  24597. fillColor: "#ee9900",
  24598. fillOpacity: 0.4,
  24599. hoverFillColor: "white",
  24600. hoverFillOpacity: 0.8,
  24601. strokeColor: "#ee9900",
  24602. strokeOpacity: 1,
  24603. strokeWidth: 1,
  24604. strokeLinecap: "round",
  24605. strokeDashstyle: "solid",
  24606. hoverStrokeColor: "red",
  24607. hoverStrokeOpacity: 1,
  24608. hoverStrokeWidth: 0.2,
  24609. pointRadius: 6,
  24610. hoverPointRadius: 1,
  24611. hoverPointUnit: "%",
  24612. pointerEvents: "visiblePainted",
  24613. cursor: "inherit",
  24614. fontColor: "#000000",
  24615. labelAlign: "cm",
  24616. labelOutlineColor: "white",
  24617. labelOutlineWidth: 3
  24618. },
  24619. 'select': {
  24620. fillColor: "blue",
  24621. fillOpacity: 0.4,
  24622. hoverFillColor: "white",
  24623. hoverFillOpacity: 0.8,
  24624. strokeColor: "blue",
  24625. strokeOpacity: 1,
  24626. strokeWidth: 2,
  24627. strokeLinecap: "round",
  24628. strokeDashstyle: "solid",
  24629. hoverStrokeColor: "red",
  24630. hoverStrokeOpacity: 1,
  24631. hoverStrokeWidth: 0.2,
  24632. pointRadius: 6,
  24633. hoverPointRadius: 1,
  24634. hoverPointUnit: "%",
  24635. pointerEvents: "visiblePainted",
  24636. cursor: "pointer",
  24637. fontColor: "#000000",
  24638. labelAlign: "cm",
  24639. labelOutlineColor: "white",
  24640. labelOutlineWidth: 3
  24641. },
  24642. 'temporary': {
  24643. fillColor: "#66cccc",
  24644. fillOpacity: 0.2,
  24645. hoverFillColor: "white",
  24646. hoverFillOpacity: 0.8,
  24647. strokeColor: "#66cccc",
  24648. strokeOpacity: 1,
  24649. strokeLinecap: "round",
  24650. strokeWidth: 2,
  24651. strokeDashstyle: "solid",
  24652. hoverStrokeColor: "red",
  24653. hoverStrokeOpacity: 1,
  24654. hoverStrokeWidth: 0.2,
  24655. pointRadius: 6,
  24656. hoverPointRadius: 1,
  24657. hoverPointUnit: "%",
  24658. pointerEvents: "visiblePainted",
  24659. //cursor:"inherit",
  24660. cursor: "default",
  24661. fontColor: "#000000",
  24662. labelAlign: "cm",
  24663. labelOutlineColor: "white",
  24664. labelOutlineWidth: 3
  24665. },
  24666. 'delete': {
  24667. display: "none"
  24668. }
  24669. };
  24670. }
  24671. /**
  24672. * @function FeatureVector.prototype.destroy
  24673. * @description 释放资源,将引用资源的属性置空。
  24674. */
  24675. destroy() {
  24676. if (this.layer) {
  24677. this.layer.removeFeatures(this);
  24678. this.layer = null;
  24679. }
  24680. this.geometry = null;
  24681. super.destroy();
  24682. }
  24683. /**
  24684. * @function FeatureVector.prototype.clone
  24685. * @description 复制矢量要素,并返回复制后的新对象。
  24686. * @returns {FeatureVector} 相同要素的新的矢量要素。
  24687. */
  24688. clone() {
  24689. return new Vector(
  24690. this.geometry ? this.geometry.clone() : null,
  24691. this.attributes,
  24692. this.style);
  24693. }
  24694. /**
  24695. * @function FeatureVector.prototype.toState
  24696. * @description 设置新状态。
  24697. * @param {string} state - 状态。
  24698. */
  24699. toState(state) {
  24700. if (state === State.UPDATE) {
  24701. switch (this.state) {
  24702. case State.UNKNOWN:
  24703. case State.DELETE:
  24704. this.state = state;
  24705. break;
  24706. case State.UPDATE:
  24707. case State.INSERT:
  24708. break;
  24709. }
  24710. } else if (state === State.INSERT) {
  24711. switch (this.state) {
  24712. case State.UNKNOWN:
  24713. break;
  24714. default:
  24715. this.state = state;
  24716. break;
  24717. }
  24718. } else if (state === State.DELETE) {
  24719. switch (this.state) {
  24720. case State.INSERT:
  24721. // the feature should be destroyed
  24722. break;
  24723. case State.DELETE:
  24724. break;
  24725. case State.UNKNOWN:
  24726. case State.UPDATE:
  24727. this.state = state;
  24728. break;
  24729. }
  24730. } else if (state === State.UNKNOWN) {
  24731. this.state = state;
  24732. }
  24733. }
  24734. }
  24735. /**
  24736. *
  24737. * @typedef {Object} FeatureVector.style
  24738. * @description Feature 有大量的样式属性,如果没有特别的指定将使用默认的样式,
  24739. * 大部分样式通过 SVG 标准定义属性。
  24740. * - fill properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#FillProperties}
  24741. * - stroke properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#StrokeProperties}
  24742. * @property {boolean} [fill] - 不需要填充则设置为 false。
  24743. * @property {string} [fillColor='#ee9900'] - 十六进制填充颜色。
  24744. * @property {number} [fillOpacity=0.4] - 填充不透明度。
  24745. * @property {boolean} [stroke] - 不需要描边则设为 false。
  24746. * @property {string} [strokeColor='#ee9900'] - 十六进制描边颜色。
  24747. * @property {number} [strokeOpacity=0.4] - 描边的不透明度(0-1)。
  24748. * @property {number} [strokeWidth=1] - 像素描边宽度。
  24749. * @property {string} [strokeLinecap='round'] - strokeLinecap 有三种类型 butt,round,square。
  24750. * @property {string} [strokeDashstyle='solid'] - 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。
  24751. * @property {boolean} [graphic] - 不需要则设置为 false。
  24752. * @property {number} [pointRadius=6] - 像素点半径。
  24753. * @property {string} [pointerEvents='visiblePainted'] - pointerEvents。
  24754. * @property {string} [cursor] - cursor。
  24755. * @property {boolean} [allowRotate='false'] - 是否允许图标随着运行方向旋转。用于时空数据图层。
  24756. * @property {string} [externalGraphic] - 连接到用来渲染点的外部的图形。
  24757. * @property {number} [graphicWidth] - 外部图表的像素宽度。
  24758. * @property {number} [graphicHeight] - 外部图表的像素高度。
  24759. * @property {number} [graphicOpacity] - 外部图表的不透明度(0-1)。
  24760. * @property {number} [graphicXOffset] - 外部图表沿着x方向的偏移量。
  24761. * @property {number} [graphicYOffset] - 外部图表沿着y方向的偏移量。
  24762. * @property {number} [rotation] - 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。
  24763. * @property {number} [graphicZIndex] - 渲染时使用的索引值。
  24764. * @property {string} [graphicName='circle'] - 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。
  24765. * @property {string} [graphicTitle] - 外部图表的提示框。
  24766. * @property {string} [backgroundGraphic] - 外部图表的背景。
  24767. * @property {number} [backgroundGraphicZIndex] - 背景图渲染时使用的索引值。
  24768. * @property {number} [backgroundXOffset] - 背景图在 x 轴的偏移量。
  24769. * @property {number} [backgroundYOffset] - 背景图在 y 轴的偏移量。
  24770. * @property {number} [backgroundHeight] - 背景图的高度。如果没有设置,将用 graphicHeight。
  24771. * @property {number} [backgroundWidth] - 背景图的宽度。如果没有设置,将用 graphicWidth。
  24772. * @property {boolean} [isUnicode=false] - 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码,
  24773. * 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "&#x61;",其中 "&#" 为前缀,标志这个为 unicode 编码,
  24774. * "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出,
  24775. * 比如,label 为 "&#x61;",这时页面显示的也是 "&#x61;"。
  24776. * @property {string} [label] - 可选的标签文本。
  24777. * @property {string} [labelAlign='cm'] - 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb",
  24778. * 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right;
  24779. * 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。
  24780. * @property {number} [labelXOffset] - 标签在 x 轴方向的偏移量。
  24781. * @property {number} [labelYOffset] - 标签在 y 轴方向的偏移量。
  24782. * @property {boolean} [labelSelect=false] - 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。
  24783. * @property {string} [fontColor='#000000'] - 标签字体颜色。
  24784. * @property {number} [fontOpacity] - 标签透明度 (0-1)。
  24785. * @property {string} [fontFamily] - 标签的字体类型。
  24786. * @property {string} [fontSize] - 标签的字体大小。
  24787. * @property {string} [fontStyle] - 标签的字体样式。
  24788. * @property {string} [fontWeight] - 标签的字体粗细。
  24789. * @property {string} [display] - 如果 display 属性设置为 “none”,符号将没有任何效果。
  24790. * @example
  24791. * // label的用法如下:
  24792. * function addGeoTest(){
  24793. * var geometry = new GeometryPoint(105, 35);
  24794. * var pointFeature = new FeatureVector(geometry);
  24795. * var styleTest = {
  24796. * label:"supermap",
  24797. * fontColor:"#0000ff",
  24798. * fontOpacity:"0.5",
  24799. * fontFamily:"隶书",
  24800. * fontSize:"8em",
  24801. * fontWeight:"bold",
  24802. * fontStyle:"italic",
  24803. * labelSelect:"true",
  24804. * }
  24805. * pointFeature.style = styleTest;
  24806. * vectorLayer.addFeatures([pointFeature]);
  24807. * }
  24808. */
  24809. ;// CONCATENATED MODULE: ./src/common/commontypes/index.js
  24810. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24811. * This program are made available under the terms of the Apache License, Version 2.0
  24812. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24813. ;// CONCATENATED MODULE: ./src/common/format/Format.js
  24814. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24815. * This program are made available under the terms of the Apache License, Version 2.0
  24816. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24817. /**
  24818. * @class Format
  24819. * @deprecatedclass SuperMap.Format
  24820. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  24821. * @category BaseTypes Format
  24822. * @param {Object} options - 可选参数。
  24823. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  24824. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  24825. * @usage
  24826. */
  24827. class Format {
  24828. constructor(options) {
  24829. /**
  24830. * @member {Object} Format.prototype.data
  24831. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  24832. */
  24833. this.data = null;
  24834. /**
  24835. * @member {Object} [Format.prototype.keepData=false]
  24836. * @description 保持最近读到的数据的引用(通过 data 属性)。
  24837. */
  24838. this.keepData = false;
  24839. Util_Util.extend(this, options);
  24840. this.options = options;
  24841. this.CLASS_NAME = "SuperMap.Format";
  24842. }
  24843. /**
  24844. * @function Format.prototype.destroy
  24845. * @description 销毁该格式类,释放相关资源。
  24846. */
  24847. destroy() {
  24848. //用来销毁该格式类,释放相关资源
  24849. }
  24850. /**
  24851. * @function Format.prototype.read
  24852. * @description 来从字符串中读取数据。
  24853. * @param {string} data - 读取的数据。
  24854. */
  24855. read(data) { // eslint-disable-line no-unused-vars
  24856. //用来从字符串中读取数据
  24857. }
  24858. /**
  24859. * @function Format.prototype.write
  24860. * @description 将对象写成字符串。
  24861. * @param {Object} object - 可序列化的对象。
  24862. * @returns {string} 对象转化后的字符串。
  24863. */
  24864. write(object) { // eslint-disable-line no-unused-vars
  24865. //用来写字符串
  24866. }
  24867. }
  24868. ;// CONCATENATED MODULE: ./src/common/format/JSON.js
  24869. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24870. * This program are made available under the terms of the Apache License, Version 2.0
  24871. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24872. /**
  24873. * @class JSONFormat
  24874. * @aliasclass Format.JSON
  24875. * @deprecatedclass SuperMap.Format.JSON
  24876. * @classdesc 安全的读写 JSON 的解析类。使用 {@link JSONFormat} 构造函数创建新实例。
  24877. * @category BaseTypes Format
  24878. * @param {Object} [options] - 可选参数。
  24879. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  24880. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  24881. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  24882. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  24883. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  24884. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  24885. * @extends {Format}
  24886. * @usage
  24887. */
  24888. class JSONFormat extends Format {
  24889. constructor(options) {
  24890. super(options);
  24891. /**
  24892. * @member {string} [JSONFormat.prototype.indent=" "]
  24893. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  24894. */
  24895. this.indent = " ";
  24896. /**
  24897. * @member {string} [JSONFormat.prototype.space=" "]
  24898. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  24899. */
  24900. this.space = " ";
  24901. /**
  24902. * @member {string} [JSONFormat.prototype.newline="\n"]
  24903. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  24904. */
  24905. this.newline = "\n";
  24906. /**
  24907. * @member {number} [JSONFormat.prototype.level=0]
  24908. * @description 用于格式化输出, 表示的是缩进级别。
  24909. */
  24910. this.level = 0;
  24911. /**
  24912. * @member {boolean} [JSONFormat.prototype.pretty=false]
  24913. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  24914. */
  24915. this.pretty = false;
  24916. /**
  24917. * @member {boolean} JSONFormat.prototype.nativeJSON
  24918. * @description 判断浏览器是否原生支持 JSON 格式数据。
  24919. */
  24920. this.nativeJSON = (function () {
  24921. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  24922. })();
  24923. this.CLASS_NAME = "SuperMap.Format.JSON";
  24924. /**
  24925. * @member JSONFormat.prototype.serialize
  24926. * @description 提供一些类型对象转 JSON 字符串的方法。
  24927. */
  24928. this.serialize = {
  24929. /**
  24930. * @function JSONFormat.serialize.object
  24931. * @description 把对象转换为 JSON 字符串。
  24932. * @param {Object} object - 可序列化的对象。
  24933. * @returns {string} JSON 字符串。
  24934. */
  24935. 'object': function (object) {
  24936. // three special objects that we want to treat differently
  24937. if (object == null) {
  24938. return "null";
  24939. }
  24940. if (object.constructor === Date) {
  24941. return this.serialize.date.apply(this, [object]);
  24942. }
  24943. if (object.constructor === Array) {
  24944. return this.serialize.array.apply(this, [object]);
  24945. }
  24946. var pieces = ['{'];
  24947. this.level += 1;
  24948. var key, keyJSON, valueJSON;
  24949. var addComma = false;
  24950. for (key in object) {
  24951. if (object.hasOwnProperty(key)) {
  24952. // recursive calls need to allow for sub-classing
  24953. keyJSON = this.write.apply(this,
  24954. [key, this.pretty]);
  24955. valueJSON = this.write.apply(this,
  24956. [object[key], this.pretty]);
  24957. if (keyJSON != null && valueJSON != null) {
  24958. if (addComma) {
  24959. pieces.push(',');
  24960. }
  24961. pieces.push(this.writeNewline(), this.writeIndent(),
  24962. keyJSON, ':', this.writeSpace(), valueJSON);
  24963. addComma = true;
  24964. }
  24965. }
  24966. }
  24967. this.level -= 1;
  24968. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  24969. return pieces.join('');
  24970. },
  24971. /**
  24972. * @function JSONFormat.serialize.array
  24973. * @description 把数组转换成 JSON 字符串。
  24974. * @param {Array} array - 可序列化的数组。
  24975. * @returns {string} JSON 字符串。
  24976. */
  24977. 'array': function (array) {
  24978. var json;
  24979. var pieces = ['['];
  24980. this.level += 1;
  24981. for (var i = 0, len = array.length; i < len; ++i) {
  24982. // recursive calls need to allow for sub-classing
  24983. json = this.write.apply(this,
  24984. [array[i], this.pretty]);
  24985. if (json != null) {
  24986. if (i > 0) {
  24987. pieces.push(',');
  24988. }
  24989. pieces.push(this.writeNewline(), this.writeIndent(), json);
  24990. }
  24991. }
  24992. this.level -= 1;
  24993. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  24994. return pieces.join('');
  24995. },
  24996. /**
  24997. * @function JSONFormat.serialize.string
  24998. * @description 把字符串转换成 JSON 字符串。
  24999. * @param {string} string - 可序列化的字符串。
  25000. * @returns {string} JSON 字符串。
  25001. */
  25002. 'string': function (string) {
  25003. // If the string contains no control characters, no quote characters, and no
  25004. // backslash characters, then we can simply slap some quotes around it.
  25005. // Otherwise we must also replace the offending characters with safe
  25006. // sequences.
  25007. var m = {
  25008. '\b': '\\b',
  25009. '\t': '\\t',
  25010. '\n': '\\n',
  25011. '\f': '\\f',
  25012. '\r': '\\r',
  25013. '"': '\\"',
  25014. '\\': '\\\\'
  25015. };
  25016. /*eslint-disable no-control-regex*/
  25017. if (/["\\\x00-\x1f]/.test(string)) {
  25018. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  25019. var c = m[b];
  25020. if (c) {
  25021. return c;
  25022. }
  25023. c = b.charCodeAt();
  25024. return '\\u00' +
  25025. Math.floor(c / 16).toString(16) +
  25026. (c % 16).toString(16);
  25027. }) + '"';
  25028. }
  25029. return '"' + string + '"';
  25030. },
  25031. /**
  25032. * @function JSONFormat.serialize.number
  25033. * @description 把数字转换成 JSON 字符串。
  25034. * @param {number} number - 可序列化的数字。
  25035. * @returns {string} JSON 字符串。
  25036. */
  25037. 'number': function (number) {
  25038. return isFinite(number) ? String(number) : "null";
  25039. },
  25040. /**
  25041. * @function JSONFormat.serialize.boolean
  25042. * @description Transform a boolean into a JSON string.
  25043. * @param {boolean} bool - The boolean to be serialized.
  25044. * @returns {string} A JSON string representing the boolean.
  25045. */
  25046. 'boolean': function (bool) {
  25047. return String(bool);
  25048. },
  25049. /**
  25050. * @function JSONFormat.serialize.object
  25051. * @description 将日期对象转换成 JSON 字符串。
  25052. * @param {Date} date - 可序列化的日期对象。
  25053. * @returns {string} JSON 字符串。
  25054. */
  25055. 'date': function (date) {
  25056. function format(number) {
  25057. // Format integers to have at least two digits.
  25058. return (number < 10) ? '0' + number : number;
  25059. }
  25060. return '"' + date.getFullYear() + '-' +
  25061. format(date.getMonth() + 1) + '-' +
  25062. format(date.getDate()) + 'T' +
  25063. format(date.getHours()) + ':' +
  25064. format(date.getMinutes()) + ':' +
  25065. format(date.getSeconds()) + '"';
  25066. }
  25067. };
  25068. }
  25069. /**
  25070. * @function JSONFormat.prototype.read
  25071. * @description 将一个符合 JSON 结构的字符串进行解析。
  25072. * @param {string} json - 符合 JSON 结构的字符串。
  25073. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  25074. * @returns {(Object|string|Array|number|boolean)} 对象,数组,字符串或数字。
  25075. */
  25076. read(json, filter) {
  25077. var object;
  25078. if (this.nativeJSON) {
  25079. try {
  25080. object = JSON.parse(json, filter);
  25081. } catch (e) {
  25082. // Fall through if the regexp test fails.
  25083. return { data: json}
  25084. }
  25085. }
  25086. if (this.keepData) {
  25087. this.data = object;
  25088. }
  25089. return object;
  25090. }
  25091. /**
  25092. * @function JSONFormat.prototype.write
  25093. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  25094. * @param {Object|string|Array|number|boolean} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  25095. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  25096. * @returns {string} 符合 JSON 格式的字符串。
  25097. *
  25098. */
  25099. write(value, pretty) {
  25100. this.pretty = !!pretty;
  25101. var json = null;
  25102. var type = typeof value;
  25103. if (this.serialize[type]) {
  25104. try {
  25105. json = (!this.pretty && this.nativeJSON) ?
  25106. JSON.stringify(value) :
  25107. this.serialize[type].apply(this, [value]);
  25108. } catch (err) {
  25109. //console.error("Trouble serializing: " + err);
  25110. }
  25111. }
  25112. return json;
  25113. }
  25114. /**
  25115. * @function JSONFormat.prototype.writeIndent
  25116. * @description 根据缩进级别输出一个缩进字符串。
  25117. * @private
  25118. * @returns {string} 一个适当的缩进字符串。
  25119. */
  25120. writeIndent() {
  25121. var pieces = [];
  25122. if (this.pretty) {
  25123. for (var i = 0; i < this.level; ++i) {
  25124. pieces.push(this.indent);
  25125. }
  25126. }
  25127. return pieces.join('');
  25128. }
  25129. /**
  25130. * @function JSONFormat.prototype.writeNewline
  25131. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  25132. * @private
  25133. * @returns {string} 代表新的一行的字符串。
  25134. */
  25135. writeNewline() {
  25136. return (this.pretty) ? this.newline : '';
  25137. }
  25138. /**
  25139. * @function JSONFormat.prototype.writeSpace
  25140. * @private
  25141. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  25142. * @returns {string} 空格字符串。
  25143. */
  25144. writeSpace() {
  25145. return (this.pretty) ? this.space : '';
  25146. }
  25147. }
  25148. ;// CONCATENATED MODULE: ./src/common/iServer/ServerColor.js
  25149. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25150. * This program are made available under the terms of the Apache License, Version 2.0
  25151. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25152. /**
  25153. * @class ServerColor
  25154. * @deprecatedclass SuperMap.ServerColor
  25155. * @category iServer Map Theme
  25156. * @classdesc 颜色类。该类使用三原色( RGB )来表达颜色。
  25157. * @param {Object} options - 可选参数。
  25158. * @param {number} [options.red=255] - 获取或设置红色值。
  25159. * @param {number} [options.green=0] - 获取或设置绿色值。
  25160. * @param {number} [options.blue=0] - 获取或设置蓝色值。
  25161. * @usage
  25162. */
  25163. class ServerColor {
  25164. constructor(red, green, blue) {
  25165. /**
  25166. * @member {number} [ServerColor.prototype.red=255]
  25167. * @description 获取或设置红色值。
  25168. */
  25169. this.red = (!red && red != 0)?255:red;
  25170. /**
  25171. * @member {number} [ServerColor.prototype.green=0]
  25172. * @description 获取或设置绿色值。
  25173. */
  25174. this.green = green||0;
  25175. /**
  25176. * @member {number} [ServerColor.prototype.blue=0]
  25177. * @description 获取或设置蓝色值。
  25178. */
  25179. this.blue = blue||0;
  25180. this.CLASS_NAME = "SuperMap.ServerColor";
  25181. }
  25182. /**
  25183. * @function ServerColor.prototype.destroy
  25184. * @description 释放资源,将引用资源的属性置空。
  25185. */
  25186. destroy() {
  25187. var me = this;
  25188. me.red = null;
  25189. me.green = null;
  25190. me.blue = null;
  25191. }
  25192. /**
  25193. * @function ServerColor.formJson
  25194. * @description 将 JSON 对象转化为 ServerColor 对象。
  25195. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25196. * @returns {ServerColor} 转化后的 ServerColor 对象。
  25197. */
  25198. static fromJson(jsonObject) {
  25199. if (!jsonObject) {
  25200. return;
  25201. }
  25202. var color = new ServerColor();
  25203. var red = 255;
  25204. if (jsonObject.red !== null) {
  25205. red = Number(jsonObject.red);
  25206. }
  25207. color.red = red;
  25208. var green = 0;
  25209. if (jsonObject.green !== null) {
  25210. green = Number(jsonObject.green);
  25211. }
  25212. color.green = green;
  25213. var blue = 0;
  25214. if (jsonObject.blue !== null) {
  25215. blue = Number(jsonObject.blue);
  25216. }
  25217. color.blue = blue;
  25218. return color;
  25219. }
  25220. }
  25221. ;// CONCATENATED MODULE: ./src/common/iServer/ServerStyle.js
  25222. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25223. * This program are made available under the terms of the Apache License, Version 2.0
  25224. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25225. /**
  25226. * @class ServerStyle
  25227. * @deprecatedclass SuperMap.ServerStyle
  25228. * @category iServer Map Theme
  25229. * @classdesc 服务端矢量要素风格类。该类用于定义点状符号、线状符号、填充符号风格及其相关属性。
  25230. * @param {Object} options - 参数。
  25231. * @param {FillGradientMode} options.fillGradientMode - 渐变填充风格的渐变类型。
  25232. * @param {ServerColor} [options.fillBackColor=[255,255,255]] - 填充背景颜色。
  25233. * @param {boolean} [options.fillBackOpaque=false] - 背景是否不透明。
  25234. * @param {ServerColor} [options.fillForeColor=[255,0,0]] - 填充颜色。
  25235. * @param {number} [options.fillGradientAngle=0] - 渐变填充的旋转角度。
  25236. * @param {number} [options.fillGradientOffsetRatioX=0] - 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。
  25237. * @param {number} [options.fillGradientOffsetRatioY=0] - 填充中心点相对于填充区域范围中心点的垂直偏移百分比。
  25238. * @param {number} [options.fillOpaqueRate=100] - 填充不透明度。
  25239. * @param {number} [options.fillSymbolID=0] - 填充符号的编码。
  25240. * @param {ServerColor} [options.lineColor] - 矢量要素的边线颜色。默认 lineColor = new ServerColor(0, 0, 0)。
  25241. * @param {number} [options.lineSymbolID=0] - 线状符号的编码。
  25242. * @param {number} [options.lineWidth=1] - 边线的宽度。
  25243. * @param {number} [options.markerAngle=0] - 点状符号的旋转角度。
  25244. * @param {number} [options.markerSize=1] - 点状符号的大小。
  25245. * @param {number} [options.markerSymbolID=-1] - 点状符号的编码。
  25246. * @usage
  25247. */
  25248. class ServerStyle {
  25249. constructor(options) {
  25250. /**
  25251. * @member {ServerColor} ServerStyle.prototype.fillBackColor
  25252. * @description 填充背景颜色。当填充模式为渐变填充时,该颜色为填充终止色。
  25253. */
  25254. this.fillBackColor = new ServerColor(255, 255, 255);
  25255. /**
  25256. * @member {boolean} [ServerStyle.prototype.fillBackOpaque=false]
  25257. * @description 背景是否不透明。false 表示透明。
  25258. */
  25259. this.fillBackOpaque = false;
  25260. /**
  25261. * @member {ServerColor} ServerStyle.prototype.fillForeColor
  25262. * @description 填充颜色。当填充模式为渐变填充时,该颜色为填充起始颜色。
  25263. */
  25264. this.fillForeColor = new ServerColor(255, 0, 0);
  25265. /**
  25266. * @member {FillGradientMode} ServerStyle.prototype.fillGradientMode
  25267. * @description 渐变填充风格的渐变类型。
  25268. */
  25269. this.fillGradientMode = null;
  25270. /**
  25271. * @member {number} ServerStyle.prototype.fillGradientAngle -
  25272. * @description 渐变填充的旋转角度。单位为度,精确到 0.1 度,逆时针方向为正方向。
  25273. */
  25274. this.fillGradientAngle = 0;
  25275. /**
  25276. * @member {number} ServerStyle.prototype.fillGradientOffsetRatioX
  25277. * @description 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。它们的关系如下:设填充区域范围中心点的坐标为(x0, y0),
  25278. * 填充中心点的坐标为(x, y),填充区域范围的宽度为 a,水平偏移百分比为 dx,则 x=x0 + a*dx/100。
  25279. */
  25280. this.fillGradientOffsetRatioX = 0;
  25281. /**
  25282. * @member {number} ServerStyle.prototype.fillGradientOffsetRatioY
  25283. * @description 填充中心点相对于填充区域范围中心点的垂直偏移百分比。它们的关系如下:<br>
  25284. * 设填充区域范围中心点的坐标为(x0, y0),填充中心点的坐标为(x, y),填充区域范围的高度为 b,垂直偏移百分比为 dy,则 y=y0 + b*dx/100。
  25285. */
  25286. this.fillGradientOffsetRatioY = 0;
  25287. /**
  25288. * @member {number} [ServerStyle.prototype.fillOpaqueRate=100]
  25289. * @description 填充不透明度。合法值为 0 - 100 的数值。其中为 0 表示完全透明;
  25290. * 100 表示完全不透明。赋值小于 0 时按照 0 处理,大于 100 时按照 100 处理。
  25291. */
  25292. this.fillOpaqueRate = 100;
  25293. /**
  25294. * @member {number} ServerStyle.prototype.fillSymbolID
  25295. * @description 填充符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  25296. * 关于填充符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  25297. */
  25298. this.fillSymbolID = 0;
  25299. /**
  25300. * @member {ServerColor} ServerStyle.prototype.lineColor
  25301. * @description 矢量要素的边线颜色。如果等级符号是点符号,点符号的颜色由 lineColor 控制。
  25302. */
  25303. this.lineColor = new ServerColor(0, 0, 0);
  25304. /**
  25305. * @member {number} [ServerStyle.prototype.lineSymbolID=0]
  25306. * @description 线状符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  25307. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  25308. */
  25309. this.lineSymbolID = 0;
  25310. /**
  25311. * @member {number} [ServerStyle.prototype.lineWidth=1.0]
  25312. * @description 边线的宽度。单位为毫米,精度到 0.1。
  25313. */
  25314. this.lineWidth = 1;
  25315. /**
  25316. * @member {number} [ServerStyle.prototype.markerAngle=0]
  25317. * @description 点状符号的旋转角度。以度为单位,精确到 0.1 度,逆时针方向为正方向。
  25318. */
  25319. this.markerAngle = 0;
  25320. /**
  25321. * @member {number} [ServerStyle.prototype.markerSize=1.0]
  25322. * @description 点状符号的大小。单位为毫米,精度为 0.1。当该属性设置为0时,采用符号默认大小 1.0 显示。
  25323. * 当该属性设置为非法值时,交由服务器默认处理。
  25324. */
  25325. this.markerSize = 1;
  25326. /**
  25327. * @member {number} [ServerStyle.prototype.markerSymbolID=-1]
  25328. * @description 点状符号的编码。此编码用于唯一标识各点状符号。
  25329. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  25330. */
  25331. this.markerSymbolID = -1;
  25332. if (options) {
  25333. Util_Util.extend(this, options);
  25334. }
  25335. this.CLASS_NAME = "SuperMap.ServerStyle";
  25336. }
  25337. /**
  25338. * @function ServerStyle.prototype.destroy
  25339. * @description 释放资源,将引用资源的属性置空。
  25340. */
  25341. destroy() {
  25342. var me = this;
  25343. if (me.fillBackColor) {
  25344. me.fillBackColor.destroy();
  25345. me.fillBackColor = null;
  25346. }
  25347. me.fillBackOpaque = null;
  25348. if (me.fillForeColor) {
  25349. me.fillForeColor.destroy();
  25350. me.fillForeColor = null;
  25351. }
  25352. me.fillGradientMode = null;
  25353. me.fillGradientAngle = null;
  25354. me.fillGradientOffsetRatioX = null;
  25355. me.fillGradientOffsetRatioY = null;
  25356. me.fillOpaqueRate = null;
  25357. me.fillSymbolID = null;
  25358. if (me.lineColor) {
  25359. me.lineColor.destroy();
  25360. me.lineColor = null;
  25361. }
  25362. me.lineSymbolID = null;
  25363. me.lineWidth = null;
  25364. me.markerAngle = null;
  25365. me.markerSize = null;
  25366. me.markerSymbolID = null;
  25367. }
  25368. /**
  25369. * @function ServerStyle.prototype.toServerJSONObject
  25370. * @description 转换成对应的 JSON 格式对象。
  25371. * @returns {Object} 对应的 JSON 格式对象.
  25372. */
  25373. toServerJSONObject() {
  25374. var styleObj = {};
  25375. styleObj = Util_Util.copyAttributes(styleObj, this);
  25376. //暂时先忽略serverColor往Json的转换
  25377. return styleObj;
  25378. }
  25379. /**
  25380. * @function ServerStyle.fromJson
  25381. * @description 将JSON对象转换为 ServerStyle 对象。
  25382. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25383. * @returns {ServerStyle} 转化后的 ServerStyle 对象。
  25384. */
  25385. static fromJson(jsonObject) {
  25386. if (!jsonObject) {
  25387. return;
  25388. }
  25389. return new ServerStyle({
  25390. fillBackColor: ServerColor.fromJson(jsonObject.fillBackColor),
  25391. fillBackOpaque: jsonObject.fillBackOpaque,
  25392. fillForeColor: ServerColor.fromJson(jsonObject.fillForeColor),
  25393. fillGradientMode: jsonObject.fillGradientMode,
  25394. fillGradientAngle: jsonObject.fillGradientAngle,
  25395. fillGradientOffsetRatioX: jsonObject.fillGradientOffsetRatioX,
  25396. fillGradientOffsetRatioY: jsonObject.fillGradientOffsetRatioY,
  25397. fillOpaqueRate: jsonObject.fillOpaqueRate,
  25398. fillSymbolID: jsonObject.fillSymbolID,
  25399. lineColor: ServerColor.fromJson(jsonObject.lineColor),
  25400. lineSymbolID: jsonObject.lineSymbolID,
  25401. lineWidth: jsonObject.lineWidth,
  25402. markerAngle: jsonObject.markerAngle,
  25403. markerSize: jsonObject.markerSize,
  25404. markerSymbolID: jsonObject.markerSymbolID
  25405. });
  25406. }
  25407. }
  25408. ;// CONCATENATED MODULE: ./src/common/iServer/PointWithMeasure.js
  25409. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25410. * This program are made available under the terms of the Apache License, Version 2.0
  25411. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25412. /**
  25413. * @class PointWithMeasure
  25414. * @deprecatedclass SuperMap.PointWithMeasure
  25415. * @category iServer SpatialAnalyst RouteLocator
  25416. * @classdesc 路由点类。路由点是指具有线性度量值 (Measure) 的二维地理坐标点。
  25417. * @param {Object} options - 参数。
  25418. * @param {number} options.measure - 度量值,即路由对象属性值 M。
  25419. * @param {number} options.x - 地理坐标系下的 X 坐标值。
  25420. * @param {number} options.y - 地理坐标系下的 Y 坐标值。
  25421. * @extends {GeometryPoint}
  25422. * @usage
  25423. */
  25424. class PointWithMeasure extends Point {
  25425. constructor(options) {
  25426. super(options);
  25427. /**
  25428. * @member {number} PointWithMeasure.prototype.measure
  25429. * @description 度量值,即路由对象属性值 M。
  25430. */
  25431. this.measure = null;
  25432. if (options) {
  25433. Util_Util.extend(this, options);
  25434. }
  25435. this.CLASS_NAME = "SuperMap.PointWithMeasure";
  25436. }
  25437. /**
  25438. * @function PointWithMeasure.prototype.equals
  25439. * @description 判断两个路由点对象是否相等。如果两个路由点对象具有相同的坐标以及度量值,则认为是相等的。
  25440. * @param {PointWithMeasure} geom - 需要判断的路由点对象。
  25441. * @returns {boolean} 两个路由点对象是否相等(true 为相等,false 为不等)。
  25442. */
  25443. equals(geom) {
  25444. var equals = false;
  25445. if (geom != null) {
  25446. var isValueEquals = this.x === geom.x && this.y === geom.y && this.measure === geom.measure;
  25447. var isNaNValue = isNaN(this.x) && isNaN(this.y) && isNaN(this.measure);
  25448. var isNaNGeometry = isNaN(geom.x) && isNaN(geom.y) && isNaN(geom.measure);
  25449. equals = ( isValueEquals || ( isNaNValue && isNaNGeometry ));
  25450. }
  25451. return equals;
  25452. }
  25453. /**
  25454. * @function PointWithMeasure.prototype.toJson
  25455. * @description 转换为 JSON 对象。
  25456. * */
  25457. toJson() {
  25458. var result = "{";
  25459. if (this.measure != null && this.measure != undefined) {
  25460. result += "\"measure\":" + this.measure + ",";
  25461. }
  25462. result += "\"x\":" + this.x + ",";
  25463. result += "\"y\":" + this.y;
  25464. result += "}";
  25465. return result;
  25466. }
  25467. /**
  25468. * @function PointWithMeasure.prototype.destroy
  25469. * @description 释放资源,将引用资源的属性置空。
  25470. */
  25471. destroy() {
  25472. var me = this;
  25473. me.measure = null;
  25474. me.x = null;
  25475. me.y = null;
  25476. }
  25477. /**
  25478. * @function PointWithMeasure.fromJson
  25479. * @description 将 JSON 对象转换为{@link PointWithMeasure} 对象。
  25480. * @param {Object} jsonObject - JSON 对象表示的路由点。
  25481. * @returns {PointWithMeasure} 转化后的 PointWithMeasure 对象。
  25482. */
  25483. static fromJson(jsonObject) {
  25484. if (!jsonObject) {
  25485. return;
  25486. }
  25487. return new PointWithMeasure({
  25488. x: jsonObject.x,
  25489. y: jsonObject.y,
  25490. measure: jsonObject.measure
  25491. });
  25492. }
  25493. }
  25494. ;// CONCATENATED MODULE: ./src/common/iServer/Route.js
  25495. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25496. * This program are made available under the terms of the Apache License, Version 2.0
  25497. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25498. /**
  25499. * @class Route
  25500. * @deprecatedclass SuperMap.Route
  25501. * @category iServer SpatialAnalyst RouteCalculateMeasure
  25502. * @classdesc 路由对象类。路由对象为一系列有序的带有属性值 M 的 x,y 坐标对,其中 M 值为该结点的距离属性(到已知点的距离)。
  25503. * @param {Array.<Geometry>} points - 形成路由对象的线数组。
  25504. * @param {Object} options - 参数。
  25505. * @param {number} options.id - 路由对象在数据库中的 ID。
  25506. * @param {number} options.length - 路由对象的长度。单位与数据集的单位相同。
  25507. * @param {number} [options.maxM] - 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  25508. * @param {number} [options.minM] - 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  25509. * @param {string} [options.type] - 数据类型,如:"LINEM"。
  25510. * @extends GeometryCollection
  25511. * @usage
  25512. */
  25513. class Route extends Collection {
  25514. constructor(points, options) {
  25515. super(points, options);
  25516. /**
  25517. * @member {number} Route.prototype.id
  25518. * @description 路由对象在数据库中的 ID。
  25519. */
  25520. this.id = null;
  25521. /**
  25522. * @member {number} Route.prototype.center
  25523. * @description 路由对象的中心点。
  25524. */
  25525. this.center = null;
  25526. /**
  25527. * @member {string} Route.prototype.style
  25528. * @description 路由对象的样式。
  25529. */
  25530. this.style = null;
  25531. /**
  25532. * @member {number} Route.prototype.length
  25533. * @description 路由对象的长度。单位与数据集的单位相同。
  25534. */
  25535. this.length = null;
  25536. /**
  25537. * @member {number} Route.prototype.maxM
  25538. * @description 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  25539. */
  25540. this.maxM = null;
  25541. /**
  25542. * @member {number} Route.prototype.minM
  25543. * @description 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  25544. */
  25545. this.minM = null;
  25546. /**
  25547. * @member {Array.<number>} Route.prototype.parts
  25548. * @description 服务端几何对象中各个子对象所包含的节点个数。
  25549. */
  25550. this.parts = null;
  25551. /**
  25552. * @member {Array.<Object>} Route.prototype.points
  25553. * @description 路由对象的所有路由点。
  25554. * @example
  25555. * (start code)
  25556. * [
  25557. * {
  25558. * "measure": 0,
  25559. * "y": -4377.027184298267,
  25560. * "x": 4020.0045221720466
  25561. * },
  25562. * {
  25563. * "measure": 37.33288381391519,
  25564. * "y": -4381.569363260499,
  25565. * "x": 4057.0600591960642
  25566. * }
  25567. * ]
  25568. * (end)
  25569. */
  25570. this.points = null;
  25571. /**
  25572. * @member {string} Route.prototype.type
  25573. * @description 服务端几何对象类型。
  25574. */
  25575. this.type = null;
  25576. /**
  25577. * @member {Array.<string>} [Route.prototype.componentTypes=LineString]
  25578. * @description components 存储的几何对象所支持的几何类型数组。
  25579. */
  25580. this.componentTypes = ["SuperMap.Geometry.LinearRing", "SuperMap.Geometry.LineString"];
  25581. if (options) {
  25582. Util_Util.extend(this, options);
  25583. }
  25584. this.CLASS_NAME = "SuperMap.Route";
  25585. this.geometryType = "LINEM";
  25586. }
  25587. /**
  25588. *
  25589. * @function Route.prototype.toJson
  25590. * @description 转换为 JSON 对象。
  25591. * @returns {Object} JSON 对象。
  25592. */
  25593. toJson() {
  25594. var result = "{";
  25595. if (this.id != null && this.id != undefined) {
  25596. result += "\"id\":" + this.id + ",";
  25597. }
  25598. if (this.center != null && this.center != undefined) {
  25599. result += "\"center\":" + this.center + ",";
  25600. }
  25601. if (this.style != null && this.style != undefined) {
  25602. result += "\"style\":" + this.style + ",";
  25603. }
  25604. if (this.length != null && this.length != undefined) {
  25605. result += "\"length\":" + this.length + ",";
  25606. }
  25607. if (this.maxM != null && this.maxM != undefined) {
  25608. result += "\"maxM\":" + this.maxM + ",";
  25609. }
  25610. if (this.minM != null && this.minM != undefined) {
  25611. result += "\"minM\":" + this.minM + ",";
  25612. }
  25613. if (this.type != null && this.type != undefined) {
  25614. result += "\"type\":\"" + this.type + "\",";
  25615. }
  25616. if (this.parts != null && this.parts != undefined) {
  25617. result += "\"parts\":[" + this.parts[0];
  25618. for (var i = 1; i < this.parts.length; i++) {
  25619. result += "," + this.parts[i];
  25620. }
  25621. result += "],";
  25622. }
  25623. if (this.components != null && this.components.length > 0) {
  25624. result += "\"points\":[";
  25625. for (var j = 0, len = this.components.length; j < len; j++) {
  25626. for (var k = 0, len2 = this.components[j].components.length; k < len2; k++) {
  25627. result += this.components[j].components[k].toJson() + ",";
  25628. }
  25629. }
  25630. result = result.replace(/,$/g, '');
  25631. result += "]";
  25632. }
  25633. result = result.replace(/,$/g, '');
  25634. result += "}";
  25635. return result;
  25636. }
  25637. /**
  25638. * @function Route.prototype.destroy
  25639. * @override
  25640. */
  25641. destroy() {
  25642. var me = this;
  25643. me.id = null;
  25644. me.center = null;
  25645. me.style = null;
  25646. me.length = null;
  25647. me.maxM = null;
  25648. me.minM = null;
  25649. me.type = null;
  25650. me.parts = null;
  25651. me.components.length = 0;
  25652. me.components = null;
  25653. me.componentTypes = null;
  25654. }
  25655. /**
  25656. * @function Route.fromJson
  25657. * @description 将 JSON 对象转换为 Route 对象。
  25658. * @param {Object} [jsonObject] - JSON 对象表示的路由对象。
  25659. * @returns {Route} 转化后的 Route 对象。
  25660. */
  25661. static fromJson(jsonObject) {
  25662. if (!jsonObject) {
  25663. return;
  25664. }
  25665. var geoParts = jsonObject.parts || [],
  25666. geoPoints = jsonObject.points || [],
  25667. len = geoParts.length,
  25668. lineList = [];
  25669. if (len > 0) {
  25670. for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) {
  25671. for (var j = 0; j < geoParts[i]; j++) {
  25672. pointList.push(PointWithMeasure.fromJson(geoPoints[pointIndex + j]));
  25673. }
  25674. pointIndex += geoParts[i];
  25675. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  25676. if (pointList[0].equals(pointList[geoParts[i] - 1])) {
  25677. lineList.push(new LinearRing_LinearRing(pointList));
  25678. } else {
  25679. lineList.push(new LineString(pointList));
  25680. }
  25681. pointList = [];
  25682. }
  25683. } else {
  25684. return null;
  25685. }
  25686. return new Route(lineList, {
  25687. id: jsonObject.id,
  25688. center: jsonObject.center,
  25689. style: jsonObject.style,
  25690. length: jsonObject.length,
  25691. maxM: jsonObject.maxM,
  25692. minM: jsonObject.minM,
  25693. type: jsonObject.type,
  25694. parts: jsonObject.parts
  25695. });
  25696. }
  25697. }
  25698. ;// CONCATENATED MODULE: ./src/common/iServer/ServerGeometry.js
  25699. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25700. * This program are made available under the terms of the Apache License, Version 2.0
  25701. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25702. /**
  25703. * @class ServerGeometry
  25704. * @deprecatedclass SuperMap.ServerGeometry
  25705. * @category iServer Data Feature
  25706. * @classdesc 服务端几何对象类。该类描述几何对象(矢量)的特征数据(坐标点对、几何对象的类型等)。基于服务端的空间分析、空间关系运算、查询等 GIS 服务功能使用服务端几何对象。
  25707. * @param {Object} options - 参数。
  25708. * @param {string} options.id - 服务端几何对象唯一标识符。
  25709. * @param {Array.<number>} options.parts - 服务端几何对象中各个子对象所包含的节点个数。
  25710. * @param {Array.<GeometryPoint>} options.points - 组成几何对象的节点的坐标对数组。
  25711. * @param {GeometryType} options.type - 几何对象的类型。
  25712. * @param {ServerStyle} [options.style] - 服务端几何对象的风格。
  25713. * @usage
  25714. */
  25715. class ServerGeometry {
  25716. constructor(options) {
  25717. /**
  25718. * @member {string} ServerGeometry.prototype.id
  25719. * @description 服务端几何对象唯一标识符。
  25720. */
  25721. this.id = 0;
  25722. /**
  25723. * @member {ServerStyle} [ServerGeometry.prototype.style]
  25724. * @description 服务端几何对象的风格(ServerStyle)。
  25725. */
  25726. this.style = null;
  25727. /**
  25728. * @member {Array.<number>} ServerGeometry.prototype.parts
  25729. * @description 服务端几何对象中各个子对象所包含的节点个数。<br>
  25730. * 1.几何对象从结构上可以分为简单几何对象和复杂几何对象。
  25731. * 简单几何对象与复杂几何对象的区别:简单的几何对象一般为单一对象,
  25732. * 而复杂的几何对象由多个简单对象组成或经过一定的空间运算之后产生,
  25733. * 如:矩形为简单的区域对象,而中空的矩形为复杂的区域对象。<br>
  25734. * 2.通常情况,一个简单几何对象的子对象就是它本身,
  25735. * 因此对于简单对象来说的该字段为长度为1的整型数组,
  25736. * 该字段的值就是这个简单对象节点的个数。
  25737. * 如果一个几何对象是由几个简单对象组合而成的,
  25738. * 例如,一个岛状几何对象由 3 个简单的多边形组成而成,
  25739. * 那么这个岛状的几何对象的 Parts 字段值就是一个长度为 3 的整型数组,
  25740. * 数组中每个成员的值分别代表这三个多边形所包含的节点个数。
  25741. */
  25742. this.parts = null;
  25743. /**
  25744. * @member {Array.<GeometryPoint>} ServerGeometry.prototype.points
  25745. * @description 组成几何对象的节点的坐标对数组。<br>
  25746. * 1.所有几何对象(点、线、面)都是由一些简单的点坐标组成的,
  25747. * 该字段存放了组成几何对象的点坐标的数组。
  25748. * 对于简单的面对象,他的起点和终点的坐标点相同。<br>
  25749. * 2.对于复杂的几何对象,根据 Parts 属性来确定每一个组成复杂几何对象的简单对象所对应的节点的个数,
  25750. * 从而确定 Points 字段中坐标对的分配归属问题。
  25751. */
  25752. this.points = null;
  25753. /**
  25754. * @member {GeometryType} ServerGeometry.prototype.type
  25755. * @description 几何对象的类型(GeometryType)。
  25756. */
  25757. this.type = null;
  25758. /**
  25759. * @member {Object} ServerGeometry.prototype.prjCoordSys
  25760. * @description 投影坐标参数,现仅在缓冲区分析中有效。
  25761. */
  25762. this.prjCoordSys = null;
  25763. if (options) {
  25764. Util_Util.extend(this, options);
  25765. }
  25766. this.CLASS_NAME = 'SuperMap.ServerGeometry';
  25767. }
  25768. /**
  25769. * @function ServerGeometry.prototype.destroy
  25770. * @description 释放资源,将引用资源的属性置空。
  25771. */
  25772. destroy() {
  25773. var me = this;
  25774. me.id = null;
  25775. me.style = null;
  25776. me.parts = null;
  25777. me.partTopo = null;
  25778. me.points = null;
  25779. me.type = null;
  25780. me.prjCoordSys = null;
  25781. }
  25782. /**
  25783. * @function ServerGeometry.prototype.toGeometry
  25784. * @description 将服务端几何对象 ServerGeometry 转换为客户端几何对象 Geometry。
  25785. * @returns {Geometry} 转换后的客户端几何对象。
  25786. */
  25787. toGeometry() {
  25788. var me = this,
  25789. geoType = me.type;
  25790. switch (geoType.toUpperCase()) {
  25791. case REST_GeometryType.POINT:
  25792. return me.toGeoPoint();
  25793. case REST_GeometryType.LINE:
  25794. return me.toGeoLine();
  25795. case REST_GeometryType.LINEM:
  25796. return me.toGeoLinem();
  25797. case REST_GeometryType.REGION:
  25798. return me.toGeoRegion();
  25799. case REST_GeometryType.POINTEPS:
  25800. return me.toGeoPoint();
  25801. case REST_GeometryType.LINEEPS:
  25802. return me.toGeoLineEPS();
  25803. case REST_GeometryType.REGIONEPS:
  25804. return me.toGeoRegionEPS();
  25805. case REST_GeometryType.GEOCOMPOUND:
  25806. return me.transformGeoCompound();
  25807. }
  25808. }
  25809. /**
  25810. * @function ServerGeometry.prototype.toGeoPoint
  25811. * @description 将服务端的点几何对象转换为客户端几何对象。包括 Point、MultiPoint。
  25812. * @returns {Geometry} 转换后的客户端几何对象。
  25813. */
  25814. toGeoPoint() {
  25815. var me = this,
  25816. geoParts = me.parts || [],
  25817. geoPoints = me.points || [],
  25818. len = geoParts.length;
  25819. if (len > 0) {
  25820. if (len === 1) {
  25821. return new Point(geoPoints[0].x, geoPoints[0].y);
  25822. } else {
  25823. var pointList = [];
  25824. for (let i = 0; i < len; i++) {
  25825. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  25826. }
  25827. return new MultiPoint(pointList);
  25828. }
  25829. } else {
  25830. return null;
  25831. }
  25832. }
  25833. /**
  25834. * @function ServerGeometry.prototype.toGeoLine
  25835. * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
  25836. * @returns {Geometry} 转换后的客户端几何对象。
  25837. */
  25838. toGeoLine() {
  25839. var me = this,
  25840. geoParts = me.parts || [],
  25841. geoPoints = me.points || [],
  25842. len = geoParts.length;
  25843. if (len > 0) {
  25844. if (len === 1) {
  25845. let pointList = [];
  25846. for (let i = 0; i < geoParts[0]; i++) {
  25847. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  25848. }
  25849. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  25850. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  25851. return new LinearRing_LinearRing(pointList);
  25852. } else {
  25853. return new LineString(pointList);
  25854. }
  25855. } else {
  25856. let lineList = [];
  25857. for (let i = 0; i < len; i++) {
  25858. let pointList = [];
  25859. for (let j = 0; j < geoParts[i]; j++) {
  25860. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  25861. }
  25862. lineList.push(new LineString(pointList));
  25863. geoPoints.splice(0, geoParts[i]);
  25864. }
  25865. return new MultiLineString(lineList);
  25866. }
  25867. } else {
  25868. return null;
  25869. }
  25870. }
  25871. /**
  25872. * @function ServerGeometry.prototype.toGeoLineEPS
  25873. * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
  25874. * @returns {Geometry} 转换后的客户端几何对象。
  25875. */
  25876. toGeoLineEPS() {
  25877. var me = this,
  25878. geoParts = me.parts || [],
  25879. geoPoints = me.points || [],
  25880. i,
  25881. j,
  25882. pointList,
  25883. lineList,
  25884. lineEPS,
  25885. len = geoParts.length;
  25886. if (len > 0) {
  25887. if (len === 1) {
  25888. for (i = 0, pointList = []; i < geoParts[0]; i++) {
  25889. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y, geoPoints[i].type));
  25890. }
  25891. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  25892. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  25893. lineEPS = LineString.createLineEPS(pointList);
  25894. return new LinearRing_LinearRing(lineEPS);
  25895. } else {
  25896. lineEPS = LineString.createLineEPS(pointList);
  25897. return new LineString(lineEPS);
  25898. }
  25899. } else {
  25900. for (i = 0, lineList = []; i < len; i++) {
  25901. for (j = 0, pointList = []; j < geoParts[i]; j++) {
  25902. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  25903. }
  25904. lineEPS = LineString.createLineEPS(pointList);
  25905. lineList.push(new LineString(lineEPS));
  25906. geoPoints.splice(0, geoParts[i]);
  25907. }
  25908. return new MultiLineString(lineList);
  25909. }
  25910. } else {
  25911. return null;
  25912. }
  25913. }
  25914. /**
  25915. * @function ServerGeometry.prototype.toGeoLinem
  25916. * @description 将服务端的路由线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  25917. * @returns {Geometry} 转换后的客户端几何对象。
  25918. */
  25919. toGeoLinem() {
  25920. var me = this;
  25921. return Route.fromJson(me);
  25922. }
  25923. /**
  25924. * @function ServerGeometry.prototype.toGeoRegion
  25925. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 GeometryPolygon。
  25926. * @returns {Geometry} 转换后的客户端几何对象。
  25927. */
  25928. toGeoRegion() {
  25929. var me = this,
  25930. geoParts = me.parts || [],
  25931. geoTopo = me.partTopo || [],
  25932. geoPoints = me.points || [],
  25933. len = geoParts.length;
  25934. if (len <= 0) {
  25935. return null;
  25936. }
  25937. var polygonArray = [];
  25938. var pointList = [];
  25939. if (len == 1) {
  25940. for (let i = 0; i < geoPoints.length; i++) {
  25941. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  25942. }
  25943. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(pointList)]));
  25944. return new MultiPolygon(polygonArray);
  25945. }
  25946. //处理复杂面
  25947. var CCWArray = [];
  25948. var areaArray = [];
  25949. var polygonArrayTemp = [];
  25950. var polygonBounds = [];
  25951. //polyon岛洞标识数组,初始都是岛。
  25952. var CCWIdent = [];
  25953. for (let i = 0, pointIndex = 0; i < len; i++) {
  25954. for (let j = 0; j < geoParts[i]; j++) {
  25955. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  25956. }
  25957. pointIndex += geoParts[i];
  25958. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(pointList)]);
  25959. pointList = [];
  25960. polygonArrayTemp.push(polygon);
  25961. if (geoTopo.length === 0) {
  25962. polygonBounds.push(polygon.getBounds());
  25963. }
  25964. CCWIdent.push(1);
  25965. areaArray.push(polygon.getArea());
  25966. }
  25967. //iServer 9D新增字段
  25968. if (geoTopo.length === 0) {
  25969. //根据面积排序
  25970. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  25971. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  25972. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  25973. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  25974. //目标polygon索引列表 -1标示没有被任何polygon包含,
  25975. var targetArray = [];
  25976. for (let i = 1; i < polygonArrayTemp.length; i++) {
  25977. for (let j = i - 1; j >= 0; j--) {
  25978. targetArray[i] = -1;
  25979. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  25980. CCWIdent[i] = CCWIdent[j] * -1;
  25981. if (CCWIdent[i] < 0) {
  25982. targetArray[i] = j;
  25983. }
  25984. break;
  25985. }
  25986. }
  25987. }
  25988. for (let i = 0; i < polygonArrayTemp.length; i++) {
  25989. if (CCWIdent[i] > 0) {
  25990. polygonArray.push(polygonArrayTemp[i]);
  25991. } else {
  25992. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  25993. polygonArrayTemp[i].components
  25994. );
  25995. //占位
  25996. polygonArray.push('');
  25997. }
  25998. }
  25999. } else {
  26000. polygonArray = new Array();
  26001. for (let i = 0; i < polygonArrayTemp.length; i++) {
  26002. if (geoTopo[i] && geoTopo[i] == -1) {
  26003. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  26004. } else {
  26005. if (CCWArray.length > 0 && polygonArray.length > 0) {
  26006. polygonArray[polygonArray.length - 1].components =
  26007. polygonArray[polygonArray.length - 1].components.concat(CCWArray);
  26008. CCWArray = [];
  26009. }
  26010. polygonArray.push(polygonArrayTemp[i]);
  26011. }
  26012. if (i == len - 1) {
  26013. var polyLength = polygonArray.length;
  26014. if (polyLength) {
  26015. polygonArray[polyLength - 1].components =
  26016. polygonArray[polyLength - 1].components.concat(CCWArray);
  26017. } else {
  26018. for (let k = 0, length = CCWArray.length; k < length; k++) {
  26019. polygonArray.push(new Polygon_Polygon(CCWArray));
  26020. }
  26021. }
  26022. }
  26023. }
  26024. }
  26025. return new MultiPolygon(polygonArray);
  26026. }
  26027. /**
  26028. * @function ServerGeometry.prototype.toGeoRegionEPS
  26029. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  26030. * @returns {Geometry} 转换后的客户端几何对象。
  26031. */
  26032. toGeoRegionEPS() {
  26033. var me = this,
  26034. geoParts = me.parts || [],
  26035. geoTopo = me.partTopo || [],
  26036. geoPoints = me.points || [],
  26037. len = geoParts.length;
  26038. if (len <= 0) {
  26039. return null;
  26040. }
  26041. var polygonArray = [];
  26042. var pointList = [];
  26043. var lineEPS;
  26044. if (len == 1) {
  26045. for (var i = 0; i < geoPoints.length; i++) {
  26046. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  26047. }
  26048. lineEPS = LineString.createLineEPS(pointList);
  26049. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]));
  26050. return new MultiPolygon(polygonArray);
  26051. }
  26052. //处理复杂面
  26053. var CCWArray = [];
  26054. var areaArray = [];
  26055. var polygonArrayTemp = [];
  26056. var polygonBounds = [];
  26057. //polyon岛洞标识数组,初始都是岛。
  26058. var CCWIdent = [];
  26059. for (let i = 0, pointIndex = 0; i < len; i++) {
  26060. for (let j = 0; j < geoParts[i]; j++) {
  26061. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  26062. }
  26063. pointIndex += geoParts[i];
  26064. lineEPS = LineString.createLineEPS(pointList);
  26065. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]);
  26066. pointList = [];
  26067. polygonArrayTemp.push(polygon);
  26068. if (geoTopo.length === 0) {
  26069. polygonBounds.push(polygon.getBounds());
  26070. }
  26071. CCWIdent.push(1);
  26072. areaArray.push(polygon.getArea());
  26073. }
  26074. //iServer 9D新增字段
  26075. if (geoTopo.length === 0) {
  26076. //根据面积排序
  26077. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  26078. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  26079. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  26080. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  26081. //目标polygon索引列表 -1标示没有被任何polygon包含,
  26082. var targetArray = [];
  26083. for (let i = 1; i < polygonArrayTemp.length; i++) {
  26084. for (let j = i - 1; j >= 0; j--) {
  26085. targetArray[i] = -1;
  26086. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  26087. CCWIdent[i] = CCWIdent[j] * -1;
  26088. if (CCWIdent[i] < 0) {
  26089. targetArray[i] = j;
  26090. }
  26091. break;
  26092. }
  26093. }
  26094. }
  26095. for (let i = 0; i < polygonArrayTemp.length; i++) {
  26096. if (CCWIdent[i] > 0) {
  26097. polygonArray.push(polygonArrayTemp[i]);
  26098. } else {
  26099. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  26100. polygonArrayTemp[i].components
  26101. );
  26102. //占位
  26103. polygonArray.push('');
  26104. }
  26105. }
  26106. } else {
  26107. polygonArray = new Array();
  26108. for (let i = 0; i < polygonArrayTemp.length; i++) {
  26109. if (geoTopo[i] && geoTopo[i] == -1) {
  26110. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  26111. } else {
  26112. if (CCWArray.length > 0 && polygonArray.length > 0) {
  26113. polygonArray[polygonArray.length - 1].components =
  26114. polygonArray[polygonArray.length - 1].components.concat(CCWArray);
  26115. CCWArray = [];
  26116. }
  26117. polygonArray.push(polygonArrayTemp[i]);
  26118. }
  26119. if (i == len - 1) {
  26120. var polyLength = polygonArray.length;
  26121. if (polyLength) {
  26122. polygonArray[polyLength - 1].components =
  26123. polygonArray[polyLength - 1].components.concat(CCWArray);
  26124. } else {
  26125. for (let k = 0, length = CCWArray.length; k < length; k++) {
  26126. polygonArray.push(new Polygon_Polygon(CCWArray));
  26127. }
  26128. }
  26129. }
  26130. }
  26131. }
  26132. return new MultiPolygon(polygonArray);
  26133. }
  26134. transformGeoCompound() {
  26135. const me = this,
  26136. geoParts = me.geoParts || [],
  26137. len = geoParts.length;
  26138. if (len <= 0) {
  26139. return null;
  26140. }
  26141. const geometryList = [];
  26142. for (let index = 0; index < len; index++) {
  26143. const geometry = geoParts[index];
  26144. geometryList.push(new ServerGeometry(geometry).toGeometry());
  26145. }
  26146. return new Collection(geometryList);
  26147. }
  26148. /**
  26149. * @function ServerGeometry.prototype.fromJson
  26150. * @description 将 JSON 对象表示服务端几何对象转换为 ServerGeometry。
  26151. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26152. * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
  26153. */
  26154. static fromJson(jsonObject) {
  26155. if (!jsonObject) {
  26156. return;
  26157. }
  26158. return new ServerGeometry({
  26159. id: jsonObject.id,
  26160. style: ServerStyle.fromJson(jsonObject.style),
  26161. parts: jsonObject.parts,
  26162. partTopo: jsonObject.partTopo,
  26163. points: jsonObject.points,
  26164. center: jsonObject.center,
  26165. length: jsonObject.length,
  26166. maxM: jsonObject.maxM,
  26167. minM: jsonObject.minM,
  26168. type: jsonObject.type
  26169. });
  26170. }
  26171. /**
  26172. * @function ServerGeometry.prototype.fromGeometry
  26173. * @description 将客户端 Geometry 转换成服务端 ServerGeometry。
  26174. * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
  26175. * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
  26176. */
  26177. static fromGeometry(geometry) {
  26178. if (!geometry) {
  26179. return;
  26180. }
  26181. var id = 0,
  26182. parts = [],
  26183. points = [],
  26184. type = null,
  26185. icomponents = geometry.components,
  26186. className = geometry.CLASS_NAME,
  26187. prjCoordSys = { epsgCode: geometry.SRID };
  26188. if (!isNaN(geometry.id)) {
  26189. id = geometry.id;
  26190. }
  26191. //坑爹的改法,没法,为了支持态势标绘,有时间就得全改
  26192. if (
  26193. className != 'SuperMap.Geometry.LinearRing' &&
  26194. className != 'SuperMap.Geometry.LineString' &&
  26195. (geometry instanceof MultiPoint || geometry instanceof MultiLineString)
  26196. ) {
  26197. let ilen = icomponents.length;
  26198. for (let i = 0; i < ilen; i++) {
  26199. const vertices = icomponents[i].getVertices();
  26200. let partPointsCount = vertices.length;
  26201. parts.push(partPointsCount);
  26202. for (let j = 0; j < partPointsCount; j++) {
  26203. points.push(new Point(vertices[j].x, vertices[j].y));
  26204. }
  26205. }
  26206. //这里className不是多点就全部是算线
  26207. type = className == 'SuperMap.Geometry.MultiPoint' ? REST_GeometryType.POINT : REST_GeometryType.LINE;
  26208. } else if (geometry instanceof MultiPolygon) {
  26209. let ilen = icomponents.length;
  26210. for (let i = 0; i < ilen; i++) {
  26211. let polygon = icomponents[i],
  26212. linearRingOfPolygon = polygon.components,
  26213. linearRingOfPolygonLen = linearRingOfPolygon.length;
  26214. for (let j = 0; j < linearRingOfPolygonLen; j++) {
  26215. const vertices = linearRingOfPolygon[j].getVertices();
  26216. const partPointsCount = vertices.length + 1;
  26217. parts.push(partPointsCount);
  26218. for (let k = 0; k < partPointsCount - 1; k++) {
  26219. points.push(new Point(vertices[k].x, vertices[k].y));
  26220. }
  26221. points.push(
  26222. new Point(vertices[0].x, vertices[0].y)
  26223. );
  26224. }
  26225. }
  26226. type = REST_GeometryType.REGION;
  26227. } else if (geometry instanceof Polygon_Polygon) {
  26228. let ilen = icomponents.length;
  26229. for (let i = 0; i < ilen; i++) {
  26230. const vertices = icomponents[i].getVertices();
  26231. let partPointsCount = vertices.length + 1;
  26232. parts.push(partPointsCount);
  26233. for (let j = 0; j < partPointsCount - 1; j++) {
  26234. points.push(new Point(vertices[j].x, vertices[j].y));
  26235. }
  26236. points.push(new Point(vertices[0].x, vertices[0].y));
  26237. }
  26238. type = REST_GeometryType.REGION;
  26239. } else {
  26240. const vertices = geometry.getVertices();
  26241. let geometryVerticesCount = vertices.length;
  26242. for (let j = 0; j < geometryVerticesCount; j++) {
  26243. points.push(new Point(vertices[j].x, vertices[j].y));
  26244. }
  26245. if (geometry instanceof LinearRing_LinearRing) {
  26246. points.push(new Point(vertices[0].x, vertices[0].y));
  26247. geometryVerticesCount++;
  26248. }
  26249. parts.push(geometryVerticesCount);
  26250. type = geometry instanceof Point ? REST_GeometryType.POINT : REST_GeometryType.LINE;
  26251. }
  26252. return new ServerGeometry({
  26253. id: id,
  26254. style: null,
  26255. parts: parts,
  26256. points: points,
  26257. type: type,
  26258. prjCoordSys: prjCoordSys
  26259. });
  26260. }
  26261. /**
  26262. * @function ServerGeometry.prototype.IsClockWise
  26263. * @description 判断 linearRing 中的点的顺序。返回值大于 0,逆时针;小于 0,顺时针。
  26264. * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
  26265. * @returns {number} 返回值大于 0,逆时针;小于 0,顺时针。
  26266. */
  26267. static IsClockWise(points) {
  26268. var length = points.length;
  26269. if (length < 3) {
  26270. return 0.0;
  26271. }
  26272. var s = points[0].y * (points[length - 1].x - points[1].x);
  26273. points.push(points[0]);
  26274. for (var i = 1; i < length; i++) {
  26275. s += points[i].y * (points[i - 1].x - points[i + 1].x);
  26276. }
  26277. return s * 0.5;
  26278. }
  26279. static bubbleSort(areaArray, pointList, geoTopo, polygonBounds) {
  26280. for (var i = 0; i < areaArray.length; i++) {
  26281. for (var j = 0; j < areaArray.length; j++) {
  26282. if (areaArray[i] > areaArray[j]) {
  26283. var d = areaArray[j];
  26284. areaArray[j] = areaArray[i];
  26285. areaArray[i] = d;
  26286. var b = pointList[j];
  26287. pointList[j] = pointList[i];
  26288. pointList[i] = b;
  26289. if (geoTopo && geoTopo.length > 0) {
  26290. var c = geoTopo[j];
  26291. geoTopo[j] = geoTopo[i];
  26292. geoTopo[i] = c;
  26293. }
  26294. if (polygonBounds && polygonBounds.length > 0) {
  26295. var f = polygonBounds[j];
  26296. polygonBounds[j] = polygonBounds[i];
  26297. polygonBounds[i] = f;
  26298. }
  26299. }
  26300. }
  26301. }
  26302. }
  26303. }
  26304. ;// CONCATENATED MODULE: ./src/common/format/GeoJSON.js
  26305. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26306. * This program are made available under the terms of the Apache License, Version 2.0
  26307. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26308. /**
  26309. * @class GeoJSONFormat
  26310. * @aliasclass Format.GeoJSON
  26311. * @deprecatedclass SuperMap.Format.GeoJSON
  26312. * @classdesc GeoJSON 的读和写。使用 {@link GeoJSONObject} 构造器创建一个 GeoJSON 解析器。
  26313. * @category BaseTypes Format
  26314. * @param {Object} [options] - 可选参数。
  26315. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  26316. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  26317. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  26318. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  26319. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  26320. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  26321. * @param {boolean} [options.ignoreExtraDims=true] - 忽略维度超过 2 的几何要素。
  26322. * @extends {JSONFormat}
  26323. * @usage
  26324. */
  26325. class GeoJSON extends JSONFormat {
  26326. constructor(options) {
  26327. super(options);
  26328. /**
  26329. * @member {boolean} [GeoJSONFormat.prototype.ignoreExtraDims=true]
  26330. * @description 忽略维度超过 2 的几何要素。
  26331. */
  26332. this.ignoreExtraDims = true;
  26333. this.CLASS_NAME = "SuperMap.Format.GeoJSON";
  26334. /**
  26335. * @member {Object} GeoJSONFormat.prototype.parseCoords
  26336. * @private
  26337. * @description 一个属性名对应着 GeoJSON 对象的几何类型的对象。每个属性其实都是一个实际上做解析用的方法。
  26338. */
  26339. this.parseCoords = {
  26340. /**
  26341. * @function GeoJSONFormat.parseCoords.point
  26342. * @description 将一组坐标转成一个 {@link Geometry} 对象。
  26343. * @param {Object} array - GeoJSON 片段中的一组坐标。
  26344. * @returns {Geometry} 一个几何对象。
  26345. */
  26346. "point": function (array) {
  26347. if (this.ignoreExtraDims === false &&
  26348. array.length != 2) {
  26349. throw "Only 2D points are supported: " + array;
  26350. }
  26351. return new Point(array[0], array[1]);
  26352. },
  26353. /**
  26354. * @function GeoJSONFormat.parseCoords.multipoint
  26355. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  26356. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  26357. * @returns {Geometry} 一个几何对象。
  26358. */
  26359. "multipoint": function (array) {
  26360. var points = [];
  26361. var p = null;
  26362. for (var i = 0, len = array.length; i < len; ++i) {
  26363. try {
  26364. p = this.parseCoords["point"].apply(this, [array[i]]);
  26365. } catch (err) {
  26366. throw err;
  26367. }
  26368. points.push(p);
  26369. }
  26370. return new MultiPoint(points);
  26371. },
  26372. /**
  26373. * @function GeoJSONFormat.parseCoords.linestring
  26374. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  26375. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  26376. * @returns {Geometry} 一个几何对象。
  26377. */
  26378. "linestring": function (array) {
  26379. var points = [];
  26380. var p = null;
  26381. for (var i = 0, len = array.length; i < len; ++i) {
  26382. try {
  26383. p = this.parseCoords["point"].apply(this, [array[i]]);
  26384. } catch (err) {
  26385. throw err;
  26386. }
  26387. points.push(p);
  26388. }
  26389. return new LineString(points);
  26390. },
  26391. /**
  26392. * @function GeoJSONFormat.parseCoords.multilinestring
  26393. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  26394. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  26395. * @returns {Geometry} 一个几何对象。
  26396. */
  26397. "multilinestring": function (array) {
  26398. var lines = [];
  26399. var l = null;
  26400. for (var i = 0, len = array.length; i < len; ++i) {
  26401. try {
  26402. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  26403. } catch (err) {
  26404. throw err;
  26405. }
  26406. lines.push(l);
  26407. }
  26408. return new MultiLineString(lines);
  26409. },
  26410. /**
  26411. * @function GeoJSONFormat.parseCoords.polygon
  26412. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  26413. * @returns {Geometry} 一个几何对象。
  26414. */
  26415. "polygon": function (array) {
  26416. var rings = [];
  26417. var r, l;
  26418. for (var i = 0, len = array.length; i < len; ++i) {
  26419. try {
  26420. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  26421. } catch (err) {
  26422. throw err;
  26423. }
  26424. r = new LinearRing_LinearRing(l.components);
  26425. rings.push(r);
  26426. }
  26427. return new Polygon_Polygon(rings);
  26428. },
  26429. /**
  26430. * @function GeoJSONFormat.parseCoords.multipolygon
  26431. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  26432. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  26433. * @returns {Geometry} 一个几何对象。
  26434. */
  26435. "multipolygon": function (array) {
  26436. var polys = [];
  26437. var p = null;
  26438. for (var i = 0, len = array.length; i < len; ++i) {
  26439. try {
  26440. p = this.parseCoords["polygon"].apply(this, [array[i]]);
  26441. } catch (err) {
  26442. throw err;
  26443. }
  26444. polys.push(p);
  26445. }
  26446. return new MultiPolygon(polys);
  26447. },
  26448. /**
  26449. * @function GeoJSONFormat.parseCoords.box
  26450. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  26451. * @param {Array} array - GeoJSON 片段中的坐标组数组。
  26452. * @returns {Geometry} 一个几何对象。
  26453. */
  26454. "box": function (array) {
  26455. if (array.length != 2) {
  26456. throw "GeoJSON box coordinates must have 2 elements";
  26457. }
  26458. return new Polygon_Polygon([
  26459. new LinearRing_LinearRing([
  26460. new Point(array[0][0], array[0][1]),
  26461. new Point(array[1][0], array[0][1]),
  26462. new Point(array[1][0], array[1][1]),
  26463. new Point(array[0][0], array[1][1]),
  26464. new Point(array[0][0], array[0][1])
  26465. ])
  26466. ]);
  26467. }
  26468. };
  26469. /**
  26470. * @member {Object} GeoJSONFormat.prototype.extract
  26471. * @private
  26472. * @description 一个属性名对应着GeoJSON类型的对象。其值为相应的实际的解析方法。
  26473. */
  26474. this.extract = {
  26475. /**
  26476. * @function GeoJSONFormat.extract.feature
  26477. * @description 返回一个表示单个要素对象的 GeoJSON 的一部分。
  26478. * @param {SuperMap.ServerFeature} feature - iServer 要素对象。
  26479. * @returns {Object} 一个表示点的对象。
  26480. */
  26481. 'feature': function (feature) {
  26482. var geom = this.extract.geometry.apply(this, [feature.geometry]);
  26483. var json = {
  26484. "type": "Feature",
  26485. "properties": this.createAttributes(feature),
  26486. "geometry": geom
  26487. };
  26488. if (feature.geometry && feature.geometry.type === 'TEXT') {
  26489. json.properties.texts = feature.geometry.texts;
  26490. json.properties.textStyle = feature.geometry.textStyle;
  26491. }
  26492. if (feature.fid) {
  26493. json.id = feature.fid;
  26494. }
  26495. if (feature.ID) {
  26496. json.id = feature.ID;
  26497. }
  26498. return json;
  26499. },
  26500. /**
  26501. * @function GeoJSONFormat.extract.geometry
  26502. * @description 返回一个表示单个几何对象的 GeoJSON 的一部分。
  26503. * @param {Object} geometry - iServer 几何对象。
  26504. * @returns {Object} 一个表示几何体的对象。
  26505. */
  26506. 'geometry': function (geometry) {
  26507. if (geometry == null) {
  26508. return null;
  26509. }
  26510. if (!geometry.parts && geometry.points) {
  26511. geometry.parts = [geometry.points.length];
  26512. }
  26513. var geo = geometry.hasOwnProperty('geometryType')
  26514. ? geometry
  26515. : new ServerGeometry(geometry).toGeometry() || geometry;
  26516. var geometryType = geo.geometryType || geo.type;
  26517. var data;
  26518. if (geometryType === "LinearRing") {
  26519. geometryType = "LineString";
  26520. }
  26521. if (geometryType === "LINEM") {
  26522. geometryType = "MultiLineString";
  26523. }
  26524. data = this.extract[geometryType.toLowerCase()].apply(this, [geo]);
  26525. geometryType = geometryType === 'TEXT' ? 'Point' : geometryType;
  26526. var json;
  26527. if (geometryType === "Collection") {
  26528. json = {
  26529. "type": "GeometryCollection",
  26530. "geometries": data
  26531. };
  26532. } else {
  26533. json = {
  26534. "type": geometryType,
  26535. "coordinates": data
  26536. };
  26537. }
  26538. return json;
  26539. },
  26540. /**
  26541. * @function GeoJSONFormat.extract.point
  26542. * @description 从一个点对象中返回一个坐标组。
  26543. * @param {GeometryPoint} point - 一个点对象。
  26544. * @returns {Array} 一个表示一个点的坐标组。
  26545. */
  26546. 'point': function (point) {
  26547. var p = [point.x, point.y];
  26548. for (var name in point) {
  26549. if (name !== "x" && name !== "y" && point[name] !== null && !isNaN(point[name])) {
  26550. p.push(point[name]);
  26551. }
  26552. }
  26553. return p;
  26554. },
  26555. /**
  26556. * @function GeoJSONFormat.extract.point
  26557. * @description 从一个文本对象中返回一个坐标组。
  26558. * @param {Object} geo - 一个文本对象。
  26559. * @returns {Array} 一个表示一个点的坐标组。
  26560. */
  26561. 'text': function (geo) {
  26562. return [geo.points[0].x, geo.points[0].y];
  26563. },
  26564. /**
  26565. * @function GeoJSONFormat.extract.multipoint
  26566. * @description 从一个多点对象中返一个坐标组数组。
  26567. * @param {GeometryMultiPoint} multipoint - 多点对象。
  26568. * @returns {Array} 一个表示多点的坐标组数组。
  26569. */
  26570. 'multipoint': function (multipoint) {
  26571. var array = [];
  26572. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  26573. array.push(this.extract.point.apply(this, [multipoint.components[i]]));
  26574. }
  26575. return array;
  26576. },
  26577. /**
  26578. * @function GeoJSONFormat.extract.linestring
  26579. * @description 从一个线对象中返回一个坐标组数组。
  26580. * @param {Linestring} linestring - 线对象。
  26581. * @returns {Array} 一个表示线对象的坐标组数组。
  26582. */
  26583. 'linestring': function (linestring) {
  26584. var array = [];
  26585. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  26586. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  26587. }
  26588. return array;
  26589. },
  26590. /**
  26591. * @function GeoJSONFormat.extract.multilinestring
  26592. * @description 从一个多线对象中返回一个线数组。
  26593. * @param {GeometryMultiLineString} multilinestring - 多线对象。
  26594. *
  26595. * @returns {Array} 一个表示多线的线数组。
  26596. */
  26597. 'multilinestring': function (multilinestring) {
  26598. var array = [];
  26599. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  26600. array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
  26601. }
  26602. return array;
  26603. },
  26604. /**
  26605. * @function GeoJSONFormat.extract.polygon
  26606. * @description 从一个面对象中返回一组线环。
  26607. * @param {GeometryPolygon} polygon - 面对象。
  26608. * @returns {Array} 一组表示面的线环。
  26609. */
  26610. 'polygon': function (polygon) {
  26611. var array = [];
  26612. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  26613. array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
  26614. }
  26615. return array;
  26616. },
  26617. /**
  26618. * @function GeoJSONFormat.extract.multipolygon
  26619. * @description 从一个多面对象中返回一组面。
  26620. * @param {GeometryMultiPolygon} multipolygon - 多面对象。
  26621. * @returns {Array} 一组表示多面的面。
  26622. */
  26623. 'multipolygon': function (multipolygon) {
  26624. var array = [];
  26625. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  26626. array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
  26627. }
  26628. return array;
  26629. },
  26630. /**
  26631. * @function GeoJSONFormat.extract.collection
  26632. * @description 从一个几何要素集合中一组几何要素数组。
  26633. * @param {GeometryCollection} collection - 几何要素集合。
  26634. * @returns {Array} 一组表示几何要素集合的几何要素数组。
  26635. */
  26636. 'collection': function (collection) {
  26637. var len = collection.components.length;
  26638. var array = new Array(len);
  26639. for (var i = 0; i < len; ++i) {
  26640. array[i] = this.extract.geometry.apply(this, [collection.components[i]]);
  26641. }
  26642. return array;
  26643. }
  26644. };
  26645. }
  26646. /**
  26647. * @function GeoJSONFormat.prototype.read
  26648. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为 SuperMap Feature 对象。
  26649. * @param {GeoJSONObject} json - GeoJSON 对象。
  26650. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  26651. * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  26652. * @returns {Object} 返回值依赖于 type 参数的值。
  26653. * -如果 type 等于 "FeatureCollection",返回值将会是 {@link FeatureVector} 数组。
  26654. * -如果 type 为 "Geometry",输入的 JSON 对象必须表示一个唯一的几何体,然后返回值就会是 {@link Geometry}。
  26655. * -如果 type 为 "Feature",输入的 JSON 对象也必须表示的一个要素,这样返回值才会是 {@link FeatureVector}。
  26656. */
  26657. read(json, type, filter) {
  26658. type = (type) ? type : "FeatureCollection";
  26659. var results = null;
  26660. var obj = null;
  26661. if (typeof json == "string") {
  26662. obj = super.read(json, filter);
  26663. } else {
  26664. obj = json;
  26665. }
  26666. if (!obj) {
  26667. //console.error("Bad JSON: " + json);
  26668. } else if (typeof (obj.type) != "string") {
  26669. //console.error("Bad GeoJSON - no type: " + json);
  26670. } else if (this.isValidType(obj, type)) {
  26671. switch (type) {
  26672. case "Geometry":
  26673. try {
  26674. results = this.parseGeometry(obj);
  26675. } catch (err) {
  26676. //console.error(err);
  26677. }
  26678. break;
  26679. case "Feature":
  26680. try {
  26681. results = this.parseFeature(obj);
  26682. results.type = "Feature";
  26683. } catch (err) {
  26684. //console.error(err);
  26685. }
  26686. break;
  26687. case "FeatureCollection":
  26688. // for type FeatureCollection, we allow input to be any type
  26689. results = [];
  26690. switch (obj.type) {
  26691. case "Feature":
  26692. try {
  26693. results.push(this.parseFeature(obj));
  26694. } catch (err) {
  26695. results = null;
  26696. //console.error(err);
  26697. }
  26698. break;
  26699. case "FeatureCollection":
  26700. for (var i = 0, len = obj.features.length; i < len; ++i) {
  26701. try {
  26702. results.push(this.parseFeature(obj.features[i]));
  26703. } catch (err) {
  26704. results = null;
  26705. // console.error(err);
  26706. }
  26707. }
  26708. break;
  26709. default:
  26710. try {
  26711. var geom = this.parseGeometry(obj);
  26712. results.push(new Vector(geom));
  26713. } catch (err) {
  26714. results = null;
  26715. //console.error(err);
  26716. }
  26717. }
  26718. break;
  26719. default:
  26720. break;
  26721. }
  26722. }
  26723. return results;
  26724. }
  26725. /**
  26726. * @function GeoJSONFormat.prototype.write
  26727. * @description iServer Geometry JSON 对象 转 GeoJSON对象字符串。
  26728. * @param {Object} obj - iServer Geometry JSON 对象。
  26729. * @param {boolean} [pretty=false] - 是否使用换行和缩进来控制输出。
  26730. * @returns {GeoJSONObject} 一个 GeoJSON 字符串,它表示了输入的几何对象,要素对象,或者要素对象数组。
  26731. */
  26732. write(obj, pretty) {
  26733. return super.write(this.toGeoJSON(obj), pretty);
  26734. }
  26735. /**
  26736. * @function GeoJSONFormat.prototype.fromGeoJSON
  26737. * @version 9.1.1
  26738. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为iServer Feature JSON。
  26739. * @param {GeoJSONObject} json - GeoJSON 对象。
  26740. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  26741. * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  26742. * @returns {Object} iServer Feature JSON。
  26743. */
  26744. fromGeoJSON(json, type, filter) {
  26745. let feature = this.read(json, type, filter);
  26746. if (!Util_Util.isArray(feature)) {
  26747. return this._toiSevrerFeature(feature);
  26748. }
  26749. return feature.map((element) => {
  26750. return this._toiSevrerFeature(element);
  26751. })
  26752. }
  26753. /**
  26754. * @function GeoJSONFormat.prototype.toGeoJSON
  26755. * @version 9.1.1
  26756. * @description 将 iServer Feature JSON 对象转换为 GeoJSON 对象。
  26757. * @param {Object} obj - iServer Feature JSON。
  26758. * @returns {GeoJSONObject} GeoJSON 对象。
  26759. */
  26760. toGeoJSON(obj) {
  26761. var geojson = {
  26762. "type": null
  26763. };
  26764. if (Util_Util.isArray(obj)) {
  26765. geojson.type = "FeatureCollection";
  26766. var numFeatures = obj.length;
  26767. geojson.features = new Array(numFeatures);
  26768. for (var i = 0; i < numFeatures; ++i) {
  26769. var element = obj[i];
  26770. if (isGeometry(element)) {
  26771. let feature = {};
  26772. feature.geometry = element;
  26773. geojson.features[i] = this.extract.feature.apply(this, [feature]);
  26774. } else {
  26775. geojson.features[i] = this.extract.feature.apply(this, [element]);
  26776. }
  26777. }
  26778. } else if (isGeometry(obj)) {
  26779. let feature = {};
  26780. feature.geometry = obj;
  26781. geojson = this.extract.feature.apply(this, [feature]);
  26782. } else {
  26783. geojson = this.extract.feature.apply(this, [obj]);
  26784. }
  26785. function isGeometry(input) {
  26786. return (input.hasOwnProperty("parts") && input.hasOwnProperty("points")) || input.hasOwnProperty("geoParts");
  26787. }
  26788. return geojson;
  26789. }
  26790. /**
  26791. * @function GeoJSONFormat.prototype.isValidType
  26792. * @description 检查一个 GeoJSON 对象是否和给定的类型相符的合法的对象。
  26793. * @returns {boolean} GeoJSON 是否是给定类型的合法对象。
  26794. * @private
  26795. */
  26796. isValidType(obj, type) {
  26797. var valid = false;
  26798. switch (type) {
  26799. case "Geometry":
  26800. if (Util_Util.indexOf(
  26801. ["Point", "MultiPoint", "LineString", "MultiLineString",
  26802. "Polygon", "MultiPolygon", "Box", "GeometryCollection"
  26803. ],
  26804. obj.type) == -1) {
  26805. // unsupported geometry type
  26806. //console.error("Unsupported geometry type: " +
  26807. // obj.type);
  26808. } else {
  26809. valid = true;
  26810. }
  26811. break;
  26812. case "FeatureCollection":
  26813. // allow for any type to be converted to a feature collection
  26814. valid = true;
  26815. break;
  26816. default:
  26817. // for Feature types must match
  26818. if (obj.type == type) {
  26819. valid = true;
  26820. } else {
  26821. //console.error("Cannot convert types from " +
  26822. //obj.type + " to " + type);
  26823. }
  26824. }
  26825. return valid;
  26826. }
  26827. /**
  26828. * @function GeoJSONFormat.prototype.parseFeature
  26829. * @description 将一个 GeoJSON 中的 feature 转化成 {@link FeatureVector}> 对象。
  26830. * @private
  26831. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  26832. * @returns {FeatureVector} 一个要素。
  26833. */
  26834. parseFeature(obj) {
  26835. var feature, geometry, attributes, bbox;
  26836. attributes = (obj.properties) ? obj.properties : {};
  26837. bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
  26838. try {
  26839. geometry = this.parseGeometry(obj.geometry);
  26840. } catch (err) {
  26841. // deal with bad geometries
  26842. throw err;
  26843. }
  26844. feature = new Vector(geometry, attributes);
  26845. if (bbox) {
  26846. feature.bounds = Bounds.fromArray(bbox);
  26847. }
  26848. if (obj.id) {
  26849. feature.geometry.id = obj.id;
  26850. feature.fid = obj.id;
  26851. }
  26852. return feature;
  26853. }
  26854. /**
  26855. * @function GeoJSONFormat.prototype.parseGeometry
  26856. * @description 将一个 GeoJSON 中的几何要素转化成 {@link Geometry} 对象。
  26857. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  26858. * @returns {Geometry} 一个几何要素。
  26859. * @private
  26860. */
  26861. parseGeometry(obj) {
  26862. if (obj == null) {
  26863. return null;
  26864. }
  26865. var geometry;
  26866. if (obj.type == "GeometryCollection") {
  26867. if (!(Util_Util.isArray(obj.geometries))) {
  26868. throw "GeometryCollection must have geometries array: " + obj;
  26869. }
  26870. var numGeom = obj.geometries.length;
  26871. var components = new Array(numGeom);
  26872. for (var i = 0; i < numGeom; ++i) {
  26873. components[i] = this.parseGeometry.apply(
  26874. this, [obj.geometries[i]]
  26875. );
  26876. }
  26877. geometry = new Collection(components);
  26878. } else {
  26879. if (!(Util_Util.isArray(obj.coordinates))) {
  26880. throw "Geometry must have coordinates array: " + obj;
  26881. }
  26882. if (!this.parseCoords[obj.type.toLowerCase()]) {
  26883. throw "Unsupported geometry type: " + obj.type;
  26884. }
  26885. try {
  26886. geometry = this.parseCoords[obj.type.toLowerCase()].apply(
  26887. this, [obj.coordinates]
  26888. );
  26889. } catch (err) {
  26890. // deal with bad coordinates
  26891. throw err;
  26892. }
  26893. }
  26894. return geometry;
  26895. }
  26896. /**
  26897. * @function GeoJSONFormat.prototype.createCRSObject
  26898. * @description 从一个要素对象中创建一个坐标参考系对象。
  26899. * @param {FeatureVector} object - 要素对象。
  26900. * @private
  26901. * @returns {GeoJSONObject} 一个可作为 GeoJSON 对象的 CRS 属性使用的对象。
  26902. */
  26903. createCRSObject(object) {
  26904. var proj = object.layer.projection.toString();
  26905. var crs = {};
  26906. if (proj.match(/epsg:/i)) {
  26907. var code = parseInt(proj.substring(proj.indexOf(":") + 1));
  26908. if (code == 4326) {
  26909. crs = {
  26910. "type": "name",
  26911. "properties": {
  26912. "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
  26913. }
  26914. };
  26915. } else {
  26916. crs = {
  26917. "type": "name",
  26918. "properties": {
  26919. "name": "EPSG:" + code
  26920. }
  26921. };
  26922. }
  26923. }
  26924. return crs;
  26925. }
  26926. _toiSevrerFeature(feature) {
  26927. const attributes = feature.attributes;
  26928. const attrNames = [];
  26929. const attrValues = [];
  26930. for (var attr in attributes) {
  26931. attrNames.push(attr);
  26932. attrValues.push(attributes[attr]);
  26933. }
  26934. const newFeature = {
  26935. fieldNames: attrNames,
  26936. fieldValues: attrValues,
  26937. geometry: ServerGeometry.fromGeometry(feature.geometry)
  26938. };
  26939. newFeature.geometry.id = feature.fid;
  26940. return newFeature;
  26941. }
  26942. createAttributes(feature) {
  26943. if (!feature) {
  26944. return null;
  26945. }
  26946. var attr = {};
  26947. processFieldsAttributes(feature, attr);
  26948. var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
  26949. for (var key in feature) {
  26950. if (exceptKeys.indexOf(key) > -1) {
  26951. continue;
  26952. }
  26953. attr[key] = feature[key];
  26954. }
  26955. function processFieldsAttributes(feature, attributes) {
  26956. if (!(feature.hasOwnProperty("fieldNames") && feature.hasOwnProperty("fieldValues"))) {
  26957. return;
  26958. }
  26959. var names = feature.fieldNames,
  26960. values = feature.fieldValues;
  26961. for (var i in names) {
  26962. attributes[names[i]] = values[i];
  26963. }
  26964. }
  26965. return attr;
  26966. }
  26967. }
  26968. ;// CONCATENATED MODULE: ./src/common/format/WKT.js
  26969. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26970. * This program are made available under the terms of the Apache License, Version 2.0
  26971. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26972. /**
  26973. * @class WKTFormat
  26974. * @aliasclass Format.WKT
  26975. * @deprecatedclass SuperMap.Format.WKT
  26976. * @classdesc 用于读写常见文本的类。通过 {@link WKTFormat} 构造器来创建一个新的实例。
  26977. * @category BaseTypes Format
  26978. * @extends {Format}
  26979. * @param {Object} options - 可选的选项对象,其属性将被设置到实例。option 具体配置项继承自 {@link Format}。
  26980. * @usage
  26981. */
  26982. class WKT extends Format {
  26983. constructor(options) {
  26984. super(options);
  26985. this.regExes = {
  26986. 'typeStr': /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  26987. 'spaces': /\s+/,
  26988. 'parenComma': /\)\s*,\s*\(/,
  26989. 'doubleParenComma': /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
  26990. 'trimParens': /^\s*\(?(.*?)\)?\s*$/
  26991. };
  26992. this.CLASS_NAME = "SuperMap.Format.WKT"; /**
  26993. * @private
  26994. * @description Object with properties corresponding to the geometry types.
  26995. * Property values are functions that do the actual data extraction.
  26996. */
  26997. this.extract = {
  26998. /**
  26999. * @description Return a space delimited string of point coordinates.
  27000. * @param {GeometryPoint} point
  27001. * @returns {string} A string of coordinates representing the point
  27002. */
  27003. 'point': function (point) {
  27004. return point.x + ' ' + point.y;
  27005. },
  27006. /**
  27007. * @description Return a comma delimited string of point coordinates from a multipoint.
  27008. * @param {GeometryMultiPoint} multipoint
  27009. * @returns {string} A string of point coordinate strings representing
  27010. * the multipoint
  27011. */
  27012. 'multipoint'(multipoint) {
  27013. var array = [];
  27014. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  27015. array.push('(' +
  27016. this.extract.point.apply(this, [multipoint.components[i]]) +
  27017. ')');
  27018. }
  27019. return array.join(',');
  27020. },
  27021. /**
  27022. * @description Return a comma delimited string of point coordinates from a line.
  27023. * @param {GeometryLineString} linestring
  27024. * @returns {string} A string of point coordinate strings representing
  27025. * the linestring
  27026. */
  27027. 'linestring'(linestring) {
  27028. var array = [];
  27029. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  27030. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  27031. }
  27032. return array.join(',');
  27033. },
  27034. /**
  27035. * @description Return a comma delimited string of linestring strings from a multilinestring.
  27036. * @param {GeometryMultiLineString} multilinestring
  27037. * @returns {string} A string of of linestring strings representing
  27038. * the multilinestring
  27039. */
  27040. 'multilinestring'(multilinestring) {
  27041. var array = [];
  27042. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  27043. array.push('(' +
  27044. this.extract.linestring.apply(this, [multilinestring.components[i]]) +
  27045. ')');
  27046. }
  27047. return array.join(',');
  27048. },
  27049. /**
  27050. * @description Return a comma delimited string of linear ring arrays from a polygon.
  27051. * @param {GeometryPolygon} polygon
  27052. * @returns {string} An array of linear ring arrays representing the polygon
  27053. */
  27054. 'polygon'(polygon) {
  27055. var array = [];
  27056. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  27057. array.push('(' +
  27058. this.extract.linestring.apply(this, [polygon.components[i]]) +
  27059. ')');
  27060. }
  27061. return array.join(',');
  27062. },
  27063. /**
  27064. * @description Return an array of polygon arrays from a multipolygon.
  27065. * @param {GeometryMultiPolygon} multipolygon
  27066. * @returns {string} An array of polygon arrays representing
  27067. * the multipolygon
  27068. */
  27069. 'multipolygon'(multipolygon) {
  27070. var array = [];
  27071. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  27072. array.push('(' +
  27073. this.extract.polygon.apply(this, [multipolygon.components[i]]) +
  27074. ')');
  27075. }
  27076. return array.join(',');
  27077. },
  27078. /**
  27079. * @description Return the WKT portion between 'GEOMETRYCOLLECTION(' and ')' for an <GeometryCollection>
  27080. * @param {GeometryCollection} collection
  27081. * @returns {string} internal WKT representation of the collection
  27082. */
  27083. 'collection'(collection) {
  27084. var array = [];
  27085. for (var i = 0, len = collection.components.length; i < len; ++i) {
  27086. array.push(this.extractGeometry.apply(this, [collection.components[i]]));
  27087. }
  27088. return array.join(',');
  27089. }
  27090. };
  27091. /**
  27092. * @private
  27093. * @description Object with properties corresponding to the geometry types.
  27094. * Property values are functions that do the actual parsing.
  27095. */
  27096. this.parse = {
  27097. /**
  27098. * @private
  27099. * @description Return point feature given a point WKT fragment.
  27100. * @param {string} str A WKT fragment representing the point
  27101. * @returns {FeatureVector} A point feature
  27102. *
  27103. */
  27104. 'point': function (str) {
  27105. var coords = StringExt.trim(str).split(this.regExes.spaces);
  27106. return new Vector(new Point(coords[0], coords[1])
  27107. );
  27108. },
  27109. /**
  27110. * @description Return a multipoint feature given a multipoint WKT fragment.
  27111. * @param {string} A WKT fragment representing the multipoint
  27112. * @returns {FeatureVector} A multipoint feature
  27113. * @private
  27114. */
  27115. 'multipoint': function (str) {
  27116. var point;
  27117. var points = StringExt.trim(str).split(',');
  27118. var components = [];
  27119. for (var i = 0, len = points.length; i < len; ++i) {
  27120. point = points[i].replace(this.regExes.trimParens, '$1');
  27121. components.push(this.parse.point.apply(this, [point]).geometry);
  27122. }
  27123. return new Vector(
  27124. new MultiPoint(components)
  27125. );
  27126. },
  27127. /**
  27128. * @description Return a linestring feature given a linestring WKT fragment.
  27129. * @param {string} A WKT fragment representing the linestring
  27130. * @returns {FeatureVector} A linestring feature
  27131. * @private
  27132. */
  27133. 'linestring': function (str) {
  27134. var points = StringExt.trim(str).split(',');
  27135. var components = [];
  27136. for (var i = 0, len = points.length; i < len; ++i) {
  27137. components.push(this.parse.point.apply(this, [points[i]]).geometry);
  27138. }
  27139. return new Vector(
  27140. new LineString(components)
  27141. );
  27142. },
  27143. /**
  27144. * @description Return a multilinestring feature given a multilinestring WKT fragment.
  27145. * @param {string} A WKT fragment representing the multilinestring
  27146. * @returns {FeatureVector} A multilinestring feature
  27147. * @private
  27148. */
  27149. 'multilinestring': function (str) {
  27150. var line;
  27151. var lines = StringExt.trim(str).split(this.regExes.parenComma);
  27152. var components = [];
  27153. for (var i = 0, len = lines.length; i < len; ++i) {
  27154. line = lines[i].replace(this.regExes.trimParens, '$1');
  27155. components.push(this.parse.linestring.apply(this, [line]).geometry);
  27156. }
  27157. return new Vector(
  27158. new MultiLineString(components)
  27159. );
  27160. },
  27161. /**
  27162. * @description Return a polygon feature given a polygon WKT fragment.
  27163. * @param {string} A WKT fragment representing the polygon
  27164. * @returns {FeatureVector} A polygon feature
  27165. * @private
  27166. */
  27167. 'polygon': function (str) {
  27168. var ring, linestring, linearring;
  27169. var rings = StringExt.trim(str).split(this.regExes.parenComma);
  27170. var components = [];
  27171. for (var i = 0, len = rings.length; i < len; ++i) {
  27172. ring = rings[i].replace(this.regExes.trimParens, '$1');
  27173. linestring = this.parse.linestring.apply(this, [ring]).geometry;
  27174. linearring = new LinearRing_LinearRing(linestring.components);
  27175. components.push(linearring);
  27176. }
  27177. return new Vector(
  27178. new Polygon_Polygon(components)
  27179. );
  27180. },
  27181. /**
  27182. * @private
  27183. * @description Return a multipolygon feature given a multipolygon WKT fragment.
  27184. * @param {string} A WKT fragment representing the multipolygon
  27185. * @returns {FeatureVector} A multipolygon feature
  27186. *
  27187. */
  27188. 'multipolygon': function (str) {
  27189. var polygon;
  27190. var polygons = StringExt.trim(str).split(this.regExes.doubleParenComma);
  27191. var components = [];
  27192. for (var i = 0, len = polygons.length; i < len; ++i) {
  27193. polygon = polygons[i].replace(this.regExes.trimParens, '$1');
  27194. components.push(this.parse.polygon.apply(this, [polygon]).geometry);
  27195. }
  27196. return new Vector(
  27197. new MultiPolygon(components)
  27198. );
  27199. },
  27200. /**
  27201. * @description Return an array of features given a geometrycollection WKT fragment.
  27202. * @param {string} A WKT fragment representing the geometrycollection
  27203. * @returns {Array} An array of FeatureVector
  27204. * @private
  27205. */
  27206. 'geometrycollection': function (str) {
  27207. // separate components of the collection with |
  27208. str = str.replace(/,\s*([A-Za-z])/g, '|$1');
  27209. var wktArray = StringExt.trim(str).split('|');
  27210. var components = [];
  27211. for (var i = 0, len = wktArray.length; i < len; ++i) {
  27212. components.push(this.read(wktArray[i]));
  27213. }
  27214. return components;
  27215. }
  27216. };
  27217. }
  27218. /**
  27219. * @function WKTFormat.prototype.read
  27220. * @description 反序列化 WKT 字符串并返回向量特征或向量特征数组。支持 POINT、MULTIPOINT、LINESTRING、MULTILINESTRING、POLYGON、MULTIPOLYGON 和 GEOMETRYCOLLECTION 的 WKT。
  27221. * @param {string} wkt - WKT 字符串。
  27222. * @returns {FeatureVector|Array} GEOMETRYCOLLECTION WKT 的矢量要素或者矢量要素数组。
  27223. */
  27224. read(wkt) {
  27225. var features, type, str;
  27226. wkt = wkt.replace(/[\n\r]/g, " ");
  27227. var matches = this.regExes.typeStr.exec(wkt);
  27228. if (matches) {
  27229. type = matches[1].toLowerCase();
  27230. str = matches[2];
  27231. if (this.parse[type]) {
  27232. features = this.parse[type].apply(this, [str]);
  27233. }
  27234. }
  27235. return features;
  27236. }
  27237. /**
  27238. * @function WKTFormat.prototype.write
  27239. * @description 将矢量要素或矢量要素数组序列化为 WKT 字符串。
  27240. * @param {(FeatureVector|Array)} features - 矢量要素或矢量要素数组。
  27241. * @returns {string} 表示几何的 WKT 字符串。
  27242. */
  27243. write(features) {
  27244. var collection, geometry, isCollection;
  27245. if (features.constructor === Array) {
  27246. collection = features;
  27247. isCollection = true;
  27248. } else {
  27249. collection = [features];
  27250. isCollection = false;
  27251. }
  27252. var pieces = [];
  27253. if (isCollection) {
  27254. pieces.push('GEOMETRYCOLLECTION(');
  27255. }
  27256. for (var i = 0, len = collection.length; i < len; ++i) {
  27257. if (isCollection && i > 0) {
  27258. pieces.push(',');
  27259. }
  27260. geometry = collection[i].geometry;
  27261. pieces.push(this.extractGeometry(geometry));
  27262. }
  27263. if (isCollection) {
  27264. pieces.push(')');
  27265. }
  27266. return pieces.join('');
  27267. }
  27268. /**
  27269. * @function WKTFormat.prototype.extractGeometry
  27270. * @description 为单个 Geometry 对象构造 WKT 的入口点。
  27271. * @param {Geometry} geometry - Geometry 对象。
  27272. * @returns {string} 表示几何的 WKT 字符串。
  27273. */
  27274. extractGeometry(geometry) {
  27275. var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
  27276. if (!this.extract[type]) {
  27277. return null;
  27278. }
  27279. var wktType = type === 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
  27280. var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
  27281. return data;
  27282. }
  27283. }
  27284. ;// CONCATENATED MODULE: ./src/common/format/index.js
  27285. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27286. * This program are made available under the terms of the Apache License, Version 2.0
  27287. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27288. ;// CONCATENATED MODULE: ./src/common/control/TimeControlBase.js
  27289. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27290. * This program are made available under the terms of the Apache License, Version 2.0
  27291. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27292. /**
  27293. * @class TimeControlBase
  27294. * @deprecatedclass SuperMap.TimeControlBase
  27295. * @classdesc 时间控制基类。
  27296. * @modulecategory Control
  27297. * @category Control
  27298. * @param {Object} options - 可选参数。
  27299. * @param {number} [options.speed=1] - 速度。不能小于 0,(每帧渲染的数据之间的间隔为1),设置越大速度越快。
  27300. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms),服务器刷新的时间间隔。
  27301. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  27302. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时以当前时间进行设置,建议设置。
  27303. * @param {boolean} [options.repeat=true] - 是否重复循环。
  27304. * @param {boolean} [options.reverse=false] - 是否反向。
  27305. * @usage
  27306. */
  27307. class TimeControlBase {
  27308. constructor(options) {
  27309. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  27310. var me = this;
  27311. options = options || {};
  27312. /**
  27313. * @member {number} [TimeControlBase.prototype.speed=1]
  27314. * @description 步长,必须为非负数,默认为1(表示前后两次渲染的数据之间的间隔为1)。
  27315. */
  27316. this.speed = (options.speed && options.speed >= 0) ? options.speed : 1;
  27317. /**
  27318. * @member {number} [TimeControlBase.prototype.frequency=1000]
  27319. * @description 刷新频率(单位ms),服务器刷新的时间间隔。
  27320. */
  27321. this.frequency = (options.speed && options.frequency >= 0) ? options.frequency : 1000;
  27322. /**
  27323. * @member {number} [TimeControlBase.prototype.startTime=0]
  27324. * @description 记录的起始时间,必须为数字,
  27325. * 如果不设置,初始化时为0,建议设置。
  27326. */
  27327. this.startTime = (options.startTime && options.startTime != null) ? options.startTime : 0;
  27328. /**
  27329. * @member {number} TimeControlBase.prototype.endTime
  27330. * @description 记录的结束时间,必须为数字,
  27331. * 如果不设置,初始化时以当前时间进行设置,建议设置。
  27332. */
  27333. this.endTime = (options.endTime && options.endTime != null && options.endTime >= me.startTime) ? options.endTime : +new Date();
  27334. /**
  27335. * @member {boolean} [TimeControlBase.prototype.repeat=true]
  27336. * @description 是否重复循环。
  27337. */
  27338. this.repeat = (options.repeat !== undefined) ? options.repeat : true;
  27339. /**
  27340. * @member {boolean} [TimeControlBase.prototype.reverse=false]
  27341. * @description 是否反向。
  27342. */
  27343. this.reverse = (options.reverse !== undefined) ? options.reverse : false;
  27344. /**
  27345. * @member {number} TimeControlBase.prototype.currentTime
  27346. * @description 记录近期的时间,也就是当前帧运行到的时间。
  27347. */
  27348. this.currentTime = null;
  27349. /**
  27350. * @member {number} TimeControlBase.prototype.oldTime
  27351. * @description 记录上一帧的时间,也就是之前运行到的时间。
  27352. */
  27353. this.oldTime = null;
  27354. /**
  27355. * @member {boolean} [TimeControlBase.prototype.running=false]
  27356. * @description 记录当前是否处于运行中。
  27357. */
  27358. this.running = false;
  27359. /**
  27360. * @private
  27361. * @member {Array.<string>} TimeControlBase.prototype.EVENT_TYPES
  27362. * @description 此类支持的事件类型。
  27363. *
  27364. */
  27365. this.EVENT_TYPES = ["start", "pause", "stop"];
  27366. /**
  27367. * @private
  27368. * @member {Events} TimeControlBase.prototype.events
  27369. * @description 事件
  27370. */
  27371. me.events = new Events(this, null, this.EVENT_TYPES);
  27372. me.speed = Number(me.speed);
  27373. me.frequency = Number(me.frequency);
  27374. me.startTime = Number(me.startTime);
  27375. me.endTime = Number(me.endTime);
  27376. me.startTime = Date.parse(new Date(me.startTime));
  27377. me.endTime = Date.parse(new Date(me.endTime));
  27378. //初始化当前时间
  27379. me.currentTime = me.startTime;
  27380. this.CLASS_NAME = "SuperMap.TimeControlBase";
  27381. }
  27382. /**
  27383. * @function TimeControlBase.prototype.updateOptions
  27384. * @description 更新参数。
  27385. * @param {Object} options - 设置参数的可选参数。设置步长,刷新频率、开始结束时间、是否循环、是否反向。
  27386. */
  27387. updateOptions(options) {
  27388. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  27389. var me = this;
  27390. options = options || {};
  27391. if (options.speed && options.speed >= 0) {
  27392. me.speed = options.speed;
  27393. me.speed = Number(me.speed);
  27394. }
  27395. if (options.speed && options.frequency >= 0) {
  27396. me.frequency = options.frequency;
  27397. me.frequency = Number(me.frequency);
  27398. }
  27399. if (options.startTime && options.startTime != null) {
  27400. me.startTime = options.startTime;
  27401. me.startTime = Date.parse(new Date(me.startTime));
  27402. }
  27403. if (options.endTime && options.endTime != null && options.endTime >= me.startTime) {
  27404. me.endTime = options.endTime;
  27405. me.endTime = Date.parse(new Date(me.endTime));
  27406. }
  27407. if (options.repeat != null) {
  27408. me.repeat = options.repeat;
  27409. }
  27410. if (options.reverse != null) {
  27411. me.reverse = options.reverse;
  27412. }
  27413. }
  27414. /**
  27415. * @function TimeControlBase.prototype.start
  27416. * @description 开始。
  27417. */
  27418. start() {
  27419. var me = this;
  27420. if (!me.running) {
  27421. me.running = true;
  27422. me.tick();
  27423. me.events.triggerEvent('start', me.currentTime);
  27424. }
  27425. }
  27426. /**
  27427. * @function TimeControlBase.prototype.pause
  27428. * @description 暂停。
  27429. */
  27430. pause() {
  27431. var me = this;
  27432. me.running = false;
  27433. me.events.triggerEvent('pause', me.currentTime);
  27434. }
  27435. /**
  27436. * @function TimeControlBase.prototype.stop
  27437. * @description 停止,停止后返回起始状态。
  27438. */
  27439. stop() {
  27440. var me = this;
  27441. //停止时 时间设置为开始时间
  27442. me.currentTime = me.startTime;
  27443. //如果正在运行,修改为初始时间即可绘制一帧
  27444. if (me.running) {
  27445. me.running = false;
  27446. }
  27447. me.events.triggerEvent('stop', me.currentTime);
  27448. }
  27449. /**
  27450. * @function TimeControlBase.prototype.toggle
  27451. * @description 开关切换,切换的是开始和暂停。
  27452. */
  27453. toggle() {
  27454. var me = this;
  27455. if (me.running) {
  27456. me.pause();
  27457. } else {
  27458. me.start();
  27459. }
  27460. }
  27461. /**
  27462. * @function TimeControlBase.prototype.setSpeed
  27463. * @description 设置步长。
  27464. * @param {number} [speed=1] - 步长,必须为非负数。
  27465. * @returns {boolean} true 代表设置成功,false 设置失败(speed 小于 0 时失败)。
  27466. */
  27467. setSpeed(speed) {
  27468. var me = this;
  27469. if (speed >= 0) {
  27470. me.speed = speed;
  27471. return true;
  27472. }
  27473. return false;
  27474. }
  27475. /**
  27476. * @function TimeControlBase.prototype.getSpeed
  27477. * @description 获取步长。
  27478. * @returns {number} 返回当前的步长。
  27479. */
  27480. getSpeed() {
  27481. return this.speed;
  27482. }
  27483. /**
  27484. * @function TimeControlBase.prototype.setFrequency
  27485. * @description 设置刷新频率。
  27486. * @param {number} [frequency=1000] - 刷新频率,单位为 ms。
  27487. * @returns {boolean} true 代表设置成功,false 设置失败(frequency 小于 0 时失败)。
  27488. */
  27489. setFrequency(frequency) {
  27490. var me = this;
  27491. if (frequency >= 0) {
  27492. me.frequency = frequency;
  27493. return true;
  27494. }
  27495. return false;
  27496. }
  27497. /**
  27498. * @function TimeControlBase.prototype.getFrequency
  27499. * @description 获取刷新频率。
  27500. * @returns {number} 返回当前的刷新频率。
  27501. */
  27502. getFrequency() {
  27503. return this.frequency;
  27504. }
  27505. /**
  27506. * @function TimeControlBase.prototype.setStartTime
  27507. * @description 设置起始时间,设置完成后如果当前时间小于起始时间,则从起始时间开始。
  27508. * @param {number} startTime - 需要设置的起始时间。
  27509. * @returns {boolean} true 代表设置成功,false 设置失败(startTime 大于结束时间时失败)。
  27510. */
  27511. setStartTime(startTime) {
  27512. var me = this;
  27513. startTime = Date.parse(new Date(startTime));
  27514. //起始时间不得大于结束时间
  27515. if (startTime > me.endTime) {
  27516. return false;
  27517. }
  27518. me.startTime = startTime;
  27519. //如果当前时间小于了起始时间,则从当前起始时间开始
  27520. if (me.currentTime < me.startTime) {
  27521. me.currentTime = me.startTime;
  27522. me.tick();
  27523. }
  27524. return true;
  27525. }
  27526. /**
  27527. * @function TimeControlBase.prototype.getStartTime
  27528. * @description 获取起始时间。
  27529. * @returns {number} 返回当前的起始时间。
  27530. */
  27531. getStartTime() {
  27532. return this.startTime;
  27533. }
  27534. /**
  27535. * @function TimeControlBase.prototype.setEndTime
  27536. * @description 设置结束时间,设置完成后如果当前时间大于结束,则从起始时间开始。
  27537. * @param {number} endTime - 需要设置的结束时间。
  27538. * @returns {boolean} true 代表设置成功,false 设置失败(endTime 小于开始时间时失败)。
  27539. */
  27540. setEndTime(endTime) {
  27541. var me = this;
  27542. me.endTime = Date.parse(new Date(me.endTime));
  27543. //结束时间不得小于开始时间
  27544. if (endTime < me.startTime) {
  27545. return false;
  27546. }
  27547. me.endTime = endTime;
  27548. //如果当前时间大于了结束时间,则从起始时间开始
  27549. if (me.currentTime >= me.endTime) {
  27550. me.currentTime = me.startTime;
  27551. me.tick();
  27552. }
  27553. return true;
  27554. }
  27555. /**
  27556. * @function TimeControlBase.prototype.getEndTime
  27557. * @description 获取结束时间。
  27558. * @returns {number} 返回当前的结束时间。
  27559. */
  27560. getEndTime() {
  27561. return this.endTime;
  27562. }
  27563. /**
  27564. * @function TimeControlBase.prototype.setCurrentTime
  27565. * @description 设置当前时间。
  27566. * @param {number} currentTime - 需要设置的当前时间。
  27567. * @returns {boolean} true 代表设置成功,false 设置失败。
  27568. */
  27569. setCurrentTime(currentTime) {
  27570. var me = this;
  27571. me.currentTime = Date.parse(new Date(me.currentTime));
  27572. //结束时间不得小于开始时间
  27573. if (currentTime >= me.startTime && currentTime <= me.endTime) {
  27574. me.currentTime = currentTime;
  27575. me.startTime = me.currentTime;
  27576. me.tick();
  27577. return true;
  27578. }
  27579. return false;
  27580. }
  27581. /**
  27582. * @function TimeControlBase.prototype.getCurrentTime
  27583. * @description 获取当前时间。
  27584. * @returns {number} 返回当前时间。
  27585. */
  27586. getCurrentTime() {
  27587. return this.currentTime;
  27588. }
  27589. /**
  27590. * @function TimeControlBase.prototype.setRepeat
  27591. * @description 设置是否重复循环。
  27592. * @param {boolean} [repeat=true] - 是否重复循环。
  27593. */
  27594. setRepeat(repeat) {
  27595. this.repeat = repeat;
  27596. }
  27597. /**
  27598. * @function TimeControlBase.prototype.getRepeat
  27599. * @description 获取是否重复循环,默认是 true。
  27600. * @returns {boolean} 返回是否重复循环。
  27601. */
  27602. getRepeat() {
  27603. return this.repeat;
  27604. }
  27605. /**
  27606. * @function TimeControlBase.prototype.setReverse
  27607. * @description 设置是否反向。
  27608. * @param {boolean} [reverse=false] - 是否反向。
  27609. */
  27610. setReverse(reverse) {
  27611. this.reverse = reverse;
  27612. }
  27613. /**
  27614. * @function TimeControlBase.prototype.getReverse
  27615. * @description 获取是否反向,默认是false。
  27616. * @returns {boolean} 返回是否反向。
  27617. */
  27618. getReverse() {
  27619. return this.reverse;
  27620. }
  27621. /**
  27622. * @function TimeControlBase.prototype.getRunning
  27623. * @description 获取运行状态。
  27624. * @returns {boolean} true 代表正在运行,false 发表没有运行。
  27625. */
  27626. getRunning() {
  27627. return this.running;
  27628. }
  27629. /**
  27630. * @function TimeControlBase.prototype.destroy
  27631. * @description 销毁 Animator 对象,释放资源。
  27632. */
  27633. destroy() {
  27634. var me = this;
  27635. me.speed = null;
  27636. me.frequency = null;
  27637. me.startTime = null;
  27638. me.endTime = null;
  27639. me.currentTime = null;
  27640. me.repeat = null;
  27641. me.running = false;
  27642. me.reverse = null;
  27643. }
  27644. tick() {
  27645. //TODO 每次刷新执行的操作。子类实现
  27646. }
  27647. }
  27648. ;// CONCATENATED MODULE: ./src/common/control/TimeFlowControl.js
  27649. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27650. * This program are made available under the terms of the Apache License, Version 2.0
  27651. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27652. /**
  27653. * @class TimeFlowControl
  27654. * @deprecatedclass SuperMap.TimeFlowControl
  27655. * @category Control
  27656. * @classdesc 时间管理类。此类只负责时间上的控制,具体执行的操作需要用户在初始化时的回调函数内部进行实现。
  27657. * 如设置起始时间为 1000,结束时间是 2000,步长设置为 1,
  27658. * 那么表示按照每次1年(可以通过 setSpeed 进行修改)的变化从公元 1000 年开始到公元 2000 年为止,默认每 1 秒会变化 1 次(通过 setFrequency 修改)
  27659. * @modulecategory Control
  27660. * @extends {TimeControlBase}
  27661. * @param {function} callback - 每次刷新回调函数。具体的效果需要用户在此回调函数里面实现。
  27662. * @param {Object} options - 可选参数。
  27663. * @param {number} [options.speed=1] - 步长(单位 ms)。不能小于 0,(每次刷新的数据之间的间隔为 1ms)。
  27664. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms)。
  27665. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  27666. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时使用 new Date() 以当前时间进行设置,建议设置。
  27667. * @param {boolean} [options.repeat=true] - 是否重复循环。
  27668. * @param {boolean} [options.reverse=false] - 是否反向。
  27669. * @usage
  27670. */
  27671. class TimeFlowControl extends TimeControlBase {
  27672. constructor(callback, options) {
  27673. super(options);
  27674. var me = this;
  27675. /**
  27676. * @member TimeFlowControl.prototype.callback -{function}
  27677. * @description 每次刷新执行的回调函数。
  27678. */
  27679. me.callback = callback;
  27680. //先让IE下支持bind方法
  27681. if (!Function.prototype.bind) {
  27682. Function.prototype.bind = function (oThis) {
  27683. if (typeof this !== "function") {
  27684. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  27685. }
  27686. var aArgs = Array.prototype.slice.call(arguments, 1),
  27687. fToBind = this,
  27688. fNOP = function () {
  27689. //empty Function
  27690. },
  27691. fBound = function () {
  27692. return fToBind.apply(this instanceof fNOP && oThis
  27693. ? this
  27694. : oThis,
  27695. aArgs.concat(Array.prototype.slice.call(arguments)));
  27696. };
  27697. fNOP.prototype = this.prototype;
  27698. fBound.prototype = new fNOP();
  27699. return fBound;
  27700. };
  27701. }
  27702. //保证 this.tick 的上下文还是 TimeControl 这个对象
  27703. me.update = me.update.bind(me);
  27704. me.oldTime = me.currentTime;
  27705. me.CLASS_NAME = "SuperMap.TimeFlowControl";
  27706. }
  27707. /**
  27708. * @function TimeFlowControl.prototype.updateOptions
  27709. * @override
  27710. */
  27711. updateOptions(options) {
  27712. options = options || {};
  27713. super.updateOptions(options);
  27714. }
  27715. /**
  27716. * @function TimeFlowControl.prototype.start
  27717. * @override
  27718. */
  27719. start() {
  27720. var me = this;
  27721. if (me.running) {
  27722. return;
  27723. }
  27724. me.running = true;
  27725. if (me.reverse) {
  27726. if (me.currentTime === me.startTime) {
  27727. me.oldTime = me.endTime;
  27728. me.currentTime = me.oldTime;
  27729. }
  27730. } else {
  27731. if (me.oldTime === me.endTime) {
  27732. me.currentTime = me.startTime;
  27733. me.oldTime = me.currentTime;
  27734. }
  27735. }
  27736. me.tick();
  27737. }
  27738. /**
  27739. * @function TimeFlowControl.prototype.stop
  27740. * @override
  27741. */
  27742. stop() {
  27743. super.stop();
  27744. var me = this;
  27745. me.oldTime = me.currentTime;
  27746. if (me.running) {
  27747. me.running = false;
  27748. }
  27749. //清除定时tick
  27750. me.intervalId && window.clearTimeout(me.intervalId);
  27751. }
  27752. /**
  27753. * @function TimeFlowControl.prototype.destroy
  27754. * @override
  27755. */
  27756. destroy() {
  27757. super.destroy();
  27758. var me = this;
  27759. me.oldTime = null;
  27760. me.callback = null;
  27761. }
  27762. /**
  27763. * @function TimeFlowControl.prototype.tick
  27764. * @description 定时刷新。
  27765. */
  27766. tick() {
  27767. var me = this;
  27768. me.intervalId && window.clearInterval(me.intervalId);
  27769. me.intervalId = null;
  27770. me.update();
  27771. me.intervalId = window.setInterval(me.update, me.frequency);
  27772. }
  27773. /**
  27774. * @function TimeFlowControl.prototype.update
  27775. * @description 更新控件。
  27776. */
  27777. update() {
  27778. var me = this;
  27779. //判定是否还需要继续
  27780. if (!me.running) {
  27781. return;
  27782. }
  27783. //调用回调函数
  27784. me.callback && me.callback(me.currentTime); //destroy之后callback就为空,所以需要判定一下
  27785. if (!me.reverse) {
  27786. //如果相等,则代表上一帧已经运行到了最后,下一帧运行初始化的状态
  27787. if (me.currentTime === me.endTime) {
  27788. //不循环时
  27789. if (!me.repeat) {
  27790. me.running = false;
  27791. me.stop();
  27792. return null;
  27793. }
  27794. me.stop();
  27795. me.currentTime = me.startTime;
  27796. me.oldTime = me.currentTime;
  27797. me.start();
  27798. } else {//否则时间递增
  27799. me.oldTime = me.currentTime;
  27800. me.currentTime += me.speed;
  27801. }
  27802. if (me.currentTime >= me.endTime) {
  27803. me.currentTime = me.endTime;
  27804. }
  27805. } else {
  27806. //如果相等,则代表上一帧已经运行到了最前,下一帧运行结束的状态
  27807. if (me.currentTime === me.startTime) {
  27808. //不循环时
  27809. if (!me.repeat) {
  27810. me.running = false;
  27811. return null;
  27812. }
  27813. me.oldTime = me.endTime;
  27814. me.currentTime = me.oldTime;
  27815. } else {//否则时间递减
  27816. me.currentTime = me.oldTime;
  27817. me.oldTime -= me.speed;
  27818. }
  27819. if (me.oldTime <= me.startTime) {
  27820. me.oldTime = me.startTime;
  27821. }
  27822. }
  27823. }
  27824. }
  27825. ;// CONCATENATED MODULE: ./src/common/control/index.js
  27826. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27827. * This program are made available under the terms of the Apache License, Version 2.0
  27828. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27829. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  27830. var polyfill = __webpack_require__(107);
  27831. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  27832. var fetch_ie8_fetch = __webpack_require__(693);
  27833. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  27834. var fetch_jsonp = __webpack_require__(144);
  27835. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  27836. ;// CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  27837. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27838. * This program are made available under the terms of the Apache License, Version 2.0
  27839. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27840. let FetchRequest_fetch = window.fetch;
  27841. var setFetch = function (newFetch) {
  27842. FetchRequest_fetch = newFetch;
  27843. }
  27844. var RequestJSONPPromise = {
  27845. limitLength: 1500,
  27846. queryKeys: [],
  27847. queryValues: [],
  27848. supermap_callbacks: {},
  27849. addQueryStrings: function (values) {
  27850. var me = this;
  27851. for (var key in values) {
  27852. me.queryKeys.push(key);
  27853. if (typeof values[key] !== 'string') {
  27854. values[key] = Util_Util.toJSON(values[key]);
  27855. }
  27856. var tempValue = encodeURIComponent(values[key]);
  27857. me.queryValues.push(tempValue);
  27858. }
  27859. },
  27860. issue: function (config) {
  27861. var me = this,
  27862. uid = me.getUid(),
  27863. url = config.url,
  27864. splitQuestUrl = [];
  27865. // me.addQueryStrings({
  27866. // callback: "RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  27867. // });
  27868. var sectionURL = url,
  27869. keysCount = 0; //此次sectionURL中有多少个key
  27870. var length = me.queryKeys ? me.queryKeys.length : 0;
  27871. for (var i = 0; i < length; i++) {
  27872. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  27873. //+2 for ("&"or"?")and"="
  27874. if (keysCount == 0) {
  27875. return false;
  27876. }
  27877. splitQuestUrl.push(sectionURL);
  27878. sectionURL = url;
  27879. keysCount = 0;
  27880. i--;
  27881. } else {
  27882. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  27883. var leftValue = me.queryValues[i];
  27884. while (leftValue.length > 0) {
  27885. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  27886. if (sectionURL.indexOf('?') > -1) {
  27887. sectionURL += '&';
  27888. } else {
  27889. sectionURL += '?';
  27890. }
  27891. var tempLeftValue = leftValue.substring(0, leftLength);
  27892. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  27893. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  27894. leftLength -= 1;
  27895. tempLeftValue = leftValue.substring(0, leftLength);
  27896. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  27897. leftLength -= 2;
  27898. tempLeftValue = leftValue.substring(0, leftLength);
  27899. }
  27900. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  27901. leftValue = leftValue.substring(leftLength);
  27902. if (tempLeftValue.length > 0) {
  27903. splitQuestUrl.push(sectionURL);
  27904. sectionURL = url;
  27905. keysCount = 0;
  27906. }
  27907. }
  27908. } else {
  27909. keysCount++;
  27910. if (sectionURL.indexOf('?') > -1) {
  27911. sectionURL += '&';
  27912. } else {
  27913. sectionURL += '?';
  27914. }
  27915. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  27916. }
  27917. }
  27918. }
  27919. splitQuestUrl.push(sectionURL);
  27920. return me.send(
  27921. splitQuestUrl,
  27922. 'SuperMapJSONPCallbacks_' + uid,
  27923. config && config.proxy
  27924. );
  27925. },
  27926. getUid: function () {
  27927. var uid = new Date().getTime(),
  27928. random = Math.floor(Math.random() * 1e17);
  27929. return uid * 1000 + random;
  27930. },
  27931. send: function (splitQuestUrl, callback, proxy) {
  27932. var len = splitQuestUrl.length;
  27933. if (len > 0) {
  27934. return new Promise((resolve) => {
  27935. var jsonpUserID = new Date().getTime();
  27936. for (var i = 0; i < len; i++) {
  27937. var url = splitQuestUrl[i];
  27938. if (url.indexOf('?') > -1) {
  27939. url += '&';
  27940. } else {
  27941. url += '?';
  27942. }
  27943. url += 'sectionCount=' + len;
  27944. url += '&sectionIndex=' + i;
  27945. url += '&jsonpUserID=' + jsonpUserID;
  27946. if (proxy) {
  27947. url = decodeURIComponent(url);
  27948. url = proxy + encodeURIComponent(url);
  27949. }
  27950. fetch_jsonp_default()(url, {
  27951. jsonpCallbackFunction: callback,
  27952. timeout: 30000
  27953. }).then((result) => {
  27954. resolve(result.json());
  27955. });
  27956. }
  27957. })
  27958. }
  27959. },
  27960. GET: function (config) {
  27961. var me = this;
  27962. me.queryKeys.length = 0;
  27963. me.queryValues.length = 0;
  27964. me.addQueryStrings(config.params);
  27965. return me.issue(config);
  27966. },
  27967. POST: function (config) {
  27968. var me = this;
  27969. me.queryKeys.length = 0;
  27970. me.queryValues.length = 0;
  27971. me.addQueryStrings({
  27972. requestEntity: config.data
  27973. });
  27974. return me.issue(config);
  27975. },
  27976. PUT: function (config) {
  27977. var me = this;
  27978. me.queryKeys.length = 0;
  27979. me.queryValues.length = 0;
  27980. me.addQueryStrings({
  27981. requestEntity: config.data
  27982. });
  27983. return me.issue(config);
  27984. },
  27985. DELETE: function (config) {
  27986. var me = this;
  27987. me.queryKeys.length = 0;
  27988. me.queryValues.length = 0;
  27989. me.addQueryStrings({
  27990. requestEntity: config.data
  27991. });
  27992. return me.issue(config);
  27993. }
  27994. };
  27995. var CORS;
  27996. var RequestTimeout;
  27997. /**
  27998. * @function setCORS
  27999. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  28000. * @category BaseTypes Util
  28001. * @param {boolean} cors - 是否允许跨域请求。
  28002. * @usage
  28003. * ```
  28004. * // 浏览器
  28005. * <script type="text/javascript" src="{cdn}"></script>
  28006. * <script>
  28007. * {namespace}.setCORS(cors);
  28008. *
  28009. * // 弃用的写法
  28010. * SuperMap.setCORS(cors);
  28011. *
  28012. * </script>
  28013. *
  28014. * // ES6 Import
  28015. * import { setCORS } from '{npm}';
  28016. *
  28017. * setCORS(cors);
  28018. * ```
  28019. */
  28020. var setCORS = function (cors) {
  28021. CORS = cors;
  28022. }
  28023. /**
  28024. * @function isCORS
  28025. * @description 是是否允许跨域请求。
  28026. * @category BaseTypes Util
  28027. * @returns {boolean} 是否允许跨域请求。
  28028. * @usage
  28029. * ```
  28030. * // 浏览器
  28031. * <script type="text/javascript" src="{cdn}"></script>
  28032. * <script>
  28033. * const result = {namespace}.isCORS();
  28034. *
  28035. * // 弃用的写法
  28036. * const result = SuperMap.isCORS();
  28037. *
  28038. * </script>
  28039. *
  28040. * // ES6 Import
  28041. * import { isCORS } from '{npm}';
  28042. *
  28043. * const result = isCORS();
  28044. * ```
  28045. */
  28046. var isCORS = function () {
  28047. if (CORS != undefined) {
  28048. return CORS;
  28049. }
  28050. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  28051. }
  28052. /**
  28053. * @function setRequestTimeout
  28054. * @category BaseTypes Util
  28055. * @description 设置请求超时时间。
  28056. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  28057. * @usage
  28058. * ```
  28059. * // 浏览器
  28060. <script type="text/javascript" src="{cdn}"></script>
  28061. <script>
  28062. {namespace}.setRequestTimeout(timeout);
  28063. // 弃用的写法
  28064. SuperMap.setRequestTimeout(timeout);
  28065. </script>
  28066. // ES6 Import
  28067. import { setRequestTimeout } from '{npm}';
  28068. setRequestTimeout(timeout);
  28069. * ```
  28070. */
  28071. var setRequestTimeout = function (timeout) {
  28072. return RequestTimeout = timeout;
  28073. }
  28074. /**
  28075. * @function getRequestTimeout
  28076. * @category BaseTypes Util
  28077. * @description 获取请求超时时间。
  28078. * @returns {number} 请求超时时间。
  28079. * @usage
  28080. * ```
  28081. * // 浏览器
  28082. <script type="text/javascript" src="{cdn}"></script>
  28083. <script>
  28084. {namespace}.getRequestTimeout();
  28085. // 弃用的写法
  28086. SuperMap.getRequestTimeout();
  28087. </script>
  28088. // ES6 Import
  28089. import { getRequestTimeout } from '{npm}';
  28090. getRequestTimeout();
  28091. * ```
  28092. */
  28093. var getRequestTimeout = function () {
  28094. return RequestTimeout || 45000;
  28095. }
  28096. /**
  28097. * @name FetchRequest
  28098. * @namespace
  28099. * @category BaseTypes Util
  28100. * @description 获取请求。
  28101. * @usage
  28102. * ```
  28103. * // 浏览器
  28104. * <script type="text/javascript" src="{cdn}"></script>
  28105. * <script>
  28106. * const result = {namespace}.FetchRequest.commit(method, url, params, options);
  28107. *
  28108. * </script>
  28109. *
  28110. * // ES6 Import
  28111. * import { FetchRequest } from '{npm}';
  28112. *
  28113. * const result = FetchRequest.commit(method, url, params, options);
  28114. *
  28115. * ```
  28116. */
  28117. var FetchRequest = {
  28118. /**
  28119. * @function FetchRequest.commit
  28120. * @description commit 请求。
  28121. * @param {string} method - 请求方法。
  28122. * @param {string} url - 请求地址。
  28123. * @param {string} params - 请求参数。
  28124. * @param {Object} options - 请求的配置属性。
  28125. * @returns {Promise} Promise 对象。
  28126. */
  28127. commit: function (method, url, params, options) {
  28128. method = method ? method.toUpperCase() : method;
  28129. switch (method) {
  28130. case 'GET':
  28131. return this.get(url, params, options);
  28132. case 'POST':
  28133. return this.post(url, params, options);
  28134. case 'PUT':
  28135. return this.put(url, params, options);
  28136. case 'DELETE':
  28137. return this.delete(url, params, options);
  28138. default:
  28139. return this.get(url, params, options);
  28140. }
  28141. },
  28142. /**
  28143. * @function FetchRequest.supportDirectRequest
  28144. * @description supportDirectRequest 请求。
  28145. * @param {string} url - 请求地址。
  28146. * @param {Object} options - 请求的配置属性。
  28147. * @returns {boolean} 是否允许跨域请求。
  28148. */
  28149. supportDirectRequest: function (url, options) {
  28150. if (Util_Util.isInTheSameDomain(url)) {
  28151. return true;
  28152. }
  28153. if (options.crossOrigin != undefined) {
  28154. return options.crossOrigin;
  28155. } else {
  28156. return isCORS() || options.proxy;
  28157. }
  28158. },
  28159. /**
  28160. * @function FetchRequest.get
  28161. * @description get 请求。
  28162. * @param {string} url - 请求地址。
  28163. * @param {string} params - 请求参数。
  28164. * @param {Object} options - 请求的配置属性。
  28165. * @returns {Promise} Promise 对象。
  28166. */
  28167. get: function (url, params, options) {
  28168. options = options || {};
  28169. var type = 'GET';
  28170. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  28171. url = this._processUrl(url, options);
  28172. if (!this.supportDirectRequest(url, options)) {
  28173. url = url.replace('.json', '.jsonp');
  28174. var config = {
  28175. url: url,
  28176. data: params
  28177. };
  28178. return RequestJSONPPromise.GET(config);
  28179. }
  28180. if (!this.urlIsLong(url)) {
  28181. return this._fetch(url, params, options, type);
  28182. } else {
  28183. return this._postSimulatie(type, url.substring(0, url.indexOf('?')), params, options);
  28184. }
  28185. },
  28186. /**
  28187. * @function FetchRequest.delete
  28188. * @description delete 请求。
  28189. * @param {string} url - 请求地址。
  28190. * @param {string} params - 请求参数。
  28191. * @param {Object} options -请求的配置属性。
  28192. * @returns {Promise} Promise 对象。
  28193. */
  28194. delete: function (url, params, options) {
  28195. options = options || {};
  28196. var type = 'DELETE';
  28197. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  28198. url = this._processUrl(url, options);
  28199. if (!this.supportDirectRequest(url, options)) {
  28200. url = url.replace('.json', '.jsonp');
  28201. var config = {
  28202. url: url += "&_method=DELETE",
  28203. data: params
  28204. };
  28205. return RequestJSONPPromise.DELETE(config);
  28206. }
  28207. if (this.urlIsLong(url)) {
  28208. return this._postSimulatie(type, url.substring(0, url.indexOf('?')), params, options);
  28209. }
  28210. return this._fetch(url, params, options, type);
  28211. },
  28212. /**
  28213. * @function FetchRequest.post
  28214. * @description post 请求。
  28215. * @param {string} url - 请求地址。
  28216. * @param {string} params - 请求参数。
  28217. * @param {Object} options - 请求的配置属性。
  28218. * @returns {Promise} Promise 对象。
  28219. */
  28220. post: function (url, params, options) {
  28221. options = options || {};
  28222. url = this._processUrl(url, options);
  28223. if (!this.supportDirectRequest(url, options)) {
  28224. url = url.replace('.json', '.jsonp');
  28225. var config = {
  28226. url: Util_Util.urlAppend(url, "_method=POST"),
  28227. data: params
  28228. };
  28229. return RequestJSONPPromise.POST(config);
  28230. }
  28231. return this._fetch(url, params, options, 'POST');
  28232. },
  28233. /**
  28234. * @function FetchRequest.put
  28235. * @description put 请求。
  28236. * @param {string} url - 请求地址。
  28237. * @param {string} params - 请求参数。
  28238. * @param {Object} options - 请求的配置属性。
  28239. * @returns {Promise} Promise 对象。
  28240. */
  28241. put: function (url, params, options) {
  28242. options = options || {};
  28243. url = this._processUrl(url, options);
  28244. if (!this.supportDirectRequest(url, options)) {
  28245. url = url.replace('.json', '.jsonp');
  28246. var config = {
  28247. url: url += "&_method=PUT",
  28248. data: params
  28249. };
  28250. return RequestJSONPPromise.PUT(config);
  28251. }
  28252. return this._fetch(url, params, options, 'PUT');
  28253. },
  28254. /**
  28255. * @function FetchRequest.urlIsLong
  28256. * @description URL 的字节长度是否太长。
  28257. * @param {string} url - 请求地址。
  28258. * @returns {boolean} URL 的字节长度是否太长。
  28259. */
  28260. urlIsLong: function (url) {
  28261. //当前url的字节长度。
  28262. var totalLength = 0,
  28263. charCode = null;
  28264. for (var i = 0, len = url.length; i < len; i++) {
  28265. //转化为Unicode编码
  28266. charCode = url.charCodeAt(i);
  28267. if (charCode < 0x007f) {
  28268. totalLength++;
  28269. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  28270. totalLength += 2;
  28271. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  28272. totalLength += 3;
  28273. }
  28274. }
  28275. return totalLength < 2000 ? false : true;
  28276. },
  28277. _postSimulatie: function (type, url, params, options) {
  28278. var separator = url.indexOf('?') > -1 ? '&' : '?';
  28279. url += separator + '_method=' + type;
  28280. if (typeof params !== 'string') {
  28281. params = JSON.stringify(params);
  28282. }
  28283. return this.post(url, params, options);
  28284. },
  28285. _processUrl: function (url, options) {
  28286. if (this._isMVTRequest(url)) {
  28287. return url;
  28288. }
  28289. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  28290. if (url.indexOf('?') < 0) {
  28291. url += '.json';
  28292. } else {
  28293. var urlArrays = url.split('?');
  28294. if (urlArrays.length === 2) {
  28295. url = urlArrays[0] + '.json?' + urlArrays[1];
  28296. }
  28297. }
  28298. }
  28299. if (options && options.proxy) {
  28300. if (typeof options.proxy === 'function') {
  28301. url = options.proxy(url);
  28302. } else {
  28303. url = decodeURIComponent(url);
  28304. url = options.proxy + encodeURIComponent(url);
  28305. }
  28306. }
  28307. return url;
  28308. },
  28309. _fetch: function (url, params, options, type) {
  28310. options = options || {};
  28311. options.headers = options.headers || {};
  28312. if (!options.headers['Content-Type'] && !FormData.prototype.isPrototypeOf(params)) {
  28313. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  28314. }
  28315. if (options.timeout) {
  28316. return this._timeout(
  28317. options.timeout,
  28318. FetchRequest_fetch(url, {
  28319. method: type,
  28320. headers: options.headers,
  28321. body: type === 'PUT' || type === 'POST' ? params : undefined,
  28322. credentials: this._getWithCredentials(options),
  28323. mode: 'cors',
  28324. timeout: getRequestTimeout()
  28325. }).then(function (response) {
  28326. return response;
  28327. })
  28328. );
  28329. }
  28330. return FetchRequest_fetch(url, {
  28331. method: type,
  28332. body: type === 'PUT' || type === 'POST' ? params : undefined,
  28333. headers: options.headers,
  28334. credentials: this._getWithCredentials(options),
  28335. mode: 'cors',
  28336. timeout: getRequestTimeout()
  28337. }).then(function (response) {
  28338. return response;
  28339. });
  28340. },
  28341. _getWithCredentials: function (options) {
  28342. if (options.withCredentials === true) {
  28343. return 'include';
  28344. }
  28345. if (options.withCredentials === false) {
  28346. return 'omit';
  28347. }
  28348. return 'same-origin';
  28349. },
  28350. _fetchJsonp: function (url, options) {
  28351. options = options || {};
  28352. return fetch_jsonp_default()(url, {
  28353. method: 'GET',
  28354. timeout: options.timeout
  28355. }).then(function (response) {
  28356. return response;
  28357. });
  28358. },
  28359. _timeout: function (seconds, promise) {
  28360. return new Promise(function (resolve, reject) {
  28361. setTimeout(function () {
  28362. reject(new Error('timeout'));
  28363. }, seconds);
  28364. promise.then(resolve, reject);
  28365. });
  28366. },
  28367. _getParameterString: function (params) {
  28368. var paramsArray = [];
  28369. for (var key in params) {
  28370. var value = params[key];
  28371. if (value != null && typeof value !== 'function') {
  28372. var encodedValue;
  28373. if (Array.isArray(value) || value.toString() === '[object Object]') {
  28374. encodedValue = encodeURIComponent(JSON.stringify(value));
  28375. } else {
  28376. encodedValue = encodeURIComponent(value);
  28377. }
  28378. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  28379. }
  28380. }
  28381. return paramsArray.join('&');
  28382. },
  28383. _isMVTRequest: function (url) {
  28384. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  28385. }
  28386. }
  28387. ;// CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  28388. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28389. * This program are made available under the terms of the Apache License, Version 2.0
  28390. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28391. /**
  28392. * @class SecurityManager
  28393. * @deprecatedclass SuperMap.SecurityManager
  28394. * @category Security
  28395. * @classdesc 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  28396. * > 使用说明:
  28397. * > 创建任何一个服务之前调用 {@link SecurityManager.registerToken}或
  28398. * > {@link SecurityManager.registerKey}注册凭据。
  28399. * > 发送请求时根据 URL 或者服务 ID 获取相应的 key 或者 token 并自动添加到服务地址中。
  28400. * @usage
  28401. */
  28402. class SecurityManager {
  28403. /**
  28404. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  28405. * @function SecurityManager.generateToken
  28406. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  28407. * @param {TokenServiceParameter} tokenParam - token 申请参数。
  28408. * @returns {Promise} 包含 token 信息的 Promise 对象。
  28409. */
  28410. static generateToken(url, tokenParam) {
  28411. var serverInfo = this.servers[url];
  28412. if (!serverInfo) {
  28413. return;
  28414. }
  28415. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function(
  28416. response
  28417. ) {
  28418. return response.text();
  28419. });
  28420. }
  28421. /**
  28422. * @description 注册安全服务器相关信息。
  28423. * @function SecurityManager.registerServers
  28424. * @param {ServerInfo} serverInfos - 服务器信息。
  28425. */
  28426. static registerServers(serverInfos) {
  28427. this.servers = this.servers || {};
  28428. if (!Util_Util.isArray(serverInfos)) {
  28429. serverInfos = [serverInfos];
  28430. }
  28431. for (var i = 0; i < serverInfos.length; i++) {
  28432. var serverInfo = serverInfos[i];
  28433. this.servers[serverInfo.server] = serverInfo;
  28434. }
  28435. }
  28436. /**
  28437. * @description 服务请求都会自动带上这个 token。
  28438. * @function SecurityManager.registerToken
  28439. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  28440. * @param {string} token - token。
  28441. */
  28442. static registerToken(url, token) {
  28443. this.tokens = this.tokens || {};
  28444. if (!url || !token) {
  28445. return;
  28446. }
  28447. var domain = this._getTokenStorageKey(url);
  28448. this.tokens[domain] = token;
  28449. }
  28450. /**
  28451. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  28452. * @function SecurityManager.registerKey
  28453. * @param {Array} ids - 可以是服务 ID 数组或者 URL 地址数组或者 webAPI 类型数组。
  28454. * @param {string} key - key。
  28455. */
  28456. static registerKey(ids, key) {
  28457. this.keys = this.keys || {};
  28458. if (!ids || ids.length < 1 || !key) {
  28459. return;
  28460. }
  28461. ids = Util_Util.isArray(ids) ? ids : [ids];
  28462. for (var i = 0; i < ids.length; i++) {
  28463. var id = this._getUrlRestString(ids[0]) || ids[0];
  28464. this.keys[id] = key;
  28465. }
  28466. }
  28467. /**
  28468. * @description 获取服务器信息。
  28469. * @function SecurityManager.getServerInfo
  28470. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  28471. * @returns {ServerInfo} 服务器信息。
  28472. */
  28473. static getServerInfo(url) {
  28474. this.servers = this.servers || {};
  28475. return this.servers[url];
  28476. }
  28477. /**
  28478. * @description 根据 URL 获取token。
  28479. * @function SecurityManager.getToken
  28480. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  28481. * @returns {string} token。
  28482. */
  28483. static getToken(url) {
  28484. if (!url) {
  28485. return;
  28486. }
  28487. this.tokens = this.tokens || {};
  28488. var domain = this._getTokenStorageKey(url);
  28489. return this.tokens[domain];
  28490. }
  28491. /**
  28492. * @description 根据 URL 获取 key。
  28493. * @function SecurityManager.getKey
  28494. * @param {string} id - ID。
  28495. * @returns {string} key。
  28496. */
  28497. static getKey(id) {
  28498. this.keys = this.keys || {};
  28499. var key = this._getUrlRestString(id) || id;
  28500. return this.keys[key];
  28501. }
  28502. /**
  28503. * @description iServer 登录验证。
  28504. * @function SecurityManager.loginiServer
  28505. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  28506. * @param {string} username - 用户名。
  28507. * @param {string} password - 密码。
  28508. * @param {boolean} [rememberme=false] - 是否记住。
  28509. * @returns {Promise} 包含 iServer 登录请求结果的 Promise 对象。
  28510. */
  28511. static loginiServer(url, username, password, rememberme) {
  28512. url = Util_Util.urlPathAppend(url, 'services/security/login');
  28513. var loginInfo = {
  28514. username: username && username.toString(),
  28515. password: password && password.toString(),
  28516. rememberme: rememberme
  28517. };
  28518. loginInfo = JSON.stringify(loginInfo);
  28519. var requestOptions = {
  28520. headers: {
  28521. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  28522. }
  28523. };
  28524. return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
  28525. return response.json();
  28526. });
  28527. }
  28528. /**
  28529. * @description iServer登出。
  28530. * @function SecurityManager.logoutiServer
  28531. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  28532. * @returns {Promise} 是否登出成功。
  28533. */
  28534. static logoutiServer(url) {
  28535. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  28536. var requestOptions = {
  28537. headers: {
  28538. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  28539. },
  28540. withoutFormatSuffix: true
  28541. };
  28542. return FetchRequest.get(url, '', requestOptions)
  28543. .then(function() {
  28544. return true;
  28545. })
  28546. .catch(function() {
  28547. return false;
  28548. });
  28549. }
  28550. /**
  28551. * @description Online 登录验证。
  28552. * @function SecurityManager.loginOnline
  28553. * @param {string} callbackLocation - 跳转位置。
  28554. * @param {boolean} [newTab=true] - 是否新窗口打开。
  28555. */
  28556. static loginOnline(callbackLocation, newTab) {
  28557. var loginUrl = SecurityManager.SSO + '/login?service=' + callbackLocation;
  28558. this._open(loginUrl, newTab);
  28559. }
  28560. /**
  28561. * @description iPortal登录验证。
  28562. * @function SecurityManager.loginiPortal
  28563. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  28564. * @param {string} username - 用户名。
  28565. * @param {string} password - 密码。
  28566. * @returns {Promise} 包含 iPortal 登录请求结果的 Promise 对象。
  28567. */
  28568. static loginiPortal(url, username, password) {
  28569. url = Util_Util.urlPathAppend(url, 'web/login');
  28570. var loginInfo = {
  28571. username: username && username.toString(),
  28572. password: password && password.toString()
  28573. };
  28574. loginInfo = JSON.stringify(loginInfo);
  28575. var requestOptions = {
  28576. headers: {
  28577. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  28578. },
  28579. withCredentials: true
  28580. };
  28581. return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
  28582. return response.json();
  28583. });
  28584. }
  28585. /**
  28586. * @description iPortal 登出。
  28587. * @function SecurityManager.logoutiPortal
  28588. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  28589. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  28590. */
  28591. static logoutiPortal(url) {
  28592. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  28593. var requestOptions = {
  28594. headers: {
  28595. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  28596. },
  28597. withCredentials: true,
  28598. withoutFormatSuffix: true
  28599. };
  28600. return FetchRequest.get(url, '', requestOptions)
  28601. .then(function() {
  28602. return true;
  28603. })
  28604. .catch(function() {
  28605. return false;
  28606. });
  28607. }
  28608. /**
  28609. * @description iManager 登录验证。
  28610. * @function SecurityManager.loginManager
  28611. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  28612. * @param {Object} [loginInfoParams] - iManager 登录参数。
  28613. * @param {string} loginInfoParams.userName - 用户名。
  28614. * @param {string} loginInfoParams.password - 密码。
  28615. * @param {Object} options
  28616. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  28617. * @returns {Promise} 包含 iManager 登录请求结果的 Promise 对象。
  28618. */
  28619. static loginManager(url, loginInfoParams, options) {
  28620. if (!Util_Util.isInTheSameDomain(url)) {
  28621. var isNewTab = options ? options.isNewTab : true;
  28622. this._open(url, isNewTab);
  28623. return;
  28624. }
  28625. var requestUrl = Util_Util.urlPathAppend(url, 'icloud/security/tokens');
  28626. var params = loginInfoParams || {};
  28627. var loginInfo = {
  28628. username: params.userName && params.userName.toString(),
  28629. password: params.password && params.password.toString()
  28630. };
  28631. loginInfo = JSON.stringify(loginInfo);
  28632. var requestOptions = {
  28633. headers: {
  28634. Accept: '*/*',
  28635. 'Content-Type': 'application/json'
  28636. }
  28637. };
  28638. var me = this;
  28639. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function(response) {
  28640. response.text().then(function(result) {
  28641. me.imanagerToken = result;
  28642. return result;
  28643. });
  28644. });
  28645. }
  28646. /**
  28647. * @description 清空全部验证信息。
  28648. * @function SecurityManager.destroyAllCredentials
  28649. */
  28650. static destroyAllCredentials() {
  28651. this.keys = null;
  28652. this.tokens = null;
  28653. this.servers = null;
  28654. }
  28655. /**
  28656. * @description 清空令牌信息。
  28657. * @function SecurityManager.destroyToken
  28658. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  28659. */
  28660. static destroyToken(url) {
  28661. if (!url) {
  28662. return;
  28663. }
  28664. var domain = this._getTokenStorageKey(url);
  28665. this.tokens = this.tokens || {};
  28666. if (this.tokens[domain]) {
  28667. delete this.tokens[domain];
  28668. }
  28669. }
  28670. /**
  28671. * @description 清空服务授权码。
  28672. * @function SecurityManager.destroyKey
  28673. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  28674. */
  28675. static destroyKey(url) {
  28676. if (!url) {
  28677. return;
  28678. }
  28679. this.keys = this.keys || {};
  28680. var key = this._getUrlRestString(url) || url;
  28681. if (this.keys[key]) {
  28682. delete this.keys[key];
  28683. }
  28684. }
  28685. /**
  28686. * @description 服务URL追加授权信息,授权信息需先通过SecurityManager.registerKey或SecurityManager.registerToken注册。
  28687. * @version 10.1.2
  28688. * @function SecurityManager.appendCredential
  28689. * @param {string} url - 服务URL。
  28690. * @returns {string} 绑定了token或者key的服务URL。
  28691. */
  28692. static appendCredential(url) {
  28693. var newUrl = url;
  28694. var value = this.getToken(url);
  28695. var credential = value ? new Credential(value, 'token') : null;
  28696. if (!credential) {
  28697. value = this.getKey(url);
  28698. credential = value ? new Credential(value, 'key') : null;
  28699. }
  28700. if (credential) {
  28701. newUrl = Util_Util.urlAppend(newUrl, credential.getUrlParameters());
  28702. }
  28703. return newUrl;
  28704. }
  28705. static _open(url, newTab) {
  28706. newTab = newTab != null ? newTab : true;
  28707. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  28708. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  28709. var options =
  28710. 'height=' +
  28711. this.INNER_WINDOW_HEIGHT +
  28712. ', width=' +
  28713. this.INNER_WINDOW_WIDTH +
  28714. ',top=' +
  28715. offsetY +
  28716. ', left=' +
  28717. offsetX +
  28718. ',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';
  28719. if (newTab) {
  28720. window.open(url, 'login');
  28721. } else {
  28722. window.open(url, 'login', options);
  28723. }
  28724. }
  28725. static _getTokenStorageKey(url) {
  28726. var patten = /(.*?):\/\/([^\/]+)/i;
  28727. var result = url.match(patten);
  28728. if (!result) {
  28729. return url;
  28730. }
  28731. return result[0];
  28732. }
  28733. static _getUrlRestString(url) {
  28734. if (!url) {
  28735. return url;
  28736. }
  28737. // var patten = /http:\/\/(.*\/rest)/i;
  28738. var patten = /(http|https):\/\/(.*\/rest)/i;
  28739. var result = url.match(patten);
  28740. if (!result) {
  28741. return url;
  28742. }
  28743. return result[0];
  28744. }
  28745. }
  28746. SecurityManager.INNER_WINDOW_WIDTH = 600;
  28747. SecurityManager.INNER_WINDOW_HEIGHT = 600;
  28748. SecurityManager.SSO = 'https://sso.supermap.com';
  28749. SecurityManager.ONLINE = 'https://www.supermapol.com';
  28750. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerServiceBase.js
  28751. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28752. * This program are made available under the terms of the Apache License, Version 2.0
  28753. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28754. /**
  28755. * @class IManagerServiceBase
  28756. * @aliasclass iManagerServiceBase
  28757. * @deprecatedclass SuperMap.iManagerServiceBase
  28758. * @classdesc iManager 服务基类(有权限限制的类需要实现此类)。
  28759. * @category iManager
  28760. * @param {string} url - iManager 首页地址,如:http://localhost:8390/imanager。
  28761. * @param {Object} options - 可选参数。
  28762. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28763. * @param {Object} [options.headers] - 请求头。
  28764. * @usage
  28765. */
  28766. class IManagerServiceBase {
  28767. constructor(url,options) {
  28768. if (url) {
  28769. var end = url.substr(url.length - 1, 1);
  28770. this.serviceUrl = end === "/" ? url.substr(0, url.length - 2) : url;
  28771. }
  28772. this.options = options || {};
  28773. this.CLASS_NAME = "SuperMap.iManagerServiceBase";
  28774. }
  28775. /**
  28776. * @function IManagerServiceBase.prototype.request
  28777. * @description 子类统一通过该方法发送请求。
  28778. * @param {string} url - 请求 URL。
  28779. * @param {string} [method='GET'] - 请求类型。
  28780. * @param {Object} [requestOptions] - 请求选项。
  28781. * @param {Object} param - 请求参数。
  28782. * @description 发送请求。
  28783. * @returns {Promise} Promise 对象。
  28784. */
  28785. request(method, url, param, requestOptions) {
  28786. requestOptions = requestOptions || {
  28787. headers: {
  28788. 'Accept': '*/*',
  28789. 'Content-Type': 'application/json'
  28790. }
  28791. };
  28792. if (!requestOptions.hasOwnProperty("withCredentials")) {
  28793. requestOptions['withCredentials'] = true;
  28794. }
  28795. requestOptions['crossOrigin'] = this.options.crossOrigin;
  28796. requestOptions['headers'] = this.options.headers;
  28797. var token = SecurityManager.imanagerToken;
  28798. if (token) {
  28799. if (!requestOptions.headers) {
  28800. requestOptions.headers = [];
  28801. }
  28802. requestOptions.headers['X-Auth-Token'] = token;
  28803. }
  28804. if (param) {
  28805. param = JSON.stringify(param);
  28806. }
  28807. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  28808. return response.json();
  28809. });
  28810. }
  28811. }
  28812. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerCreateNodeParam.js
  28813. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28814. * This program are made available under the terms of the Apache License, Version 2.0
  28815. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28816. /**
  28817. * @class IManagerCreateNodeParam
  28818. * @aliasclass iManagerCreateNodeParam
  28819. * @deprecatedclass SuperMap.iManagerCreateNodeParam
  28820. * @classdesc iManager 创建节点参数。
  28821. * @category iManager
  28822. * @param {Object} [params] - 节点参数。
  28823. * @usage
  28824. */
  28825. class IManagerCreateNodeParam {
  28826. constructor(params) {
  28827. params = params || {};
  28828. this.nodeSpec = 'SMALL'; //取值范围: ['SMALL','MEDIUM','LARGE'] 以及自定义的环境规格名称
  28829. this.nodeCount = 1; //要创建vm的个数
  28830. this.nodeName = ''; //vm名称
  28831. this.password = ''; //vm的密码,空表示随机分配
  28832. this.description = ''; //描述信息
  28833. this.physicalMachineName = ''; //vm所属的物理机名称.
  28834. this.ips = []; //vm的ip,空数组表示随机分配
  28835. this.userName = ''; //vm所属用户
  28836. Util_Util.extend(this, params);
  28837. }
  28838. }
  28839. ;// CONCATENATED MODULE: ./src/common/iManager/iManager.js
  28840. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28841. * This program are made available under the terms of the Apache License, Version 2.0
  28842. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28843. /**
  28844. * @class IManager
  28845. * @aliasclass iManager
  28846. * @deprecatedclass SuperMap.iManager
  28847. * @classdesc iManager 服务类。
  28848. * @category iManager
  28849. * @modulecategory Services
  28850. * @param {string} serviceUrl - iManager 首页地址。
  28851. * @usage
  28852. */
  28853. class IManager extends IManagerServiceBase {
  28854. constructor(iManagerUrl) {
  28855. super(iManagerUrl);
  28856. }
  28857. /**
  28858. * @function IManager.prototype.load
  28859. * @description 获取所有服务接口,验证是否已登录授权。
  28860. * @returns {Promise} Promise 对象。
  28861. */
  28862. load() {
  28863. return this.request("GET", this.serviceUrl + '/web/api/service.json');
  28864. }
  28865. /**
  28866. * @function IManager.prototype.createIServer
  28867. * @param {IManagerCreateNodeParam} createParam - 创建参数。
  28868. * @description 创建 iServer。
  28869. * @returns {Promise} Promise 对象。
  28870. */
  28871. createIServer(createParam) {
  28872. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/server.json', new IManagerCreateNodeParam(createParam));
  28873. }
  28874. /**
  28875. * @function IManager.prototype.createIPortal
  28876. * @param {IManagerCreateNodeParam} createParam - 创建参数。
  28877. * @description 创建 iPortal。
  28878. * @returns {Promise} Promise 对象。
  28879. */
  28880. createIPortal(createParam) {
  28881. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/portal.json', new IManagerCreateNodeParam(createParam));
  28882. }
  28883. /**
  28884. * @function IManager.prototype.iServerList
  28885. * @description 获取所有创建的 iServer。
  28886. * @returns {Promise} Promise 对象。
  28887. */
  28888. iServerList() {
  28889. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/server.json');
  28890. }
  28891. /**
  28892. * @function IManager.prototype.iPortalList
  28893. * @description 获取所有创建的 iPortal。
  28894. * @returns {Promise} Promise 对象。
  28895. */
  28896. iPortalList() {
  28897. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/portal.json');
  28898. }
  28899. /**
  28900. * @function IManager.prototype.startNodes
  28901. * @param {Array.<string>} ids - 需要启动节点的 ID 数组。e.g:['1']。
  28902. * @description 启动节点。
  28903. * @returns {Promise} Promise 对象。
  28904. */
  28905. startNodes(ids) {
  28906. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/started.json', ids);
  28907. }
  28908. /**
  28909. * @function IManager.prototype.stopNodes
  28910. * @param {Array.<string>} ids - 需要停止节点的 ID 数组。e.g:['1']。
  28911. * @description 停止节点。
  28912. * @returns {Promise} Promise 对象。
  28913. */
  28914. stopNodes(ids) {
  28915. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/stopped.json', ids);
  28916. }
  28917. }
  28918. ;// CONCATENATED MODULE: ./src/common/iManager/index.js
  28919. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28920. * This program are made available under the terms of the Apache License, Version 2.0
  28921. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28922. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalServiceBase.js
  28923. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28924. * This program are made available under the terms of the Apache License, Version 2.0
  28925. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28926. /**
  28927. * @class IPortalServiceBase
  28928. * @aliasclass iPortalServiceBase
  28929. * @deprecatedclass SuperMap.iPortalServiceBase
  28930. * @classdesc iPortal 服务基类(有权限限制的类需要实现此类)。
  28931. * @category iPortal/Online Core
  28932. * @param {string} url - 服务地址。
  28933. * @param {Object} options - 可选参数。
  28934. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  28935. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28936. * @param {Object} [options.headers] - 请求头。
  28937. * @usage
  28938. */
  28939. class IPortalServiceBase {
  28940. constructor(url, options) {
  28941. options = options || {};
  28942. this.serviceUrl = url;
  28943. this.CLASS_NAME = "SuperMap.iPortalServiceBase";
  28944. this.withCredentials = options.withCredentials || false;
  28945. this.crossOrigin = options.crossOrigin
  28946. this.headers = options.headers
  28947. }
  28948. /**
  28949. * @function IPortalServiceBase.prototype.request
  28950. * @description 子类统一通过该方法发送请求。
  28951. * @param {string} [method='GET'] - 请求类型。
  28952. * @param {string} url - 服务地址。
  28953. * @param {Object} param - 请求参数。
  28954. * @param {Object} [requestOptions] - fetch 请求配置项。
  28955. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  28956. */
  28957. request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) {
  28958. url = SecurityManager.appendCredential(url);
  28959. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  28960. return response.json();
  28961. });
  28962. }
  28963. }
  28964. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryParam.js
  28965. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28966. * This program are made available under the terms of the Apache License, Version 2.0
  28967. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28968. /**
  28969. * @class IPortalQueryParam
  28970. * @aliasclass iPortalQueryParam
  28971. * @deprecatedclass SuperMap.iPortalQueryParam
  28972. * @classdesc iPortal 资源查询参数。
  28973. * @version 10.0.1
  28974. * @category iPortal/Online Resources ResourcesQuery
  28975. * @param {Object} params - 可选参数。
  28976. * @param {ResourceType} [params.resourceType] - 资源类型。
  28977. * @param {number} [params.pageSize] - 分页中每页大小。
  28978. * @param {number} [params.currentPage] - 分页页码。
  28979. * @param {OrderBy} [params.orderBy] - 排序字段。
  28980. * @param {OrderType} [params.orderType] - 根据升序还是降序过滤。
  28981. * @param {SearchType} [params.searchType] - 根据查询的范围进行过滤。
  28982. * @param {Array} [params.tags] - 标签。
  28983. * @param {Array} [params.dirIds] - 目录 ID。
  28984. * @param {Array} [params.resourceSubTypes] - 根据资源的子类型进行过滤。
  28985. * @param {AggregationTypes} [params.aggregationTypes] - 聚合查询的类型。
  28986. * @param {string} [params.text] - 搜索的关键词。
  28987. * @param {Array} [params.groupIds] - 根据群组进行过滤。
  28988. * @param {Array} [params.departmentIds] - 根据部门进行过滤。
  28989. * @usage
  28990. */
  28991. class IPortalQueryParam {
  28992. constructor(params) {
  28993. params = params || {};
  28994. this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  28995. this.pageSize = 12; // 每页多少条
  28996. this.currentPage = 1; // 第几页
  28997. this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
  28998. this.orderType = "DESC"; // DESC ASC
  28999. this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
  29000. this.tags = []; // 标签
  29001. this.dirIds = []; // 类别
  29002. this.resourceSubTypes = []; // 类型
  29003. this.aggregationTypes = []; // TAG TYPE SUBTYPE
  29004. this.text = ""; // 搜索字段
  29005. this.groupIds = []; // 群组Id过滤
  29006. this.departmentIds = []; // 部门Id过滤
  29007. Util_Util.extend(this, params);
  29008. }
  29009. }
  29010. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryResult.js
  29011. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29012. * This program are made available under the terms of the Apache License, Version 2.0
  29013. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29014. /**
  29015. * @class IPortalQueryResult
  29016. * @aliasclass iPortalQueryResult
  29017. * @deprecatedclass SuperMap.iPortalQueryResult
  29018. * @classdesc iPortal 资源结果集封装类。
  29019. * @version 10.0.1
  29020. * @category iPortal/Online Resources ResourcesQuery
  29021. * @param {Object} queryResult - 可选参数。
  29022. * @param {Array} [queryResult.content] - 页面内容。
  29023. * @param {number} [queryResult.total] - 总记录数。
  29024. * @param {number} [queryResult.currentPage] - 当前第几页。
  29025. * @param {number} [queryResult.pageSize] - 每页大小。
  29026. * @param {Object} [queryResult.aggregations] - 聚合查询的结果。
  29027. * @usage
  29028. */
  29029. class IPortalQueryResult {
  29030. constructor(queryResult) {
  29031. queryResult = queryResult || {};
  29032. this.content = [];
  29033. this.total = 0;
  29034. this.currentPage = 1;
  29035. this.pageSize = 12;
  29036. this.aggregations = null;
  29037. Util_Util.extend(this, queryResult);
  29038. }
  29039. }
  29040. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalResource.js
  29041. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29042. * This program are made available under the terms of the Apache License, Version 2.0
  29043. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29044. /**
  29045. * @class IPortalResource
  29046. * @aliasclass iPortalResource
  29047. * @deprecatedclass SuperMap.iPortalResource
  29048. * @classdesc iPortal 资源详情类。
  29049. * @version 10.0.1
  29050. * @category iPortal/Online Resources
  29051. * @param {string} portalUrl - 服务地址。
  29052. * @param {Object} resourceInfo - 可选参数。
  29053. * @param {Array} [resourceInfo.authorizeSetting] - 资源的授权信息。
  29054. * @param {string} [resourceInfo.bounds] - 资源的坐标范围。
  29055. * @param {string} [resourceInfo.bounds4326] - 资源的坐标范围,转换为EPSG 4326坐标系统后的地理范围。
  29056. * @param {string} [resourceInfo.checkStatus] - 资源的审核状态,可以是:空,SUCCESSFUL,UNCHECKED,FAILED。
  29057. * @param {Date} [resourceInfo.createTime] - 资源的创建时间。
  29058. * @param {string} [resourceInfo.description] - 资源描述。
  29059. * @param {number} [resourceInfo.dirId] - 资源所在的门户目录的ID。
  29060. * @param {number} [resourceInfo.epsgCode] - 门户资源基于的坐标系的EPSG值。
  29061. * @param {number} [resourceInfo.heatLevel] - 记录资源的访问量或下载量。
  29062. * @param {string} [resourceInfo.id] - 资源存储到ElasticSearch中的文档ID。
  29063. * @param {string} [resourceInfo.name] - 资源名称。
  29064. * @param {number} [resourceInfo.personalDirId] - 资源所在的个人目录的ID。
  29065. * @param {number} [resourceInfo.resourceId] - 资源表(maps,services等)里的ID。
  29066. * @param {string} [resourceInfo.resourceSubType] - 某类资源的具体子类型。
  29067. * @param {ResourceType} [resourceInfo.resourceType] - 资源类型。
  29068. * @param {number} [resourceInfo.serviceRootUrlId] - 批量注册服务时,服务根地址的ID。
  29069. * @param {Array} [resourceInfo.tags] - 资源的标签。
  29070. * @param {string} [resourceInfo.thumbnail] - 资源的缩略图。
  29071. * @param {Date} [resourceInfo.updateTime] - 资源的更新时间。
  29072. * @param {string} [resourceInfo.userName] - 搜索的关键词。
  29073. * @param {Object} [resourceInfo.sourceJSON] - 提供了门户项目返回的所有信息。
  29074. * @extends {IPortalServiceBase}
  29075. * @usage
  29076. */
  29077. class IPortalResource extends IPortalServiceBase {
  29078. constructor(portalUrl, resourceInfo) {
  29079. super(portalUrl);
  29080. resourceInfo = resourceInfo || {};
  29081. this.authorizeSetting = [];
  29082. this.bounds = "";
  29083. this.bounds4326 = "";
  29084. this.checkStatus = "";
  29085. this.createTime = 0;
  29086. this.description = null;
  29087. this.dirId = null;
  29088. this.epsgCode = 0;
  29089. this.heatLevel = 0;
  29090. this.id = 0;
  29091. this.name = "";
  29092. this.personalDirId = null;
  29093. this.resourceId = 0;
  29094. this.resourceSubType = null;
  29095. this.resourceType = null;
  29096. this.serviceRootUrlId = null;
  29097. this.tags = null;
  29098. this.thumbnail = null;
  29099. this.updateTime = 0;
  29100. this.userName = "";
  29101. this.sourceJSON = {};//返回门户资源详细信息
  29102. Util_Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
  29103. this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  29104. if (this.withCredentials) {
  29105. this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  29106. }
  29107. // if (this.id) {
  29108. // this.mapUrl = mapUrl + "/" + this.id;
  29109. // }
  29110. }
  29111. /**
  29112. * @function IPortalResource.prototype.load
  29113. * @description 加载资源信息。
  29114. * @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
  29115. */
  29116. load() {
  29117. var me = this;
  29118. return me.request("GET", me.resourceUrl + ".json")
  29119. .then(function (resourceInfo) {
  29120. if (resourceInfo.error) {
  29121. return resourceInfo;
  29122. }
  29123. me.sourceJSON = resourceInfo;
  29124. });
  29125. }
  29126. /**
  29127. * @function IPortalResource.prototype.update
  29128. * @description 更新资源属性信息。
  29129. * @returns {Promise} 返回包含更新操作状态的 Promise 对象。
  29130. */
  29131. update() {
  29132. var resourceName = this.resourceType.replace("_","").toLowerCase();
  29133. var options = {
  29134. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  29135. };
  29136. if( resourceName === 'data') {
  29137. this.resourceUrl = this.resourceUrl + "/attributes.json";
  29138. }
  29139. var entity = JSON.stringify(this.sourceJSON);
  29140. //对服务资源进行编辑时,请求体内容只留关键字字段(目前如果是全部字段 更新返回成功 但其实没有真正的更新)
  29141. if( resourceName === 'service') {
  29142. var serviceInfo = {
  29143. authorizeSetting:this.sourceJSON.authorizeSetting,
  29144. metadata:this.sourceJSON.metadata,
  29145. tags:this.sourceJSON.tags,
  29146. thumbnail:this.sourceJSON.thumbnail,
  29147. tokenRefreshUrl:this.sourceJSON.tokenRefreshUrl
  29148. };
  29149. entity = JSON.stringify(serviceInfo);
  29150. }
  29151. return this.request("PUT", this.resourceUrl, entity, options);
  29152. }
  29153. }
  29154. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareParam.js
  29155. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29156. * This program are made available under the terms of the Apache License, Version 2.0
  29157. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29158. /**
  29159. * @class IPortalShareParam
  29160. * @aliasclass iPortalShareParam
  29161. * @deprecatedclass SuperMap.iPortalShareParam
  29162. * @classdesc iPortal 资源共享参数。
  29163. * @version 10.0.1
  29164. * @category iPortal/Online Resources ResourcesShare
  29165. * @param {Object} params - 可选参数。
  29166. * @param {ResourceType} [params.resourceType] - 资源类型。
  29167. * @param {Array} [params.ids] - 资源的ID数组。
  29168. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  29169. * @usage
  29170. */
  29171. class IPortalShareParam {
  29172. constructor(params) {
  29173. params = params || {};
  29174. this.ids = [];
  29175. this.entities = [];
  29176. this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  29177. Util_Util.extend(this, params);
  29178. }
  29179. }
  29180. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortal.js
  29181. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29182. * This program are made available under the terms of the Apache License, Version 2.0
  29183. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29184. /**
  29185. * @class IPortal
  29186. * @aliasclass iPortal
  29187. * @deprecatedclass SuperMap.iPortal
  29188. * @classdesc 对接 SuperMap iPortal 基础服务。
  29189. * @category iPortal/Online Resources
  29190. * @modulecategory Services
  29191. * @extends {IPortalServiceBase}
  29192. * @param {string} iportalUrl - 服务地址。
  29193. * @param {Object} options - 可选参数。
  29194. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  29195. * @usage
  29196. */
  29197. class IPortal extends IPortalServiceBase {
  29198. constructor(iportalUrl, options) {
  29199. super(iportalUrl, options);
  29200. this.iportalUrl = iportalUrl;
  29201. options = options || {};
  29202. this.withCredentials = options.withCredentials || false;
  29203. }
  29204. /**
  29205. * @function IPortal.prototype.load
  29206. * @description 加载页面。
  29207. * @returns {Promise} 包含 iportal web 资源信息的 Promise 对象。
  29208. */
  29209. load() {
  29210. return FetchRequest.get(this.iportalUrl + "/web");
  29211. }
  29212. /**
  29213. * @function IPortal.prototype.queryResources
  29214. * @description 查询资源。
  29215. * @version 10.0.1
  29216. * @param {IPortalQueryParam} queryParams - 查询参数。
  29217. * @returns {Promise} 包含所有资源结果的 Promise 对象。
  29218. */
  29219. queryResources(queryParams) {
  29220. if (!(queryParams instanceof IPortalQueryParam)) {
  29221. return new Promise( function(resolve){
  29222. resolve(
  29223. "queryParams is not instanceof iPortalQueryParam !"
  29224. );
  29225. });
  29226. }
  29227. var me = this;
  29228. var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
  29229. queryParams.t = new Date().getTime();
  29230. return this.request("GET", resourceUrl, queryParams).then(function(result) {
  29231. var content = [];
  29232. (result.content || []).forEach(function(item) {
  29233. content.push(new IPortalResource(me.iportalUrl, item));
  29234. });
  29235. let queryResult = new IPortalQueryResult();
  29236. queryResult.content = content;
  29237. queryResult.total = result.total;
  29238. queryResult.currentPage = result.currentPage;
  29239. queryResult.pageSize = result.pageSize;
  29240. queryResult.aggregations = result.aggregations;
  29241. return queryResult;
  29242. });
  29243. }
  29244. /**
  29245. * @function IPortal.prototype.updateResourcesShareSetting
  29246. * @description 更新共享设置。
  29247. * @version 10.0.1
  29248. * @param {IPortalShareParam} shareParams - 共享的参数。
  29249. * @returns {Promise} 包含共享资源结果的 Promise 对象。
  29250. */
  29251. updateResourcesShareSetting(shareParams) {
  29252. if (!(shareParams instanceof IPortalShareParam)) {
  29253. return new Promise( function(resolve){
  29254. resolve(
  29255. "shareParams is not instanceof iPortalShareParam !"
  29256. );
  29257. });
  29258. }
  29259. var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
  29260. if(resourceUrlName === "datas"){
  29261. resourceUrlName = "mycontent/"+resourceUrlName;
  29262. }
  29263. var cloneShareParams = {
  29264. ids: shareParams.ids,
  29265. entities: shareParams.entities
  29266. }
  29267. var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
  29268. return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
  29269. return result;
  29270. });
  29271. }
  29272. }
  29273. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareEntity.js
  29274. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29275. * This program are made available under the terms of the Apache License, Version 2.0
  29276. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29277. /**
  29278. * @class IPortalShareEntity
  29279. * @aliasclass iPortalShareEntity
  29280. * @deprecatedclass SuperMap.iPortalShareEntity
  29281. * @classdesc iPortal 资源共享实体参数。
  29282. * @version 10.0.1
  29283. * @category iPortal/Online Resources ResourcesShare
  29284. * @param {Object} shareEntity - 可选参数。
  29285. * @param {PermissionType} [shareEntity.permissionType] - 权限类型。
  29286. * @param {EntityType} [shareEntity.entityType] - 实体类型。
  29287. * @param {string} [shareEntity.entityName] - 实体 Name。对应的 USER(用户)、ROLE(角色)、GROUP(用户组)、IPORTALGROUP(群组)的名称。
  29288. * @param {number} [shareEntity.entityId] - 实体的 ID。用于群组的授权。
  29289. * @usage
  29290. */
  29291. class IPortalShareEntity {
  29292. constructor(shareEntity) {
  29293. shareEntity = shareEntity || {};
  29294. this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
  29295. this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
  29296. this.entityName = "GUEST"; // GUEST or 具体用户 name
  29297. this.entityId = null;
  29298. Util_Util.extend(this, shareEntity);
  29299. }
  29300. }
  29301. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddResourceParam.js
  29302. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29303. * This program are made available under the terms of the Apache License, Version 2.0
  29304. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29305. /**
  29306. * @class IPortalAddResourceParam
  29307. * @aliasclass iPortalAddResourceParam
  29308. * @deprecatedclass SuperMap.iPortalAddResourceParam
  29309. * @classdesc iPortal 添加资源参数。
  29310. * @version 10.0.1
  29311. * @category iPortal/Online Resources ResourcesShare
  29312. * @param {Object} params - 可选参数。
  29313. * @param {string} [params.rootUrl] - 服务地址。
  29314. * @param {Array} [params.tags] - 标签。
  29315. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  29316. * @usage
  29317. */
  29318. class IPortalAddResourceParam {
  29319. constructor(params) {
  29320. params = params || {};
  29321. this.rootUrl = "";
  29322. this.tags = [];
  29323. this.entities = [];
  29324. Util_Util.extend(this, params);
  29325. }
  29326. }
  29327. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalRegisterServiceParam.js
  29328. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29329. * This program are made available under the terms of the Apache License, Version 2.0
  29330. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29331. /**
  29332. * @class IPortalRegisterServiceParam
  29333. * @aliasclass iPortalRegisterServiceParam
  29334. * @deprecatedclass SuperMap.iPortalRegisterServiceParam
  29335. * @classdesc iPortal 注册服务参数。
  29336. * @version 10.0.1
  29337. * @category iPortal/Online Resources Data
  29338. * @param {Object} params - 可选参数。
  29339. * @param {string} [params.type] - 服务类型。
  29340. * @param {Array} [params.tags] - 服务标签。
  29341. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  29342. * @param {Object} [params.metadata] - 服务元信息。
  29343. * @param {Array} [params.addedMapNames] - 地图服务列表。
  29344. * @param {Array} [params.addedSceneNames] - 场景服务列表。
  29345. * @usage
  29346. */
  29347. class IPortalRegisterServiceParam {
  29348. constructor(params) {
  29349. params = params || {};
  29350. this.type = ""; // SUPERMAP_REST ARCGIS_REST WMS WFS WCS WPS WMTS OTHERS
  29351. this.tags = [];
  29352. this.entities = [];
  29353. this.metadata = {};
  29354. this.addedMapNames = [];
  29355. this.addedSceneNames = [];
  29356. Util_Util.extend(this, params);
  29357. }
  29358. }
  29359. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddDataParam.js
  29360. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29361. * This program are made available under the terms of the Apache License, Version 2.0
  29362. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29363. /**
  29364. * @class IPortalAddDataParam
  29365. * @aliasclass iPortalAddDataParam
  29366. * @deprecatedclass SuperMap.iPortalAddDataParam
  29367. * @classdesc iPortal 上传/注册数据所需的参数。
  29368. * @version 10.0.1
  29369. * @category iPortal/Online Resources Data
  29370. * @param {Object} params - 参数。
  29371. * @param {string} params.fileName - 文件名称。
  29372. * @param {DataItemType} params.type - 数据类型。
  29373. * @param {Array} [params.tags] - 数据的标签。
  29374. * @param {IPortalDataMetaInfoParam} [params.dataMetaInfo] - 数据元信息。
  29375. * @usage
  29376. */
  29377. class IPortalAddDataParam {
  29378. constructor(params) {
  29379. params = params || {};
  29380. this.fileName = "";
  29381. this.type = "";
  29382. this.tags = [];
  29383. this.dataMetaInfo = {};
  29384. Util_Util.extend(this, params);
  29385. }
  29386. }
  29387. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataMetaInfoParam.js
  29388. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29389. * This program are made available under the terms of the Apache License, Version 2.0
  29390. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29391. /**
  29392. * @class IPortalDataMetaInfoParam
  29393. * @aliasclass iPortalDataMetaInfoParam
  29394. * @deprecatedclass SuperMap.iPortalDataMetaInfoParam
  29395. * @classdesc iPortal 上传数据/注册数据元信息所需的参数。
  29396. * @version 10.0.1
  29397. * @category iPortal/Online Resources Data
  29398. * @param {Object} params - 参数。
  29399. * @param {string} params.xField - X 坐标字段。
  29400. * @param {string} params.yField - Y 坐标字段。
  29401. * @param {number} params.xIndex - x所在列(关系型存储下CSV或EXCEL数据时必填)。
  29402. * @param {number} params.yIndex - y所在列(关系型存储下CSV或EXCEL数据时必填)。
  29403. * @param {Array.<string>} [params.fieldTypes] - 设置字段类型(关系型存储下CSV或EXCEL数据时可选填)。默认类型为:WTEXT。该参数按照CSV文件字段顺序从左到右依次设置,其中默认字段类型可省略不设置。例如,CSV文件中有10个字段,如果只需设定第1,2,4个字段,可设置为['a','b',,'c']。
  29404. * @param {string} params.separator - 分隔符(关系型存储下CSV数据时必填)。
  29405. * @param {boolean} params.firstRowIsHead - 是否带表头(关系型存储下CSV数据时必填)。
  29406. * @param {boolean} params.url - HDFS注册目录地址。
  29407. * @param {IPortalDataStoreInfoParam} params.dataStoreInfo - 注册数据时的数据存储信息。
  29408. * @usage
  29409. */
  29410. class IPortalDataMetaInfoParam {
  29411. constructor(params) {
  29412. params = params || {};
  29413. this.xField = "";
  29414. this.yField = "";
  29415. this.fileEncoding = "UTF-8";
  29416. this.xIndex = 1;
  29417. this.yIndex = 1;
  29418. this.fieldTypes = [];
  29419. this.separator = "";
  29420. this.firstRowIsHead = true;
  29421. this.url = "";
  29422. this.dataStoreInfo = {};
  29423. Util_Util.extend(this, params);
  29424. }
  29425. }
  29426. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataStoreInfoParam.js
  29427. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29428. * This program are made available under the terms of the Apache License, Version 2.0
  29429. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29430. /**
  29431. * @class IPortalDataStoreInfoParam
  29432. * @aliasclass iPortalDataStoreInfoParam
  29433. * @deprecatedclass SuperMap.iPortalDataStoreInfoParam
  29434. * @classdesc iPortal 注册一个HBASE HDFS数据存储类。
  29435. * @version 10.0.1
  29436. * @category iPortal/Online Resources Data
  29437. * @param {Object} params - 参数。
  29438. * @param {string} params.type - 大数据文件共享类型和空间数据库类型,包括大数据文件共享HDFS 目录(HDFS)和空间数据库HBASE。
  29439. * @param {string} params.url - HDFS数据存储目录地址。
  29440. * @param {IPortalDataConnectionInfoParam} [params.connectionInfo] - HBASE空间数据库服务的连接信息。
  29441. * @usage
  29442. */
  29443. class IPortalDataStoreInfoParam {
  29444. constructor(params) {
  29445. params = params || {};
  29446. this.type = "";
  29447. this.url = "";
  29448. this.connectionInfo = {};
  29449. Util_Util.extend(this, params);
  29450. }
  29451. }
  29452. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataConnectionInfoParam.js
  29453. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29454. * This program are made available under the terms of the Apache License, Version 2.0
  29455. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29456. /**
  29457. * @class IPortalDataConnectionInfoParam
  29458. * @aliasclass iPortalDataConnectionInfoParam
  29459. * @deprecatedclass SuperMap.iPortalDataConnectionInfoParam
  29460. * @classdesc iPortal HBASE数据源连接信息类。
  29461. * @version 10.0.1
  29462. * @category iPortal/Online Resources Data
  29463. * @param {Object} params - 参数。
  29464. * @param {string} params.dataBase - 数据源连接的数据库名。
  29465. * @param {string} params.server - 服务地址。
  29466. * @usage
  29467. */
  29468. class IPortalDataConnectionInfoParam {
  29469. constructor(params) {
  29470. params = params || {};
  29471. this.dataBase = "";
  29472. this.server = "";
  29473. Util_Util.extend(this, params);
  29474. }
  29475. }
  29476. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalUser.js
  29477. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29478. * This program are made available under the terms of the Apache License, Version 2.0
  29479. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29480. /**
  29481. * @class IPortalUser
  29482. * @aliasclass iPortalUser
  29483. * @deprecatedclass SuperMap.iPortalUser
  29484. * @classdesc iPortal 门户中用户信息的封装类。用于管理用户资源,包括可删除,添加资源。
  29485. * @version 10.0.1
  29486. * @category iPortal/Online Resources
  29487. * @param {string} iportalUrl - 服务地址。
  29488. * @extends {IPortalServiceBase}
  29489. * @usage
  29490. */
  29491. class IPortalUser extends IPortalServiceBase {
  29492. constructor(iportalUrl) {
  29493. super(iportalUrl);
  29494. this.iportalUrl = iportalUrl;
  29495. }
  29496. /**
  29497. * @function IPortalUser.prototype.deleteResources
  29498. * @description 删除资源。
  29499. * @param {Object} params - 删除资源所需的参数对象:{ids,resourceType}。
  29500. * @returns {Promise} 返回包含删除操作状态的 Promise 对象。
  29501. */
  29502. deleteResources(params) {
  29503. var resourceName = params.resourceType.replace("_","").toLowerCase();
  29504. var deleteResourceUrl = this.iportalUrl+"/web/" + resourceName +"s.json?ids=" + encodeURI(JSON.stringify(params.ids));
  29505. if( resourceName === 'data') {
  29506. deleteResourceUrl = this.iportalUrl + "/web/mycontent/datas/delete.json";
  29507. return this.request("POST", deleteResourceUrl, JSON.stringify(params.ids));
  29508. }
  29509. return this.request("DELETE", deleteResourceUrl);
  29510. }
  29511. /**
  29512. * @function IPortalUser.prototype.addMap
  29513. * @description 添加地图。
  29514. * @version 10.1.0
  29515. * @param {IPortalAddResourceParam} addMapParams - 添加地图的参数。
  29516. * @returns {Promise} 返回包含添加地图结果的 Promise 对象。
  29517. */
  29518. addMap(addMapParams) {
  29519. if (!(addMapParams instanceof IPortalAddResourceParam)) {
  29520. return this.getErrMsgPromise("addMapParams is not instanceof IPortalAddResourceParam !");
  29521. }
  29522. let cloneAddMapParams = {
  29523. rootUrl: addMapParams.rootUrl,
  29524. tags: addMapParams.tags,
  29525. authorizeSetting: addMapParams.entities
  29526. }
  29527. let addMapUrl = this.iportalUrl + "/web/maps/batchaddmaps.json";
  29528. return this.request("POST", addMapUrl, JSON.stringify(cloneAddMapParams)).then(function(result) {
  29529. return result;
  29530. });
  29531. }
  29532. /**
  29533. * @function IPortalUser.prototype.addScene
  29534. * @description 添加场景。
  29535. * @version 10.1.0
  29536. * @param {IPortalAddResourceParam} addSceneParams - 添加场景的参数。
  29537. * @returns {Promise} 返回包含添加场景结果的 Promise 对象。
  29538. */
  29539. addScene(addSceneParams) {
  29540. if (!(addSceneParams instanceof IPortalAddResourceParam)) {
  29541. return this.getErrMsgPromise("addSceneParams is not instanceof IPortalAddResourceParam !");
  29542. }
  29543. let cloneAddSceneParams = {
  29544. rootUrl: addSceneParams.rootUrl,
  29545. tags: addSceneParams.tags,
  29546. authorizeSetting: addSceneParams.entities
  29547. }
  29548. let addSceneUrl = this.iportalUrl + "/web/scenes/batchaddscenes.json";
  29549. return this.request("POST", addSceneUrl, JSON.stringify(cloneAddSceneParams)).then(function(result) {
  29550. return result;
  29551. });
  29552. }
  29553. /**
  29554. * @function IPortalUser.prototype.registerService
  29555. * @description 注册服务。
  29556. * @version 10.1.0
  29557. * @param {IPortalRegisterServiceParam} registerParams - 注册服务的参数。
  29558. * @returns {Promise} 返回包含注册服务结果的 Promise 对象。
  29559. */
  29560. registerService(registerParams) {
  29561. if(!(registerParams instanceof IPortalRegisterServiceParam)) {
  29562. return this.getErrMsgPromise("registerParams is not instanceof IPortalRegisterServiceParam !");
  29563. }
  29564. let cloneRegisterParams = {
  29565. type: registerParams.type,
  29566. tags: registerParams.tags,
  29567. authorizeSetting: registerParams.entities,
  29568. metadata: registerParams.metadata,
  29569. addedMapNames: registerParams.addedMapNames,
  29570. addedSceneNames: registerParams.addedSceneNames
  29571. }
  29572. let registerUrl = this.iportalUrl + "/web/services.json";
  29573. return this.request("POST", registerUrl, JSON.stringify(cloneRegisterParams)).then(result => {
  29574. return result;
  29575. });
  29576. }
  29577. /**
  29578. * @function IPortalUser.prototype.getErrMsgPromise
  29579. * @description 获取包含错误信息的Promise对象。
  29580. * @version 10.1.0
  29581. * @param {string} errMsg - 传入的错误信息。
  29582. * @returns {Promise} 返回包含错误信息的 Promise 对象。
  29583. */
  29584. getErrMsgPromise(errMsg) {
  29585. return new Promise(resolve => {
  29586. resolve(errMsg);
  29587. })
  29588. }
  29589. /**
  29590. * @function IPortalUser.prototype.uploadDataRequest
  29591. * @description 上传数据。
  29592. * @version 10.1.0
  29593. * @param {number} id - 上传数据的资源ID。
  29594. * @param {Object} formData - 请求体为文本数据流。
  29595. * @returns {Promise} 返回包含上传数据操作的 Promise 对象。
  29596. */
  29597. uploadDataRequest(id,formData) {
  29598. var uploadDataUrl = this.iportalUrl + "/web/mycontent/datas/"+id+"/upload.json";
  29599. return this.request("POST",uploadDataUrl,formData);
  29600. }
  29601. /**
  29602. * @function IPortalUser.prototype.addData
  29603. * @description 上传/注册数据。
  29604. * @version 10.1.0
  29605. * @param {IPortalAddDataParam} params - 上传/注册数据所需的参数。
  29606. * @param {Object} [formData] - 请求体为文本数据流(上传数据时传入)。
  29607. * @returns {Promise} 返回上传/注册数据的 Promise 对象。
  29608. */
  29609. addData(params,formData) {
  29610. if(!(params instanceof IPortalAddDataParam)){
  29611. return this.getErrMsgPromise("params is not instanceof iPortalAddDataParam !");
  29612. }
  29613. var datasUrl = this.iportalUrl + "/web/mycontent/datas.json";
  29614. var entity = {
  29615. fileName:params.fileName,
  29616. tags:params.tags,
  29617. type:params.type
  29618. };
  29619. var type = params.type.toLowerCase();
  29620. var dataMetaInfo;
  29621. if(type === "excel" || type === "csv"){
  29622. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  29623. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  29624. }
  29625. dataMetaInfo = {
  29626. xField:params.dataMetaInfo.xField,
  29627. yField:params.dataMetaInfo.yField
  29628. }
  29629. if(type === 'csv') {
  29630. dataMetaInfo.fileEncoding = params.dataMetaInfo.fileEncoding
  29631. }
  29632. entity.coordType = "WGS84";
  29633. entity.dataMetaInfo = dataMetaInfo;
  29634. }else if(type === "hdfs" || type === "hbase") {
  29635. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  29636. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  29637. }
  29638. if(!(params.dataMetaInfo.dataStoreInfo instanceof IPortalDataStoreInfoParam)){
  29639. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo is not instanceof iPortalDataStoreInfoParam !");
  29640. }
  29641. var dataStoreInfo = {
  29642. type:params.dataMetaInfo.dataStoreInfo.type
  29643. }
  29644. switch (type) {
  29645. case "hdfs":
  29646. dataStoreInfo.url = params.dataMetaInfo.dataStoreInfo.url;
  29647. dataMetaInfo = {
  29648. url: params.dataMetaInfo.url,
  29649. dataStoreInfo:dataStoreInfo
  29650. }
  29651. break;
  29652. case "hbase":
  29653. if(!(params.dataMetaInfo.dataStoreInfo.connectionInfo instanceof IPortalDataConnectionInfoParam)){
  29654. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo.connectionInfo is not instanceof iPortalDataConnectionInfoParam !");
  29655. }
  29656. dataStoreInfo.connectionInfo = {
  29657. dataBase:params.dataMetaInfo.dataStoreInfo.connectionInfo.dataBase,
  29658. server:params.dataMetaInfo.dataStoreInfo.connectionInfo.server,
  29659. engineType:'HBASE'
  29660. }
  29661. dataStoreInfo.datastoreType = "SPATIAL";//该字段SPATIAL表示HBASE注册
  29662. dataMetaInfo = {
  29663. dataStoreInfo:dataStoreInfo
  29664. }
  29665. break;
  29666. }
  29667. entity.dataMetaInfo = dataMetaInfo;
  29668. }
  29669. return this.request("POST",datasUrl,JSON.stringify(entity)).then(res=>{
  29670. if(type === "hdfs" || type === "hbase"){
  29671. return res;
  29672. }else {
  29673. if(res.childID) {
  29674. return this.uploadDataRequest(res.childID,formData);
  29675. }else {
  29676. return res.customResult;
  29677. }
  29678. }
  29679. })
  29680. }
  29681. /**
  29682. * @function IPortalUser.prototype.publishOrUnpublish
  29683. * @description 发布/取消发布。
  29684. * @version 10.1.0
  29685. * @param {Object} options - 发布/取消发布数据服务所需的参数。
  29686. * @param {Object} options.dataId - 数据项ID。
  29687. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  29688. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  29689. * @param {boolean} forPublish - 是否取消发布。
  29690. * @returns {Promise} 返回发布/取消发布数据服务的 Promise 对象。
  29691. */
  29692. publishOrUnpublish(option,forPublish){
  29693. if(!option.dataId || !option.serviceType) {
  29694. return this.getErrMsgPromise("option.dataID and option.serviceType are Required!");
  29695. }
  29696. var dataId = option.dataId;
  29697. var dataServiceId = option.dataServiceId;
  29698. var serviceType = option.serviceType;
  29699. var publishUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?serviceType=" + serviceType;
  29700. if (dataServiceId) {
  29701. publishUrl += "&dataServiceId=" + dataServiceId;
  29702. }
  29703. return this.request("PUT",publishUrl,JSON.stringify(forPublish)).then(res=>{
  29704. // 发起服务状态查询
  29705. if(forPublish) {
  29706. // 发布服务的结果异步处理
  29707. // var publishStateUrl = this.iportalUrl + "web/mycontent/datas/" + dataId + "/publishstatus.rjson";
  29708. if (!dataServiceId) { // 发布服务时会回传serviceIDs,发布服务之前serviceIDs为空
  29709. dataServiceId = res.customResult;
  29710. }
  29711. return dataServiceId;
  29712. }else {
  29713. // 取消发布的结果同步处理
  29714. return res;
  29715. }
  29716. });
  29717. }
  29718. /**
  29719. * @function IPortalUser.prototype.getDataPublishedStatus
  29720. * @description 查询服务状态,发起服务状态查询。
  29721. * @version 10.1.0
  29722. * @param {number} dataId - 查询服务状态的数据项ID。
  29723. * @param {string} dataServiceId - 发布的服务ID。
  29724. * @returns {Promise} 返回查询服务状态的 Promise 对象。
  29725. */
  29726. getDataPublishedStatus(dataId,dataServiceId){
  29727. var publishStateUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?dataServiceId="+dataServiceId+"&forPublish=true";
  29728. return this.request("GET",publishStateUrl);
  29729. }
  29730. /**
  29731. * @function IPortalUser.prototype.unPublishedDataService
  29732. * @description 取消发布。
  29733. * @version 10.1.0
  29734. * @param {Object} options - 取消发布服务具体参数。
  29735. * @param {Object} options.dataId - 数据项ID。
  29736. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  29737. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  29738. * @returns {Promise} 返回取消发布数据服务的 Promise 对象。
  29739. */
  29740. unPublishDataService(option){
  29741. return this.publishOrUnpublish(option,false);
  29742. }
  29743. /**
  29744. * @function IPortalUser.prototype.publishedDataService
  29745. * @description 发布数据服务。
  29746. * @version 10.1.0
  29747. * @param {Object} options - 发布数据服务具体参数。
  29748. * @param {Object} options.dataId - 数据项ID。
  29749. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  29750. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  29751. * @returns {Promise} 返回发布数据服务的 Promise 对象。
  29752. */
  29753. publishDataService(option){
  29754. return this.publishOrUnpublish(option,true);
  29755. }
  29756. }
  29757. ;// CONCATENATED MODULE: ./src/common/iPortal/index.js
  29758. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29759. * This program are made available under the terms of the Apache License, Version 2.0
  29760. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29761. ;// CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  29762. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29763. * This program are made available under the terms of the Apache License, Version 2.0
  29764. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29765. /**
  29766. * @class CommonServiceBase
  29767. * @deprecatedclass SuperMap.CommonServiceBase
  29768. * @category iServer Core
  29769. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  29770. * @param {string} url - 服务地址。
  29771. * @param {Object} options - 参数。
  29772. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  29773. * @param {string} [options.proxy] - 服务代理地址。
  29774. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  29775. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29776. * @param {Object} [options.headers] - 请求头。
  29777. * @usage
  29778. */
  29779. class CommonServiceBase {
  29780. constructor(url, options) {
  29781. let me = this;
  29782. this.EVENT_TYPES = ['processCompleted', 'processFailed'];
  29783. this.events = null;
  29784. this.eventListeners = null;
  29785. this.url = null;
  29786. this.urls = null;
  29787. this.proxy = null;
  29788. this.index = null;
  29789. this.length = null;
  29790. this.totalTimes = null;
  29791. this.POLLING_TIMES = 3;
  29792. this.isInTheSameDomain = null;
  29793. this.withCredentials = false;
  29794. if (Util_Util.isArray(url)) {
  29795. me.urls = url;
  29796. me.length = url.length;
  29797. me.totalTimes = me.length;
  29798. if (me.length === 1) {
  29799. me.url = url[0];
  29800. } else {
  29801. me.index = parseInt(Math.random() * me.length);
  29802. me.url = url[me.index];
  29803. }
  29804. } else {
  29805. me.totalTimes = 1;
  29806. me.url = url;
  29807. }
  29808. if (Util_Util.isArray(url) && !me.isServiceSupportPolling()) {
  29809. me.url = url[0];
  29810. me.totalTimes = 1;
  29811. }
  29812. options = options || {};
  29813. this.crossOrigin = options.crossOrigin;
  29814. this.headers = options.headers;
  29815. Util_Util.extend(this, options);
  29816. me.isInTheSameDomain = Util_Util.isInTheSameDomain(me.url);
  29817. me.events = new Events(me, null, me.EVENT_TYPES, true);
  29818. if (me.eventListeners instanceof Object) {
  29819. me.events.on(me.eventListeners);
  29820. }
  29821. this.CLASS_NAME = 'SuperMap.CommonServiceBase';
  29822. }
  29823. /**
  29824. * @function CommonServiceBase.prototype.destroy
  29825. * @description 释放资源,将引用的资源属性置空。
  29826. */
  29827. destroy() {
  29828. let me = this;
  29829. if (Util_Util.isArray(me.urls)) {
  29830. me.urls = null;
  29831. me.index = null;
  29832. me.length = null;
  29833. me.totalTimes = null;
  29834. }
  29835. me.url = null;
  29836. me._processSuccess = null;
  29837. me._processFailed = null;
  29838. me.isInTheSameDomain = null;
  29839. me.EVENT_TYPES = null;
  29840. if (me.events) {
  29841. me.events.destroy();
  29842. me.events = null;
  29843. }
  29844. if (me.eventListeners) {
  29845. me.eventListeners = null;
  29846. }
  29847. }
  29848. /**
  29849. * @function CommonServiceBase.prototype.request
  29850. * @description: 该方法用于向服务发送请求。
  29851. * @param {Object} options - 参数。
  29852. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  29853. * @param {string} [options.url] - 发送请求的地址。
  29854. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  29855. * @param {string} [options.data] - 发送到服务器的数据。
  29856. * @param {function} options.success - 请求成功后的回调函数。
  29857. * @param {function} options.failure - 请求失败后的回调函数。
  29858. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  29859. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  29860. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  29861. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29862. * @param {Object} [options.headers] - 请求头。
  29863. */
  29864. request(options) {
  29865. const format = options.scope.format;
  29866. if (format && !this.supportDataFormat(format)) {
  29867. throw new Error(`${this.CLASS_NAME} is not surport ${format} format!`);
  29868. }
  29869. let me = this;
  29870. options.url = options.url || me.url;
  29871. if (this._returnContent(options) && !options.url.includes('returnContent=true')) {
  29872. options.url = Util_Util.urlAppend(options.url, 'returnContent=true');
  29873. }
  29874. options.proxy = options.proxy || me.proxy;
  29875. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  29876. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  29877. options.headers = options.headers || me.headers;
  29878. options.isInTheSameDomain = me.isInTheSameDomain;
  29879. options.withoutFormatSuffix = options.scope.withoutFormatSuffix || false;
  29880. //为url添加安全认证信息片段
  29881. options.url = SecurityManager.appendCredential(options.url);
  29882. me.calculatePollingTimes();
  29883. options.scope = me;
  29884. var success = options.scope? options.success.bind(options.scope) : options.success;
  29885. var failure = options.scope? options.failure.bind(options.scope) : options.failure;
  29886. options.success = me.getUrlCompleted(success, options);
  29887. options.failure = me.getUrlFailed(failure, options);
  29888. me._commit(options);
  29889. }
  29890. /**
  29891. * @function CommonServiceBase.prototype.getUrlCompleted
  29892. * @description 请求成功后执行此方法。
  29893. * @param {Object} cb - 成功回调函数。
  29894. * @param {Object} options - 请求参数对象。
  29895. * @private
  29896. */
  29897. getUrlCompleted(cb, options) {
  29898. // @param {Object} result - 服务器返回的结果对象。
  29899. return function(result) {
  29900. cb && cb(result, options);
  29901. }
  29902. }
  29903. /**
  29904. * @function CommonServiceBase.prototype.getUrlFailed
  29905. * @description 请求失败后执行此方法。
  29906. * @param {Object} cb - 失败回调函数。
  29907. * @param {Object} options - 请求参数对象。
  29908. * @private
  29909. */
  29910. getUrlFailed(cb, options) {
  29911. const me = this;
  29912. // @param {Object} result - 服务器返回的结果对象。
  29913. return function(result) {
  29914. if (me.totalTimes > 0) {
  29915. me.totalTimes--;
  29916. me.ajaxPolling(options);
  29917. } else {
  29918. cb && cb(result, options);
  29919. }
  29920. }
  29921. }
  29922. /**
  29923. *
  29924. * @function CommonServiceBase.prototype.ajaxPolling
  29925. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求。
  29926. * @param {Object} options - 请求参数对象。
  29927. * @private
  29928. */
  29929. ajaxPolling(options) {
  29930. let me = this,
  29931. url = options.url,
  29932. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  29933. me.index = parseInt(Math.random() * me.length);
  29934. me.url = me.urls[me.index];
  29935. url = url.replace(re, re.exec(me.url)[0]);
  29936. options.url = url;
  29937. options.isInTheSameDomain = Util_Util.isInTheSameDomain(url);
  29938. me._commit(options);
  29939. }
  29940. /**
  29941. * @function CommonServiceBase.prototype.calculatePollingTimes
  29942. * @description 计算剩余请求失败执行次数。
  29943. */
  29944. calculatePollingTimes() {
  29945. let me = this;
  29946. if (me.times) {
  29947. if (me.totalTimes > me.POLLING_TIMES) {
  29948. if (me.times > me.POLLING_TIMES) {
  29949. me.totalTimes = me.POLLING_TIMES;
  29950. } else {
  29951. me.totalTimes = me.times;
  29952. }
  29953. } else {
  29954. if (me.times < me.totalTimes) {
  29955. me.totalTimes = me.times;
  29956. }
  29957. }
  29958. } else {
  29959. if (me.totalTimes > me.POLLING_TIMES) {
  29960. me.totalTimes = me.POLLING_TIMES;
  29961. }
  29962. }
  29963. me.totalTimes--;
  29964. }
  29965. /**
  29966. * @function CommonServiceBase.prototype.isServiceSupportPolling
  29967. * @description 判断服务是否支持轮询。
  29968. */
  29969. isServiceSupportPolling() {
  29970. let me = this;
  29971. return !(
  29972. me.CLASS_NAME === 'SuperMap.REST.ThemeService' || me.CLASS_NAME === 'SuperMap.REST.EditFeaturesService'
  29973. );
  29974. }
  29975. /**
  29976. * @function CommonServiceBase.prototype.serviceProcessCompleted
  29977. * @description 状态完成,执行此方法。
  29978. * @param {Object} result - 服务器返回的结果对象。
  29979. * @param {Object} options - 请求参数对象。
  29980. * @private
  29981. */
  29982. serviceProcessCompleted(result, options) {
  29983. result = Util_Util.transformResult(result);
  29984. this.events.triggerEvent('processCompleted', {
  29985. result: result,
  29986. options: options
  29987. });
  29988. }
  29989. /**
  29990. * @function CommonServiceBase.prototype.serviceProcessFailed
  29991. * @description 状态失败,执行此方法。
  29992. * @param {Object} result - 服务器返回的结果对象。
  29993. * @param {Object} options - 请求参数对象。对象
  29994. * @private
  29995. */
  29996. serviceProcessFailed(result, options) {
  29997. result = Util_Util.transformResult(result);
  29998. let error = result.error || result;
  29999. this.events.triggerEvent('processFailed', {
  30000. error: error,
  30001. options: options
  30002. });
  30003. }
  30004. _returnContent(options) {
  30005. if (options.scope.format === DataFormat.FGB) {
  30006. return false;
  30007. }
  30008. if (options.scope.returnContent) {
  30009. return true;
  30010. }
  30011. return false;
  30012. }
  30013. supportDataFormat(foramt) {
  30014. return this.dataFormat().includes(foramt);
  30015. }
  30016. dataFormat() {
  30017. return [DataFormat.GEOJSON, DataFormat.ISERVER];
  30018. }
  30019. _commit(options) {
  30020. if (options.method === 'POST' || options.method === 'PUT' || options.method === 'PATCH') {
  30021. if (options.params) {
  30022. options.url = Util_Util.urlAppend(options.url, Util_Util.getParameterString(options.params || {}));
  30023. }
  30024. if (typeof options.data === 'object') {
  30025. try {
  30026. options.params = Util_Util.toJSON(options.data);
  30027. } catch (e) {
  30028. console.log('不是json对象');
  30029. }
  30030. } else {
  30031. options.params = options.data;
  30032. }
  30033. }
  30034. FetchRequest.commit(options.method, options.url, options.params, {
  30035. headers: options.headers,
  30036. withoutFormatSuffix: options.withoutFormatSuffix,
  30037. withCredentials: options.withCredentials,
  30038. crossOrigin: options.crossOrigin,
  30039. timeout: options.async ? 0 : null,
  30040. proxy: options.proxy
  30041. })
  30042. .then(function (response) {
  30043. if (response.text) {
  30044. return response.text();
  30045. }
  30046. if (response.json) {
  30047. return response.json();
  30048. }
  30049. return response;
  30050. })
  30051. .then(function (text) {
  30052. let requestResult = text;
  30053. if (typeof text === 'string') {
  30054. requestResult = new JSONFormat().read(text);
  30055. }
  30056. if (
  30057. !requestResult ||
  30058. requestResult.error ||
  30059. (requestResult.code >= 300 && requestResult.code !== 304)
  30060. ) {
  30061. if (requestResult && requestResult.error) {
  30062. requestResult = {
  30063. error: requestResult.error
  30064. };
  30065. } else {
  30066. requestResult = {
  30067. error: requestResult
  30068. };
  30069. }
  30070. }
  30071. if (requestResult && options.scope.format === DataFormat.FGB) {
  30072. requestResult.newResourceLocation = requestResult.newResourceLocation.replace('.json', '') + '.fgb';
  30073. }
  30074. return requestResult;
  30075. })
  30076. .catch(function (e) {
  30077. return { error: e };
  30078. })
  30079. .then((requestResult) => {
  30080. if (requestResult.error) {
  30081. var failure = options.scope ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  30082. failure(requestResult);
  30083. } else {
  30084. requestResult.succeed = requestResult.succeed == undefined ? true : requestResult.succeed;
  30085. var success = options.scope ? FunctionExt.bind(options.success, options.scope) : options.success;
  30086. success(requestResult);
  30087. }
  30088. });
  30089. }
  30090. }
  30091. /**
  30092. * 服务器请求回调函数。
  30093. * @callback RequestCallback
  30094. * @category BaseTypes Util
  30095. * @example
  30096. * var requestCallback = function (serviceResult){
  30097. * console.log(serviceResult.result);
  30098. * }
  30099. * new QueryService(url).queryByBounds(param, requestCallback);
  30100. * @param {Object} serviceResult
  30101. * @param {Object} serviceResult.result 服务器返回结果。
  30102. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  30103. * @param {Object} serviceResult.type 事件类型。
  30104. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  30105. * @param {Object} serviceResult.options 请求参数。
  30106. */
  30107. ;// CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  30108. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30109. * This program are made available under the terms of the Apache License, Version 2.0
  30110. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30111. /**
  30112. * @class GeoCodingParameter
  30113. * @deprecatedclass SuperMap.GeoCodingParameter
  30114. * @category iServer AddressMatch
  30115. * @classdesc 地理正向匹配参数类。
  30116. * @param {Object} options - 参数。
  30117. * @param {string} options.address - 地点关键词。
  30118. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  30119. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  30120. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  30121. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  30122. * @param {number} [options.maxReturn] - 最大返回结果数。
  30123. * @usage
  30124. */
  30125. class GeoCodingParameter {
  30126. constructor(options) {
  30127. if (options.filters && typeof(options.filters) === 'string') {
  30128. options.filters = options.filters.split(',');
  30129. }
  30130. /**
  30131. * @member {string} GeoCodingParameter.prototype.address
  30132. * @description 地点关键词。
  30133. */
  30134. this.address = null;
  30135. /**
  30136. * @member {number} [GeoCodingParameter.prototype.fromIndex]
  30137. * @description 设置返回对象的起始索引值。
  30138. */
  30139. this.fromIndex = null;
  30140. /**
  30141. * @member {number} [GeoCodingParameter.prototype.toIndex]
  30142. * @description 设置返回对象的结束索引值。
  30143. */
  30144. this.toIndex = null;
  30145. /**
  30146. * @member {Array.<string>} [GeoCodingParameter.prototype.filters]
  30147. * @description 过滤字段,限定查询区域。
  30148. */
  30149. this.filters = null;
  30150. /**
  30151. * @member {string} [GeoCodingParameter.prototype.prjCoordSys]
  30152. * @description 查询结果的坐标系。
  30153. */
  30154. this.prjCoordSys = null;
  30155. /**
  30156. * @member {number} [GeoCodingParameter.prototype.maxReturn]
  30157. * @description 最大返回结果数。
  30158. */
  30159. this.maxReturn = null;
  30160. Util_Util.extend(this, options);
  30161. }
  30162. /**
  30163. * @function GeoCodingParameter.prototype.destroy
  30164. * @description 释放资源,将引用资源的属性置空。
  30165. */
  30166. destroy() {
  30167. this.address = null;
  30168. this.fromIndex = null;
  30169. this.toIndex = null;
  30170. this.filters = null;
  30171. this.prjCoordSys = null;
  30172. this.maxReturn = null;
  30173. }
  30174. }
  30175. ;// CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  30176. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30177. * This program are made available under the terms of the Apache License, Version 2.0
  30178. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30179. /**
  30180. * @class GeoDecodingParameter
  30181. * @deprecatedclass SuperMap.GeoDecodingParameter
  30182. * @category iServer AddressMatch
  30183. * @classdesc 地理反向匹配参数类。
  30184. * @param {Object} options - 参数。
  30185. * @param {number} options.x - 查询位置的横坐标。
  30186. * @param {number} options.y - 查询位置的纵坐标。
  30187. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  30188. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  30189. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  30190. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  30191. * @param {number} [options.maxReturn] - 最大返回结果数。
  30192. * @param {number} [options.geoDecodingRadius] - 查询半径。
  30193. * @usage
  30194. */
  30195. class GeoDecodingParameter {
  30196. constructor(options) {
  30197. if (options.filters) {
  30198. options.filters = options.filters.split(',');
  30199. }
  30200. /**
  30201. * @member {number} GeoDecodingParameter.prototype.x
  30202. * @description 查询位置的横坐标。
  30203. */
  30204. this.x = null;
  30205. /**
  30206. * @member {number} GeoDecodingParameter.prototype.y
  30207. * @description 查询位置的纵坐标。
  30208. */
  30209. this.y = null;
  30210. /**
  30211. * @member {number} [GeoDecodingParameter.prototype.fromIndex]
  30212. * @description 设置返回对象的起始索引值。
  30213. */
  30214. this.fromIndex = null;
  30215. /**
  30216. * @member {number} [GeoDecodingParameter.prototype.toIndex]
  30217. * @description 设置返回对象的结束索引值。
  30218. */
  30219. this.toIndex = null;
  30220. /**
  30221. * @member {Array.<string>} [GeoDecodingParameter.prototype.filters]
  30222. * @description 过滤字段,限定查询区域。
  30223. */
  30224. this.filters = null;
  30225. /**
  30226. * @member {string} [GeoDecodingParameter.prototype.prjCoordSys]
  30227. * @description 查询结果的坐标系。
  30228. */
  30229. this.prjCoordSys = null;
  30230. /**
  30231. * @member {number} [GeoDecodingParameter.prototype.maxReturn]
  30232. * @description 最大返回结果数。
  30233. */
  30234. this.maxReturn = null;
  30235. /**
  30236. * @member {number} GeoDecodingParameter.prototype.geoDecodingRadius
  30237. * @description 查询半径。
  30238. */
  30239. this.geoDecodingRadius = null;
  30240. Util_Util.extend(this, options);
  30241. }
  30242. /**
  30243. * @function GeoDecodingParameter.prototype.destroy
  30244. * @description 释放资源,将引用资源的属性置空。
  30245. */
  30246. destroy() {
  30247. this.x = null;
  30248. this.y = null;
  30249. this.fromIndex = null;
  30250. this.toIndex = null;
  30251. this.filters = null;
  30252. this.prjCoordSys = null;
  30253. this.maxReturn = null;
  30254. this.geoDecodingRadius = null;
  30255. }
  30256. }
  30257. ;// CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  30258. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30259. * This program are made available under the terms of the Apache License, Version 2.0
  30260. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30261. /**
  30262. * @class AddressMatchService
  30263. * @deprecatedclass SuperMap.AddressMatchService
  30264. * @category iServer AddressMatch
  30265. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  30266. * @param {string} url - 服务地址。
  30267. * @param {Object} options - 可选参数。
  30268. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30269. * @param {Object} [options.headers] - 请求头。
  30270. * @usage
  30271. */
  30272. class AddressMatchService_AddressMatchService extends CommonServiceBase {
  30273. constructor(url, options) {
  30274. super(url, options);
  30275. this.options = options || {};
  30276. this.eventCount = 0;
  30277. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  30278. }
  30279. /**
  30280. * @function AddressMatchService.prototype.destroy
  30281. * @override
  30282. */
  30283. destroy() {
  30284. super.destroy();
  30285. }
  30286. /**
  30287. * @function AddressMatchService.prototype.code
  30288. * @param {string} url - 正向地址匹配服务地址。
  30289. * @param {GeoCodingParameter} params - 正向地址匹配服务参数。
  30290. */
  30291. code(url, params, callback) {
  30292. if (!(params instanceof GeoCodingParameter)) {
  30293. return;
  30294. }
  30295. this.processAsync(url, params, callback);
  30296. }
  30297. /**
  30298. * @function AddressMatchService.prototype.decode
  30299. * @param {string} url - 反向地址匹配服务地址。
  30300. * @param {GeoDecodingParameter} params - 反向地址匹配服务参数。
  30301. */
  30302. decode(url, params, callback) {
  30303. if (!(params instanceof GeoDecodingParameter)) {
  30304. return;
  30305. }
  30306. this.processAsync(url, params, callback);
  30307. }
  30308. /**
  30309. * @function AddressMatchService.prototype.processAsync
  30310. * @description 负责将客户端的动态分段服务参数传递到服务端。
  30311. * @param {string} url - 服务地址。
  30312. * @param {Object} params - 参数。
  30313. */
  30314. processAsync(url, params, callback) {
  30315. let eventId = ++this.eventCount;
  30316. let eventListeners = {
  30317. scope: this,
  30318. processCompleted: function(result) {
  30319. if (eventId === result.result.eventId && callback) {
  30320. delete result.result.eventId;
  30321. callback(result);
  30322. this.events && this.events.un(eventListeners);
  30323. return false;
  30324. }
  30325. },
  30326. processFailed: function(result) {
  30327. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  30328. callback(result);
  30329. this.events && this.events.un(eventListeners);
  30330. return false;
  30331. }
  30332. }
  30333. }
  30334. this.events.on(eventListeners);
  30335. this.request({
  30336. method: 'GET',
  30337. url,
  30338. params,
  30339. scope: this,
  30340. success(result, options) {
  30341. result.eventId = eventId;
  30342. this.serviceProcessCompleted(result, options);
  30343. },
  30344. failure(result, options) {
  30345. if (result.error) {
  30346. result.error.eventId = eventId;
  30347. }
  30348. result.eventId = eventId;
  30349. this.serviceProcessFailed(result, options);
  30350. }
  30351. });
  30352. }
  30353. /**
  30354. * @function AddressMatchService.prototype.serviceProcessCompleted
  30355. * @param {Object} result - 服务器返回的结果对象。
  30356. * @description 服务流程是否完成
  30357. */
  30358. serviceProcessCompleted(result, options) {
  30359. if (result.succeed) {
  30360. delete result.succeed;
  30361. }
  30362. super.serviceProcessCompleted(result, options);
  30363. }
  30364. /**
  30365. * @function AddressMatchService.prototype.serviceProcessCompleted
  30366. * @param {Object} result - 服务器返回的结果对象。
  30367. * @description 服务流程是否失败
  30368. */
  30369. serviceProcessFailed(result, options) {
  30370. super.serviceProcessFailed(result, options);
  30371. }
  30372. }
  30373. ;// CONCATENATED MODULE: ./src/common/iServer/AggregationParameter.js
  30374. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30375. * This program are made available under the terms of the Apache License, Version 2.0
  30376. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30377. /**
  30378. * @class AggregationParameter
  30379. * @deprecatedclass SuperMap.AggregationParameter
  30380. * @classdesc 聚合查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  30381. * @category iServer Data FeatureResults
  30382. * @param {Object} options - 参数。
  30383. * @param {string} options.aggName - 聚合名称。
  30384. * @param {string} options.aggFieldName - 聚合字段。
  30385. * @usage
  30386. */
  30387. class AggregationParameter {
  30388. constructor(options) {
  30389. /**
  30390. * @member {string} AggregationParameter.prototype.aggName
  30391. * @description 聚合名称。
  30392. */
  30393. this.aggName = null;
  30394. /**
  30395. * @member {string} AggregationParameter.prototype.aggFieldName
  30396. * @description 聚合字段。
  30397. */
  30398. this.aggFieldName = null;
  30399. this.CLASS_NAME = 'SuperMap.AggregationParameter';
  30400. Util_Util.extend(this, options);
  30401. }
  30402. destroy() {
  30403. var me = this;
  30404. me.aggName = null;
  30405. me.aggFieldName = null;
  30406. me.aggType = null;
  30407. }
  30408. }
  30409. ;// CONCATENATED MODULE: ./src/common/iServer/BucketAggParameter.js
  30410. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30411. * This program are made available under the terms of the Apache License, Version 2.0
  30412. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30413. /**
  30414. * @class BucketAggParameter
  30415. * @deprecatedclass SuperMap.BucketAggParameter
  30416. * @classdesc 子聚合类查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  30417. * @category iServer Data FeatureResults
  30418. * @param {Object} options - 参数。
  30419. * @param {Array.<MetricsAggParameter>} options.subAggs - 子聚合类集合。
  30420. * @extends {AggregationParameter}
  30421. * @usage
  30422. */
  30423. class BucketAggParameter extends AggregationParameter {
  30424. constructor(options) {
  30425. super();
  30426. /**
  30427. * @member {Array.<MetricsAggParameter>} BucketAggParameter.prototype.subAggs
  30428. * @description 子聚合类集合。
  30429. */
  30430. this.subAggs = null;
  30431. this.aggType = null;
  30432. this.CLASS_NAME = 'SuperMap.BucketAggParameter';
  30433. Util_Util.extend(this, options);
  30434. }
  30435. destroy() {
  30436. var me = this;
  30437. if (me.subAggs) {
  30438. me.subAggs = null;
  30439. }
  30440. }
  30441. }
  30442. ;// CONCATENATED MODULE: ./src/common/iServer/MetricsAggParameter.js
  30443. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30444. * This program are made available under the terms of the Apache License, Version 2.0
  30445. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30446. /**
  30447. * @class MetricsAggParameter
  30448. * @deprecatedclass SuperMap.MetricsAggParameter
  30449. * @classdesc 指标聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  30450. * @category iServer Data FeatureResults
  30451. * @param {Object} options - 可选参数。
  30452. * @param {MetricsAggType} [options.aggType = 'avg'] - 聚合类型。
  30453. * @extends {AggregationParameter}
  30454. * @usage
  30455. */
  30456. class MetricsAggParameter extends AggregationParameter {
  30457. constructor(option) {
  30458. super();
  30459. /**
  30460. * @member {MetricsAggType} [MetricsAggParameter.prototype.aggType=MetricsAggType.AVG]
  30461. * @description 指标聚合类型。
  30462. */
  30463. this.aggType = MetricsAggType.AVG;
  30464. Util_Util.extend(this, option);
  30465. this.CLASS_NAME = 'SuperMap.MetricsAggParameter';
  30466. }
  30467. destroy() {
  30468. super.destroy();
  30469. var me = this;
  30470. me.aggType = null;
  30471. }
  30472. }
  30473. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationParameters.js
  30474. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30475. * This program are made available under the terms of the Apache License, Version 2.0
  30476. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30477. /**
  30478. * @class AreaSolarRadiationParameters
  30479. * @deprecatedclass SuperMap.AreaSolarRadiationParameters
  30480. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  30481. * @classdesc 地区太阳辐射参数类。
  30482. * @param {Object} options - 参数。
  30483. * @param {string} options.dataset - 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"的形式来表示,例如:JingjinTerrain@Jingjin。
  30484. * @param {string} options.targetDatasourceName - 指定的存储结果数据集的数据源名称, 例如:"Jingjin"。
  30485. * @param {string} options.totalGridName - 指定地区太阳辐射总辐射量数据集的名称。
  30486. * @param {string} options.diffuseDatasetGridName - 指定地区太阳辐射散射辐射量数据集的名称。
  30487. * @param {string} options.durationDatasetGridName - 指定地区太阳辐射太阳直射持续时间数据集的名称。
  30488. * @param {string} options.directDatasetGridName - 指定地区太阳辐射直射辐射量数据集的名称。
  30489. * @param {number} options.latitude - 待计算区域的纬度值。
  30490. * @param {string} [options.timeMode = 'MULTIDAYS'] - 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  30491. * @param {number} options.dayStart - 起始日期(年内的第几天)。
  30492. * @param {number} options.dayEnd - 结束日期(年内的第几天)。
  30493. * @param {number} [options.hourStart] - 起始时间(一天中的第几个小时)。
  30494. * @param {number} [options.hourEnd] - 结束时间(一天中的第几个小时)。
  30495. * @param {number} [options.transmittance] - 太阳辐射穿过大气的透射率。
  30496. * @param {number} [options.hourInterval=0.5] - 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确,如果修改此参数,必须使用整数)。
  30497. * @param {number} [options.dayInterval=5] - 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确,必须使用整数)。
  30498. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  30499. * @usage
  30500. */
  30501. class AreaSolarRadiationParameters {
  30502. constructor(options) {
  30503. /**
  30504. * @member {string} AreaSolarRadiationParameters.prototype.dataset
  30505. * @description 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示,例如:JingjinTerrain@Jingjin。注:地区太阳辐射数据必须为栅格数据集。
  30506. */
  30507. this.dataset = null;
  30508. /**
  30509. * @member {string} AreaSolarRadiationParameters.prototype.targetDatasourceName
  30510. * @description 指定的存储结果数据集的数据源名称,例如:"Jingjin"。
  30511. */
  30512. this.targetDatasourceName = null;
  30513. /**
  30514. * @member {string} AreaSolarRadiationParameters.prototype.totalGridName
  30515. * @description 指定地区太阳辐射总辐射量数据集的名称。
  30516. */
  30517. this.totalGridName = null;
  30518. /**
  30519. * @member {string} AreaSolarRadiationParameters.prototype.diffuseDatasetGridName
  30520. * @description 指定地区太阳辐射散射辐射量数据集的名称。
  30521. */
  30522. this.diffuseDatasetGridName = null;
  30523. /**
  30524. * @member {string} AreaSolarRadiationParameters.prototype.durationDatasetGridName
  30525. * @description 指定地区太阳辐射太阳直射持续时间数据集的名称。
  30526. */
  30527. this.durationDatasetGridName = null;
  30528. /**
  30529. * @member {string} AreaSolarRadiationParameters.prototype.directDatasetGridName
  30530. * @description 指定地区太阳辐射直射辐射量数据集的名称。
  30531. */
  30532. this.directDatasetGridName = null;
  30533. /**
  30534. * @member {number} AreaSolarRadiationParameters.prototype.latitude
  30535. * @description 待计算区域的纬度值。
  30536. */
  30537. this.latitude = null;
  30538. /**
  30539. * @member {string} [AreaSolarRadiationParameters.prototype.timeMode='MULTIDAYS']
  30540. * @description 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  30541. */
  30542. this.timeMode = "MULTIDAYS";
  30543. /**
  30544. * @member {number} AreaSolarRadiationParameters.prototype.dayStart
  30545. * @description 起始日期(年内的第几天)。
  30546. */
  30547. this.dayStart = null;
  30548. /**
  30549. * @member {number} AreaSolarRadiationParameters.prototype.dayEnd
  30550. * @description 结束日期(年内的第几天)。
  30551. */
  30552. this.dayEnd = null;
  30553. /**
  30554. * @member {number} [AreaSolarRadiationParameters.prototype.hourStart]
  30555. * @description 起始时间(一天中的第几个小时)。
  30556. */
  30557. this.hourStart = null;
  30558. /**
  30559. * @member {number} [AreaSolarRadiationParameters.prototype.hourEnd]
  30560. * @description 结束时间(一天中的第几个小时)。
  30561. */
  30562. this.hourEnd = null;
  30563. /**
  30564. * @member {number} [AreaSolarRadiationParameters.prototype.transmittance]
  30565. * @description 太阳辐射穿过大气的透射率。
  30566. */
  30567. this.transmittance = null;
  30568. /**
  30569. * @member {number} [AreaSolarRadiationParameters.prototype.hourInterval=0.5]
  30570. * @description 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确, 如果修改此参数,必须使用整数)
  30571. */
  30572. this.hourInterval = null;
  30573. /**
  30574. * @member {number} [AreaSolarRadiationParameters.prototype.dayInterval=5]
  30575. * @description 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确, 必须使用整数)
  30576. */
  30577. this.dayInterval = null;
  30578. /**
  30579. * @member {boolean} [AreaSolarRadiationParameters.prototype.deleteExistResultDataset=false]
  30580. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  30581. */
  30582. this.deleteExistResultDataset = false;
  30583. Util_Util.extend(this, options);
  30584. this.CLASS_NAME = "SuperMap.AreaSolarRadiationParameters";
  30585. }
  30586. /**
  30587. * @function AreaSolarRadiationParameters.prototype.destroy
  30588. * @description 释放资源,将引用资源的属性置空。
  30589. */
  30590. destroy() {
  30591. var me = this;
  30592. me.dataset = null;
  30593. me.zFactor = 1.0;
  30594. me.averageCurvatureName = null;
  30595. me.profileCurvatureName = null;
  30596. me.planCurvatureName = null;
  30597. me.deleteExistResultDataset = true;
  30598. }
  30599. /**
  30600. * @function AreaSolarRadiationParameters.toObject
  30601. * @param {AreaSolarRadiationParameters} param - 地区太阳辐射参数类。
  30602. * @param {AreaSolarRadiationParameters} tempObj - 地区太阳辐射参数对象。
  30603. * @returns {Object} JSON对象。
  30604. * @description 将AreaSolarRadiationParameters对象转换成JSON对象。
  30605. */
  30606. static toObject(param, tempObj) {
  30607. var parameter = {};
  30608. for (var name in param) {
  30609. if (name !== "dataset") {
  30610. var name1 = (name === "latitude" || name === "timeMode" || name === "dayStart");
  30611. var name2 = (name === "dayEnd" || name === "hourStart" || name === "hourEnd");
  30612. var name3 = (name === "transmittance" || name === "hourInterval" || name === "dayInterval");
  30613. if (name1 || name2 || name3) {
  30614. parameter[name] = param[name];
  30615. } else {
  30616. tempObj[name] = param[name];
  30617. }
  30618. }
  30619. }
  30620. tempObj["parameter"] = parameter;
  30621. }
  30622. }
  30623. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystBase.js
  30624. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30625. * This program are made available under the terms of the Apache License, Version 2.0
  30626. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30627. /**
  30628. * @class SpatialAnalystBase
  30629. * @deprecatedclass SuperMap.SpatialAnalystBase
  30630. * @category iServer Core
  30631. * @classdesc 空间分析服务基类。
  30632. * @param {string} url - 地址。
  30633. * @param {Object} options - 可选参数。
  30634. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30635. * @param {Object} [options.headers] - 请求头。
  30636. * @extends {CommonServiceBase}
  30637. * @usage
  30638. */
  30639. class SpatialAnalystBase extends CommonServiceBase {
  30640. constructor(url, options) {
  30641. super(url, options);
  30642. /**
  30643. * @member {DataFormat} [SpatialAnalystBase.prototype.format=DataFormat.GEOJSON]
  30644. * @description 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  30645. */
  30646. this.format = options.format || DataFormat.GEOJSON;
  30647. this.CLASS_NAME = "SuperMap.SpatialAnalystBase";
  30648. }
  30649. /**
  30650. * @function SpatialAnalystBase.prototype.destroy
  30651. * @override
  30652. */
  30653. destroy() {
  30654. super.destroy();
  30655. this.format = null;
  30656. }
  30657. /**
  30658. * @function SpatialAnalystBase.prototype.serviceProcessCompleted
  30659. * @description 分析完成,执行此方法。
  30660. * @param {Object} result - 服务器返回的结果对象。
  30661. */
  30662. serviceProcessCompleted(result, options) {
  30663. var me = this, analystResult;
  30664. result = Util_Util.transformResult(result);
  30665. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  30666. //批量分析时会返回多个结果
  30667. if (Util_Util.isArray(result)) {
  30668. for (var i = 0; i < result.length; i++) {
  30669. result[i] = me.toGeoJSONResult(result[i])
  30670. }
  30671. analystResult = result;
  30672. } else {
  30673. analystResult = me.toGeoJSONResult(result);
  30674. }
  30675. }
  30676. if (!analystResult) {
  30677. analystResult = result;
  30678. }
  30679. me.events.triggerEvent("processCompleted", {result: analystResult, options});
  30680. }
  30681. /**
  30682. * @function SpatialAnalystBase.prototype.toGeoJSONResult
  30683. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  30684. * @param {Object} result - 服务器返回的结果对象。
  30685. *
  30686. */
  30687. toGeoJSONResult(result) {
  30688. if (!result) {
  30689. return null;
  30690. }
  30691. //批量叠加分析时结果这样处理
  30692. if (result.result && result.result.resultGeometry) {
  30693. result = result.result
  30694. }
  30695. var geoJSONFormat = new GeoJSON();
  30696. if (result.recordsets) {
  30697. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  30698. if (recordsets[i].features) {
  30699. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  30700. }
  30701. }
  30702. } else if (result.recordset && result.recordset.features) {
  30703. result.recordset.features =geoJSONFormat.toGeoJSON(result.recordset.features);
  30704. }
  30705. if (result.resultGeometry) {
  30706. result.resultGeometry = geoJSONFormat.toGeoJSON(result.resultGeometry);
  30707. }
  30708. if (result.regions) {
  30709. result.regions = geoJSONFormat.toGeoJSON(result.regions);
  30710. }
  30711. return result;
  30712. }
  30713. }
  30714. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationService.js
  30715. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30716. * This program are made available under the terms of the Apache License, Version 2.0
  30717. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30718. /**
  30719. * @class AreaSolarRadiationService
  30720. * @deprecatedclass SuperMap.AreaSolarRadiationService
  30721. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  30722. * @classdesc 地区太阳辐射服务类。
  30723. * @param {string} url - 服务的访问地址。如:</br>http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst。</br>
  30724. * @param {Object} options - 参数。</br>
  30725. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30726. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30727. * @param {Object} [options.headers] - 请求头。
  30728. * @extends {SpatialAnalystBase}
  30729. * @example 例如:
  30730. * (start code)
  30731. * var myAreaSolarRadiationService = new AreaSolarRadiationService(url);
  30732. * myAreaSolarRadiationService.on({
  30733. * "processCompleted": processCompleted,
  30734. * "processFailed": processFailed
  30735. * }
  30736. * );
  30737. * (end)
  30738. * @usage
  30739. */
  30740. class AreaSolarRadiationService extends SpatialAnalystBase {
  30741. constructor(url, options) {
  30742. super(url, options);
  30743. this.CLASS_NAME = "SuperMap.AreaSolarRadiationService";
  30744. }
  30745. /**
  30746. * @function AreaSolarRadiationService.prototype.destroy
  30747. * @override
  30748. */
  30749. destroy() {
  30750. super.destroy();
  30751. }
  30752. /**
  30753. * @function AreaSolarRadiationService.prototype.processAsync
  30754. * @description 负责将客户端的查询参数传递到服务端。
  30755. * @param {AreaSolarRadiationParameters} parameter - 地区太阳辐射参数。
  30756. */
  30757. processAsync(parameter) {
  30758. if (!(parameter instanceof AreaSolarRadiationParameters)) {
  30759. return;
  30760. }
  30761. var me = this;
  30762. var parameterObject = {};
  30763. if (parameter instanceof AreaSolarRadiationParameters) {
  30764. me.url = Util_Util.urlPathAppend(me.url, `datasets/${parameter.dataset}/solarradiation`);
  30765. }
  30766. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  30767. AreaSolarRadiationParameters.toObject(parameter, parameterObject);
  30768. var jsonParameters = Util_Util.toJSON(parameterObject);
  30769. me.request({
  30770. method: 'POST',
  30771. data: jsonParameters,
  30772. scope: me,
  30773. success: me.serviceProcessCompleted,
  30774. failure: me.serviceProcessFailed
  30775. });
  30776. }
  30777. }
  30778. ;// CONCATENATED MODULE: ./src/common/iServer/BufferDistance.js
  30779. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30780. * This program are made available under the terms of the Apache License, Version 2.0
  30781. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30782. /**
  30783. * @class BufferDistance
  30784. * @deprecatedclass SuperMap.BufferDistance
  30785. * @category iServer SpatialAnalyst BufferAnalyst
  30786. * @classdesc 缓冲区分析的缓冲距离类。通过该类可以设置缓冲区分析的缓冲距离,距离可以是数值也可以是数值型的字段表达式。
  30787. * @param {Object} options - 可选参数。
  30788. * @param {string} [options.exp] - 以数值型的字段表达式作为缓冲区分析的距离值。
  30789. * @param {number} [options.value=100] - 以数值作为缓冲区分析的距离值。单位:米。
  30790. * @usage
  30791. */
  30792. class BufferDistance {
  30793. constructor(options) {
  30794. /**
  30795. * @member {string} [BufferDistance.prototype.exp]
  30796. * @description 以数值型的字段表达式作为缓冲区分析的距离值。
  30797. */
  30798. this.exp = null;
  30799. /**
  30800. * @member {number} [BufferDistance.prototype.value=100]
  30801. * @description 以数值作为缓冲区分析的距离值。单位:米。
  30802. */
  30803. this.value = 100;
  30804. Util_Util.extend(this, options);
  30805. this.CLASS_NAME = "SuperMap.BufferDistance";
  30806. }
  30807. /**
  30808. * @function BufferDistance.prototype.destroy
  30809. * @description 释放资源,将引用资源的属性置空。
  30810. */
  30811. destroy() {
  30812. this.exp = null;
  30813. this.value = null;
  30814. }
  30815. }
  30816. ;// CONCATENATED MODULE: ./src/common/iServer/BufferSetting.js
  30817. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30818. * This program are made available under the terms of the Apache License, Version 2.0
  30819. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30820. /**
  30821. * @class BufferSetting
  30822. * @deprecatedclass SuperMap.BufferSetting
  30823. * @category iServer SpatialAnalyst BufferAnalyst
  30824. * @classdesc 缓冲区分析通用设置类。
  30825. * @param {Object} options - 可选参数。
  30826. * @param {BufferEndType} [options.endType=BufferEndType.FLAT] - 缓冲区端点枚举值。
  30827. * @param {BufferDistance} [options.leftDistance=100] - 左侧缓冲距离。
  30828. * @param {BufferDistance} [options.rightDistance=100] - 右侧缓冲距离。
  30829. * @param {number} [options.semicircleLineSegment=4] - 圆头缓冲圆弧处线段的个数。
  30830. * @param {BufferRadiusUnit} [options.radiusUnit=BufferRadiusUnit.METER] - 缓冲半径单位。
  30831. * @usage
  30832. */
  30833. class BufferSetting {
  30834. constructor(options) {
  30835. /**
  30836. * @member {BufferEndType} [BufferSetting.prototype.endType = BufferEndType.FLAT]
  30837. * @description 缓冲区端点枚举值。分为平头和圆头两种。
  30838. */
  30839. this.endType = BufferEndType.FLAT;
  30840. /**
  30841. * @member {BufferDistance} [BufferSetting.prototype.leftDistance=100]
  30842. * @description 左侧缓冲距离。
  30843. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  30844. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  30845. */
  30846. this.leftDistance = new BufferDistance();
  30847. /**
  30848. * @member {BufferDistance} [BufferSetting.prototype.rightDistance=100]
  30849. * @description 右侧缓冲距离。
  30850. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  30851. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting#radiusUnit}设置(默认全部为米)。
  30852. */
  30853. this.rightDistance = new BufferDistance();
  30854. /**
  30855. * @member {number} [BufferSetting.prototype.semicircleLineSegment=4]
  30856. * @description 圆头缓冲圆弧处线段的个数。即用多少个线段来模拟一个半圆。
  30857. */
  30858. this.semicircleLineSegment = 4;
  30859. /**
  30860. * @member {BufferRadiusUnit} [BufferSetting.prototype.radiusUnit = BufferRadiusUnit.METER]
  30861. * @description 缓冲半径单位,可以是{@link BufferRadiusUnit.METER}、{@link BufferRadiusUnit.MILLIMETER}、
  30862. * {@link BufferRadiusUnit.CENTIMETER}、{@link BufferRadiusUnit.DECIMETER}、{@link BufferRadiusUnit.KILOMETER}、
  30863. * {@link BufferRadiusUnit.FOOT}、{@link BufferRadiusUnit.INCH}、{@link BufferRadiusUnit.MILE}、{@link BufferRadiusUnit.YARD}。
  30864. * 仅对BufferAnalyst有效。
  30865. */
  30866. this.radiusUnit = BufferRadiusUnit.METER;
  30867. if (options) {
  30868. Util_Util.extend(this, options);
  30869. }
  30870. this.CLASS_NAME = "SuperMap.BufferSetting";
  30871. }
  30872. /**
  30873. * @function BufferSetting.prototype.destroy
  30874. * @description 释放资源,将引用资源的属性置空。
  30875. */
  30876. destroy() {
  30877. let me = this;
  30878. me.endType = null;
  30879. if (me.leftDistance) {
  30880. me.leftDistance.destroy();
  30881. me.leftDistance = null;
  30882. }
  30883. if (me.rightDistance) {
  30884. me.rightDistance.destroy();
  30885. me.rightDistance = null;
  30886. }
  30887. me.semicircleLineSegment = null;
  30888. me.radiusUnit = null;
  30889. }
  30890. }
  30891. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystParameters.js
  30892. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30893. * This program are made available under the terms of the Apache License, Version 2.0
  30894. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30895. /**
  30896. * @class BufferAnalystParameters
  30897. * @deprecatedclass SuperMap.BufferAnalystParameters
  30898. * @category iServer SpatialAnalyst BufferAnalyst
  30899. * @classdesc 缓冲区分析参数基类。
  30900. * @param {Object} options - 参数。
  30901. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  30902. * @usage
  30903. */
  30904. class BufferAnalystParameters {
  30905. constructor(options) {
  30906. var me = this;
  30907. /**
  30908. * @member {BufferSetting} [BufferAnalystParameters.prototype.bufferSetting]
  30909. * @description 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  30910. */
  30911. me.bufferSetting = new BufferSetting();
  30912. Util_Util.extend(this, options);
  30913. this.CLASS_NAME = "SuperMap.BufferAnalystParameters";
  30914. }
  30915. /**
  30916. * @function BufferAnalystParameters.prototype.destroy
  30917. * @description 释放资源,将引用资源的属性置空。
  30918. */
  30919. destroy() {
  30920. var me = this;
  30921. if (me.bufferSetting) {
  30922. me.bufferSetting.destroy();
  30923. me.bufferSetting = null;
  30924. }
  30925. }
  30926. }
  30927. ;// CONCATENATED MODULE: ./src/common/iServer/DataReturnOption.js
  30928. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30929. * This program are made available under the terms of the Apache License, Version 2.0
  30930. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30931. /**
  30932. * @class DataReturnOption
  30933. * @deprecatedclass SuperMap.DataReturnOption
  30934. * @category iServer Data Dataset
  30935. * @classdesc 数据返回设置类。
  30936. * @param {Object} options - 参数。
  30937. * @param {number} [options.expectCount=1000] - 设置返回的最大记录数,小于或者等于 0 时表示返回所有记录数。
  30938. * @param {string} [options.dataset] - 设置结果数据集标识,当 dataReturnMode 为 {@link DataReturnMode.DATASET_ONLY}或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
  30939. * 作为返回数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  30940. * @param {DataReturnMode} [options.dataReturnMode=DataReturnMode.RECORDSET_ONLY] - 数据返回模式。
  30941. * @param {boolean} [options.deleteExistResultDataset=true] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  30942. * @usage
  30943. */
  30944. class DataReturnOption {
  30945. constructor(options) {
  30946. /**
  30947. * @member {number} [DataReturnOption.prototype.expectCount=1000]
  30948. * @description 设置返回的最大记录数,小于或者等于0时表示返回所有记录数。
  30949. */
  30950. this.expectCount = 1000;
  30951. /**
  30952. * @member {string} [DataReturnOption.prototype.dataset]
  30953. * @description 设置结果数据集标识,当dataReturnMode为 {@link DataReturnMode.DATASET_ONLY}
  30954. * 或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
  30955. * 作为返回数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  30956. */
  30957. this.dataset = null;
  30958. /**
  30959. * @member {DataReturnMode} [DataReturnOption.prototype.dataReturnMode=DataReturnMode.RECORDSET_ONLY]
  30960. * @description 数据返回模式。
  30961. */
  30962. this.dataReturnMode = DataReturnMode.RECORDSET_ONLY;
  30963. /**
  30964. * @member {boolean} [DataReturnOption.prototype.deleteExistResultDataset=true]
  30965. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  30966. */
  30967. this.deleteExistResultDataset = true;
  30968. Util_Util.extend(this, options);
  30969. this.CLASS_NAME = "SuperMap.DataReturnOption";
  30970. }
  30971. /**
  30972. * @function DataReturnOption.prototype.destroy
  30973. * @description 释放资源,将引用资源的属性置空。
  30974. */
  30975. destroy() {
  30976. var me = this;
  30977. me.expectCount = null;
  30978. me.dataset = null;
  30979. me.dataReturnMode = null;
  30980. me.deleteExistResultDataset = null;
  30981. }
  30982. }
  30983. ;// CONCATENATED MODULE: ./src/common/iServer/FilterParameter.js
  30984. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30985. * This program are made available under the terms of the Apache License, Version 2.0
  30986. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30987. /**
  30988. * @class FilterParameter
  30989. * @deprecatedclass SuperMap.FilterParameter
  30990. * @category iServer Data FeatureResults
  30991. * @classdesc 查询过滤条件参数类。该类用于设置查询数据集的查询过滤参数。
  30992. * @param {Object} options - 参数。
  30993. * @param {string} options.attributeFilter - 属性过滤条件。
  30994. * @param {string} options.name - 查询数据集名称或者图层名称。
  30995. * @param {Array.<JoinItem>} [options.joinItems] - 与外部表的连接信息 JoinItem 数组。
  30996. * @param {Array.<LinkItem>} [options.linkItems] - 与外部表的关联信息 LinkItem 数组。
  30997. * @param {Array.<string>} [options.ids] - 查询 id 数组,即属性表中的 SmID 值。
  30998. * @param {string} [options.orderBy] - 查询排序的字段,orderBy 的字段须为数值型的。
  30999. * @param {string} [options.groupBy] - 查询分组条件的字段。
  31000. * @param {Array.<string>} [options.fields] - 查询字段数组。
  31001. * @usage
  31002. */
  31003. class FilterParameter {
  31004. constructor(options) {
  31005. /**
  31006. * @member {string} FilterParameter.prototype.attributeFilter
  31007. * @description 属性过滤条件。
  31008. * 相当于 SQL 语句中的 WHERE 子句,其格式为:WHERE <条件表达式>,
  31009. * attributeFilter 就是其中的“条件表达式”。
  31010. * 该字段的用法为 attributeFilter = "过滤条件"。
  31011. * 例如,要查询字段 fieldValue 小于100的记录,设置 attributeFilter = "fieldValue < 100";
  31012. * 要查询字段 name 的值为“酒店”的记录,设置 attributeFilter = "name like '%酒店%'",等等。
  31013. */
  31014. this.attributeFilter = null;
  31015. /**
  31016. * @member {string} FilterParameter.prototype.name
  31017. * @description 查询数据集名称或者图层名称,根据实际的查询对象而定。
  31018. * 一般情况下该字段为数据集名称,但在进行与地图相关功能的操作时,
  31019. * 需要设置为图层名称(图层名称格式:数据集名称@数据源别名)。
  31020. * 因为一个地图的图层可能是来自于不同数据源的数据集,
  31021. * 而不同的数据源中可能存在同名的数据集,
  31022. * 使用数据集名称不能唯一的确定数据集,
  31023. * 所以在进行与地图相关功能的操作时,该值需要设置为图层名称。
  31024. */
  31025. this.name = null;
  31026. /**
  31027. * @member {Array.<JoinItem>} [FilterParameter.prototype.joinItems]
  31028. * @description 与外部表的连接信息 JoinItem 数组。
  31029. */
  31030. this.joinItems = null;
  31031. /**
  31032. * @member {Array.<LinkItem>} [FilterParameter.prototype.linkItems]
  31033. * @description 与外部表的关联信息 LinkItem 数组。
  31034. */
  31035. this.linkItems = null;
  31036. /**
  31037. * @member {Array.<string>} [FilterParameter.prototype.ids]
  31038. * @description 查询 id 数组,即属性表中的 SmID 值。
  31039. */
  31040. this.ids = null;
  31041. /**
  31042. * @member {string} [FilterParameter.prototype.orderBy]
  31043. * @description 查询排序的字段,orderBy的字段须为数值型的。
  31044. * 相当于 SQL 语句中的 ORDER BY 子句,其格式为:ORDER BY <列名>,
  31045. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  31046. * 对单个字段排序时,该字段的用法为 orderBy = "字段名";
  31047. * 对多个字段排序时,字段之间以英文逗号进行分割,用法为 orderBy = "字段名1, 字段名2"。
  31048. * 例如,现有一个国家数据集,它有两个字段分别为“SmArea”和“pop_1994”,
  31049. * 分别表示国家的面积和1994年的各国人口数量。
  31050. * 如果要按照各国人口数量对记录进行排序,则 orderBy = "pop_1994";
  31051. * 如果要以面积和人口进行排序,则 orderBy = "SmArea, pop_1994"。
  31052. */
  31053. this.orderBy = null;
  31054. /**
  31055. * @member {string} [FilterParameter.prototype.groupBy]
  31056. * @description 查询分组条件的字段。
  31057. * 相当于 SQL 语句中的 GROUP BY 子句,其格式为:GROUP BY <列名>,
  31058. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  31059. * 对单个字段分组时,该字段的用法为 groupBy = "字段名";
  31060. * 对多个字段分组时,字段之间以英文逗号进行分割,用法为 groupBy = "字段名1, 字段名2"。
  31061. * 例如,现有一个全球城市数据集,该数据集有两个字段分别为“Continent”和“Country”,
  31062. * 分别表示某个城市所属的洲和国家。
  31063. * 如果要按照国家对全球的城市进行分组,可以设置 groupBy = "Country";
  31064. * 如果以洲和国家对城市进行分组,设置 groupBy = "Continent, Country"。
  31065. */
  31066. this.groupBy = null;
  31067. /**
  31068. * @member {Array.<string>} [FilterParameter.prototype.fields]
  31069. * @description 查询字段数组,如果不设置则使用系统返回的所有字段。
  31070. */
  31071. this.fields = null;
  31072. if (options) {
  31073. Util_Util.extend(this, options);
  31074. }
  31075. this.CLASS_NAME = "SuperMap.FilterParameter";
  31076. }
  31077. /**
  31078. * @function FilterParameter.prototype.destroy
  31079. * @description 释放资源,将引用资源的属性置空。
  31080. */
  31081. destroy() {
  31082. var me = this;
  31083. me.attributeFilter = null;
  31084. me.name = null;
  31085. if (me.joinItems) {
  31086. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  31087. joinItems[i].destroy();
  31088. }
  31089. me.joinItems = null;
  31090. }
  31091. if (me.linkItems) {
  31092. for (let i = 0, linkItems = me.linkItems, len = linkItems.length; i < len; i++) {
  31093. linkItems[i].destroy();
  31094. }
  31095. me.linkItems = null;
  31096. }
  31097. me.ids = null;
  31098. me.orderBy = null;
  31099. me.groupBy = null;
  31100. me.fields = null;
  31101. }
  31102. }
  31103. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetBufferAnalystParameters.js
  31104. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31105. * This program are made available under the terms of the Apache License, Version 2.0
  31106. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31107. /**
  31108. * @class DatasetBufferAnalystParameters
  31109. * @deprecatedclass SuperMap.DatasetBufferAnalystParameters
  31110. * @category iServer SpatialAnalyst BufferAnalyst
  31111. * @classdesc 数据集缓冲区分析参数类。
  31112. * @param {Object} options - 参数。
  31113. * @param {string} options.dataset - 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  31114. * @param {FilterParameter} [options.filterQueryParameter] - 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  31115. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  31116. * @param {boolean} [options.isAttributeRetained=true] - 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  31117. * @param {boolean} [options.isUnion=false] - 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  31118. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  31119. *
  31120. * @extends {BufferAnalystParameters}
  31121. * @usage
  31122. */
  31123. class DatasetBufferAnalystParameters extends BufferAnalystParameters {
  31124. constructor(options) {
  31125. super(options);
  31126. /**
  31127. * @member {string} DatasetBufferAnalystParameters.prototype.dataset
  31128. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  31129. */
  31130. this.dataset = null;
  31131. /**
  31132. * @member {FilterParameter} [DatasetBufferAnalystParameters.prototype.filterQueryParameter]
  31133. * @description 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  31134. */
  31135. this.filterQueryParameter = new FilterParameter();
  31136. /**
  31137. * @member {DataReturnOption} [DatasetBufferAnalystParameters.prototype.resultSetting]
  31138. * @description 结果返回设置类。
  31139. */
  31140. this.resultSetting = new DataReturnOption();
  31141. /**
  31142. * @member {boolean} [DatasetBufferAnalystParameters.prototype.isAttributeRetained=true]
  31143. * @description 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  31144. */
  31145. this.isAttributeRetained = true;
  31146. /**
  31147. * @member {boolean} [DatasetBufferAnalystParameters.prototype.isUnion=false]
  31148. * @description 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  31149. */
  31150. this.isUnion = false;
  31151. Util_Util.extend(this, options);
  31152. this.CLASS_NAME = "SuperMap.DatasetBufferAnalystParameters";
  31153. }
  31154. /**
  31155. * @function DatasetBufferAnalystParameters.prototype.destroy
  31156. * @override
  31157. */
  31158. destroy() {
  31159. super.destroy();
  31160. var me = this;
  31161. me.dataset = null;
  31162. if (me.filterQueryParameter) {
  31163. me.filterQueryParameter.destroy();
  31164. me.filterQueryParameter = null;
  31165. }
  31166. if (me.resultSetting) {
  31167. me.resultSetting.destroy();
  31168. me.resultSetting = null;
  31169. }
  31170. me.isAttributeRetained = null;
  31171. me.isUnion = null;
  31172. }
  31173. /**
  31174. * @function DatasetBufferAnalystParameters.toObject
  31175. * @param {DatasetBufferAnalystParameters} datasetBufferAnalystParameters - 数据集缓冲区分析参数类。
  31176. * @param {DatasetBufferAnalystParameters} tempObj - 数据集缓冲区分析参数对象。
  31177. * @description 将数据集缓冲区分析参数对象转换为 JSON 对象。
  31178. * @returns {Object} JSON 对象。
  31179. */
  31180. static toObject(datasetBufferAnalystParameters, tempObj) {
  31181. for (var name in datasetBufferAnalystParameters) {
  31182. if (name === "bufferSetting") {
  31183. datasetBufferAnalystParameters.bufferSetting.radiusUnit = datasetBufferAnalystParameters.bufferSetting.radiusUnit.toUpperCase();
  31184. tempObj.bufferAnalystParameter = datasetBufferAnalystParameters.bufferSetting;
  31185. } else if (name === "resultSetting") {
  31186. tempObj.dataReturnOption = datasetBufferAnalystParameters.resultSetting;
  31187. } else if (name === "dataset") {
  31188. continue;
  31189. } else {
  31190. tempObj[name] = datasetBufferAnalystParameters[name];
  31191. }
  31192. }
  31193. }
  31194. }
  31195. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBufferAnalystParameters.js
  31196. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31197. * This program are made available under the terms of the Apache License, Version 2.0
  31198. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31199. /**
  31200. * @class GeometryBufferAnalystParameters
  31201. * @deprecatedclass SuperMap.GeometryBufferAnalystParameters
  31202. * @category iServer SpatialAnalyst BufferAnalyst
  31203. * @classdesc 几何对象缓冲区分析参数类。
  31204. * 对指定的某个几何对象做缓冲区分析。通过该类可以指定要做缓冲区分析的几何对象、缓冲区参数等。
  31205. * @param {Object} options - 参数。
  31206. * @param {GeoJSONObject} options.sourceGeometry - 要做缓冲区分析的几何对象。
  31207. * @param {number} options.sourceGeometrySRID - 缓冲区几何对象投影坐标参数, 如 4326,3857。
  31208. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  31209. * @extends {BufferAnalystParameters}
  31210. * @usage
  31211. */
  31212. class GeometryBufferAnalystParameters extends BufferAnalystParameters {
  31213. constructor(options) {
  31214. super(options);
  31215. /**
  31216. * @member {GeoJSONObject} GeometryBufferAnalystParameters.prototype.sourceGeometry
  31217. * @description 要做缓冲区分析的几何对象。<br>
  31218. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  31219. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  31220. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  31221. */
  31222. this.sourceGeometry = null;
  31223. /**
  31224. * @member {number} GeometryBufferAnalystParameters.prototype.sourceGeometrySRID
  31225. * @description 缓冲区几何对象投影坐标参数, 如 4326,3857。
  31226. */
  31227. this.sourceGeometrySRID = null;
  31228. if (options) {
  31229. Util_Util.extend(this, options);
  31230. }
  31231. this.CLASS_NAME = " SuperMap.GeometryBufferAnalystParameters";
  31232. }
  31233. /**
  31234. * @function GeometryBufferAnalystParameters.prototype.destroy
  31235. * @override
  31236. */
  31237. destroy() {
  31238. super.destroy();
  31239. var me = this;
  31240. if (me.sourceGeometry) {
  31241. me.sourceGeometry.destroy();
  31242. me.sourceGeometry = null;
  31243. }
  31244. }
  31245. /**
  31246. * @function GeometryBufferAnalystParameters.toObject
  31247. * @param {GeometryBufferAnalystParameters} geometryBufferAnalystParameters - 几何对象缓冲区分析参数类。
  31248. * @param {GeometryBufferAnalystParameters} tempObj - 几何对象缓冲区分析参数对象。
  31249. * @description 将几何对象缓冲区分析参数对象转换为 JSON 对象。
  31250. * @returns {Object} JSON 对象。
  31251. */
  31252. static toObject(geometryBufferAnalystParameters, tempObj) {
  31253. for (var name in geometryBufferAnalystParameters) {
  31254. if (name === "bufferSetting") {
  31255. var tempBufferSetting = {};
  31256. for (var key in geometryBufferAnalystParameters.bufferSetting) {
  31257. tempBufferSetting[key] = geometryBufferAnalystParameters.bufferSetting[key];
  31258. }
  31259. tempObj.analystParameter = tempBufferSetting;
  31260. } else if (name === "sourceGeometry") {
  31261. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryBufferAnalystParameters.sourceGeometry);
  31262. } else {
  31263. tempObj[name] = geometryBufferAnalystParameters[name];
  31264. }
  31265. }
  31266. }
  31267. }
  31268. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystService.js
  31269. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31270. * This program are made available under the terms of the Apache License, Version 2.0
  31271. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31272. /**
  31273. * @class BufferAnalystService
  31274. * @deprecatedclass SuperMap.BufferAnalystService
  31275. * @category iServer SpatialAnalyst BufferAnalyst
  31276. * @classdesc 缓冲区分析服务类。
  31277. * 该类负责将客户设置的缓冲区分析参数传递给服务端,并接收服务端返回的缓冲区分析结果数据。
  31278. * 缓冲区分析结果通过该类支持的事件的监听函数参数获取。
  31279. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  31280. * @param {Object} options - 参数。
  31281. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31282. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31283. * @param {Object} [options.headers] - 请求头。
  31284. * @extends {SpatialAnalystBase}
  31285. * @example 例如:
  31286. * (start code)
  31287. * var myBufferAnalystService = new BufferAnalystService(url, {
  31288. * eventListeners: {
  31289. * "processCompleted": bufferCompleted,
  31290. * "processFailed": bufferFailed
  31291. * }
  31292. * });
  31293. * (end)
  31294. * @usage
  31295. */
  31296. class BufferAnalystService extends SpatialAnalystBase {
  31297. constructor(url, options) {
  31298. super(url, options);
  31299. /**
  31300. * @member {string} BufferAnalystService.prototype.mode
  31301. * @description 缓冲区分析类型
  31302. */
  31303. this.mode = null;
  31304. if (options) {
  31305. Util_Util.extend(this, options);
  31306. }
  31307. this.CLASS_NAME = "SuperMap.BufferAnalystService";
  31308. }
  31309. /**
  31310. * @function BufferAnalystService.prototype.destroy
  31311. * @override
  31312. */
  31313. destroy() {
  31314. super.destroy();
  31315. this.mode = null;
  31316. }
  31317. /**
  31318. * @method BufferAnalystService.prototype.processAsync
  31319. * @description 负责将客户端的查询参数传递到服务端。
  31320. * @param {BufferAnalystParameters} parameter - 缓冲区分析参数
  31321. */
  31322. processAsync(parameter) {
  31323. var parameterObject = {};
  31324. var me = this;
  31325. if (parameter instanceof DatasetBufferAnalystParameters) {
  31326. me.mode = 'datasets';
  31327. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/buffer');
  31328. DatasetBufferAnalystParameters.toObject(parameter, parameterObject);
  31329. } else if (parameter instanceof GeometryBufferAnalystParameters) {
  31330. me.mode = 'geometry';
  31331. me.url = Util_Util.urlPathAppend(me.url, 'geometry/buffer');
  31332. GeometryBufferAnalystParameters.toObject(parameter, parameterObject);
  31333. }
  31334. var jsonParameters = Util_Util.toJSON(parameterObject);
  31335. this.returnContent = true;
  31336. me.request({
  31337. method: "POST",
  31338. data: jsonParameters,
  31339. scope: me,
  31340. success: me.serviceProcessCompleted,
  31341. failure: me.serviceProcessFailed
  31342. });
  31343. }
  31344. dataFormat() {
  31345. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  31346. }
  31347. }
  31348. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  31349. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31350. * This program are made available under the terms of the Apache License, Version 2.0
  31351. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31352. // eslint-disable-line no-unused-vars
  31353. /**
  31354. * @class DatasourceConnectionInfo
  31355. * @deprecatedclass SuperMap.DatasourceConnectionInfo
  31356. * @category iServer Data Datasource
  31357. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  31358. * 当保存为工作空间时,工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  31359. * 所以在使用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  31360. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  31361. * @param {Object} options - 参数。
  31362. * @param {string} options.alias - 数据源别名。
  31363. * @param {string} options.dataBase - 数据源连接的数据库名。
  31364. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  31365. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  31366. * @param {EngineType} [options.engineType] - 数据源连接的引擎类型。
  31367. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  31368. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  31369. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  31370. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  31371. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  31372. * @param {string} [options.user] - 登录数据库的用户名。
  31373. * @usage
  31374. */
  31375. class DatasourceConnectionInfo {
  31376. constructor(options) {
  31377. /**
  31378. * @member {string} DatasourceConnectionInfo.prototype.alias
  31379. * @description 数据源别名。
  31380. */
  31381. this.alias = null;
  31382. /**
  31383. * @member {boolean} [DatasourceConnectionInfo.prototype.connect]
  31384. * @description 数据源是否自动连接数据。
  31385. */
  31386. this.connect = null;
  31387. /**
  31388. * @member {string} DatasourceConnectionInfo.prototype.dataBase
  31389. * @description 数据源连接的数据库名。
  31390. */
  31391. this.dataBase = null;
  31392. /**
  31393. * @member {string} [DatasourceConnectionInfo.prototype.driver]
  31394. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  31395. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  31396. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  31397. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  31398. */
  31399. this.driver = null;
  31400. /**
  31401. * @member {EngineType} [DatasourceConnectionInfo.prototype.engineType]
  31402. * @description 数据源连接的引擎类型。
  31403. */
  31404. this.engineType = null;
  31405. /**
  31406. * @member {boolean} [DatasourceConnectionInfo.prototype.exclusive]
  31407. * @description 是否以独占方式打开数据源。
  31408. */
  31409. this.exclusive = null;
  31410. /**
  31411. * @member {boolean} [DatasourceConnectionInfo.prototype.OpenLinkTable]
  31412. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  31413. */
  31414. this.OpenLinkTable = null;
  31415. /**
  31416. * @member {string} [DatasourceConnectionInfo.prototype.password]
  31417. * @description 登录数据源连接的数据库或文件的密码。
  31418. */
  31419. this.password = null;
  31420. /**
  31421. * @member {boolean} [DatasourceConnectionInfo.prototype.readOnly]
  31422. * @description 是否以只读方式打开数据源。
  31423. */
  31424. this.readOnly = null;
  31425. /**
  31426. * @member {string} [DatasourceConnectionInfo.prototype.server]
  31427. * @description 数据库服务器名、文件名或服务地址。
  31428. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  31429. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  31430. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  31431. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  31432. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  31433. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  31434. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  31435. * 8.对于 SuperMapCould 数据源,为其服务地址。
  31436. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  31437. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  31438. */
  31439. this.server = null;
  31440. /**
  31441. * @member {string} DatasourceConnectionInfo.prototype.user
  31442. * @description 登录数据库的用户名。
  31443. */
  31444. this.user = null;
  31445. if (options) {
  31446. Util_Util.extend(this, options);
  31447. }
  31448. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  31449. }
  31450. /**
  31451. * @function DatasourceConnectionInfo.prototype.destroy
  31452. * @description 释放资源,将引用资源的属性置空。
  31453. */
  31454. destroy() {
  31455. var me = this;
  31456. me.alias = null;
  31457. me.connect = null;
  31458. me.dataBase = null;
  31459. me.driver = null;
  31460. me.engineType = null;
  31461. me.exclusive = null;
  31462. me.OpenLinkTable = null;
  31463. me.password = null;
  31464. me.readOnly = null;
  31465. me.server = null;
  31466. me.user = null;
  31467. }
  31468. }
  31469. ;// CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  31470. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31471. * This program are made available under the terms of the Apache License, Version 2.0
  31472. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31473. /**
  31474. * @class OutputSetting
  31475. * @deprecatedclass SuperMap.OutputSetting
  31476. * @category iServer ProcessingService
  31477. * @classdesc 分布式分析输出类型设置类。
  31478. * @param {Object} options - 参数。
  31479. * @param {DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  31480. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  31481. * @param {OutputType} [options.type=OutputType.UDB] - 输出类型。
  31482. * @param {string} [options.outputPath] - 分析结果输出路径。
  31483. * @usage
  31484. */
  31485. class OutputSetting {
  31486. constructor(options) {
  31487. /**
  31488. * @member {OutputType} OutputSetting.prototype.type
  31489. * @description 分布式分析的输出类型。
  31490. */
  31491. this.type = OutputType.UDB;
  31492. /**
  31493. * @member {string} [OutputSetting.prototype.datasetName='analystResult']
  31494. * @description 分布式分析的输出结果数据集名称。
  31495. */
  31496. this.datasetName = "analystResult";
  31497. /**
  31498. * @member {DatasourceConnectionInfo} OutputSetting.prototype.datasourceInfo
  31499. * @description 分布式分析的输出结果数据源连接信息。
  31500. */
  31501. this.datasourceInfo = null;
  31502. /**
  31503. * @member {string} [OutputSetting.prototype.outputPath]
  31504. * @description 分布式分析的分析结果输出路径。
  31505. */
  31506. this.outputPath = "";
  31507. Util_Util.extend(this, options);
  31508. this.CLASS_NAME = "SuperMap.OutputSetting";
  31509. }
  31510. /**
  31511. * @function OutputSetting.prototype.destroy
  31512. * @description 释放资源,将引用资源的属性置空。
  31513. */
  31514. destroy() {
  31515. var me = this;
  31516. me.type = null;
  31517. me.datasetName = null;
  31518. me.outputPath = null;
  31519. if (me.datasourceInfo instanceof DatasourceConnectionInfo) {
  31520. me.datasourceInfo.destroy();
  31521. me.datasourceInfo = null;
  31522. }
  31523. }
  31524. }
  31525. ;// CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  31526. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31527. * This program are made available under the terms of the Apache License, Version 2.0
  31528. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31529. /**
  31530. * @class MappingParameters
  31531. * @deprecatedclass SuperMap.MappingParameters
  31532. * @category iServer ProcessingService
  31533. * @classdesc 分析后结果可视化的参数类。
  31534. * @param {Object} options - 参数。
  31535. * @param {Array.<ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  31536. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  31537. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 专题图分段模式。
  31538. * @param {number} [options.rangeCount] - 专题图分段个数。
  31539. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  31540. * @usage
  31541. */
  31542. class MappingParameters {
  31543. constructor(options) {
  31544. /**
  31545. * @member {Array.<ThemeGridRangeItem>} [MappingParameters.prototype.items]
  31546. * @description 栅格分段专题图子项数组。
  31547. */
  31548. this.items = null;
  31549. /**
  31550. * @member {number} [MappingParameters.prototype.numericPrecision=1]
  31551. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  31552. */
  31553. this.numericPrecision = 1;
  31554. /**
  31555. * @member {RangeMode} [MappingParameters.prototype.RangeMode=RangeMode.EQUALINTERVAL]
  31556. * @description 专题图分段模式。
  31557. */
  31558. this.rangeMode = RangeMode.EQUALINTERVAL;
  31559. /**
  31560. * @member {number} [MappingParameters.prototype.rangeCount]
  31561. * @description 专题图分段个数。
  31562. */
  31563. this.rangeCount = "";
  31564. /**
  31565. * @member {ColorGradientType} [MappingParameters.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  31566. * @description 专题图颜色渐变模式。
  31567. */
  31568. this.colorGradientType = ColorGradientType.YELLOW_RED;
  31569. Util_Util.extend(this, options);
  31570. this.CLASS_NAME = "SuperMap.MappingParameters";
  31571. }
  31572. /**
  31573. * @function MappingParameters.prototype.destroy
  31574. * @description 释放资源,将引用资源的属性置空。
  31575. */
  31576. destroy() {
  31577. var me = this;
  31578. if (me.items) {
  31579. if (me.items.length > 0) {
  31580. for (var item in me.items) {
  31581. me.items[item].destroy();
  31582. me.items[item] = null;
  31583. }
  31584. }
  31585. me.items = null;
  31586. }
  31587. me.numericPrecision = null;
  31588. me.rangeMode = null;
  31589. me.rangeCount = null;
  31590. me.colorGradientType = null;
  31591. }
  31592. }
  31593. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  31594. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31595. * This program are made available under the terms of the Apache License, Version 2.0
  31596. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31597. /**
  31598. * @class BuffersAnalystJobsParameter
  31599. * @deprecatedclass SuperMap.BuffersAnalystJobsParameter
  31600. * @category iServer ProcessingService BufferAnalyst
  31601. * @classdesc 缓冲区分析任务参数类。
  31602. * @param {Object} options - 参数。
  31603. * @param {string} options.datasetName - 数据集名。
  31604. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 分析范围(默认为全图范围)。
  31605. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  31606. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  31607. * @param {AnalystSizeUnit} [options.distanceUnit=AnalystSizeUnit.METER] - 缓冲距离单位单位。
  31608. * @param {OutputSetting} [options.output] - 输出参数设置。
  31609. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  31610. * @usage
  31611. */
  31612. class BuffersAnalystJobsParameter {
  31613. constructor(options) {
  31614. /**
  31615. * @member {string} BuffersAnalystJobsParameter.prototype.datasetName
  31616. * @description 数据集名。
  31617. */
  31618. this.datasetName = '';
  31619. /**
  31620. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} BuffersAnalystJobsParameter.prototype.bounds
  31621. * @description 分析范围。
  31622. */
  31623. this.bounds = '';
  31624. /**
  31625. * @member {string} [BuffersAnalystJobsParameter.prototype.distance='15']
  31626. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段为空时,此参数有效。
  31627. */
  31628. this.distance = '';
  31629. /**
  31630. * @member {string} [BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  31631. * @description 缓冲距离字段。
  31632. */
  31633. this.distanceField = '';
  31634. /**
  31635. * @member {AnalystSizeUnit} [BuffersAnalystJobsParameter.prototype.distanceUnit=AnalystSizeUnit.METER]
  31636. * @description 缓冲距离单位。
  31637. */
  31638. this.distanceUnit = AnalystSizeUnit.METER;
  31639. /**
  31640. * @member {string} BuffersAnalystJobsParameter.prototype.dissolveField
  31641. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  31642. */
  31643. this.dissolveField = '';
  31644. /**
  31645. * @member {OutputSetting} [BuffersAnalystJobsParameter.prototype.output]
  31646. * @description 输出参数设置类。
  31647. */
  31648. this.output = null;
  31649. /**
  31650. * @member {MappingParameters} [BuffersAnalystJobsParameter.prototype.mappingParameters]
  31651. * @description 分析后结果可视化的参数类。
  31652. */
  31653. this.mappingParameters = null;
  31654. if (!options) {
  31655. return this;
  31656. }
  31657. Util_Util.extend(this, options);
  31658. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  31659. }
  31660. /**
  31661. * @function BuffersAnalystJobsParameter.prototype.destroy
  31662. * @description 释放资源,将引用资源的属性置空。
  31663. */
  31664. destroy() {
  31665. this.datasetName = null;
  31666. this.bounds = null;
  31667. this.distance = null;
  31668. this.distanceField = null;
  31669. this.distanceUnit = null;
  31670. this.dissolveField = null;
  31671. if (this.output instanceof OutputSetting) {
  31672. this.output.destroy();
  31673. this.output = null;
  31674. }
  31675. if (this.mappingParameters instanceof MappingParameters) {
  31676. this.mappingParameters.destroy();
  31677. this.mappingParameters = null;
  31678. }
  31679. }
  31680. /**
  31681. * @function BuffersAnalystJobsParameter.toObject
  31682. * @param {BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  31683. * @param {Object} tempObj - 目标对象。
  31684. * @description 生成缓冲区分析任务对象。
  31685. */
  31686. static toObject(BuffersAnalystJobsParameter, tempObj) {
  31687. for (var name in BuffersAnalystJobsParameter) {
  31688. if (name === 'datasetName') {
  31689. tempObj['input'] = tempObj['input'] || {};
  31690. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  31691. continue;
  31692. }
  31693. if (name === 'output') {
  31694. tempObj['output'] = tempObj['output'] || {};
  31695. tempObj['output'] = BuffersAnalystJobsParameter[name];
  31696. continue;
  31697. }
  31698. tempObj['analyst'] = tempObj['analyst'] || {};
  31699. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  31700. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  31701. } else {
  31702. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  31703. }
  31704. if (name === 'mappingParameters') {
  31705. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  31706. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  31707. }
  31708. }
  31709. }
  31710. }
  31711. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  31712. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31713. * This program are made available under the terms of the Apache License, Version 2.0
  31714. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31715. /**
  31716. * @class ProcessingServiceBase
  31717. * @deprecatedclass SuperMap.ProcessingServiceBase
  31718. * @category iServer Core
  31719. * @classdesc 分布式分析服务基类
  31720. * @extends {CommonServiceBase}
  31721. * @param {string} url - 服务地址。
  31722. * @param {Object} options - 参数。
  31723. * @param {Events} options.events - 处理所有事件的对象。
  31724. * @param {number} options.index - 服务访问地址在数组中的位置。
  31725. * @param {number} options.length - 服务访问地址数组长度。
  31726. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  31727. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31728. * @param {Object} [options.headers] - 请求头。
  31729. * @usage
  31730. */
  31731. class ProcessingServiceBase extends CommonServiceBase {
  31732. constructor(url, options) {
  31733. options = options || {};
  31734. /*
  31735. * Constant: EVENT_TYPES
  31736. * {Array.<string>}
  31737. * 此类支持的事件类型
  31738. * - *processCompleted* 创建成功后触发的事件。
  31739. * - *processFailed* 创建失败后触发的事件 。
  31740. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  31741. */
  31742. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  31743. super(url, options);
  31744. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  31745. }
  31746. /**
  31747. * @function ProcessingServiceBase.prototype.destroy
  31748. * @override
  31749. */
  31750. destroy() {
  31751. super.destroy();
  31752. }
  31753. /**
  31754. * @function ProcessingServiceBase.prototype.getJobs
  31755. * @description 获取分布式分析任务。
  31756. * @param {string} url - 资源地址。
  31757. */
  31758. getJobs(url) {
  31759. var me = this;
  31760. FetchRequest.get(SecurityManager.appendCredential(url), null, {
  31761. proxy: me.proxy
  31762. }).then(function (response) {
  31763. return response.json();
  31764. }).then(function (result) {
  31765. me.events.triggerEvent("processCompleted", {
  31766. result: result
  31767. });
  31768. }).catch(function (e) {
  31769. me.eventListeners.processFailed({
  31770. error: e
  31771. });
  31772. });
  31773. }
  31774. /**
  31775. * @function ProcessingServiceBase.prototype.addJob
  31776. * @description 添加分布式分析任务。
  31777. * @param {string} url - 资源根地址。
  31778. * @param {Object} params - 创建一个空间分析的请求参数。
  31779. * @param {string} paramType - 请求参数类型。
  31780. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  31781. */
  31782. addJob(url, params, paramType, seconds) {
  31783. var me = this,
  31784. parameterObject = null;
  31785. if (params && params instanceof paramType) {
  31786. parameterObject = new Object();
  31787. paramType.toObject(params, parameterObject);
  31788. }
  31789. let headers = Object.assign({
  31790. 'Content-Type': 'application/x-www-form-urlencoded'
  31791. }, me.headers || {})
  31792. var options = {
  31793. proxy: me.proxy,
  31794. headers,
  31795. withCredentials: me.withCredentials,
  31796. crossOrigin: me.crossOrigin,
  31797. isInTheSameDomain: me.isInTheSameDomain
  31798. };
  31799. FetchRequest.post(SecurityManager.appendCredential(url), JSON.stringify(parameterObject), options).then(function (response) {
  31800. return response.json();
  31801. }).then(function (result) {
  31802. if (result.succeed) {
  31803. me.serviceProcessCompleted(result, seconds);
  31804. } else {
  31805. me.serviceProcessFailed(result);
  31806. }
  31807. }).catch(function (e) {
  31808. me.serviceProcessFailed({
  31809. error: e
  31810. });
  31811. });
  31812. }
  31813. serviceProcessCompleted(result, seconds) {
  31814. result = Util_Util.transformResult(result);
  31815. seconds = seconds || 1000;
  31816. var me = this;
  31817. if (result) {
  31818. var id = setInterval(function () {
  31819. FetchRequest.get(SecurityManager.appendCredential(result.newResourceLocation), {
  31820. _t: new Date().getTime()
  31821. })
  31822. .then(function (response) {
  31823. return response.json();
  31824. }).then(function (job) {
  31825. me.events.triggerEvent("processRunning", {
  31826. id: job.id,
  31827. state: job.state
  31828. });
  31829. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  31830. clearInterval(id);
  31831. me.events.triggerEvent("processFailed", {
  31832. error: job.state.errorMsg,
  31833. state: job.state.runState
  31834. });
  31835. }
  31836. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  31837. clearInterval(id);
  31838. me.events.triggerEvent("processCompleted", {
  31839. result: job
  31840. });
  31841. }
  31842. }).catch(function (e) {
  31843. clearInterval(id);
  31844. me.events.triggerEvent("processFailed", {
  31845. error: e
  31846. });
  31847. });
  31848. }, seconds);
  31849. }
  31850. }
  31851. serviceProcessFailed(result) {
  31852. super.serviceProcessFailed(result);
  31853. }
  31854. }
  31855. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  31856. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31857. * This program are made available under the terms of the Apache License, Version 2.0
  31858. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31859. /**
  31860. * @class BuffersAnalystJobsService
  31861. * @deprecatedclass SuperMap.BuffersAnalystJobsService
  31862. * @category iServer ProcessingService BufferAnalyst
  31863. * @classdesc 缓冲区分析服务类。
  31864. * @extends {ProcessingServiceBase}
  31865. * @param {string} url - 服务地址。
  31866. * @param {Object} options - 参数。
  31867. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31868. * @param {Object} [options.headers] - 请求头。
  31869. * @usage
  31870. */
  31871. class BuffersAnalystJobsService extends ProcessingServiceBase {
  31872. constructor(url, options) {
  31873. super(url, options);
  31874. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  31875. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  31876. }
  31877. /**
  31878. *@override
  31879. */
  31880. destroy() {
  31881. super.destroy();
  31882. }
  31883. /**
  31884. * @function BuffersAnalystJobsService.prototype.getBufferJobs
  31885. * @description 获取缓冲区分析所有任务
  31886. */
  31887. getBuffersJobs() {
  31888. super.getJobs(this.url);
  31889. }
  31890. /**
  31891. * @function BuffersAnalystJobsService.prototype.getBufferJob
  31892. * @description 获取指定id的缓冲区分析服务
  31893. * @param {string} id - 指定要获取数据的id。
  31894. */
  31895. getBuffersJob(id) {
  31896. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  31897. }
  31898. /**
  31899. * @function BuffersAnalystJobsService.prototype.addBufferJob
  31900. * @description 新建缓冲区分析服务
  31901. * @param {BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  31902. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  31903. */
  31904. addBuffersJob(params, seconds) {
  31905. super.addJob(this.url, params, BuffersAnalystJobsParameter, seconds);
  31906. }
  31907. }
  31908. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystParameters.js
  31909. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31910. * This program are made available under the terms of the Apache License, Version 2.0
  31911. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31912. /**
  31913. * @class BurstPipelineAnalystParameters
  31914. * @deprecatedclass SuperMap.BurstPipelineAnalystParameters
  31915. * @category iServer NetworkAnalyst BurstAnalyse
  31916. * @classdesc 爆管分析参数类。
  31917. * @param {Object} options - 参数。
  31918. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  31919. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  31920. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  31921. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  31922. * @usage
  31923. */
  31924. class BurstPipelineAnalystParameters {
  31925. constructor(options) {
  31926. var me = this;
  31927. /**
  31928. * @member {Array.<number>} BurstPipelineAnalystParameters.prototype.sourceNodeIDs
  31929. * @description 指定的设施点 ID 数组。
  31930. */
  31931. this.sourceNodeIDs = null;
  31932. /**
  31933. * @member {number} [BurstPipelineAnalystParameters.prototype.edgeID]
  31934. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  31935. */
  31936. this.edgeID = null;
  31937. /**
  31938. * @member {number} [BurstPipelineAnalystParameters.prototype.nodeID]
  31939. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  31940. */
  31941. this.nodeID = null;
  31942. /**
  31943. * @member {boolean} [BurstPipelineAnalystParameters.prototype.isUncertainDirectionValid=false]
  31944. * @description 指定不确定流向是否有效。
  31945. * 指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行。
  31946. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  31947. */
  31948. this.isUncertainDirectionValid = false;
  31949. Util_Util.extend(me, options);
  31950. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystParameters";
  31951. }
  31952. /**
  31953. * @function BurstPipelineAnalystParameters.prototype.destroy
  31954. * @description 释放资源,将引用资源的属性置空。
  31955. */
  31956. destroy() {
  31957. var me = this;
  31958. me.sourceNodeIDs = null;
  31959. me.edgeID = null;
  31960. me.nodeID = null;
  31961. me.isUncertainDirectionValid = null;
  31962. }
  31963. }
  31964. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystServiceBase.js
  31965. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31966. * This program are made available under the terms of the Apache License, Version 2.0
  31967. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31968. /**
  31969. * @class NetworkAnalystServiceBase
  31970. * @deprecatedclass SuperMap.NetworkAnalystServiceBase
  31971. * @category iServer Core
  31972. * @classdesc 网络分析服务基类。
  31973. * @extends {CommonServiceBase}
  31974. * @param {string} url - 服务地址。
  31975. * @param {Object} options - 可选参数。
  31976. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31977. * @param {Object} [options.headers] - 请求头。
  31978. * @usage
  31979. */
  31980. class NetworkAnalystServiceBase extends CommonServiceBase {
  31981. constructor(url, options) {
  31982. super(url, options);
  31983. /**
  31984. * @member {DataFormat} [NetworkAnalystServiceBase.prototype.format=DataFormat.GEOJSON]
  31985. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"
  31986. */
  31987. this.format = DataFormat.GEOJSON;
  31988. this.CLASS_NAME = "SuperMap.NetworkAnalystServiceBase";
  31989. }
  31990. /**
  31991. * @function NetworkAnalystServiceBase.prototype.destroy
  31992. * @description 释放资源,将引用的资源属性置空。
  31993. */
  31994. destroy() {
  31995. super.destroy();
  31996. this.format = null;
  31997. }
  31998. /**
  31999. * @function NetworkAnalystServiceBase.prototype.serviceProcessCompleted
  32000. * @description 分析完成,执行此方法。
  32001. * @param {Object} result - 服务器返回的结果对象。
  32002. */
  32003. serviceProcessCompleted(result, options) {
  32004. var me = this, analystResult;
  32005. result = Util_Util.transformResult(result);
  32006. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  32007. analystResult = me.toGeoJSONResult(result);
  32008. }
  32009. if (!analystResult) {
  32010. analystResult = result;
  32011. }
  32012. me.events.triggerEvent("processCompleted", {result: analystResult, options});
  32013. }
  32014. /**
  32015. * @function NetworkAnalystServiceBase.prototype.toGeoJSONResult
  32016. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。只处理结果中的路由,由子类实现。
  32017. * @param {Object} result - 服务器返回的结果对象。
  32018. * @returns {GeoJSONObject} GeoJSON 对象。
  32019. */
  32020. toGeoJSONResult(result) { // eslint-disable-line no-unused-vars
  32021. return null;
  32022. }
  32023. }
  32024. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystService.js
  32025. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32026. * This program are made available under the terms of the Apache License, Version 2.0
  32027. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32028. /**
  32029. * @class BurstPipelineAnalystService
  32030. * @deprecatedclass SuperMap.BurstPipelineAnalystService
  32031. * @category iServer NetworkAnalyst BurstAnalyse
  32032. * @classdesc 爆管分析服务类。即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组、普通结点 ID 数组及其上下游弧段 ID 数组。
  32033. * @extends {NetworkAnalystServiceBase}
  32034. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  32035. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源},
  32036. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  32037. * @param {Object} options - 参数。
  32038. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32039. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32040. * @param {Object} [options.headers] - 请求头。
  32041. * @usage
  32042. */
  32043. class BurstPipelineAnalystService extends NetworkAnalystServiceBase {
  32044. constructor(url, options) {
  32045. super(url, options);
  32046. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystService";
  32047. }
  32048. /**
  32049. * @function BurstPipelineAnalystService.prototype.destroy
  32050. * @override
  32051. */
  32052. destroy() {
  32053. super.destroy();
  32054. }
  32055. /**
  32056. * @function BurstPipelineAnalystService.prototype.processAsync
  32057. * @description 负责将客户端的查询参数传递到服务端。
  32058. * @params {BurstPipelineAnalystParameters} params - 爆管分析参数类
  32059. */
  32060. processAsync(params) {
  32061. if (!(params instanceof BurstPipelineAnalystParameters)) {
  32062. return null;
  32063. }
  32064. var me = this, jsonObject;
  32065. me.url = Util_Util.urlPathAppend(me.url, 'burstAnalyse');
  32066. jsonObject = {
  32067. sourceNodeIDs: params.sourceNodeIDs,
  32068. isUncertainDirectionValid: params.isUncertainDirectionValid
  32069. };
  32070. //必传参数不正确,就终止
  32071. if (params.edgeID !== null && params.nodeID !== null) {
  32072. throw new Error('edgeID and nodeID cannot be null at the same time.');
  32073. }
  32074. if (params.edgeID === null && params.nodeID === null) {
  32075. throw new Error('edgeID and nodeID cannot be null at the same time.');
  32076. }
  32077. if (params.edgeID !== null) {
  32078. jsonObject.edgeID = params.edgeID;
  32079. } else {
  32080. jsonObject.nodeID = params.nodeID;
  32081. }
  32082. me.request({
  32083. method: "GET",
  32084. params: jsonObject,
  32085. scope: me,
  32086. success: me.serviceProcessCompleted,
  32087. failure: me.serviceProcessFailed
  32088. });
  32089. }
  32090. }
  32091. ;// CONCATENATED MODULE: ./src/common/iServer/ChartFeatureInfoSpecsService.js
  32092. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32093. * This program are made available under the terms of the Apache License, Version 2.0
  32094. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32095. /**
  32096. * @class ChartFeatureInfoSpecsService
  32097. * @deprecatedclass SuperMap.ChartFeatureInfoSpecsService
  32098. * @category iServer Map Chart
  32099. * @classdesc 海图物标信息服务类,通过该服务类可以查询到服务端支持的所有海图物标信息。
  32100. * 用户可以通过两种方式获取查询结果:
  32101. * 一种是通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件;
  32102. * 另一种是使用 AsyncResponder 类实现异步处理。
  32103. * @extends {CommonServiceBase}
  32104. * @param {string} url - 地图(特指海图)服务地址。
  32105. * 如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  32106. * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。
  32107. * @param {Object} options - 参数。
  32108. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  32109. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。
  32110. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32111. * @param {Object} [options.headers] - 请求头。
  32112. * @usage
  32113. */
  32114. class ChartFeatureInfoSpecsService extends CommonServiceBase {
  32115. constructor(url, options) {
  32116. super(url, options);
  32117. this.CLASS_NAME = "SuperMap.ChartFeatureInfoSpecsService";
  32118. }
  32119. /**
  32120. * @function ChartFeatureInfoSpecsService.prototype.destroy
  32121. * @override
  32122. */
  32123. destroy() {
  32124. super.destroy();
  32125. Util_Util.reset(this);
  32126. }
  32127. /**
  32128. * @function ChartFeatureInfoSpecsService.prototype.processAsync
  32129. * @description 根据地图(特指海图)服务地址与服务端完成异步通讯,获取物标信息。
  32130. * 当查询物标信息成功时,将触发 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE
  32131. * 事件。用可以通过户两种方式获取图层信息:
  32132. * 1. 通过 AsyncResponder 类获取(推荐使用);
  32133. * 2. 通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件获取。
  32134. */
  32135. processAsync() {
  32136. var me = this, method = "GET";
  32137. if (!me.isTempLayers) {
  32138. Util_Util.urlPathAppend(me.url,'chartFeatureInfoSpecs');
  32139. }
  32140. me.request({
  32141. method: method,
  32142. params: null,
  32143. scope: me,
  32144. success: me.serviceProcessCompleted,
  32145. failure: me.serviceProcessFailed
  32146. });
  32147. }
  32148. }
  32149. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryFilterParameter.js
  32150. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32151. * This program are made available under the terms of the Apache License, Version 2.0
  32152. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32153. /**
  32154. * @class ChartQueryFilterParameter
  32155. * @deprecatedclass SuperMap.ChartQueryFilterParameter
  32156. * @category iServer Map Chart
  32157. * @classdesc 海图查询过滤参数类,用于设置海图查询的过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  32158. * @param {Object} options - 参数。
  32159. * @param {string} options.attributeFilter - 属性字段过滤条件。
  32160. * @param {number} options.chartFeatureInfoSpecCode - 查询的物标代号。
  32161. * @param {boolean} [options.isQueryPoint] - 是否查询点。
  32162. * @param {boolean} [options.isQueryLine] - 是否查询线。
  32163. * @param {boolean} [options.isQueryRegion] - 是否查询面。
  32164. * @usage
  32165. */
  32166. class ChartQueryFilterParameter {
  32167. constructor(options) {
  32168. /**
  32169. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryPoint]
  32170. * @description 是否查询点。
  32171. */
  32172. this.isQueryPoint = null;
  32173. /**
  32174. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryLine]
  32175. * @description 是否查询线。
  32176. */
  32177. this.isQueryLine = null;
  32178. /**
  32179. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryRegion]
  32180. * @description 是否查询面。
  32181. */
  32182. this.isQueryRegion = null;
  32183. /**
  32184. * @member {string} ChartQueryFilterParameter.prototype.attributeFilter
  32185. * @description 属性字段过滤条件。
  32186. */
  32187. this.attributeFilter = null;
  32188. /**
  32189. * @member {number} ChartQueryFilterParameter.prototype.chartFeatureInfoSpecCode
  32190. * @description 查询的物标代号。
  32191. */
  32192. this.chartFeatureInfoSpecCode = null;
  32193. Util_Util.extend(this, options);
  32194. this.CLASS_NAME = "SuperMap.ChartQueryFilterParameter";
  32195. }
  32196. /**
  32197. * @function ChartQueryFilterParameter.prototype.destroy
  32198. * @description 释放资源,将引用资源的属性置空。
  32199. */
  32200. destroy() {
  32201. var me = this;
  32202. me.isQueryPoint = null;
  32203. me.isQueryLine = null;
  32204. me.isQueryRegion = null;
  32205. me.attributeFilter = null;
  32206. me.chartFeatureInfoSpecCode = null;
  32207. }
  32208. /**
  32209. * @function ChartQueryFilterParameter.prototype.toJson
  32210. * @description 将属性信息转化成 JSON 格式字符串。
  32211. */
  32212. toJson() {
  32213. var json = "";
  32214. json += "\"isQueryPoint\":" + this.isQueryPoint + ",";
  32215. json += "\"isQueryLine\":" + this.isQueryLine + ",";
  32216. json += "\"isQueryRegion\":" + this.isQueryRegion + ",";
  32217. if (this.attributeFilter) {
  32218. json += "\"attributeFilter\": \"" + this.attributeFilter + "\",";
  32219. }
  32220. json += "\"chartFeatureInfoSpecCode\":" + this.chartFeatureInfoSpecCode;
  32221. json = "{" + json + "}";
  32222. return json;
  32223. }
  32224. }
  32225. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryParameters.js
  32226. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32227. * This program are made available under the terms of the Apache License, Version 2.0
  32228. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32229. /**
  32230. * @class ChartQueryParameters
  32231. * @deprecatedclass SuperMap.ChartQueryParameters
  32232. * @category iServer Map Chart
  32233. * @classdesc 海图查询参数类,该类用于设置海图查询时的相关参数,海图查询分为海图属性查询和海图范围查询两类,通过属性 queryMode 指定查询模式。
  32234. * 必设属性有:queryMode、chartLayerNames、chartQueryFilterParameters。当进行海图范围查询时,必设属性还包括 bounds。
  32235. * @param {Object} options - 参数。
  32236. * @param {string} options.queryMode - 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  32237. * @param {Array.<string>} options.chartLayerNames - 查询的海图图层的名称。
  32238. * @param {Array.<ChartQueryFilterParameter>} options.chartQueryFilterParameters - 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  32239. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 海图查询范围。当进行海图范围查询时,此为必选参数。
  32240. * @param {boolean} [options.returnContent=true] - 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  32241. * @param {number} [options.startRecord=0] - 查询起始记录位置。
  32242. * @param {number} [options.expectCount] - 期望查询结果返回的记录数,该值大于0。
  32243. * @usage
  32244. */
  32245. class ChartQueryParameters {
  32246. constructor(options) {
  32247. /**
  32248. * @member {string} ChartQueryParameters.prototype.queryMode
  32249. * @description 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  32250. */
  32251. this.queryMode = null;
  32252. /**
  32253. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} ChartQueryParameters.prototype.bounds
  32254. * @description 海图查询范围。
  32255. */
  32256. this.bounds = null;
  32257. /**
  32258. * @member {Array.<string>} ChartQueryParameters.prototype.chartLayerNames
  32259. * @description 查询的海图图层的名称。
  32260. */
  32261. this.chartLayerNames = null;
  32262. /**
  32263. * @member {Array.<ChartQueryFilterParameter>} ChartQueryParameters.prototype.chartQueryFilterParameters
  32264. * @description 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  32265. */
  32266. this.chartQueryFilterParameters = null;
  32267. /**
  32268. * @member {boolean} [ChartQueryParameters.prototype.returnContent=true]
  32269. * @description 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  32270. */
  32271. this.returnContent = true;
  32272. /**
  32273. * @member {number} [ChartQueryParameters.prototype.startRecord=0]
  32274. * @description 查询起始记录位置。
  32275. */
  32276. this.startRecord = 0;
  32277. /**
  32278. * @member {number} [ChartQueryParameters.prototype.expectCount]
  32279. * @description 期望查询结果返回的记录数,该值大于0。
  32280. */
  32281. this.expectCount = null;
  32282. Util_Util.extend(this, options);
  32283. this.CLASS_NAME = "SuperMap.ChartQueryParameters";
  32284. }
  32285. /**
  32286. * @function ChartQueryParameters.prototype.destroy
  32287. * @description 释放资源,将引用资源的属性置空。
  32288. */
  32289. destroy() {
  32290. var me = this;
  32291. me.queryMode = null;
  32292. me.bounds = null;
  32293. me.chartLayerNames = null;
  32294. me.chartQueryFilterParameters = null;
  32295. me.returnContent = true;
  32296. me.startRecord = 0;
  32297. me.expectCount = null;
  32298. }
  32299. /**
  32300. * @function ChartQueryParameters.prototype.getVariablesJson
  32301. * @description 将属性信息转换成能够被服务识别的 JSON 格式字符串。
  32302. * @returns {string} JSON 字符串。
  32303. */
  32304. getVariablesJson() {
  32305. var json = "";
  32306. json += "\"queryMode\":\"" + this.queryMode + "\",";
  32307. if (this.chartLayerNames && this.chartLayerNames.length) {
  32308. var chartLayersArray = [];
  32309. var layerLength = this.chartLayerNames.length;
  32310. for (var i = 0; i < layerLength; i++) {
  32311. chartLayersArray.push("\"" + this.chartLayerNames[i] + "\"");
  32312. }
  32313. var layerNames = "[" + chartLayersArray.join(",") + "]";
  32314. json += "\"chartLayerNames\":" + layerNames + ",";
  32315. }
  32316. if (this.queryMode === "ChartBoundsQuery" && this.bounds) {
  32317. json += "\"bounds\":" + "{" + "\"leftBottom\":" + "{" + "\"x\":" + this.bounds.left + "," +
  32318. "\"y\":" + this.bounds.bottom + "}" + "," + "\"rightTop\":" + "{" + "\"x\":" + this.bounds.right + "," +
  32319. "\"y\":" + this.bounds.top + "}" + "},";
  32320. }
  32321. if (this.chartQueryFilterParameters && this.chartQueryFilterParameters.length) {
  32322. var chartParamArray = [];
  32323. var chartLength = this.chartQueryFilterParameters.length;
  32324. for (var j = 0; j < chartLength; j++) {
  32325. var chartQueryFilterParameter = this.chartQueryFilterParameters[j];
  32326. if (!(chartQueryFilterParameter instanceof ChartQueryFilterParameter)) {
  32327. continue;
  32328. }
  32329. chartParamArray.push(chartQueryFilterParameter.toJson());
  32330. }
  32331. var chartParamsJson = "[" + chartParamArray.join(",") + "]";
  32332. chartParamsJson = "\"chartQueryParams\":" + chartParamsJson + ",";
  32333. chartParamsJson += "\"startRecord\":" + this.startRecord + ",";
  32334. chartParamsJson += "\"expectCount\":" + this.expectCount;
  32335. chartParamsJson = "{" + chartParamsJson + "}";
  32336. json += "\"chartQueryParameters\":" + chartParamsJson;
  32337. }
  32338. json = "{" + json + "}";
  32339. return json;
  32340. }
  32341. }
  32342. ;// CONCATENATED MODULE: ./src/common/iServer/QueryParameters.js
  32343. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32344. * This program are made available under the terms of the Apache License, Version 2.0
  32345. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32346. /**
  32347. * @class QueryParameters
  32348. * @deprecatedclass SuperMap.QueryParameters
  32349. * @category iServer Map QueryResults
  32350. * @classdesc 查询参数基类。距离查询、SQL 查询、几何地物查询等各自的参数均继承此类。
  32351. * @param {Object} options - 参数。
  32352. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  32353. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  32354. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  32355. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  32356. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  32357. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  32358. * @param {number} [options.startRecord=0] - 查询起始记录号。
  32359. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  32360. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  32361. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  32362. * @usage
  32363. */
  32364. class QueryParameters {
  32365. constructor(options) {
  32366. if (!options) {
  32367. return;
  32368. }
  32369. /**
  32370. * @member {string} [QueryParameters.prototype.customParams]
  32371. * @description 自定义参数,供扩展使用。
  32372. */
  32373. this.customParams = null;
  32374. /**
  32375. * @member {Object} [QueryParameters.prototype.prjCoordSys]
  32376. * @description 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}
  32377. */
  32378. this.prjCoordSys = null;
  32379. /**
  32380. * @member {number} [QueryParameters.prototype.expectCount=100000]
  32381. * @description 期望返回结果记录个数,默认返回100000条查询记录,
  32382. * 如果实际不足100000条则返回实际记录条数。
  32383. */
  32384. this.expectCount = 100000;
  32385. /**
  32386. * @member {GeometryType} [QueryParameters.prototype.networkType=GeometryType.LINE]
  32387. * @description 网络数据集对应的查询类型,分为点和线两种类型。
  32388. */
  32389. this.networkType = REST_GeometryType.LINE;
  32390. /**
  32391. * @member {QueryOption} [QueryParameters.prototype.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY]
  32392. * @description 查询结果类型枚举类。
  32393. * 该类描述查询结果返回类型,包括只返回属性、
  32394. * 只返回几何实体以及返回属性和几何实体。
  32395. */
  32396. this.queryOption = QueryOption.ATTRIBUTEANDGEOMETRY;
  32397. /**
  32398. * @member {Array.<FilterParameter>} QueryParameters.prototype.queryParams
  32399. * @description 查询过滤条件参数数组。
  32400. * 该类用于设置查询数据集的查询过滤参数。
  32401. */
  32402. this.queryParams = null;
  32403. /**
  32404. * @member {number} [QueryParameters.prototype.startRecord=0]
  32405. * @description 查询起始记录号。
  32406. */
  32407. this.startRecord = 0;
  32408. /**
  32409. * @member {number} [QueryParameters.prototype.holdTime=10]
  32410. * @description 资源在服务端保存的时间,单位为分钟。
  32411. */
  32412. this.holdTime = 10;
  32413. /**
  32414. * @member {boolean} [QueryParameters.prototype.returnCustomResult=false]
  32415. * @description 仅供三维使用。
  32416. */
  32417. this.returnCustomResult = false;
  32418. /**
  32419. * @member {boolean} [QueryParameters.prototype.returnFeatureWithFieldCaption=false]
  32420. * @description 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  32421. */
  32422. this.returnFeatureWithFieldCaption = false;
  32423. Util_Util.extend(this, options);
  32424. this.CLASS_NAME = "SuperMap.QueryParameters";
  32425. }
  32426. /**
  32427. * @function QueryParameters.prototype.destroy
  32428. * @description 释放资源,将引用资源的属性置空。
  32429. */
  32430. destroy() {
  32431. var me = this;
  32432. me.customParams = null;
  32433. me.expectCount = null;
  32434. me.networkType = null;
  32435. me.queryOption = null;
  32436. if (me.queryParams) {
  32437. for (var i = 0, qps = me.queryParams, len = qps.length; i < len; i++) {
  32438. qps[i].destroy();
  32439. }
  32440. me.queryParams = null;
  32441. }
  32442. me.startRecord = null;
  32443. me.holdTime = null;
  32444. me.returnCustomResult = null;
  32445. me.prjCoordSys = null;
  32446. }
  32447. }
  32448. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryService.js
  32449. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32450. * This program are made available under the terms of the Apache License, Version 2.0
  32451. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32452. /**
  32453. * @class ChartQueryService
  32454. * @deprecatedclass SuperMap.ChartQueryService
  32455. * @category iServer Map Chart
  32456. * @classdesc 海图查询服务类。该类负责将海图查询所需参数(ChartQueryParameters)传递至服务端,并获取服务端的返回结果。
  32457. * 用户可以通过两种方式获取查询结果:
  32458. * 1.通过 AsyncResponder 类获取(推荐使用);
  32459. * 2.通过监听 QueryEvent.PROCESS_COMPLETE 事件获取。
  32460. * @extends {CommonServiceBase}
  32461. * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  32462. * @param {Object} options - 参数。
  32463. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  32464. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。
  32465. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32466. * @param {Object} [options.headers] - 请求头。
  32467. * @example
  32468. * 下面示例显示了如何进行海图属性查询:
  32469. * var nameArray = ["GB4X0000_52000"];
  32470. * var chartQueryFilterParameter = new ChartQueryFilterParameter({
  32471. * isQueryPoint:true,
  32472. * isQueryLine:true,
  32473. * isQueryRegion:true,
  32474. * attributeFilter:"SmID<10",
  32475. * chartFeatureInfoSpecCode:1
  32476. * });
  32477. *
  32478. * var chartQueryParameters = new ChartQueryParameters({
  32479. * queryMode:"ChartAttributeQuery",
  32480. * chartLayerNames:nameArray,
  32481. * returnContent:true,
  32482. * chartQueryFilterParameters:[chartQueryFilterParameter]
  32483. * });
  32484. *
  32485. * var chartQueryService = new ChartQueryService(url);
  32486. *
  32487. * chartQueryService.events.on({
  32488. * "processCompleted":processCompleted,
  32489. * "processFailed":processFailed
  32490. * });
  32491. * chartQueryService.processAsync(chartQueryParameters);
  32492. * @usage
  32493. */
  32494. class ChartQueryService extends CommonServiceBase {
  32495. constructor(url, options) {
  32496. super(url, options);
  32497. options = options || {};
  32498. /**
  32499. * @member {boolean} ChartQueryService.prototype.returnContent
  32500. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  32501. */
  32502. this.returnContent = null;
  32503. /**
  32504. * @member {DataFormat} ChartQueryService.prototype.format
  32505. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式
  32506. * 参数格式为"ISERVER","GEOJSON",GEOJSON
  32507. */
  32508. this.format = DataFormat.GEOJSON;
  32509. Util_Util.extend(this, options);
  32510. var me = this;
  32511. if (options.format) {
  32512. me.format = options.format.toUpperCase();
  32513. }
  32514. if (!me.url) {
  32515. return;
  32516. }
  32517. me.url = Util_Util.urlPathAppend(me.url, 'queryResults');
  32518. this.CLASS_NAME = "SuperMap.ChartQueryService";
  32519. }
  32520. /**
  32521. * @function ChartQueryService.prototype.destroy
  32522. * @override
  32523. */
  32524. destroy() {
  32525. var me = this;
  32526. CommonServiceBase.prototype.destroy.apply(this, arguments);
  32527. me.returnContent = null;
  32528. me.format = null;
  32529. }
  32530. /**
  32531. * @function ChartQueryService.prototype.processAsync
  32532. * @description 使用服务地址 URL 实例化 ChartQueryService 对象。
  32533. * @param {ChartQueryParameters} params - 查询参数。
  32534. */
  32535. processAsync(params) {
  32536. //todo重点需要添加代码的地方
  32537. if (!(params instanceof ChartQueryParameters)) {
  32538. return;
  32539. }
  32540. var me = this, jsonParameters;
  32541. me.returnContent = params.returnContent;
  32542. jsonParameters = params.getVariablesJson();
  32543. if (me.returnContent) {
  32544. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  32545. }
  32546. me.request({
  32547. method: "POST",
  32548. data: jsonParameters,
  32549. scope: me,
  32550. success: me.serviceProcessCompleted,
  32551. failure: me.serviceProcessFailed
  32552. });
  32553. }
  32554. /**
  32555. * @function ChartQueryService.prototype.serviceProcessCompleted
  32556. * @description 查询完成,执行此方法。
  32557. * @param {Object} result - 服务器返回的结果对象。
  32558. */
  32559. serviceProcessCompleted(result, options) {
  32560. var me = this;
  32561. result = Util_Util.transformResult(result);
  32562. if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
  32563. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  32564. if (recordsets[i].features) {
  32565. var geoJSONFormat = new GeoJSON();
  32566. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  32567. }
  32568. }
  32569. }
  32570. me.events.triggerEvent("processCompleted", {result: result, options});
  32571. }
  32572. /**
  32573. * @function ChartQueryService.prototype.getQueryParameters
  32574. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  32575. * @param {Object} params - JSON 字符串表示的查询参数。
  32576. * @returns {QueryParameters} 返回查询结果
  32577. */
  32578. getQueryParameters(params) {
  32579. return new QueryParameters({
  32580. queryMode: params.queryMode,
  32581. bounds: params.bounds,
  32582. chartLayerNames: params.chartLayerNames,
  32583. chartQueryFilterParameters: params.chartQueryFilterParameters,
  32584. returnContent: params.returnContent
  32585. });
  32586. }
  32587. }
  32588. ;// CONCATENATED MODULE: ./src/common/iServer/ClipParameter.js
  32589. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32590. * This program are made available under the terms of the Apache License, Version 2.0
  32591. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32592. /**
  32593. * @class ClipParameter
  32594. * @deprecatedclass SuperMap.ClipParameter
  32595. * @category iServer SpatialAnalyst InterpolationAnalyst
  32596. * @classdesc 用于裁剪的参数。优先使用用户指定的裁剪区域多边形进行裁剪,也可以通过指定数据源和数据集名,从而使用指定数据集的边界多边形进行裁剪。
  32597. * @param {Object} options - 可选参数。
  32598. * @param {string} [options.clipDatasetName] - 裁剪的数据集名。
  32599. * @param {string} [options.clipDatasourceName] - 裁剪的数据集所在数据源的名字。
  32600. * @param {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject} [options.clipRegion] - 用户指定的裁剪区域。
  32601. * @param {boolean} [options.isClipInRegion=true] - 是否对裁剪区内的数据集进行裁剪。
  32602. * @param {boolean} [options.isExactClip=true] - 是否使用精确裁剪。
  32603. * @usage
  32604. */
  32605. class ClipParameter {
  32606. constructor(options) {
  32607. /**
  32608. * @member {string} ClipParameter.prototype.clipDatasetName
  32609. * @description 用于裁剪的数据集名,clipDatasetName 与 clipRegion 必须设置一个。
  32610. */
  32611. this.clipDatasetName = null;
  32612. /**
  32613. * @member {string} ClipParameter.prototype.clipDatasourceName
  32614. * @description 用于裁剪的数据集所在数据源的名字。当 clipRegion 不设置时起作用。
  32615. */
  32616. this.clipDatasourceName = null;
  32617. /**
  32618. * @member {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject} ClipParameter.prototype.clipRegion
  32619. * @description 用户指定的裁剪区域,优先使用,clipDatasetName 与 clipRegion 必须设置一个。
  32620. */
  32621. this.clipRegion = null;
  32622. /**
  32623. * @member {boolean} [ClipParameter.prototype.isClipInRegion=true]
  32624. * @description 是否对裁剪区内的数据集进行裁剪。若为 true,则对裁剪区域内的结果进行裁剪,若为 false,则对裁剪区域外的结果进行裁剪。
  32625. */
  32626. this.isClipInRegion = true;
  32627. /**
  32628. * @member {boolean} [ClipParameter.prototype.isExactClip=true]
  32629. * @description 是否使用精确裁剪。
  32630. */
  32631. this.isExactClip = null;
  32632. if (options) {
  32633. Util_Util.extend(this, options);
  32634. }
  32635. this.CLASS_NAME = "SuperMap.ClipParameter";
  32636. }
  32637. /**
  32638. * @function ClipParameter.prototype.destroy
  32639. * @description 释放资源,将引用资源的属性置空。
  32640. */
  32641. destroy() {
  32642. var me = this;
  32643. me.clipDatasetName = null;
  32644. me.clipDatasourceName = null;
  32645. me.clipRegion = null;
  32646. me.isClipInRegion = null;
  32647. me.isExactClip = null;
  32648. }
  32649. /**
  32650. * @function ClipParameter.prototype.toJSON
  32651. * @description 将 ClipParameter 对象转化为 JSON 字符串。
  32652. * @returns {string} 返回转换后的 JSON 字符串。
  32653. */
  32654. toJSON() {
  32655. return Util_Util.toJSON({
  32656. isClipInRegion: this.isClipInRegion,
  32657. clipDatasetName: this.clipDatasetName,
  32658. clipDatasourceName: this.clipDatasourceName,
  32659. isExactClip: this.isExactClip,
  32660. clipRegion: ServerGeometry.fromGeometry(this.clipRegion)
  32661. });
  32662. }
  32663. }
  32664. ;// CONCATENATED MODULE: ./src/common/iServer/ColorDictionary.js
  32665. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32666. * This program are made available under the terms of the Apache License, Version 2.0
  32667. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32668. /**
  32669. * @class ColorDictionary
  32670. * @deprecatedclass SuperMap.ColorDictionary
  32671. * @category iServer Map Theme
  32672. * @classdesc 颜色对照表类。颜色对照表中的键名为具体的高程值,键值表示该高程值要显示的颜色。
  32673. * 对于栅格图层中高程值小于颜色对照表中高程最小值的点使用颜色对照表中高程最小值对应的颜色,
  32674. * 对于栅格图层中高程值大于颜色对照表中高程最大值的点使用颜色对照表中高程最大值对应的颜色,
  32675. * 对于栅格图层中高程值在颜色对照表中没有对应颜色的点,则查找颜色对照表中与当前高程值相邻的两个高程对应的颜色,
  32676. * 然后通过渐变运算要显示的颜色。如果设置了颜色对照表的话,则颜色表设置无效。
  32677. * @param {Object} options - 参数。
  32678. * @param {number} options.elevation - 高程值。
  32679. * @param {ServerColor} options.color - 服务端颜色类。
  32680. * @usage
  32681. */
  32682. class ColorDictionary {
  32683. constructor(options) {
  32684. options = options || {};
  32685. /**
  32686. * @member {number} ColorDictionary.prototype.elevation
  32687. * @description 高程值。
  32688. */
  32689. this.elevation = null;
  32690. /**
  32691. * @member {ServerColor} ColorDictionary.prototype.color
  32692. * @description 服务端颜色类。
  32693. */
  32694. this.color = null;
  32695. Util_Util.extend(this, options);
  32696. var me = this,
  32697. c = me.color;
  32698. if (c) {
  32699. me.color = new ServerColor(c.red, c.green, c.blue);
  32700. }
  32701. this.CLASS_NAME = "SuperMap.ColorDictionary";
  32702. }
  32703. /**
  32704. * @function ColorDictionary.prototype.destroy
  32705. * @description 释放资源,将引用资源的属性置空。
  32706. */
  32707. destroy() {
  32708. Util_Util.reset(this);
  32709. }
  32710. /**
  32711. * @function ColorDictionary.prototype.toServerJSONObject
  32712. * @description 转换成对应的 JSON 格式对象。
  32713. * @returns {Object} JSON 对象。
  32714. */
  32715. toServerJSONObject() {
  32716. var dataObj = {};
  32717. dataObj = Util_Util.copyAttributes(dataObj, this);
  32718. return dataObj;
  32719. }
  32720. }
  32721. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystResultSetting.js
  32722. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32723. * This program are made available under the terms of the Apache License, Version 2.0
  32724. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32725. /**
  32726. * @class TransportationAnalystResultSetting
  32727. * @deprecatedclass SuperMap.TransportationAnalystResultSetting
  32728. * @category iServer NetworkAnalyst
  32729. * @classdesc 交通网络分析结果参数类。通过该类设置交通网络分析返回的结果,包括是否返回图片、是否返回弧段空间信息、是否返回结点空间信息等。
  32730. * @param {Object} options - 可选参数。
  32731. * @param {boolean} [options.returnEdgeFeatures=false] - 是否在分析结果中包含弧段要素集合。
  32732. * @param {boolean} [options.returnEdgeGeometry=false] - 返回的弧段要素集合中是否包含几何对象信息。
  32733. * @param {boolean} [options.returnEdgeIDs=false] - 返回结果中是否包含经过弧段 ID 集合。
  32734. * @param {boolean} [options.returnNodeFeatures=false] - 是否在分析结果中包含结点要素集合。
  32735. * @param {boolean} [options.returnNodeGeometry=false] - 返回的结点要素集合中是否包含几何对象信息。
  32736. * @param {boolean} [options.returnNodeIDs=false] - 返回结果中是否包含经过结点 ID 集合。
  32737. * @param {boolean} [options.returnPathGuides=false] - 返回分析结果中是否包含行驶导引集合。
  32738. * @param {boolean} [options.returnRoutes=false] - 返回分析结果中是否包含路由对象的集合。
  32739. * @usage
  32740. */
  32741. class TransportationAnalystResultSetting {
  32742. constructor(options) {
  32743. if (!options) {
  32744. return;
  32745. }
  32746. /**
  32747. * @member {boolean} TransportationAnalystResultSetting.prototype.returnEdgeFeatures
  32748. * @description 是否在分析结果中包含弧段要素集合。弧段要素包括弧段的空间信息和属性信息。
  32749. */
  32750. this.returnEdgeFeatures = false;
  32751. /**
  32752. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeGeometry=false]
  32753. * @description 返回的弧段要素集合中是否包含几何对象信息。
  32754. */
  32755. this.returnEdgeGeometry = false;
  32756. /**
  32757. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeIDs=false]
  32758. * @description 返回结果中是否包含经过弧段 ID 集合。
  32759. */
  32760. this.returnEdgeIDs = false;
  32761. /**
  32762. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeFeatures=false]
  32763. * @description 是否在分析结果中包含结点要素集合。
  32764. * 结点要素包括结点的空间信息和属性信息。其中返回的结点要素是否包含空间信息可通过 returnNodeGeometry 字段设置。
  32765. */
  32766. this.returnNodeFeatures = false;
  32767. /**
  32768. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeGeometry=false]
  32769. * @description 返回的结点要素集合中是否包含几何对象信息。
  32770. */
  32771. this.returnNodeGeometry = false;
  32772. /**
  32773. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeIDs=false]
  32774. * @description 返回结果中是否包含经过结点 ID 集合。
  32775. */
  32776. this.returnNodeIDs = false;
  32777. /**
  32778. * @member {boolean} TransportationAnalystResultSetting.prototype.returnPathGuides
  32779. * @description 返回分析结果中是否包含行驶导引集合。
  32780. */
  32781. this.returnPathGuides = false;
  32782. /**
  32783. * @member {boolean} TransportationAnalystResultSetting.prototype.returnRoutes
  32784. * @description 返回分析结果中是否包含路由对象的集合。
  32785. */
  32786. this.returnRoutes = false;
  32787. Util_Util.extend(this, options);
  32788. this.CLASS_NAME = "SuperMap.TransportationAnalystResultSetting";
  32789. }
  32790. /**
  32791. * @function TransportationAnalystResultSetting.prototype.destroy
  32792. * @description 释放资源,将引用资源的属性置空。
  32793. */
  32794. destroy() {
  32795. var me = this;
  32796. me.returnEdgeFeatures = null;
  32797. me.returnEdgeGeometry = null;
  32798. me.returnEdgeIDs = null;
  32799. me.returnNodeFeatures = null;
  32800. me.returnNodeGeometry = null;
  32801. me.returnNodeIDs = null;
  32802. me.returnPathGuides = null;
  32803. me.returnRoutes = null;
  32804. }
  32805. }
  32806. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystParameter.js
  32807. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32808. * This program are made available under the terms of the Apache License, Version 2.0
  32809. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32810. /**
  32811. * @class TransportationAnalystParameter
  32812. * @deprecatedclass SuperMap.TransportationAnalystParameter
  32813. * @category iServer NetworkAnalyst
  32814. * @classdesc 交通网络分析通用参数类。该类主要用来提供交通网络分析所需的通用参数。
  32815. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息,还可以对分析结果包含的内容进行一些设置。
  32816. * @param {Object} options - 参数。
  32817. * @param {Array.<number>} options.barrierEdgeIDs - 网络分析中障碍弧段的 ID 数组。
  32818. * @param {Array.<number>} options.barrierNodeIDs - 网络分析中障碍点的 ID 数组。
  32819. * @param {string} options.turnWeightField - 转向权重字段的名称。
  32820. * @param {TransportationAnalystResultSetting} options.resultSetting - 分析结果返回内容。
  32821. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [options.barrierPoints] - 网络分析中 Point2D 类型的障碍点数组。
  32822. * @param {string} [options.weightFieldName] - 阻力字段的名称。
  32823. * @usage
  32824. */
  32825. class TransportationAnalystParameter {
  32826. constructor(options) {
  32827. if (!options) {
  32828. return;
  32829. }
  32830. /**
  32831. * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierEdgeIDs
  32832. * @description 网络分析中障碍弧段的 ID 数组。弧段设置为障碍边之后,表示双向都不通。
  32833. */
  32834. this.barrierEdgeIDs = null;
  32835. /**
  32836. * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierNodeIDs
  32837. * @description 网络分析中障碍点的 ID 数组。结点设置为障碍点之后,表示任何方向都不能通过此结点。
  32838. */
  32839. this.barrierNodeIDs = null;
  32840. /**
  32841. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} TransportationAnalystParameter.prototype.barrierPoints
  32842. * @description 网络分析中 Point2D 类型的障碍点数组。障碍点表示任何方向都不能通过此点。</br>
  32843. * 当各网络分析参数类中的 isAnalyzeById 属性设置为 false 时,该属性才生效。
  32844. */
  32845. this.barrierPoints = null;
  32846. /**
  32847. * @member {string} [TransportationAnalystParameter.prototype.weightFieldName]
  32848. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段,例如表示时间、长度等的字段都可以用作阻力字段。
  32849. * 该字段默值为服务器发布的所有耗费字段的第一个字段。
  32850. */
  32851. this.weightFieldName = null;
  32852. /**
  32853. * @member {string} TransportationAnalystParameter.prototype.turnWeightField
  32854. * @description 转向权重字段的名称。
  32855. */
  32856. this.turnWeightField = null;
  32857. /**
  32858. * @member {TransportationAnalystResultSetting} TransportationAnalystParameter.prototype.resultSetting
  32859. * @description 分析结果返回内容。
  32860. */
  32861. this.resultSetting = new TransportationAnalystResultSetting();
  32862. Util_Util.extend(this, options);
  32863. this.CLASS_NAME = "SuperMap.TransportationAnalystParameter";
  32864. }
  32865. /**
  32866. * @function TransportationAnalystParameter.prototype.destroy
  32867. * @description 释放资源,将引用资源的属性置空。
  32868. */
  32869. destroy() {
  32870. var me = this;
  32871. me.barrierEdgeIDs = null;
  32872. me.barrierNodeIDs = null;
  32873. me.weightFieldName = null;
  32874. me.turnWeightField = null;
  32875. if (me.resultSetting) {
  32876. me.resultSetting.destroy();
  32877. me.resultSetting = null;
  32878. }
  32879. if (me.barrierPoints && me.barrierPoints.length) {
  32880. for (var i in me.barrierPoints) {
  32881. me.barrierPoints[i].destroy();
  32882. }
  32883. }
  32884. me.barrierPoints = null;
  32885. }
  32886. }
  32887. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixParameters.js
  32888. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32889. * This program are made available under the terms of the Apache License, Version 2.0
  32890. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32891. /**
  32892. * @class ComputeWeightMatrixParameters
  32893. * @deprecatedclass SuperMap.ComputeWeightMatrixParameters
  32894. * @category iServer NetworkAnalyst WeightMatrix
  32895. * @classdesc 耗费矩阵分析参数类。根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  32896. * @param {Object} options - 参数。
  32897. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  32898. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.nodes - 要计算耗费矩阵的点数组。
  32899. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  32900. * @usage
  32901. */
  32902. class ComputeWeightMatrixParameters {
  32903. constructor(options) {
  32904. /**
  32905. * @member {boolean} [ComputeWeightMatrixParameters.prototype.isAnalyzeById=false]
  32906. * @description 是否通过节点 ID 指定路径分析的结点,即通过坐标点指定。
  32907. */
  32908. this.isAnalyzeById = false;
  32909. /**
  32910. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} ComputeWeightMatrixParameters.prototype.nodes
  32911. * @description 要计算耗费矩阵的点数组。
  32912. * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = false 时,nodes 应为点的坐标数组;
  32913. * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = true 时,nodes 应为点的 ID 数组。
  32914. */
  32915. this.nodes = null;
  32916. /**
  32917. * @member {TransportationAnalystParameter} ComputeWeightMatrixParameters.prototype.parameter
  32918. * @description 交通网络分析通用参数。
  32919. */
  32920. this.parameter = new TransportationAnalystParameter();
  32921. Util_Util.extend(this, options);
  32922. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixParameters";
  32923. }
  32924. /**
  32925. * @function ComputeWeightMatrixParameters.prototype.destroy
  32926. * @description 释放资源,将引用资源的属性置空。
  32927. */
  32928. destroy() {
  32929. var me = this;
  32930. me.isAnalyzeById = null;
  32931. me.nodes = null;
  32932. if (me.parameter) {
  32933. me.parameter.destroy();
  32934. me.parameter = null;
  32935. }
  32936. }
  32937. }
  32938. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixService.js
  32939. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32940. * This program are made available under the terms of the Apache License, Version 2.0
  32941. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32942. /**
  32943. * @class ComputeWeightMatrixService
  32944. * @deprecatedclass SuperMap.ComputeWeightMatrixService
  32945. * @category iServer NetworkAnalyst WeightMatrix
  32946. * @classdesc 耗费矩阵分析服务类。
  32947. * 耗费矩阵是根据交通网络分析参数中的耗费字段来计算一个二维数组,
  32948. * 用来存储指定的任意两点间的资源消耗。
  32949. * 耗费矩阵分析结果通过该类支持的事件的监听函数参数获取
  32950. * @extends {NetworkAnalystServiceBase}
  32951. * @example
  32952. * var mycomputeWeightMatrixService = new ComputeWeightMatrixService(url,{
  32953. * eventListeners: {
  32954. * "processCompleted": computeWeightMatrixCompleted,
  32955. * "processFailed": computeWeightMatrixnError
  32956. * }
  32957. * });
  32958. * @param {string} url - 耗费矩阵分析服务地址。请求服务的URL应为:
  32959. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  32960. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  32961. * @param {Object} options - 参数。
  32962. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32963. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32964. * @param {Object} [options.headers] - 请求头。
  32965. * @usage
  32966. */
  32967. class ComputeWeightMatrixService extends NetworkAnalystServiceBase {
  32968. constructor(url, options) {
  32969. super(url, options);
  32970. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixService";
  32971. }
  32972. /**
  32973. * @function ComputeWeightMatrixService.prototype.destroy
  32974. * @override
  32975. */
  32976. destroy() {
  32977. super.destroy();
  32978. }
  32979. /**
  32980. * @function ComputeWeightMatrixService.prototype.processAsync
  32981. * @description 负责将客户端的查询参数传递到服务端。
  32982. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类
  32983. */
  32984. processAsync(params) {
  32985. if (!(params instanceof ComputeWeightMatrixParameters)) {
  32986. return;
  32987. }
  32988. var me = this,
  32989. jsonObject;
  32990. me.url = Util_Util.urlPathAppend(me.url, 'weightmatrix');
  32991. jsonObject = {
  32992. parameter: Util_Util.toJSON(params.parameter),
  32993. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  32994. };
  32995. me.request({
  32996. method: "GET",
  32997. params: jsonObject,
  32998. scope: me,
  32999. success: me.serviceProcessCompleted,
  33000. failure: me.serviceProcessFailed
  33001. });
  33002. }
  33003. /**
  33004. * @function ComputeWeightMatrixService.prototype.getJson
  33005. * @description 将对象转化为JSON字符串。
  33006. * @param {boolean} isAnalyzeById - 是否通过id分析
  33007. * @param {Array.<ComputeWeightMatrixParameters>} params - 分析参数数组
  33008. * @returns {string} 转化后的JSON字符串。
  33009. */
  33010. getJson(isAnalyzeById, params) {
  33011. var jsonString = "[",
  33012. len = params ? params.length : 0;
  33013. if (isAnalyzeById === false) {
  33014. for (let i = 0; i < len; i++) {
  33015. if (i > 0) {
  33016. jsonString += ",";
  33017. }
  33018. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  33019. }
  33020. } else if (isAnalyzeById === true) {
  33021. for (let i = 0; i < len; i++) {
  33022. if (i > 0) {
  33023. jsonString += ",";
  33024. }
  33025. jsonString += params[i];
  33026. }
  33027. }
  33028. jsonString += ']';
  33029. return jsonString;
  33030. }
  33031. }
  33032. ;// CONCATENATED MODULE: ./src/common/iServer/DataFlowService.js
  33033. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33034. * This program are made available under the terms of the Apache License, Version 2.0
  33035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33036. /**
  33037. * @class DataFlowService
  33038. * @deprecatedclass SuperMap.DataFlowService
  33039. * @category iServer DataFlow
  33040. * @classdesc 数据流服务类。
  33041. * @extends {CommonServiceBase}
  33042. * @param {string} url - 数据流服务地址。
  33043. * @param {Object} options - 参数。
  33044. * @param {function} options.style - 设置数据加载样式。
  33045. * @param {function} [options.onEachFeature] - 设置每个数据加载popup等。
  33046. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  33047. * @param {Object} [options.excludeField] - 排除字段。
  33048. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33049. * @param {Object} [options.headers] - 请求头。
  33050. * @usage
  33051. */
  33052. class DataFlowService_DataFlowService extends CommonServiceBase {
  33053. constructor(url, options) {
  33054. options = options || {};
  33055. /*
  33056. * @constant EVENT_TYPES
  33057. * {Array.<string>}
  33058. * 此类支持的事件类型
  33059. */
  33060. options.EVENT_TYPES = ["broadcastSocketConnected", "broadcastSocketClosed", "broadcastSocketError", "broadcastFailed", "broadcastSucceeded", "subscribeSocketConnected", "subscribeSocketClosed", "subscribeSocketError", "messageSucceeded", "setFilterParamSucceeded"]
  33061. super(url, options);
  33062. /**
  33063. * @member {GeoJSONObject} DataFlowService.prototype.geometry
  33064. * @description 指定几何范围,该范围内的要素才能被订阅。
  33065. */
  33066. this.geometry = null;
  33067. /**
  33068. * @member {Object} DataFlowService.prototype.prjCoordSys
  33069. * @description 动态投影参数。
  33070. */
  33071. this.prjCoordSys = null;
  33072. /**
  33073. * @member {Object} DataFlowService.prototype.excludeField
  33074. * @description 排除字段。
  33075. */
  33076. this.excludeField = null;
  33077. Util_Util.extend(this, options);
  33078. this.CLASS_NAME = "SuperMap.DataFlowService";
  33079. }
  33080. /**
  33081. * @function DataFlowService.prototype.initBroadcast
  33082. * @description 初始化广播。
  33083. * @returns {DataFlowService}
  33084. */
  33085. initBroadcast() {
  33086. var me = this;
  33087. this.broadcastWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'broadcast'));
  33088. this.broadcastWebSocket.onopen = function (e) {
  33089. me.broadcastWebSocket.isOpen = true;
  33090. e.eventType = 'broadcastSocketConnected';
  33091. me.events.triggerEvent('broadcastSocketConnected', e);
  33092. };
  33093. this.broadcastWebSocket.onclose = function (e) {
  33094. if (me.broadcastWebSocket) {
  33095. me.broadcastWebSocket.isOpen = false;
  33096. }
  33097. e.eventType = 'broadcastSocketClosed';
  33098. me.events.triggerEvent('broadcastSocketClosed', e);
  33099. };
  33100. this.broadcastWebSocket.onerror = function (e) {
  33101. e.eventType = 'broadcastSocketError';
  33102. me.events.triggerEvent('broadcastSocketError', e);
  33103. };
  33104. return this;
  33105. }
  33106. /**
  33107. * @function DataFlowService.prototype.broadcast
  33108. * @description 加载广播数据。
  33109. * @param {GeoJSONObject} geoJSONFeature - JSON 格式的要素数据。
  33110. */
  33111. broadcast(geoJSONFeature) {
  33112. if (!this.broadcastWebSocket||!this.broadcastWebSocket.isOpen) {
  33113. this.events.triggerEvent('broadcastFailed');
  33114. return;
  33115. }
  33116. this.broadcastWebSocket.send(JSON.stringify(geoJSONFeature));
  33117. this.events.triggerEvent('broadcastSucceeded');
  33118. }
  33119. /**
  33120. * @function DataFlowService.prototype.initSubscribe
  33121. * @description 初始化订阅数据。
  33122. * @returns {DataFlowService} DataFlowService的实例对象。
  33123. */
  33124. initSubscribe() {
  33125. var me = this;
  33126. this.subscribeWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'subscribe'));
  33127. this.subscribeWebSocket.onopen = function (e) {
  33128. me.subscribeWebSocket.send(me._getFilterParams());
  33129. e.eventType = 'subscribeSocketConnected';
  33130. me.events.triggerEvent('subscribeSocketConnected', e);
  33131. };
  33132. this.subscribeWebSocket.onclose = function (e) {
  33133. e.eventType = 'subscribeWebSocketClosed';
  33134. me.events.triggerEvent('subscribeWebSocketClosed', e);
  33135. };
  33136. this.subscribeWebSocket.onerror = function (e) {
  33137. e.eventType = 'subscribeSocketError';
  33138. me.events.triggerEvent('subscribeSocketError', e);
  33139. };
  33140. this.subscribeWebSocket.onmessage = function (e) {
  33141. me._onMessage(e);
  33142. };
  33143. return this;
  33144. }
  33145. /**
  33146. * @function DataFlowService.prototype.setExcludeField
  33147. * @description 设置排除字段。
  33148. * @param {Object} excludeField - 排除字段。
  33149. * @returns {DataFlowService} DataFlowService的实例对象。
  33150. */
  33151. setExcludeField(excludeField) {
  33152. this.excludeField = excludeField;
  33153. this.subscribeWebSocket.send(this._getFilterParams());
  33154. return this;
  33155. }
  33156. /**
  33157. * @function DataFlowService.prototype.setGeometry
  33158. * @description 设置添加的几何要素数据。
  33159. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  33160. * @returns {DataFlowService} DataFlowService的实例对象。
  33161. */
  33162. setGeometry(geometry) {
  33163. this.geometry = geometry;
  33164. this.subscribeWebSocket.send(this._getFilterParams());
  33165. return this;
  33166. }
  33167. /**
  33168. * @function DataFlowService.prototype.unSubscribe
  33169. * @description 结束订阅数据。
  33170. */
  33171. unSubscribe() {
  33172. if (!this.subscribeWebSocket) {
  33173. return;
  33174. }
  33175. this.subscribeWebSocket.close();
  33176. this.subscribeWebSocket = null;
  33177. }
  33178. /**
  33179. * @function DataFlowService.prototype.unBroadcast
  33180. * @description 结束加载广播。
  33181. */
  33182. unBroadcast() {
  33183. if (!this.broadcastWebSocket) {
  33184. return;
  33185. }
  33186. this.broadcastWebSocket.close();
  33187. this.broadcastWebSocket = null;
  33188. }
  33189. /**
  33190. * @function DataFlowService.prototype.destroy
  33191. * @override
  33192. */
  33193. destroy() {
  33194. CommonServiceBase.prototype.destroy.apply(this, arguments);
  33195. var me = this;
  33196. me.geometry = null;
  33197. me.prjCoordSys = null;
  33198. me.excludeField = null;
  33199. this.unBroadcast();
  33200. this.unSubscribe();
  33201. }
  33202. _getFilterParams() {
  33203. var filter = {
  33204. filterParam: {
  33205. prjCoordSys: this.prjCoordSys,
  33206. excludeField: this.excludeField,
  33207. geometry: this.geometry
  33208. }
  33209. };
  33210. return Util_Util.toJSON(filter);
  33211. }
  33212. _onMessage(e) {
  33213. if (e.data && e.data.indexOf("filterParam") >= 0) {
  33214. var filterParam = JSON.parse(e.data);
  33215. e.filterParam = filterParam;
  33216. e.eventType = 'setFilterParamSucceeded';
  33217. this.events.triggerEvent('setFilterParamSucceeded', e);
  33218. return;
  33219. }
  33220. var feature = JSON.parse(e.data);
  33221. e.featureResult = feature;
  33222. e.eventType = 'messageSucceeded';
  33223. this.events.triggerEvent('messageSucceeded', e);
  33224. }
  33225. _connect(url) {
  33226. url = SecurityManager.appendCredential(url);
  33227. if ("WebSocket" in window) {
  33228. return new WebSocket(url);
  33229. } else if ("MozWebSocket" in window) {
  33230. var mozWebSocket = window.MozWebSocket;
  33231. return new mozWebSocket(url);
  33232. } else {
  33233. console.log("no WebSocket");
  33234. return null;
  33235. }
  33236. }
  33237. }
  33238. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetInfo.js
  33239. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33240. * This program are made available under the terms of the Apache License, Version 2.0
  33241. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33242. /**
  33243. * @class DatasetInfo
  33244. * @deprecatedclass SuperMap.DatasetInfo
  33245. * @category iServer Data Dataset
  33246. * @classdesc 数据集信息类。
  33247. * 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集、栅格数据集(griddataset)和
  33248. * 影像数据集(image dataset),以及为了处理特定问题而设计的数据集,如拓扑数据集,网络数据集等。
  33249. * 数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,
  33250. * 所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,
  33251. * 线数据集,面数据集等,各矢量数据集是空间特征和性质相同的数据组织起来的集合。
  33252. * 目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、
  33253. * 网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  33254. * @param {Object} options - 参数。
  33255. * @param {Bounds} [options.bounds] - 数据集范围。
  33256. * @param {string} [options.dataSourceName] - 数据源名称。
  33257. * @param {string} [options.description] - 数据集的描述信息。
  33258. * @param {string} [options.encodeType] - 数据集存储时的压缩编码方式。
  33259. * @param {boolean} [options.isReadOnly] - 数据集是否为只读。
  33260. * @param {string} options.name - 数据集名称。
  33261. * @param {Object} [options.prjCoordSys] - 数据集的投影信息。如:prjCoordSys={"epsgCode":3857}。
  33262. * @param {string} [options.tableName] - 表名。
  33263. * @param {string} options.type - 数据集类型。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  33264. * @usage
  33265. */
  33266. class DatasetInfo {
  33267. constructor(options) {
  33268. options = options || {};
  33269. /**
  33270. * @member {Bounds} [DatasetInfo.prototype.bounds]
  33271. * @description 数据集范围,该字段只读。
  33272. */
  33273. this.bounds = null;
  33274. /**
  33275. * @member {string} [DatasetInfo.prototype.dataSourceName]
  33276. * @description 数据源名称,该字段只读。
  33277. */
  33278. this.dataSourceName = null;
  33279. /**
  33280. * @member {string} [DatasetInfo.prototype.description]
  33281. * @description 数据集的描述信息。
  33282. */
  33283. this.description = null;
  33284. /**
  33285. * @member {string} [DatasetInfo.prototype.encodeType]
  33286. * @description 数据集存储时的压缩编码方式,该字段只读。
  33287. */
  33288. this.encodeType = null;
  33289. /**
  33290. * @member {boolean} [DatasetInfo.prototype.isReadOnly]
  33291. * @description 数据集是否为只读。
  33292. */
  33293. this.isReadOnly = null;
  33294. /**
  33295. * @member {string} DatasetInfo.prototype.name
  33296. * @description 数据集名称,该字段必须且只读。
  33297. */
  33298. this.name = null;
  33299. /**
  33300. * @member {Object} [DatasetInfo.prototype.prjCoordSys]
  33301. * @description 数据集的投影信息。
  33302. */
  33303. this.prjCoordSys = null;
  33304. /**
  33305. * @member {string} [DatasetInfo.prototype.tableName]
  33306. * @description 表名,该字段只读。
  33307. */
  33308. this.tableName = null;
  33309. /**
  33310. * @member {string} DatasetInfo.prototype.type
  33311. * @description 数据集类型,该字段必设。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  33312. */
  33313. this.type = null;
  33314. Util_Util.extend(this, options);
  33315. var b = this.bounds;
  33316. if (b) {
  33317. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  33318. }
  33319. this.CLASS_NAME = "SuperMap.DatasetInfo";
  33320. }
  33321. /**
  33322. * @function DatasetInfo.prototype.destroy
  33323. * @description 释放资源,将引用资源的属性置空。
  33324. */
  33325. destroy() {
  33326. Util_Util.reset(this);
  33327. }
  33328. /**
  33329. * @function DatasetInfo.prototype.toServerJSONObject
  33330. * @description 转换成对应的 JSON 格式对象。
  33331. * @returns {Object} JSON 对象。
  33332. */
  33333. toServerJSONObject() {
  33334. var dataObj = {};
  33335. dataObj = Util_Util.copyAttributes(dataObj, this);
  33336. if (dataObj.bounds) {
  33337. if (dataObj.bounds.toServerJSONObject) {
  33338. dataObj.bounds = dataObj.bounds.toServerJSONObject();
  33339. }
  33340. }
  33341. return dataObj;
  33342. }
  33343. }
  33344. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystParameters.js
  33345. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33346. * This program are made available under the terms of the Apache License, Version 2.0
  33347. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33348. /**
  33349. * @class OverlayAnalystParameters
  33350. * @deprecatedclass SuperMap.OverlayAnalystParameters
  33351. * @category iServer SpatialAnalyst OverlayAnalyst
  33352. * @classdesc 叠加分析参数基类。数据集叠加分析参数和几何对象叠加分析参数均继承此基类。
  33353. * @param {Object} options - 参数。
  33354. * @usage
  33355. */
  33356. class OverlayAnalystParameters {
  33357. constructor(options) {
  33358. /**
  33359. * @member {OverlayOperationType} [OverlayAnalystParameters.prototype.operation=OverlayOperationType.UNION]
  33360. * @description 指定叠加分析操作类型。
  33361. */
  33362. this.operation = OverlayOperationType.UNION;
  33363. if (options) {
  33364. Util_Util.extend(this, options);
  33365. }
  33366. this.CLASS_NAME = "SuperMap.OverlayAnalystParameters";
  33367. }
  33368. /**
  33369. * @function OverlayAnalystParameters.prototype.destroy
  33370. * @description 释放资源,将引用资源的属性置空。
  33371. */
  33372. destroy() {
  33373. var me = this;
  33374. me.operation = null;
  33375. }
  33376. }
  33377. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetOverlayAnalystParameters.js
  33378. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33379. * This program are made available under the terms of the Apache License, Version 2.0
  33380. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33381. /**
  33382. * @class DatasetOverlayAnalystParameters
  33383. * @deprecatedclass SuperMap.DatasetOverlayAnalystParameters
  33384. * @category iServer SpatialAnalyst OverlayAnalyst
  33385. * @classdesc 数据集叠加分析参数类。
  33386. * @param {Object} options - 参数。
  33387. * @param {string} options.operateDataset -数据集名称。
  33388. * @param {string} options.sourceDataset - 源数据集名称。
  33389. * @param {Array.<string>} [options.operateDatasetFields] - 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  33390. * @param {FilterParameter} [options.operateDatasetFilter] - 设置操作数据集中空间对象过滤条件。
  33391. * @param {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [options.operateRegions] - 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  33392. * @param {Array.<string>} [options.sourceDatasetFields] - 叠加分析中源数据集保留在结果数据集中的字段名列表。
  33393. * @param {FilterParameter} [options.sourceDatasetFilter] - 设置源数据集中空间对象过滤条件。
  33394. * @param {number} [options.tolerance=0] - 容限。
  33395. * @param {OverlayOperationType} options.operation - 叠加操作枚举值。
  33396. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  33397. * @extends {GetFeaturesParametersBase}
  33398. * @usage
  33399. */
  33400. class DatasetOverlayAnalystParameters extends OverlayAnalystParameters {
  33401. constructor(options) {
  33402. super(options);
  33403. /**
  33404. * @member {string} DatasetOverlayAnalystParameters.prototype.operateDataset
  33405. * @description 叠加分析中操作数据集的名称。
  33406. */
  33407. this.operateDataset = null;
  33408. /**
  33409. * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.operateDatasetFields]
  33410. * @description 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  33411. */
  33412. this.operateDatasetFields = [];
  33413. /**
  33414. * @member {FilterParameter} DatasetOverlayAnalystParameters.prototype.operateDatasetFilter
  33415. * @description 设置操作数据集中空间对象过滤条件。
  33416. */
  33417. this.operateDatasetFilter = new FilterParameter();
  33418. /**
  33419. * @member {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [DatasetOverlayAnalystParameters.prototype.operateRegions]
  33420. * @description 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  33421. */
  33422. this.operateRegions = [];
  33423. /**
  33424. * @member {string} DatasetOverlayAnalystParameters.prototype.sourceDataset
  33425. * @description 叠加分析中源数据集的名称。
  33426. */
  33427. this.sourceDataset = null;
  33428. /**
  33429. * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.sourceDatasetFields]
  33430. * @description 叠加分析中源数据集保留在结果数据集中的字段名列表。
  33431. */
  33432. this.sourceDatasetFields = [];
  33433. /**
  33434. * @member {FilterParameter} [DatasetOverlayAnalystParameters.prototype.filterQueryParameter]
  33435. * @description 设置源数据集中空间对象过滤条件。
  33436. */
  33437. this.sourceDatasetFilter = new FilterParameter();
  33438. /**
  33439. * @member {number} [DatasetOverlayAnalystParameters.prototype.tolerance=0]
  33440. * @description 容限。
  33441. */
  33442. this.tolerance = 0;
  33443. /**
  33444. * @member {DataReturnOption} [DatasetOverlayAnalystParameters.prototype.resultSetting]
  33445. * @description 结果返回设置类。
  33446. */
  33447. this.resultSetting = new DataReturnOption();
  33448. Util_Util.extend(this, options);
  33449. this.CLASS_NAME = "SuperMap.DatasetOverlayAnalystParameters";
  33450. }
  33451. /**
  33452. * @function DatasetOverlayAnalystParameters.prototype.destroy
  33453. * @override
  33454. */
  33455. destroy() {
  33456. super.destroy();
  33457. var me = this;
  33458. me.operateDataset = null;
  33459. me.operateDatasetFields = null;
  33460. if (me.operateDatasetFilter) {
  33461. me.operateDatasetFilter.destroy();
  33462. me.operateDatasetFilter = null;
  33463. }
  33464. if (me.operateRegions) {
  33465. for (var i = 0, opRegions = me.operateRegions, len = opRegions.length; i < len; i++) {
  33466. opRegions[i].destroy();
  33467. }
  33468. me.operateRegions = null;
  33469. }
  33470. me.sourceDataset = null;
  33471. me.sourceDatasetFields = null;
  33472. if (me.sourceDatasetFilter) {
  33473. me.sourceDatasetFilter.destroy();
  33474. me.sourceDatasetFilter = null;
  33475. }
  33476. me.tolerance = null;
  33477. if (me.resultSetting) {
  33478. me.resultSetting.destroy();
  33479. me.resultSetting = null;
  33480. }
  33481. }
  33482. /**
  33483. * @function DatasetOverlayAnalystParameters.toObject
  33484. * @param {DatasetOverlayAnalystParameters} datasetOverlayAnalystParameters - 数据集叠加分析参数类。
  33485. * @param {DatasetOverlayAnalystParameters} tempObj - 数据集叠加分析参数对象。
  33486. * @description 将数据集叠加分析参数类转换为 JSON 对象。
  33487. * @returns {Object} JSON 对象。
  33488. */
  33489. static toObject(datasetOverlayAnalystParameters, tempObj) {
  33490. for (var name in datasetOverlayAnalystParameters) {
  33491. if (name === "sourceDataset") {
  33492. continue;
  33493. } else if (name === "operateRegions") {
  33494. tempObj.operateRegions = [];
  33495. var ors = datasetOverlayAnalystParameters.operateRegions;
  33496. for (var index in ors) {
  33497. if (ors.hasOwnProperty(index)) { //icl542
  33498. tempObj.operateRegions[index] = ServerGeometry.fromGeometry(ors[index]);
  33499. }
  33500. }
  33501. } else if (name === "resultSetting") {
  33502. tempObj.dataReturnOption = datasetOverlayAnalystParameters.resultSetting;
  33503. } else {
  33504. tempObj[name] = datasetOverlayAnalystParameters[name];
  33505. }
  33506. }
  33507. }
  33508. }
  33509. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParametersSetting.js
  33510. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33511. * This program are made available under the terms of the Apache License, Version 2.0
  33512. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33513. /**
  33514. * @class SurfaceAnalystParametersSetting
  33515. * @deprecatedclass SuperMap.SurfaceAnalystParametersSetting
  33516. * @category iServer SpatialAnalyst SurfaceAnalyst
  33517. * @classdesc 表面分析参数设置类。
  33518. * 通过该类可以设置表面分析提取等值线、提取等值面的一些参数,包括基准值、等值距、光滑度、光滑方法等。
  33519. * @param {Object} options - 参数。
  33520. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  33521. * @param {number} [options.datumValue=0] - 提取等值线、提取等值面的基准值。
  33522. * @param {Array.<number>} options.expectedZValues - 期望分析结果的 Z 值集合。
  33523. * @param {number} [options.interval=0] - 等值距。等值距是两条等值线之间的间隔值。
  33524. * @param {number} [options.resampleTolerance=0] - 重采样容限。
  33525. * @param {SmoothMethod} [options.smoothMethod=SmoothMethod.BSPLINE] - 光滑处理所使用的方法。
  33526. * @param {number} [options.smoothness=0] - 等值线或等值面的边界线的光滑度。
  33527. * @usage
  33528. */
  33529. class SurfaceAnalystParametersSetting {
  33530. constructor(options) {
  33531. /**
  33532. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [SurfaceAnalystParametersSetting.prototype.clipRegion]
  33533. * @description 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  33534. */
  33535. this.clipRegion = null;
  33536. /**
  33537. * @member {number} [SurfaceAnalystParametersSetting.prototype.datumValue=0]
  33538. * @description 获取或设置表面分析中提取等值线、提取等值面的基准值。
  33539. * 基准值是作为一个生成等值线的初始起算值,并不一定是最小等值线的值。例如,高程范围为 220 -1550 的 DEM 栅格数据,
  33540. * 如果设基准值为 0,等值距为 50,则提取等值线时,以基准值 0 为起点,等值距 50 为间隔提取等值线,
  33541. * 因为给定高程的最小值是 220,所以,在给定范围内提取等值线的最小高程是 250。
  33542. * 提取等值线的结果是:最小等值线值为 250,最大等值线值为 1550。
  33543. */
  33544. this.datumValue = 0;
  33545. /**
  33546. * @member {Array.<number>} SurfaceAnalystParametersSetting.prototype.expectedZValues
  33547. * @description 获取或设置期望分析结果的 Z 值集合。
  33548. * Z 值集合存储一系列数值,该数值为待提取等值线的值。即仅高程值在 Z 值集合中的等值线会被提取。
  33549. */
  33550. this.expectedZValues = null;
  33551. /**
  33552. * @member {number} [SurfaceAnalystParametersSetting.prototype.interval=0]
  33553. * @description 获取或设置等值距。等值距是两条等值线之间的间隔值。
  33554. */
  33555. this.interval = 0;
  33556. /**
  33557. * @member {number} [SurfaceAnalystParametersSetting.prototype.resampleTolerance=0]
  33558. * @description 获取或设置重采样容限。
  33559. * 容限值越大,采样结果数据越简化。当分析结果出现交叉时,可通过调整重采样容限为较小的值来处理。
  33560. */
  33561. this.resampleTolerance = 0;
  33562. /**
  33563. * @member {SmoothMethod} [SurfaceAnalystParametersSetting.prototype.smoothMethod=SmoothMethod.BSPLINE]
  33564. * @description 获取或设置光滑处理所使用的方法。
  33565. */
  33566. this.smoothMethod = SmoothMethod.BSPLINE;
  33567. /**
  33568. * @member {number} [SurfaceAnalystParametersSetting.prototype.smoothness=0]
  33569. * @description 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  33570. * 以为 0-5 为例,光滑度为 0 表示不进行光滑操作,值越大表示光滑度越高。
  33571. * 随着光滑度的增加,提取的等值线越光滑,当然光滑度越大,
  33572. * 计算所需的时间和占用的内存也就越大。而且,当等值距较小时,
  33573. * 光滑度太高会出现等值线相交的问题。
  33574. */
  33575. this.smoothness = 0;
  33576. if (options) {
  33577. Util_Util.extend(this, options);
  33578. }
  33579. this.CLASS_NAME = "SuperMap.SurfaceAnalystParametersSetting";
  33580. }
  33581. /**
  33582. * @function SurfaceAnalystParametersSetting.prototype.destroy
  33583. * @description 释放资源,将引用资源的属性置空。
  33584. */
  33585. destroy() {
  33586. var me = this;
  33587. if (me.clipRegion) {
  33588. me.clipRegion.destroy();
  33589. me.clipRegion = null;
  33590. }
  33591. me.datumValue = null;
  33592. me.expectedZValues = null;
  33593. me.interval = null;
  33594. me.resampleTolerance = null;
  33595. me.smoothMethod = null;
  33596. me.smoothness = null;
  33597. }
  33598. /**
  33599. * @function SurfaceAnalystParametersSetting.prototype.toJSON
  33600. * @description 将对象转化为 JSON 字符串。
  33601. * @returns {string} 对象 JSON 字符串。
  33602. */
  33603. toJSON() {
  33604. let json = "'datumValue':" + Util_Util.toJSON(this.datumValue);
  33605. json += ",'interval':" + Util_Util.toJSON(this.interval);
  33606. json += ",'resampleTolerance':" + Util_Util.toJSON(this.resampleTolerance);
  33607. json += ",'smoothMethod':" + Util_Util.toJSON(this.smoothMethod);
  33608. json += ",'smoothness':" + Util_Util.toJSON(this.smoothness);
  33609. if (this.expectedZValues != null) {
  33610. json += "," + "'expectedZValues':" + Util_Util.toJSON(this.expectedZValues);
  33611. }
  33612. if (this.clipRegion != null) {
  33613. var serverGeometry = this.clipRegion;
  33614. if (this.clipRegion instanceof Geometry_Geometry && this.clipRegion.components) {
  33615. serverGeometry = ServerGeometry.fromGeometry(this.clipRegion)
  33616. }
  33617. json += ",'clipRegion':" + Util_Util.toJSON(serverGeometry);
  33618. }
  33619. return "{" + json + "}";
  33620. }
  33621. }
  33622. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParameters.js
  33623. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33624. * This program are made available under the terms of the Apache License, Version 2.0
  33625. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33626. /**
  33627. * @class SurfaceAnalystParameters
  33628. * @deprecatedclass SuperMap.SurfaceAnalystParameters
  33629. * @category iServer SpatialAnalyst SurfaceAnalyst
  33630. * @classdesc 表面分析提取操作参数类。通过该类可以为进行表面分析提供参数信息,包括表面分析的方法提取等值线、提取等值面和中间结果的分辨率,
  33631. * {@link DatasetSurfaceAnalystParameters} 和 {@link GeometrySurfaceAnalystParameters} 继承自该类。
  33632. * @param {Object} options - 参数。
  33633. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。
  33634. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  33635. * @param {DataReturnOption} options.resultSetting - 结果返回设置类。
  33636. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  33637. * @usage
  33638. */
  33639. class SurfaceAnalystParameters {
  33640. constructor(options) {
  33641. /**
  33642. * @member {number} SurfaceAnalystParameters.prototype.resolution
  33643. * @description 获取或设置指定中间结果(栅格数据集)的分辨率。
  33644. */
  33645. this.resolution = 0;
  33646. /**
  33647. * @member {SurfaceAnalystParametersSetting} SurfaceAnalystParameters.prototype.extractParameter
  33648. * @description 获取或设置表面分析参数。
  33649. * 在进行点数据集进行提取等值面分析时,暂时不支持 SurfaceAnalystParametersSetting 类中的 expectedZValues 字段。
  33650. */
  33651. this.extractParameter = new SurfaceAnalystParametersSetting();
  33652. /**
  33653. * @member {DataReturnOption} SurfaceAnalystParameters.prototype.resultSetting
  33654. * @description 结果返回设置类。
  33655. */
  33656. this.resultSetting = new DataReturnOption();
  33657. /**
  33658. * @member {SurfaceAnalystMethod} [SurfaceAnalystParameters.prototype.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE]
  33659. * @description 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  33660. */
  33661. this.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE;
  33662. if (options) {
  33663. Util_Util.extend(this, options);
  33664. }
  33665. this.CLASS_NAME = "SuperMap.SurfaceAnalystParameters";
  33666. }
  33667. /**
  33668. * @function SurfaceAnalystParameters.prototype.destroy
  33669. * @description 释放资源,将引用资源的属性置空。
  33670. */
  33671. destroy() {
  33672. var me = this;
  33673. me.resolution = null;
  33674. if (me.extractParameter) {
  33675. me.extractParameter.destroy();
  33676. me.extractParameter = null;
  33677. }
  33678. if (me.resultSetting) {
  33679. me.resultSetting.destroy();
  33680. me.resultSetting = null;
  33681. }
  33682. me.surfaceAnalystMethod = null;
  33683. }
  33684. }
  33685. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetSurfaceAnalystParameters.js
  33686. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33687. * This program are made available under the terms of the Apache License, Version 2.0
  33688. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33689. /**
  33690. * @class DatasetSurfaceAnalystParameters
  33691. * @deprecatedclass SuperMap.DatasetSurfaceAnalystParameters
  33692. * @category iServer SpatialAnalyst SurfaceAnalyst
  33693. * @classdesc 数据集表面分析参数类。该类对数据集表面分析所用到的参数进行设置。
  33694. * @param {Object} options - 参数。
  33695. * @param {string} options.dataset - 数据集名称。
  33696. * @param {string} options.zValueFieldName - 字段名称。
  33697. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  33698. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。获取或设置表面分析参数。
  33699. * @param {FilterParameter} [options.filterQueryParameter] - 查询过滤条件参数。
  33700. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  33701. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 表面分析的提取方法,提取等值线和提取等值面。
  33702. * @extends {SurfaceAnalystParameters}
  33703. * @usage
  33704. */
  33705. class DatasetSurfaceAnalystParameters extends SurfaceAnalystParameters {
  33706. constructor(options) {
  33707. super(options);
  33708. /**
  33709. * @member {string} DatasetSurfaceAnalystParameters.prototype.dataset
  33710. * @description 要用来做数据集表面分析的数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Country@World。
  33711. */
  33712. this.dataset = null;
  33713. /**
  33714. * @member {FilterParameter} DatasetSurfaceAnalystParameters.prototype.filterQueryParameter
  33715. * @description 获取或设置查询过滤条件参数。
  33716. */
  33717. this.filterQueryParameter = new FilterParameter();
  33718. /**
  33719. * @member {string} DatasetSurfaceAnalystParameters.prototype.zValueFieldName
  33720. * @description 获取或设置用于提取操作的字段名称。提取等值线时,将使用该字段中的值,对点记录集中的点数据进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  33721. */
  33722. this.zValueFieldName = null;
  33723. if (options) {
  33724. Util_Util.extend(this, options);
  33725. }
  33726. this.CLASS_NAME = "SuperMap.DatasetSurfaceAnalystParameters";
  33727. }
  33728. /**
  33729. * @function DatasetSurfaceAnalystParameters.prototype.destroy
  33730. * @override
  33731. */
  33732. destroy() {
  33733. super.destroy();
  33734. var me = this;
  33735. me.dataset = null;
  33736. if (me.filterQueryParameter) {
  33737. me.filterQueryParameter.destroy();
  33738. me.filterQueryParameter = null;
  33739. }
  33740. me.zValueFieldName = null;
  33741. }
  33742. /**
  33743. * @function DatasetSurfaceAnalystParameters.toObject
  33744. * @param {DatasetSurfaceAnalystParameters} datasetSurfaceAnalystParameters - 数据集表面分析参数类。
  33745. * @param {DatasetSurfaceAnalystParameters} tempObj - 数据集表面分析参数对象。
  33746. * @description 将数据集表面分析参数对象转换为 JSON 对象。
  33747. * @returns JSON 对象。
  33748. */
  33749. static toObject(datasetSurfaceAnalystParameters, tempObj) {
  33750. for (var name in datasetSurfaceAnalystParameters) {
  33751. if (name === "filterQueryParameter") {
  33752. tempObj.filterQueryParameter = datasetSurfaceAnalystParameters.filterQueryParameter;
  33753. }
  33754. if (name === "extractParameter") {
  33755. if (datasetSurfaceAnalystParameters.extractParameter.clipRegion instanceof Geometry_Geometry && datasetSurfaceAnalystParameters.extractParameter.clipRegion.components) {
  33756. datasetSurfaceAnalystParameters.extractParameter.clipRegion = ServerGeometry.fromGeometry(datasetSurfaceAnalystParameters.extractParameter.clipRegion);
  33757. }
  33758. tempObj.extractParameter = datasetSurfaceAnalystParameters.extractParameter;
  33759. } else if (name === "dataset") {
  33760. continue;
  33761. } else if (name === "surfaceAnalystMethod") {
  33762. continue;
  33763. } else {
  33764. tempObj[name] = datasetSurfaceAnalystParameters[name];
  33765. }
  33766. }
  33767. }
  33768. }
  33769. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystParameters.js
  33770. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33771. * This program are made available under the terms of the Apache License, Version 2.0
  33772. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33773. /**
  33774. * @class ThiessenAnalystParameters
  33775. * @deprecatedclass SuperMap.ThiessenAnalystParameters
  33776. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  33777. * @classdesc 泰森多边形分析参数基类。
  33778. * @param {Object} options - 可选参数。
  33779. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  33780. * @param {boolean} [options.createResultDataset=false] - 是否返回结果数据集。
  33781. * @param {string} [options.resultDatasetName] - 指定结果数据集名称。
  33782. * @param {string} [options.resultDatasourceName] - 指定结果数据集所在数据源,默认为当前数据源。
  33783. * @param {boolean} [options.returnResultRegion=true] - 是否返回分析得到的多边形面数组。
  33784. * @usage
  33785. */
  33786. class ThiessenAnalystParameters {
  33787. constructor(options) {
  33788. if (!options) {
  33789. return;
  33790. }
  33791. /**
  33792. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [ThiessenAnalystParameters.prototype.clipRegion]
  33793. * @description 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  33794. */
  33795. this.clipRegion = null;
  33796. /**
  33797. * @member {boolean} [ThiessenAnalystParameters.prototype.createResultDataset=false]
  33798. * @description 是否返回结果数据集。如果为 true,则必须设置属性 resultDatasetName 和 resultDatasourceName。
  33799. */
  33800. this.createResultDataset = false;
  33801. /**
  33802. * @member {string} ThiessenAnalystParameters.prototype.resultDatasetName
  33803. * @description 指定结果数据集名称。
  33804. */
  33805. this.resultDatasetName = null;
  33806. /**
  33807. * @member {string} ThiessenAnalystParameters.prototype.resultDatasourceName
  33808. * @description 指定结果数据集所在数据源。
  33809. */
  33810. this.resultDatasourceName = null;
  33811. /**
  33812. * @member {boolean} ThiessenAnalystParameters.prototype.returnResultRegion
  33813. * @description 是否返回分析得到的多边形面数组。
  33814. */
  33815. this.returnResultRegion = true;
  33816. Util_Util.extend(this, options);
  33817. this.CLASS_NAME = "SuperMap.ThiessenAnalystParameters";
  33818. }
  33819. /**
  33820. * @function ThiessenAnalystParameters.prototype.destroy
  33821. * @description 释放资源,将引用资源的属性置空。
  33822. */
  33823. destroy() {
  33824. var me = this;
  33825. if (me.clipRegion) {
  33826. me.clipRegion.destroy();
  33827. me.clipRegion = null;
  33828. }
  33829. me.createResultDataset = null;
  33830. me.resultDatasetName = null;
  33831. me.resultDatasourceName = null;
  33832. me.returnResultRegion = null;
  33833. }
  33834. }
  33835. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetThiessenAnalystParameters.js
  33836. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33837. * This program are made available under the terms of the Apache License, Version 2.0
  33838. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33839. /**
  33840. * @class DatasetThiessenAnalystParameters
  33841. * @deprecatedclass SuperMap.DatasetThiessenAnalystParameters
  33842. * @category iServer SpatialAnalyst ThiessenAnalyst
  33843. * @classdesc 数据集泰森多边形分析参数类。
  33844. * @param {Object} options - 参数。
  33845. * @param {FilterParameter} [options.filterQueryParameter] - 过滤参数类,即对数据集中的所有点进行分析。
  33846. * @extends {ThiessenAnalystParameters}
  33847. * @usage
  33848. */
  33849. class DatasetThiessenAnalystParameters extends ThiessenAnalystParameters {
  33850. constructor(options) {
  33851. super(options);
  33852. /**
  33853. * @member {FilterParameter} [DatasetThiessenAnalystParameters.prototype.filterQueryParameter]
  33854. * @description 过滤条件,对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  33855. * @example
  33856. * var filterQueryParameter = new FilterParameter({
  33857. * name: "Countries@World",
  33858. * attributeFilter: "SmID>100"
  33859. * });
  33860. */
  33861. this.filterQueryParameter = null;
  33862. /**
  33863. * @member {string} DatasetThiessenAnalystParameters.prototype.dataset
  33864. * @description 数据集名称待分析的数据集名称,请使用 "datasetName@datasourceName" 格式来表示。
  33865. */
  33866. this.dataset = null;
  33867. if (options) {
  33868. Util_Util.extend(this, options);
  33869. }
  33870. this.CLASS_NAME = "SuperMap.DatasetThiessenAnalystParameters";
  33871. }
  33872. /**
  33873. * @function DatasetThiessenAnalystParameters.prototype.destroy
  33874. * @override
  33875. */
  33876. destroy() {
  33877. super.destroy();
  33878. var me = this;
  33879. if (me.filterQueryParameter) {
  33880. me.filterQueryParameter.destroy();
  33881. me.filterQueryParameter = null;
  33882. }
  33883. }
  33884. /**
  33885. * @function DatasetThiessenAnalystParameters.toObject
  33886. * @param {DatasetThiessenAnalystParameters} datasetThiessenAnalystParameters - 泰森多边形分析服务参数类。
  33887. * @param {DatasetThiessenAnalystParameters} tempObj - 泰森多边形分析服务参数对象。
  33888. * @description 将泰森多边形分析服务参数对象转换为 JSON 对象。
  33889. * @returns JSON 对象。
  33890. */
  33891. static toObject(datasetThiessenAnalystParameters, tempObj) {
  33892. for (var name in datasetThiessenAnalystParameters) {
  33893. if (name === "clipRegion") {
  33894. tempObj.clipRegion = ServerGeometry.fromGeometry(datasetThiessenAnalystParameters.clipRegion);
  33895. } else {
  33896. tempObj[name] = datasetThiessenAnalystParameters[name];
  33897. }
  33898. }
  33899. }
  33900. }
  33901. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceService.js
  33902. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33903. * This program are made available under the terms of the Apache License, Version 2.0
  33904. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33905. /**
  33906. * @class DatasourceService
  33907. * @deprecatedclass SuperMap.DatasourceService
  33908. * @category iServer Data Datasource
  33909. * @classdesc 数据源查询服务类。
  33910. * @param {string} url - 服务地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  33911. * @param {Object} options - 参数。
  33912. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  33913. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  33914. * @param {string} options.datasource - 要查询的数据集所在的数据源名称。
  33915. * @param {string} options.dataset - 要查询的数据集名称。
  33916. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33917. * @param {Object} [options.headers] - 请求头。
  33918. * @extends {CommonServiceBase}
  33919. * @usage
  33920. */
  33921. class DatasourceService_DatasourceService extends CommonServiceBase {
  33922. constructor(url, options) {
  33923. super(url, options);
  33924. if (options) {
  33925. Util_Util.extend(this, options);
  33926. }
  33927. this.eventCount = 0;
  33928. this.CLASS_NAME = "SuperMap.DatasourceService";
  33929. }
  33930. /**
  33931. * @function DatasourceService.prototype.destroy
  33932. * @override
  33933. */
  33934. destroy() {
  33935. this.eventCount = 0;
  33936. super.destroy();
  33937. }
  33938. /**
  33939. * @function DatasourceService.prototype.getDatasourceService
  33940. * @description 获取指定数据源信息。
  33941. */
  33942. getDatasourceService(datasourceName, callback) {
  33943. let url = Util_Util.urlPathAppend(this.url,`datasources/name/${datasourceName}`);
  33944. this.processAsync(url, "GET", callback);
  33945. }
  33946. /**
  33947. * @function DatasourceService.prototype.getDatasourcesService
  33948. * @description 获取所有数据源信息。
  33949. */
  33950. getDatasourcesService(callback) {
  33951. let url = Util_Util.urlPathAppend(this.url,`datasources`);
  33952. this.processAsync(url, "GET", callback);
  33953. }
  33954. /**
  33955. * @function DatasourceService.prototype.setDatasourceService
  33956. * @description 更新数据源信息。
  33957. */
  33958. setDatasourceService(params, callback) {
  33959. if (!params) {
  33960. return;
  33961. }
  33962. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${params.datasourceName}`);
  33963. this.processAsync(url, "PUT", callback, params);
  33964. }
  33965. processAsync(url, method, callback, params) {
  33966. let eventId = ++this.eventCount;
  33967. let eventListeners = {
  33968. scope: this,
  33969. processCompleted: function(result) {
  33970. if (eventId === result.result.eventId && callback) {
  33971. delete result.result.eventId;
  33972. callback(result);
  33973. this.events && this.events.un(eventListeners);
  33974. return false;
  33975. }
  33976. },
  33977. processFailed: function(result) {
  33978. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  33979. callback(result);
  33980. this.events && this.events.un(eventListeners);
  33981. return false;
  33982. }
  33983. }
  33984. }
  33985. this.events.on(eventListeners);
  33986. var me = this;
  33987. let requestConfig = {
  33988. url,
  33989. method,
  33990. scope: me,
  33991. success(result, options) {
  33992. result.eventId = eventId;
  33993. this.serviceProcessCompleted(result, options);
  33994. },
  33995. failure(result, options) {
  33996. if (result.error) {
  33997. result.error.eventId = eventId;
  33998. }
  33999. result.eventId = eventId;
  34000. this.serviceProcessFailed(result, options);
  34001. }
  34002. }
  34003. params && (requestConfig.data = Util_Util.toJSON(params));
  34004. me.request(requestConfig);
  34005. }
  34006. }
  34007. ;// CONCATENATED MODULE: ./src/common/iServer/DensityKernelAnalystParameters.js
  34008. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34009. * This program are made available under the terms of the Apache License, Version 2.0
  34010. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34011. /**
  34012. * @class DensityKernelAnalystParameters
  34013. * @deprecatedclass SuperMap.DensityKernelAnalystParameters
  34014. * @category iServer SpatialAnalyst DensityAnalyst
  34015. * @classdesc 核密度分析参数类。
  34016. * @param {Object} options - 参数。
  34017. * @param {string} options.dataset - 要用来做核密度分析数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:BaseMap_P@Jingjin。
  34018. * @param {string} options.fieldName - 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  34019. * @param {string} options.resultGridName - 指定结果数据集名称。
  34020. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 核密度分析的范围,用于确定结果栅格数据集的范围。如果缺省,则默认为原数据集的范围。
  34021. * @param {number} [options.searchRadius] - 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  34022. * @param {number} [options.resultGridDatasetResolution] - 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  34023. * @param {string} [options.targetDatasource] - 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  34024. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  34025. * @usage
  34026. */
  34027. class DensityKernelAnalystParameters {
  34028. constructor(options) {
  34029. /**
  34030. * @member {string} DensityKernelAnalystParameters.prototype.dataset
  34031. * @description 要用来做核密度分析数据源中数据集的名称。
  34032. * 该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Railway@Changchun。
  34033. * 注:核密度分析支持点数据集和线数据集。
  34034. */
  34035. this.dataset = null;
  34036. /**
  34037. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [DensityKernelAnalystParameters.prototype.bounds]
  34038. * @description 核密度分析的范围,用于确定结果栅格数据集的范围。
  34039. * 如果缺省,则默认为原数据集的范围。
  34040. */
  34041. this.bounds = null;
  34042. /**
  34043. * @member {string} DensityKernelAnalystParameters.prototype.fieldName
  34044. * @description 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  34045. */
  34046. this.fieldName = null;
  34047. /**
  34048. * @member {number} [DensityKernelAnalystParameters.prototype.resultGridDatasetResolution]
  34049. * @description 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  34050. */
  34051. this.resultGridDatasetResolution = null;
  34052. /**
  34053. * @member {number} [DensityKernelAnalystParameters.prototype.searchRadius]
  34054. * @description 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  34055. */
  34056. this.searchRadius = null;
  34057. /**
  34058. * @member {string} [DensityKernelAnalystParameters.prototype.targetDatasource]
  34059. * @description 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  34060. */
  34061. this.targetDatasource = null;
  34062. /**
  34063. * @member {string} DensityKernelAnalystParameters.prototype.resultGridName
  34064. * @description 指定结果数据集名称。
  34065. */
  34066. this.resultGridName = null;
  34067. /**
  34068. * @member {boolean} [DensityKernelAnalystParameters.prototype.deleteExistResultDataset=false]
  34069. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  34070. */
  34071. this.deleteExistResultDataset = false;
  34072. Util_Util.extend(this, options);
  34073. this.CLASS_NAME = "SuperMap.DensityKernelAnalystParameters";
  34074. }
  34075. /**
  34076. * @function DensityKernelAnalystParameters.prototype.destroy
  34077. * @description 释放资源,将引用资源的属性置空。
  34078. */
  34079. destroy() {
  34080. var me = this;
  34081. me.dataset = null;
  34082. me.bounds = null;
  34083. me.fieldName = null;
  34084. me.resultGridDatasetResolution = null;
  34085. me.searchRadius = null;
  34086. me.targetDatasource = null;
  34087. me.resultGridName = null;
  34088. me.deleteExistResultDataset = null;
  34089. }
  34090. /**
  34091. * @function DensityKernelAnalystParameters.toObject
  34092. * @param {DensityKernelAnalystParameters} densityKernelAnalystParameters -核密度分析参数类。
  34093. * @param {DensityKernelAnalystParameters} tempObj - 核密度分析参数对象。
  34094. * @description 将核密度分析参数对象转换成 JSON 对象。
  34095. * @returns JSON 对象。
  34096. */
  34097. static toObject(densityKernelAnalystParameters, tempObj) {
  34098. for (var name in densityKernelAnalystParameters) {
  34099. if (name !== "dataset") {
  34100. tempObj[name] = densityKernelAnalystParameters[name];
  34101. }
  34102. }
  34103. }
  34104. }
  34105. ;// CONCATENATED MODULE: ./src/common/iServer/DensityAnalystService.js
  34106. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34107. * This program are made available under the terms of the Apache License, Version 2.0
  34108. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34109. /**
  34110. * @class DensityAnalystService
  34111. * @deprecatedclass SuperMap.DensityAnalystService
  34112. * @category iServer SpatialAnalyst DensityAnalyst
  34113. * @classdesc
  34114. * 密度分析服务类,密度分析可计算每个输出栅格像元周围圆形邻域内输入的点或线对象的密度。
  34115. * 密度分析,在某种意义上来说,相当于在表面上将输入的点线对象的测量值散开来,将每个点或线对象的测量量分布在整个研究区域,并计算输出栅格中每个像元的密度值。目前提供1种密度分析:核密度分析(Kernel)。
  34116. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  34117. * @param {Object} options - 参数。
  34118. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34119. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34120. * @param {Object} [options.headers] - 请求头。
  34121. * @extends {SpatialAnalystBase}
  34122. * @example 例如:
  34123. * var myDensityAnalystService = new DensityAnalystService(url);
  34124. * myDensityAnalystService.on({
  34125. * "processCompleted": processCompleted,
  34126. * "processFailed": processFailed
  34127. * }
  34128. * );
  34129. * @usage
  34130. */
  34131. class DensityAnalystService extends SpatialAnalystBase {
  34132. constructor(url, options) {
  34133. super(url, options);
  34134. /**
  34135. * @member {string} DensityAnalystService.prototype.mode
  34136. * @description 密度分析类型。
  34137. */
  34138. this.mode = null;
  34139. if (options) {
  34140. Util_Util.extend(this, options);
  34141. }
  34142. this.CLASS_NAME = "SuperMap.DensityAnalystService";
  34143. }
  34144. /**
  34145. * @function DensityAnalystService.prototype.destroy
  34146. * @description 释放资源,将引用资源的属性置空。
  34147. */
  34148. destroy() {
  34149. super.destroy();
  34150. this.mode = null;
  34151. }
  34152. /**
  34153. * @function DensityAnalystService.prototype.processAsync
  34154. * @description 负责将客户端的查询参数传递到服务端。
  34155. * @param {DensityKernelAnalystParameters} parameter - 核密度分析参数。
  34156. */
  34157. processAsync(parameter) {
  34158. var me = this;
  34159. var parameterObject = new Object();
  34160. if (parameter instanceof DensityKernelAnalystParameters) {
  34161. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/densityanalyst/kernel');
  34162. me.mode = "kernel";
  34163. }
  34164. DensityKernelAnalystParameters.toObject(parameter, parameterObject);
  34165. var jsonParameters = Util_Util.toJSON(parameterObject);
  34166. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  34167. me.request({
  34168. method: "POST",
  34169. data: jsonParameters,
  34170. scope: me,
  34171. success: me.serviceProcessCompleted,
  34172. failure: me.serviceProcessFailed
  34173. });
  34174. }
  34175. }
  34176. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesParameters.js
  34177. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34178. * This program are made available under the terms of the Apache License, Version 2.0
  34179. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34180. /**
  34181. * @class EditFeaturesParameters
  34182. * @deprecatedclass SuperMap.EditFeaturesParameters
  34183. * @category iServer Data Feature
  34184. * @classdesc 数据集添加、修改、删除参数类。
  34185. * @param {Object} options - 参数。
  34186. * @param {Array.<FeatureVector|GeoJSONObject|ol.Feature>} options.features - 当前需要创建或者是修改的要素集。
  34187. * @param {boolean} [options.returnContent=false] - 是否返回要素内容。如果为true则返回创建要素的 ID 数组,否则返回 featureResult 资源的 URI。
  34188. * @param {EditType} [options.editType=EditType.ADD] - POST 动作类型 (ADD、UPDATE、DELETE)。
  34189. * @param {Array.<string|number>} [options.IDs] - 删除要素时的要素的 ID 数组。
  34190. * @usage
  34191. */
  34192. class EditFeaturesParameters {
  34193. constructor(options) {
  34194. /**
  34195. * @member {string} EditFeaturesParameters.prototype.dataSourceName
  34196. * @description 当前需要创建或者是修改的要素的数据源。
  34197. */
  34198. this.dataSourceName = null;
  34199. /**
  34200. * @member {string} EditFeaturesParameters.prototype.dataSetName
  34201. * @description 当前需要创建或者是修改的要素的数据集。
  34202. */
  34203. this.dataSetName = null;
  34204. /**
  34205. * @member {Array.<FeatureVector|GeoJSONObject|ol.Feature>} EditFeaturesParameters.prototype.features
  34206. * @description 当前需要创建或者是修改的要素集。
  34207. */
  34208. this.features = null;
  34209. /**
  34210. * @member {EditType} [EditFeaturesParameters.prototype.editType=EditType.ADD]
  34211. * @description 要素集更新类型 (add、update、delete)。
  34212. */
  34213. this.editType = EditType.ADD;
  34214. /**
  34215. * @member {Array.<string|number>} [EditFeaturesParameters.prototype.IDs]
  34216. * @description 执行删除时要素集 ID 集合。
  34217. */
  34218. this.IDs = null;
  34219. /**
  34220. * @member {boolean} [EditFeaturesParameters.prototype.returnContent=false]
  34221. * @description 要素添加时,isUseBatch 不传或传为 false 的情况下有效。
  34222. * true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  34223. */
  34224. this.returnContent = false;
  34225. /**
  34226. * @member {boolean} [EditFeaturesParameters.prototype.isUseBatch=false]
  34227. * @description 是否使用批量添加要素功能,要素添加时有效。批量添加能够提高要素编辑效率。true 表示批量添加;false 表示不使用批量添加。
  34228. */
  34229. this.isUseBatch = false;
  34230. Util_Util.extend(this, options);
  34231. this.CLASS_NAME = "SuperMap.EditFeaturesParameters";
  34232. }
  34233. /**
  34234. * @function EditFeaturesParameters.prototype.destroy
  34235. * @description 释放资源,将引用资源的属性置空。
  34236. */
  34237. destroy() {
  34238. var me = this;
  34239. me.dataSourceName = null;
  34240. me.dataSetName = null;
  34241. me.features = null;
  34242. me.editType = null;
  34243. me.IDs = null;
  34244. me.returnContent = null;
  34245. }
  34246. /**
  34247. * @function EditFeaturesParameters.prototype.toJsonParameters
  34248. * @description 将 EditFeaturesParameters 对象参数转换为 JSON 字符串。
  34249. * @param {EditFeaturesParameters} params - 地物编辑参数。
  34250. * @returns {string} JSON 字符串。
  34251. */
  34252. static toJsonParameters(params) {
  34253. var feature,
  34254. len,
  34255. features,
  34256. editType = params.editType;
  34257. if (editType === EditType.DELETE) {
  34258. if (params.IDs === null) {
  34259. return;
  34260. }
  34261. features = {ids: params.IDs};
  34262. } else {
  34263. features = [];
  34264. if (params.features) {
  34265. len = params.features.length;
  34266. for (var i = 0; i < len; i++) {
  34267. feature = params.features[i];
  34268. feature.geometry = ServerGeometry.fromGeometry(feature.geometry);
  34269. features.push(feature);
  34270. }
  34271. }
  34272. }
  34273. return Util_Util.toJSON(features);
  34274. }
  34275. }
  34276. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesService.js
  34277. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34278. * This program are made available under the terms of the Apache License, Version 2.0
  34279. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34280. /**
  34281. * @class EditFeaturesService
  34282. * @deprecatedclass SuperMap.EditFeaturesService
  34283. * @category iServer Data Feature
  34284. * @classdesc 数据服务中数据集添加、更新、删除服务类。
  34285. * @extends {CommonServiceBase}
  34286. * @param {string} url - 服务端的数据服务资源地址。请求数据服务中数据集编辑服务,URL 应为:</br>
  34287. * http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/datasources/name/{数据源名}/datasets/name/{数据集名} 。</br>
  34288. * 例如:http://localhost:8090/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/Landuse_R
  34289. * @param {Object} options - 参数。
  34290. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  34291. * @param {DataFormat} [format] -查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  34292. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34293. * @param {Object} [options.headers] - 请求头。
  34294. * @example
  34295. * var myService = new EditFeaturesService(url, {eventListeners: {
  34296. * "processCompleted": editFeatureCompleted,
  34297. * "processFailed": editFeatureError
  34298. * }
  34299. * };
  34300. * @usage
  34301. */
  34302. class EditFeaturesService extends CommonServiceBase {
  34303. constructor(url, options) {
  34304. super(url, options);
  34305. /**
  34306. * @member {boolean} [EditFeaturesService.prototype.returnContent=false]
  34307. * @description要素添加时,isUseBatch 不传或传为 false 的情况下有效。true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  34308. */
  34309. this.returnContent = false;
  34310. /**
  34311. * @member {boolean} [EditFeaturesService.prototype.isUseBatch=false]
  34312. * @description 是否使用批量添加要素功能,要素添加时有效。
  34313. * 批量添加能够提高要素编辑效率。
  34314. * true 表示批量添加;false 表示不使用批量添加。
  34315. */
  34316. this.isUseBatch = false;
  34317. if (options) {
  34318. Util_Util.extend(this, options);
  34319. }
  34320. this.url = Util_Util.urlPathAppend(this.url, 'features');
  34321. this.CLASS_NAME = "SuperMap.EditFeaturesService";
  34322. }
  34323. /**
  34324. * @function EditFeaturesService.prototype.destroy
  34325. * @override
  34326. */
  34327. destroy() {
  34328. super.destroy();
  34329. var me = this;
  34330. me.returnContent = null;
  34331. me.isUseBatch = null;
  34332. me.fromIndex = null;
  34333. me.toIndex = null;
  34334. }
  34335. /**
  34336. * @function EditFeaturesService.prototype.processAsync
  34337. * @description 负责将客户端的更新参数传递到服务端。
  34338. * @param {EditFeaturesParameters} params - 编辑要素参数。
  34339. */
  34340. processAsync(params) {
  34341. if (!(params instanceof EditFeaturesParameters)) {
  34342. return;
  34343. }
  34344. var me = this,
  34345. method = "POST",
  34346. ids = "",
  34347. editType = params.editType,
  34348. jsonParameters = null;
  34349. me.returnContent = params.returnContent;
  34350. me.isUseBatch = params.isUseBatch;
  34351. jsonParameters = EditFeaturesParameters.toJsonParameters(params);
  34352. if (editType === EditType.DELETE) {
  34353. ids = Util_Util.toJSON(params.IDs);
  34354. jsonParameters = ids;
  34355. var urlWithIds = Util_Util.urlAppend(me.url, Util_Util.getParameterString({ids}))
  34356. if(FetchRequest.urlIsLong(urlWithIds)) {
  34357. me.url = Util_Util.urlAppend(me.url, Util_Util.getParameterString({_method: 'DELETE'}));
  34358. method = "POST";
  34359. } else{
  34360. me.url = urlWithIds;
  34361. method = "DELETE";
  34362. }
  34363. } else if (editType === EditType.UPDATE) {
  34364. method = "PUT";
  34365. } else {
  34366. if (me.isUseBatch) {
  34367. me.url = Util_Util.urlAppend(me.url, `isUseBatch=${me.isUseBatch}`);
  34368. me.returnContent = false;
  34369. }
  34370. if (me.returnContent) {
  34371. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  34372. method = "POST";
  34373. }
  34374. }
  34375. me.request({
  34376. method: method,
  34377. data: jsonParameters,
  34378. scope: me,
  34379. success: me.serviceProcessCompleted,
  34380. failure: me.serviceProcessFailed
  34381. });
  34382. }
  34383. }
  34384. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalyst3DParameters.js
  34385. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34386. * This program are made available under the terms of the Apache License, Version 2.0
  34387. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34388. /**
  34389. * @class FacilityAnalyst3DParameters
  34390. * @deprecatedclass SuperMap.FacilityAnalyst3DParameters
  34391. * @category iServer FacilityAnalyst3D
  34392. * @classdesc 最近设施分析参数基类。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  34393. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,
  34394. * 超过 10 分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  34395. * @param {Object} options - 参数。
  34396. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  34397. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  34398. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  34399. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  34400. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  34401. * @usage
  34402. */
  34403. class FacilityAnalyst3DParameters {
  34404. constructor(options) {
  34405. /**
  34406. * @member {number} [FacilityAnalyst3DParameters.prototype.edgeID]
  34407. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  34408. */
  34409. this.edgeID = null;
  34410. /**
  34411. * @member {number} [FacilityAnalyst3DParameters.prototype.nodeID]
  34412. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  34413. */
  34414. this.nodeID = null;
  34415. /**
  34416. * @member {string} FacilityAnalyst3DParameters.prototype.weightName
  34417. * @description 指定的权值字段信息对象的名称。
  34418. */
  34419. this.weightName = null;
  34420. /**
  34421. * @member {boolean} [FacilityAnalyst3DParameters.prototype.isUncertainDirectionValid=false]
  34422. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  34423. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  34424. */
  34425. this.isUncertainDirectionValid = false;
  34426. Util_Util.extend(this, options);
  34427. this.CLASS_NAME = "SuperMap.FacilityAnalyst3DParameters";
  34428. }
  34429. /**
  34430. * @function FacilityAnalyst3DParameters.prototype.destroy
  34431. * @description 释放资源,将资源的属性置空。
  34432. */
  34433. destroy() {
  34434. var me = this;
  34435. me.edgeID = null;
  34436. me.nodeID = null;
  34437. me.weightName = null;
  34438. me.isUncertainDirectionValid = null;
  34439. }
  34440. }
  34441. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DParameters.js
  34442. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34443. * This program are made available under the terms of the Apache License, Version 2.0
  34444. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34445. /**
  34446. * @class FacilityAnalystSinks3DParameters
  34447. * @deprecatedclass SuperMap.FacilityAnalystSinks3DParameters
  34448. * @category iServer FacilityAnalyst3D Sinks
  34449. * @classdesc 最近设施分析参数类(汇查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  34450. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  34451. * @extends {FacilityAnalyst3DParameters}
  34452. * @param {Object} options - 参数。
  34453. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  34454. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  34455. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  34456. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  34457. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  34458. * @usage
  34459. */
  34460. class FacilityAnalystSinks3DParameters extends FacilityAnalyst3DParameters {
  34461. constructor(options) {
  34462. super(options);
  34463. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DParameters";
  34464. }
  34465. /**
  34466. * @function FacilityAnalystSinks3DParameters.prototype.destroy
  34467. * @override
  34468. */
  34469. destroy() {
  34470. super.destroy();
  34471. }
  34472. }
  34473. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DService.js
  34474. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34475. * This program are made available under the terms of the Apache License, Version 2.0
  34476. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34477. /**
  34478. * @class FacilityAnalystSinks3DService
  34479. * @deprecatedclass SuperMap.FacilityAnalystSinks3DService
  34480. * @category iServer FacilityAnalyst3D Sinks
  34481. * @classdesc 最近设施分析服务类(汇查找资源)<br>
  34482. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  34483. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  34484. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  34485. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  34486. * @extends {CommonServiceBase}
  34487. * @example
  34488. * var myFacilityAnalystSinks3DService = new FacilityAnalystSinks3DService(url, {
  34489. * eventListeners: {
  34490. * "processCompleted": facilityAnalystSinks3DCompleted,
  34491. * "processFailed": facilityAnalystSinks3DError
  34492. * }
  34493. * });
  34494. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:<br>
  34495. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  34496. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。<br>
  34497. * @param {Object} options - 参数。
  34498. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34499. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34500. * @param {Object} [options.headers] - 请求头。
  34501. * @usage
  34502. */
  34503. class FacilityAnalystSinks3DService extends CommonServiceBase {
  34504. constructor(url, options) {
  34505. super(url, options);
  34506. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DService";
  34507. }
  34508. /**
  34509. * @function FacilityAnalystSinks3DService.prototype.destroy
  34510. * @override
  34511. */
  34512. destroy() {
  34513. CommonServiceBase.prototype.destroy.apply(this, arguments);
  34514. }
  34515. /**
  34516. * @function FacilityAnalystSinks3DService.prototype.processAsync
  34517. * @description 负责将客户端的查询参数传递到服务端。
  34518. * @param {FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)
  34519. */
  34520. processAsync(params) {
  34521. if (!(params instanceof FacilityAnalystSinks3DParameters)) {
  34522. return;
  34523. }
  34524. var me = this, jsonObject;
  34525. me.url = Util_Util.urlPathAppend(me.url, 'sinks');
  34526. jsonObject = {
  34527. edgeID: params.edgeID,
  34528. nodeID: params.nodeID,
  34529. weightName: params.weightName,
  34530. isUncertainDirectionValid: params.isUncertainDirectionValid
  34531. };
  34532. me.request({
  34533. method: "GET",
  34534. params: jsonObject,
  34535. scope: me,
  34536. success: me.serviceProcessCompleted,
  34537. failure: me.serviceProcessFailed
  34538. });
  34539. }
  34540. }
  34541. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DParameters.js
  34542. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34543. * This program are made available under the terms of the Apache License, Version 2.0
  34544. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34545. /**
  34546. * @class FacilityAnalystSources3DParameters
  34547. * @deprecatedclass SuperMap.FacilityAnalystSources3DParameters
  34548. * @category iServer FacilityAnalyst3D Sources
  34549. * @classdesc 最近设施分析参数类(源查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  34550. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  34551. * @extends {FacilityAnalyst3DParameters}
  34552. * @param {Object} options - 参数。
  34553. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  34554. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  34555. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  34556. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  34557. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  34558. * @usage
  34559. */
  34560. class FacilityAnalystSources3DParameters extends FacilityAnalyst3DParameters {
  34561. constructor(options) {
  34562. super(options);
  34563. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DParameters";
  34564. }
  34565. /**
  34566. * @function FacilityAnalystSources3DParameters.prototype.destroy
  34567. * @override
  34568. */
  34569. destroy() {
  34570. super.destroy();
  34571. }
  34572. }
  34573. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DService.js
  34574. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34575. * This program are made available under the terms of the Apache License, Version 2.0
  34576. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34577. /**
  34578. * @class FacilityAnalystSources3DService
  34579. * @deprecatedclass SuperMap.FacilityAnalystSources3DService
  34580. * @category iServer FacilityAnalyst3D Sources
  34581. * @classdesc 最近设施分析服务类(源查找资源)
  34582. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  34583. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  34584. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  34585. * 最近设施分析结果通过该类支持的事件的监听函数参数获取。
  34586. * @extends {CommonServiceBase}
  34587. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  34588. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  34589. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  34590. * @param {Object} options - 参数。
  34591. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34592. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34593. * @param {Object} [options.headers] - 请求头。
  34594. * @usage
  34595. */
  34596. class FacilityAnalystSources3DService extends CommonServiceBase {
  34597. constructor(url, options) {
  34598. super(url, options);
  34599. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DService";
  34600. }
  34601. /**
  34602. * @function FacilityAnalystSources3DService.prototype.destroy
  34603. * @override
  34604. */
  34605. destroy() {
  34606. super.destroy();
  34607. }
  34608. /**
  34609. * @function FacilityAnalystSources3DService.prototype.processAsync
  34610. * @description 负责将客户端的查询参数传递到服务端。
  34611. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)
  34612. */
  34613. processAsync(params) {
  34614. if (!(params instanceof FacilityAnalystSources3DParameters)) {
  34615. return;
  34616. }
  34617. var me = this, jsonObject;
  34618. me.url = Util_Util.urlPathAppend(me.url, 'sources');
  34619. jsonObject = {
  34620. edgeID: params.edgeID,
  34621. nodeID: params.nodeID,
  34622. weightName: params.weightName,
  34623. isUncertainDirectionValid: params.isUncertainDirectionValid
  34624. };
  34625. me.request({
  34626. method: "GET",
  34627. params: jsonObject,
  34628. scope: me,
  34629. success: me.serviceProcessCompleted,
  34630. failure: me.serviceProcessFailed
  34631. });
  34632. }
  34633. }
  34634. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamParameters.js
  34635. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34636. * This program are made available under the terms of the Apache License, Version 2.0
  34637. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34638. /**
  34639. * @class FacilityAnalystStreamParameters
  34640. * @deprecatedclass SuperMap.FacilityAnalystStreamParameters
  34641. * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
  34642. * @classdesc 上游/下游关键设施查找资源参数类。
  34643. * @param {Object} options - 参数。
  34644. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  34645. * @param {number} options.queryType - 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  34646. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  34647. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  34648. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  34649. * @usage
  34650. */
  34651. class FacilityAnalystStreamParameters {
  34652. constructor(options) {
  34653. /**
  34654. * @member {Array.<number>} [FacilityAnalystStreamParameters.prototype.sourceNodeIDs]
  34655. * @description 指定的设施点 ID 数组。
  34656. */
  34657. this.sourceNodeIDs = null;
  34658. /**
  34659. * @member {number} [FacilityAnalystStreamParameters.prototype.edgeID]
  34660. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  34661. */
  34662. this.edgeID = null;
  34663. /**
  34664. * @member {number} [FacilityAnalystStreamParameters.prototype.nodeID]
  34665. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  34666. */
  34667. this.nodeID = null;
  34668. /**
  34669. * @member {boolean} [FacilityAnalystStreamParameters.prototype.isUncertainDirectionValid=false]
  34670. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  34671. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  34672. */
  34673. this.isUncertainDirectionValid = false;
  34674. /**
  34675. * @member {number} FacilityAnalystStreamParameters.prototype.queryType
  34676. * @description 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  34677. */
  34678. this.queryType = null;
  34679. Util_Util.extend(this, options);
  34680. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamParameters";
  34681. }
  34682. /**
  34683. * @function FacilityAnalystStreamParameters.prototype.destroy
  34684. * @description 释放资源,将引用资源的属性置空。
  34685. */
  34686. destroy() {
  34687. var me = this;
  34688. me.edgeID = null;
  34689. me.nodeID = null;
  34690. me.weightName = null;
  34691. me.isUncertainDirectionValid = null;
  34692. me.type = null;
  34693. }
  34694. }
  34695. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamService.js
  34696. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34697. * This program are made available under the terms of the Apache License, Version 2.0
  34698. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34699. /**
  34700. * @class FacilityAnalystStreamService
  34701. * @deprecatedclass SuperMap.FacilityAnalystStreamService
  34702. * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
  34703. * @classdesc 上游/下游 关键设施查找资源服务类:即查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  34704. * @extends NetworkAnalystServiceBase
  34705. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  34706. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  34707. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet";
  34708. * @param {Object} options - 参数。
  34709. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34710. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34711. * @param {Object} [options.headers] - 请求头。
  34712. * @usage
  34713. */
  34714. class FacilityAnalystStreamService extends NetworkAnalystServiceBase {
  34715. constructor(url, options) {
  34716. super(url, options);
  34717. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamService";
  34718. }
  34719. /**
  34720. * @function FacilityAnalystStreamService.prototype.destroy
  34721. * @override
  34722. */
  34723. destroy() {
  34724. super.destroy();
  34725. }
  34726. /**
  34727. * @function FacilityAnalystStreamService.prototype.processAsync
  34728. * @description 负责将客户端的查询参数传递到服务端。
  34729. * @param {FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
  34730. */
  34731. processAsync(params) {
  34732. if (!(params instanceof FacilityAnalystStreamParameters)) {
  34733. return;
  34734. }
  34735. var me = this,
  34736. jsonObject;
  34737. //URL 通过参数类型来判断是 上游 还是下游 查询
  34738. if (params.queryType === 0) {
  34739. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  34740. } else if (params.queryType === 1) {
  34741. me.url = Util_Util.urlPathAppend(me.url, 'downstreamcirticalfaclilities');
  34742. } else {
  34743. return;
  34744. }
  34745. jsonObject = {
  34746. sourceNodeIDs: params.sourceNodeIDs,
  34747. isUncertainDirectionValid: params.isUncertainDirectionValid
  34748. };
  34749. if (params.edgeID !== null && params.nodeID !== null) {
  34750. return;
  34751. }
  34752. if (params.edgeID === null && params.nodeID === null) {
  34753. return;
  34754. }
  34755. if (params.edgeID !== null) {
  34756. jsonObject.edgeID = params.edgeID;
  34757. } else {
  34758. jsonObject.nodeID = params.nodeID;
  34759. }
  34760. me.request({
  34761. method: "GET",
  34762. params: jsonObject,
  34763. scope: me,
  34764. success: me.serviceProcessCompleted,
  34765. failure: me.serviceProcessFailed
  34766. });
  34767. }
  34768. }
  34769. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DParameters.js
  34770. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34771. * This program are made available under the terms of the Apache License, Version 2.0
  34772. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34773. /**
  34774. * @class FacilityAnalystTracedown3DParameters
  34775. * @deprecatedclass SuperMap.FacilityAnalystTracedown3DParameters
  34776. * @category iServer FacilityAnalyst3D TraceDownResult
  34777. * @classdesc 下游追踪资源参数类。
  34778. * @extends {FacilityAnalyst3DParameters}
  34779. * @param {Object} options - 参数。
  34780. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  34781. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  34782. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  34783. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  34784. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  34785. * @usage
  34786. */
  34787. class FacilityAnalystTracedown3DParameters extends FacilityAnalyst3DParameters {
  34788. constructor(options) {
  34789. super(options);
  34790. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DParameters";
  34791. }
  34792. /**
  34793. * @function FacilityAnalystTracedown3DParameters.prototype.destroy
  34794. * @override
  34795. */
  34796. destroy() {
  34797. super.destroy();
  34798. }
  34799. }
  34800. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DService.js
  34801. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34802. * This program are made available under the terms of the Apache License, Version 2.0
  34803. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34804. /**
  34805. * @class FacilityAnalystTracedown3DService
  34806. * @deprecatedclass SuperMap.FacilityAnalystTracedown3DService
  34807. * @category iServer FacilityAnalyst3D TraceDownResult
  34808. * @classdesc 下游追踪资源服务类
  34809. * @extends {CommonServiceBase}
  34810. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  34811. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  34812. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  34813. * @param {Object} options - 参数。
  34814. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34815. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34816. * @param {Object} [options.headers] - 请求头。
  34817. * @usage
  34818. */
  34819. class FacilityAnalystTracedown3DService extends CommonServiceBase {
  34820. constructor(url, options) {
  34821. super(url, options);
  34822. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DService";
  34823. }
  34824. /**
  34825. * @function FacilityAnalystTracedown3DService.prototype.destroy
  34826. * @override
  34827. */
  34828. destroy() {
  34829. super.destroy();
  34830. }
  34831. /**
  34832. * @function FacilityAnalystTracedown3DService.prototype.processAsync
  34833. * @description 负责将客户端的查询参数传递到服务端。
  34834. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
  34835. */
  34836. processAsync(params) {
  34837. if (!(params instanceof FacilityAnalystTracedown3DParameters)) {
  34838. return;
  34839. }
  34840. var me = this, jsonObject;
  34841. me.url = Util_Util.urlPathAppend(me.url, 'tracedownresult');
  34842. jsonObject = {
  34843. edgeID: params.edgeID,
  34844. nodeID: params.nodeID,
  34845. weightName: params.weightName,
  34846. isUncertainDirectionValid: params.isUncertainDirectionValid
  34847. };
  34848. me.request({
  34849. method: "GET",
  34850. params: jsonObject,
  34851. scope: me,
  34852. success: me.serviceProcessCompleted,
  34853. failure: me.serviceProcessFailed
  34854. });
  34855. }
  34856. }
  34857. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DParameters.js
  34858. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34859. * This program are made available under the terms of the Apache License, Version 2.0
  34860. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34861. /**
  34862. * @class FacilityAnalystTraceup3DParameters
  34863. * @deprecatedclass SuperMap.FacilityAnalystTraceup3DParameters
  34864. * @category iServer FacilityAnalyst3D TraceUpResult
  34865. * @classdesc 上游追踪资源参数类。
  34866. * @extends {FacilityAnalyst3DParameters}
  34867. * @param {Object} options - 参数。
  34868. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  34869. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  34870. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  34871. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  34872. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  34873. * @usage
  34874. */
  34875. class FacilityAnalystTraceup3DParameters extends FacilityAnalyst3DParameters {
  34876. constructor(options) {
  34877. super(options);
  34878. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DParameters";
  34879. }
  34880. /**
  34881. * @function FacilityAnalystTraceup3DParameters.prototype.destroy
  34882. * @override
  34883. */
  34884. destroy() {
  34885. super.destroy();
  34886. }
  34887. }
  34888. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DService.js
  34889. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34890. * This program are made available under the terms of the Apache License, Version 2.0
  34891. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34892. /**
  34893. * @class FacilityAnalystTraceup3DService
  34894. * @deprecatedclass SuperMap.FacilityAnalystTraceup3DService
  34895. * @category iServer FacilityAnalyst3D TraceUpResult
  34896. * @classdesc 上游追踪资源服务类
  34897. * @extends {CommonServiceBase}
  34898. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  34899. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  34900. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  34901. * @param {Object} options - 参数。
  34902. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34903. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34904. * @param {Object} [options.headers] - 请求头。
  34905. * @usage
  34906. */
  34907. class FacilityAnalystTraceup3DService extends CommonServiceBase {
  34908. constructor(url, options) {
  34909. super(url, options);
  34910. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DService";
  34911. }
  34912. /**
  34913. * @function FacilityAnalystTraceup3DService.prototype.destroy
  34914. * @override
  34915. */
  34916. destroy() {
  34917. super.destroy();
  34918. }
  34919. /**
  34920. * @function FacilityAnalystTraceup3DService.prototype.processAsync
  34921. * @description 负责将客户端的查询参数传递到服务端。
  34922. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类
  34923. */
  34924. processAsync(params) {
  34925. if (!(params instanceof FacilityAnalystTraceup3DParameters)) {
  34926. return;
  34927. }
  34928. var me = this, jsonObject;
  34929. me.url = Util_Util.urlPathAppend(me.url, 'traceupresult');
  34930. jsonObject = {
  34931. edgeID: params.edgeID,
  34932. nodeID: params.nodeID,
  34933. weightName: params.weightName,
  34934. isUncertainDirectionValid: params.isUncertainDirectionValid
  34935. };
  34936. me.request({
  34937. method: "GET",
  34938. params: jsonObject,
  34939. scope: me,
  34940. success: me.serviceProcessCompleted,
  34941. failure: me.serviceProcessFailed
  34942. });
  34943. }
  34944. }
  34945. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DParameters.js
  34946. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34947. * This program are made available under the terms of the Apache License, Version 2.0
  34948. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34949. /**
  34950. * @class FacilityAnalystUpstream3DParameters
  34951. * @deprecatedclass SuperMap.FacilityAnalystUpstream3DParameters
  34952. * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
  34953. * @classdesc 上游关键设施查找资源参数类。
  34954. * @extends {FacilityAnalyst3DParameters}
  34955. * @param {Object} options - 参数。
  34956. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  34957. * @param {number} [options.edgeID] - 指定的弧段ID。edgeID 与 nodeID 必须指定一个。
  34958. * @param {number} [options.nodeID] - 指定的结点ID。edgeID 与 edgeID 必须指定一个。
  34959. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  34960. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  34961. * @usage
  34962. */
  34963. class FacilityAnalystUpstream3DParameters extends FacilityAnalyst3DParameters {
  34964. constructor(options) {
  34965. super(options);
  34966. options = options || {};
  34967. this.sourceNodeIDs = null;
  34968. Util_Util.extend(this, options);
  34969. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DParameters";
  34970. }
  34971. /**
  34972. * @function FacilityAnalystUpstream3DParameters.prototype.destroy
  34973. * @override
  34974. */
  34975. destroy() {
  34976. super.destroy();
  34977. this.sourceNodeIDs = null;
  34978. }
  34979. }
  34980. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DService.js
  34981. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34982. * This program are made available under the terms of the Apache License, Version 2.0
  34983. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34984. /**
  34985. * @class FacilityAnalystUpstream3DService
  34986. * @deprecatedclass SuperMap.FacilityAnalystUpstream3DService
  34987. * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
  34988. * @classdesc 上游关键设施查找资源服务类
  34989. * @extends {CommonServiceBase}
  34990. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  34991. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  34992. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  34993. * @param {Object} options - 参数。
  34994. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34995. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34996. * @param {Object} [options.headers] - 请求头。
  34997. * @usage
  34998. */
  34999. class FacilityAnalystUpstream3DService extends CommonServiceBase {
  35000. constructor(url, options) {
  35001. super(url, options);
  35002. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DService";
  35003. }
  35004. /**
  35005. * @function FacilityAnalystUpstream3DService.prototype.destroy
  35006. * @override
  35007. */
  35008. destroy() {
  35009. super.destroy();
  35010. }
  35011. /**
  35012. * @function FacilityAnalystUpstream3DService.prototype.processAsync
  35013. * @description 负责将客户端的查询参数传递到服务端。
  35014. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类
  35015. */
  35016. processAsync(params) {
  35017. if (!(params instanceof FacilityAnalystUpstream3DParameters)) {
  35018. return;
  35019. }
  35020. var me = this, jsonObject;
  35021. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  35022. jsonObject = {
  35023. sourceNodeIDs: params.sourceNodeIDs,
  35024. edgeID: params.edgeID,
  35025. nodeID: params.nodeID,
  35026. isUncertainDirectionValid: params.isUncertainDirectionValid
  35027. };
  35028. me.request({
  35029. method: "GET",
  35030. params: jsonObject,
  35031. scope: me,
  35032. success: me.serviceProcessCompleted,
  35033. failure: me.serviceProcessFailed
  35034. });
  35035. }
  35036. }
  35037. ;// CONCATENATED MODULE: ./src/common/iServer/FieldParameters.js
  35038. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35039. * This program are made available under the terms of the Apache License, Version 2.0
  35040. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35041. /**
  35042. * @class FieldParameters
  35043. * @deprecatedclass SuperMap.FieldParameters
  35044. * @category iServer Data Field
  35045. * @classdesc 字段信息查询参数类。
  35046. * @param {Object} options - 参数。
  35047. * @param {string} options.datasource - 数据源名称。
  35048. * @param {string} options.dataset - 数据集名称。
  35049. * @usage
  35050. */
  35051. class FieldParameters {
  35052. constructor(options) {
  35053. /**
  35054. * @member {string} FieldParameters.prototype.datasource
  35055. * @description 要查询的数据集所在的数据源名称。
  35056. */
  35057. this.datasource = null;
  35058. /**
  35059. * @member {string} FieldParameters.prototype.dataset
  35060. * @description 要查询的数据集名称。
  35061. */
  35062. this.dataset = null;
  35063. if (options) {
  35064. Util_Util.extend(this, options);
  35065. }
  35066. this.CLASS_NAME = "SuperMap.FieldParameters";
  35067. }
  35068. /**
  35069. * @function FieldParameters.prototype.destroy
  35070. * @description 释放资源,将引用资源的属性置空。
  35071. */
  35072. destroy() {
  35073. var me = this;
  35074. me.datasource = null;
  35075. me.dataset = null;
  35076. }
  35077. }
  35078. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticsParameters.js
  35079. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35080. * This program are made available under the terms of the Apache License, Version 2.0
  35081. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35082. /**
  35083. * @class FieldStatisticsParameters
  35084. * @deprecatedclass SuperMap.FieldStatisticsParameters
  35085. * @category iServer Data Field
  35086. * @classdesc 字段统计信息查询参数类。
  35087. * @param {Object} options - 参数。
  35088. * @param {string} options.datasource - 数据源名称。
  35089. * @param {string} options.dataset - 数据集名称。
  35090. * @param {string} options.fieldName - 字段名。
  35091. * @param {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} statisticMode - 字段统计方法类型。
  35092. * @extends {FieldParameters}
  35093. * @usage
  35094. */
  35095. class FieldStatisticsParameters extends FieldParameters {
  35096. constructor(options) {
  35097. super(options);
  35098. /**
  35099. * @member {string} FieldStatisticsParameters.prototype.fieldName
  35100. * @description 字段名。
  35101. */
  35102. this.fieldName = null;
  35103. /**
  35104. * @member {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} FieldStatisticsParameters.prototype.statisticMode
  35105. * @description 字段统计方法类型。
  35106. */
  35107. this.statisticMode = null;
  35108. if (options) {
  35109. Util_Util.extend(this, options);
  35110. }
  35111. this.CLASS_NAME = "SuperMap.FieldStatisticsParameters";
  35112. }
  35113. /**
  35114. * @function FieldStatisticsParameters.prototype.destroy
  35115. * @description 释放资源,将引用资源的属性置空。
  35116. */
  35117. destroy() {
  35118. var me = this;
  35119. me.fieldName = null;
  35120. me.statisticMode = null;
  35121. }
  35122. }
  35123. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticService.js
  35124. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35125. * This program are made available under the terms of the Apache License, Version 2.0
  35126. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35127. /**
  35128. * @class FieldStatisticService
  35129. * @deprecatedclass SuperMap.FieldStatisticService
  35130. * @category iServer Data Field
  35131. * @classdesc 字段查询统计服务类。用来完成对指定数据集指定字段的查询统计分析,即求平均值,最大值等。
  35132. * @extends {CommonServiceBase}
  35133. * @param {string} url - 服务地址。如访问 World Map 服务,只需将 url 设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  35134. * @param {Object} options - 参数。
  35135. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  35136. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  35137. * @param {string} options.datasource - 数据集所在的数据源名称。
  35138. * @param {string} options.dataset - 数据集名称。
  35139. * @param {string} options.field - 查询统计的目标字段名称。
  35140. * @param {StatisticMode} options.statisticMode - 字段查询统计的方法类型。
  35141. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35142. * @param {Object} [options.headers] - 请求头。
  35143. * @example
  35144. * var myService = new FieldStatisticService(url, {eventListeners: {
  35145. * "processCompleted": fieldStatisticCompleted,
  35146. * "processFailed": fieldStatisticError
  35147. * },
  35148. * datasource: "World",
  35149. * dataset: "Countries",
  35150. * field: "SmID",
  35151. * statisticMode: StatisticMode.AVERAGE
  35152. * };
  35153. * @usage
  35154. */
  35155. class FieldStatisticService extends CommonServiceBase {
  35156. constructor(url, options) {
  35157. super(url, options);
  35158. /**
  35159. * @member {string} FieldStatisticService.prototype.datasource
  35160. * @description 数据集所在的数据源名称。
  35161. */
  35162. this.datasource = null;
  35163. /**
  35164. * @member {string} FieldStatisticService.prototype.dataset
  35165. * @description 数据集名称。
  35166. */
  35167. this.dataset = null;
  35168. /**
  35169. * @member {string} FieldStatisticService.prototype.field
  35170. * @description 查询统计的目标字段名称。
  35171. */
  35172. this.field = null;
  35173. /**
  35174. * @member {StatisticMode} FieldStatisticService.prototype.statisticMode
  35175. * @description 字段查询统计的方法类型。
  35176. */
  35177. this.statisticMode = null;
  35178. if (options) {
  35179. Util_Util.extend(this, options);
  35180. }
  35181. this.CLASS_NAME = "SuperMap.FieldStatisticService";
  35182. }
  35183. /**
  35184. * @function FieldStatisticService.prototype.destroy
  35185. * @override
  35186. */
  35187. destroy() {
  35188. super.destroy();
  35189. var me = this;
  35190. me.datasource = null;
  35191. me.dataset = null;
  35192. me.field = null;
  35193. me.statisticMode = null;
  35194. }
  35195. /**
  35196. * @function FieldStatisticService.prototype.processAsync
  35197. * @description 执行服务,进行指定字段的查询统计。
  35198. */
  35199. processAsync() {
  35200. var me = this,
  35201. fieldStatisticURL = "datasources/" + me.datasource + "/datasets/" + me.dataset + "/fields/" + me.field + "/" + me.statisticMode;
  35202. me.url = Util_Util.urlPathAppend(me.url, fieldStatisticURL);
  35203. me.request({
  35204. method: "GET",
  35205. data: null,
  35206. scope: me,
  35207. success: me.serviceProcessCompleted,
  35208. failure: me.serviceProcessFailed
  35209. });
  35210. }
  35211. }
  35212. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesParameters.js
  35213. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35214. * This program are made available under the terms of the Apache License, Version 2.0
  35215. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35216. /**
  35217. * @class FindClosestFacilitiesParameters
  35218. * @deprecatedclass SuperMap.FindClosestFacilitiesParameters
  35219. * @category iServer NetworkAnalyst ClosestFacility
  35220. * @classdesc 最近设施分析参数类。
  35221. * @param {Object} options - 参数。
  35222. * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} options.event - 事件点,一般为需要获得服务设施服务的事件位置。
  35223. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.facilities - 设施点集合,一般为提供服务的服务设施位置。
  35224. * @param {number} [options.expectFacilityCount=1] - 要查找的设施点数量。
  35225. * @param {boolean} [options.fromEvent=false] - 是否从事件点到设施点进行查找。
  35226. * @param {boolean} [options.isAnalyzeById=false] - 事件点和设施点是否通过节点 ID 号来指定。
  35227. * @param {number} [options.maxWeight=0] - 权值的最大限值。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  35228. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  35229. * @usage
  35230. */
  35231. class FindClosestFacilitiesParameters {
  35232. constructor(options) {
  35233. /**
  35234. * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} FindClosestFacilitiesParameters.prototype.event
  35235. * @description 事件点,一般为需要获得服务设施服务的事件位置。
  35236. * 可以通过两种方式赋予事件点:当该类中字段 isAnalyzeById = true 时,应输入事件点 ID 号;当 isAnalyzeById = false 时,应输入事件点坐标。
  35237. */
  35238. this.event = null;
  35239. /**
  35240. * @member {number} [FindClosestFacilitiesParameters.prototype.expectFacilityCount=1]
  35241. * @description 要查找的设施点数量。
  35242. */
  35243. this.expectFacilityCount = 1;
  35244. /**
  35245. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [FindClosestFacilitiesParameters.prototype.facilities=false]
  35246. * @description 设施点集合,一般为提供服务的服务设施位置。
  35247. * 可以通过两种方式赋予设施点:当该类中字段 isAnalyzeById = true 时,应输入设施点 ID 号;当 isAnalyzeById = false 时,应输入设施点坐标。
  35248. */
  35249. this.facilities = null;
  35250. /**
  35251. * @member {boolean} [FindClosestFacilitiesParameters.prototype.fromEvent=false]
  35252. * @description 是否从事件点到设施点进行查找。最近设施分析主要是通过设施点和事件点之间最优的路线来分析在一定范围内哪个或哪些设施与事件点有最优路线的关系。
  35253. * 这个行走线路是通过网络图层进行网络分析算法计算出来的两点间的最优路线。由于存在从 A 点到 B 点与从 B 点到 A 点的耗费不一样的情况,因此起止点不同可能会得到不同的最优路线。因此在进行最近设施分析之前,需要设置获取的最优路线的方向,即是以事件点作为起点到最近设施点的方向分析,还是以最近设施点为起点到事件点的方向分析。如果需要以事件点作为起点到设施点方向进行查找,设置该字段值为 true;设置为 false,表示从设施点到事件点进行查找。
  35254. */
  35255. this.fromEvent = false;
  35256. /**
  35257. * @member {boolean} [FindClosestFacilitiesParameters.prototype.isAnalyzeById=false]
  35258. * @description 事件点和设施点是否通过节点 ID 号来指定,设置为 false,表示通过坐标点指定事件点和设施点。
  35259. */
  35260. this.isAnalyzeById = false;
  35261. /**
  35262. * @member {number} [FindClosestFacilitiesParameters.prototype.maxWeight=0]
  35263. * @description 权值的最大限值。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  35264. * 例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,超过 10 分钟能到达的都不予考虑。
  35265. * 那么需要将网络分析参数中 parameter.weightFieldName 设置为表示时间的字段,然后设置查找范围的半径值为10。
  35266. */
  35267. this.maxWeight = 0;
  35268. /**
  35269. * @member {TransportationAnalystParameter} [FindClosestFacilitiesParameters.prototype.parameter]
  35270. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  35271. * 它为 TransportationAnalystParameter 类型,虽然为可选参数,但是如果不设置其中的 resultSetting 字段,
  35272. * 则返回结果空间信息等都为空。
  35273. */
  35274. this.parameter = new TransportationAnalystParameter();
  35275. Util_Util.extend(this, options);
  35276. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesParameters";
  35277. }
  35278. /**
  35279. * @function FindClosestFacilitiesParameters.prototype.destroy
  35280. * @description 释放资源,将引用资源的属性置空。
  35281. */
  35282. destroy() {
  35283. var me = this;
  35284. me.event = null;
  35285. me.expectFacilityCount = null;
  35286. me.facilities = null;
  35287. me.fromEvent = null;
  35288. me.isAnalyzeById = null;
  35289. me.maxWeight = null;
  35290. if (me.parameter) {
  35291. me.parameter.destroy();
  35292. me.parameter = null;
  35293. }
  35294. }
  35295. }
  35296. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesService.js
  35297. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35298. * This program are made available under the terms of the Apache License, Version 2.0
  35299. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35300. /**
  35301. * @class FindClosestFacilitiesService
  35302. * @deprecatedclass SuperMap.FindClosestFacilitiesService
  35303. * @category iServer NetworkAnalyst ClosestFacility
  35304. * @classdesc 最近设施分析服务类。
  35305. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  35306. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  35307. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  35308. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  35309. * @extends {NetworkAnalystServiceBase}
  35310. * @example
  35311. * var myfindClosestFacilitiesService = new FindClosestFacilitiesService(url, {
  35312. * eventListeners: {
  35313. * "processCompleted": findClosestFacilitiesCompleted,
  35314. * "processFailed": findClosestFacilitiesError
  35315. * }
  35316. * });
  35317. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  35318. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  35319. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  35320. * @param {Object} options - 参数。
  35321. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  35322. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35323. * @param {Object} [options.headers] - 请求头。
  35324. * @usage
  35325. */
  35326. class FindClosestFacilitiesService extends NetworkAnalystServiceBase {
  35327. constructor(url, options) {
  35328. super(url, options);
  35329. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesService";
  35330. }
  35331. /**
  35332. * @function FindClosestFacilitiesService.prototype.destroy
  35333. * @override
  35334. */
  35335. destroy() {
  35336. super.destroy();
  35337. }
  35338. /**
  35339. * @function FindClosestFacilitiesService.prototype.processAsync
  35340. * @description 负责将客户端的查询参数传递到服务端。
  35341. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类
  35342. */
  35343. processAsync(params) {
  35344. if (!(params instanceof FindClosestFacilitiesParameters)) {
  35345. return;
  35346. }
  35347. var me = this,
  35348. jsonObject;
  35349. me.url = Util_Util.urlPathAppend(me.url, 'closestfacility');
  35350. jsonObject = {
  35351. expectFacilityCount: params.expectFacilityCount,
  35352. fromEvent: params.fromEvent,
  35353. maxWeight: params.maxWeight,
  35354. parameter: Util_Util.toJSON(params.parameter),
  35355. event: Util_Util.toJSON(params.event),
  35356. facilities: me.getJson(params.isAnalyzeById, params.facilities)
  35357. };
  35358. me.request({
  35359. method: "GET",
  35360. params: jsonObject,
  35361. scope: me,
  35362. success: me.serviceProcessCompleted,
  35363. failure: me.serviceProcessFailed
  35364. });
  35365. }
  35366. /**
  35367. * @function FindClosestFacilitiesService.prototype.getJson
  35368. * @description 将对象转化为JSON字符串。
  35369. * @param {boolean} isAnalyzeById - 是否通过ID来分析
  35370. * @param {Array.<Object>} params - 分析参数数组
  35371. * @returns {Object} 转化后的JSON字符串。
  35372. */
  35373. getJson(isAnalyzeById, params) {
  35374. var jsonString = "[",
  35375. len = params ? params.length : 0;
  35376. if (isAnalyzeById === false) {
  35377. for (let i = 0; i < len; i++) {
  35378. if (i > 0) {
  35379. jsonString += ",";
  35380. }
  35381. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  35382. }
  35383. } else if (isAnalyzeById === true) {
  35384. for (let i = 0; i < len; i++) {
  35385. if (i > 0) {
  35386. jsonString += ",";
  35387. }
  35388. jsonString += params[i];
  35389. }
  35390. }
  35391. jsonString += ']';
  35392. return jsonString;
  35393. }
  35394. /**
  35395. * @function FindClosestFacilitiesService.prototype.toGeoJSONResult
  35396. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  35397. * @param {Object} result - 服务器返回的结果对象。
  35398. */
  35399. toGeoJSONResult(result) {
  35400. if (!result || !result.facilityPathList) {
  35401. return result;
  35402. }
  35403. var geoJSONFormat = new GeoJSON();
  35404. result.facilityPathList.map(function (path) {
  35405. if (path.route) {
  35406. path.route = geoJSONFormat.toGeoJSON(path.route);
  35407. }
  35408. if (path.pathGuideItems) {
  35409. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  35410. }
  35411. if (path.edgeFeatures) {
  35412. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  35413. }
  35414. if (path.nodeFeatures) {
  35415. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  35416. }
  35417. return path;
  35418. });
  35419. return result;
  35420. }
  35421. }
  35422. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationParameters.js
  35423. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35424. * This program are made available under the terms of the Apache License, Version 2.0
  35425. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35426. /**
  35427. * @class FindLocationParameters
  35428. * @deprecatedclass SuperMap.FindLocationParameters
  35429. * @category iServer NetworkAnalyst Location
  35430. * @classdesc 选址分区分析参数类。
  35431. * @param {Object} options - 参数。
  35432. * @param {string} options.turnWeightField - 转向权值字段的名称。
  35433. * @param {string} options.weightName - 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  35434. * @param {Array.<SupplyCenter>} options.supplyCenters - 资源供给中心集合。
  35435. * @param {number} [options.expectedSupplyCenterCount=1] - 期望用于最终设施选址的资源供给中心数量。
  35436. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分配资源。
  35437. * @usage
  35438. */
  35439. class FindLocationParameters {
  35440. constructor(options) {
  35441. /**
  35442. * @member {number} [FindLocationParameters.prototype.expectedSupplyCenterCount=1]
  35443. * @description 期望用于最终设施选址的资源供给中心数量。
  35444. * 当输入值为 0 时,最终设施选址的资源供给中心数量默认为覆盖分析区域内的所需最少的供给中心数。
  35445. */
  35446. this.expectedSupplyCenterCount = null;
  35447. /**
  35448. * @member {boolean} [FindLocationParameters.prototype.isFromCenter=false]
  35449. * @description 是否从中心点开始分配资源。
  35450. * 由于网路数据中的弧段具有正反阻力,即弧段的正向阻力值与其反向阻力值可能不同,
  35451. * 因此,在进行分析时,从资源供给中心开始分配资源到需求点与从需求点向资源供给中心分配这两种分配形式下,所得的分析结果会不同。
  35452. */
  35453. this.isFromCenter = false;
  35454. /**
  35455. * @member {Array.<SupplyCenter>} FindLocationParameters.prototype.supplyCenters
  35456. * @description 资源供给中心集合。
  35457. * 资源供给中心是提供资源和服务的设施,对应于网络结点,
  35458. * 资源供给中心的相关信息包括资源量、最大阻力值、资源供给中心类型,资源供给中心在网络中所处结点的 ID 等,以便在进行选址分区分析时使用。
  35459. */
  35460. this.supplyCenters = null;
  35461. /**
  35462. * @member {string} FindLocationParameters.prototype.turnWeightField
  35463. * @description 转向权值字段的名称。
  35464. */
  35465. this.turnWeightField = null;
  35466. /**
  35467. * @member {string} FindLocationParameters.prototype.weightName
  35468. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  35469. */
  35470. this.weightName = null;
  35471. Util_Util.extend(this, options);
  35472. this.CLASS_NAME = "SuperMap.FindLocationParameters";
  35473. }
  35474. /**
  35475. * @function FindLocationParameters.prototype.destroy
  35476. * @description 释放资源,将引用资源的属性置空。
  35477. */
  35478. destroy() {
  35479. var me = this;
  35480. me.expectedSupplyCenterCount = null;
  35481. me.isFromCenter = null;
  35482. me.turnWeightField = null;
  35483. me.weightName = null;
  35484. if (me.supplyCenters) {
  35485. for (var i = 0, supplyCenters = me.supplyCenters, len = supplyCenters.length; i < len; i++) {
  35486. supplyCenters[i].destroy();
  35487. }
  35488. me.supplyCenters = null;
  35489. }
  35490. }
  35491. }
  35492. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationService.js
  35493. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35494. * This program are made available under the terms of the Apache License, Version 2.0
  35495. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35496. /**
  35497. * @class FindLocationService
  35498. * @deprecatedclass SuperMap.FindLocationService
  35499. * @category iServer NetworkAnalyst Location
  35500. * @classdesc 选址分区分析服务类。
  35501. * 选址分区分析是为了确定一个或多个待建设施的最佳或最优位置,使得设施可以用一种最经济有效的方式为需求方提供服务或者商品。
  35502. * 选址分区不仅仅是一个选址过程,还要将需求点的需求分配到相应的新建设施的服务区中,因此称之为选址与分区。
  35503. * 选址分区分析结果通过该类支持的事件的监听函数参数获取
  35504. * @extends {NetworkAnalystServiceBase}
  35505. * @example
  35506. * (start code)
  35507. * var findLocationService = new FindLocationService(url, {
  35508. * eventListeners: {
  35509. * "processCompleted": findLocationCompleted,
  35510. * "processFailed": findLocationError
  35511. * }
  35512. * });
  35513. * (end)
  35514. * @param {string} url - 服务地址。
  35515. * 如 http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  35516. * @param {Object} options - 参数。
  35517. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  35518. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35519. * @param {Object} [options.headers] - 请求头。
  35520. * @usage
  35521. */
  35522. class FindLocationService extends NetworkAnalystServiceBase {
  35523. constructor(url, options) {
  35524. super(url, options);
  35525. this.CLASS_NAME = "SuperMap.FindLocationService";
  35526. }
  35527. /**
  35528. * @function FindLocationService.prototype.destroy
  35529. * @override
  35530. */
  35531. destroy() {
  35532. super.destroy();
  35533. }
  35534. /**
  35535. * @function FindLocationService.prototype.processAsync
  35536. * @description 负责将客户端的查询参数传递到服务端。
  35537. * @param {FindLocationParameters} params - 选址分区分析服务参数类
  35538. */
  35539. processAsync(params) {
  35540. if (!(params instanceof FindLocationParameters)) {
  35541. return;
  35542. }
  35543. var me = this,
  35544. jsonObject;
  35545. me.url = Util_Util.urlPathAppend(me.url, 'location');
  35546. jsonObject = {
  35547. isFromCenter: params.isFromCenter,
  35548. expectedSupplyCenterCount: params.expectedSupplyCenterCount,
  35549. weightName: params.weightName,
  35550. turnWeightField: params.turnWeightField,
  35551. returnEdgeFeature: true,
  35552. returnEdgeGeometry: true,
  35553. returnNodeFeature: true,
  35554. mapParameter: Util_Util.toJSON(params.mapParameter),
  35555. supplyCenters: me.getCentersJson(params.supplyCenters)
  35556. };
  35557. me.request({
  35558. method: "GET",
  35559. params: jsonObject,
  35560. scope: me,
  35561. success: me.serviceProcessCompleted,
  35562. failure: me.serviceProcessFailed
  35563. });
  35564. }
  35565. /**
  35566. * @function FindLocationService.prototype.getCentersJson
  35567. * @description 将数组对象转化为JSON字符串。
  35568. * @param {Array} params - 需要转换的参数
  35569. * @returns {string} 转化后的JSON字符串。
  35570. */
  35571. getCentersJson(params) {
  35572. var json = "[",
  35573. len = params ? params.length : 0;
  35574. for (var i = 0; i < len; i++) {
  35575. if (i > 0) {
  35576. json += ",";
  35577. }
  35578. json += Util_Util.toJSON(params[i]);
  35579. }
  35580. json += "]";
  35581. return json;
  35582. }
  35583. /**
  35584. * @function FindLocationService.prototype.toGeoJSONResult
  35585. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  35586. * @param {Object} result - 服务器返回的结果对象。
  35587. */
  35588. toGeoJSONResult(result) {
  35589. if (!result) {
  35590. return null;
  35591. }
  35592. var geoJSONFormat = new GeoJSON();
  35593. if (result.demandResults) {
  35594. result.demandResults = geoJSONFormat.toGeoJSON(result.demandResults);
  35595. }
  35596. if (result.supplyResults) {
  35597. result.supplyResults = geoJSONFormat.toGeoJSON(result.supplyResults);
  35598. }
  35599. return result;
  35600. }
  35601. }
  35602. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsParameters.js
  35603. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35604. * This program are made available under the terms of the Apache License, Version 2.0
  35605. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35606. /**
  35607. * @class FindMTSPPathsParameters
  35608. * @deprecatedclass SuperMap.FindMTSPPathsParameters
  35609. * @category iServer NetworkAnalyst MTSPPath
  35610. * @classdesc 多旅行商分析参数类。
  35611. * @param {Object} options - 参数。
  35612. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 配送中心集合。
  35613. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
  35614. * @param {boolean} [options.hasLeastTotalCost=false] - 配送模式是否为总花费最小方案。
  35615. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  35616. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  35617. * @usage
  35618. */
  35619. class FindMTSPPathsParameters {
  35620. constructor(options) {
  35621. /**
  35622. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.centers
  35623. * @description 配送中心集合。
  35624. * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,centers 应为点的坐标数组;
  35625. * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,centers 应为点的 ID 数组。
  35626. */
  35627. this.centers = null;
  35628. /**
  35629. * @member {boolean} [FindMTSPPathsParameters.prototype.hasLeastTotalCost=false]
  35630. * @description 配送模式是否为总花费最小方案。
  35631. * 若为 true,则按照总花费最小的模式进行配送,此时可能会出现某几个配送中心点配送的花费较多而其他配送中心点的花费很少的情况。
  35632. * 若为 false,则为局部最优,此方案会控制每个配送中心点的花费,使各个中心点花费相对平均,此时总花费不一定最小。
  35633. */
  35634. this.hasLeastTotalCost = false;
  35635. /**
  35636. * @member {boolean} [FindMTSPPathsParameters.prototype.isAnalyzeById=false]
  35637. * @description 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  35638. */
  35639. this.isAnalyzeById = false;
  35640. /**
  35641. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.nodes
  35642. * @description 配送目标集合。
  35643. * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  35644. * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  35645. */
  35646. this.nodes = null;
  35647. /**
  35648. * @member {TransportationAnalystParameter} [FindMTSPPathsParameters.prototype.parameter]
  35649. * @description 交通网络分析通用参数。
  35650. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  35651. * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting 字段,则返回结果空间信息等都为空。
  35652. */
  35653. this.parameter = new TransportationAnalystParameter();
  35654. Util_Util.extend(this, options);
  35655. this.CLASS_NAME = "SuperMap.FindMTSPPathsParameters";
  35656. }
  35657. /**
  35658. * @function FindMTSPPathsParameters.prototype.destroy
  35659. * @description 释放资源,将引用资源的属性置空。
  35660. */
  35661. destroy() {
  35662. var me = this;
  35663. me.centers = null;
  35664. me.hasLeastTotalCost = null;
  35665. me.isAnalyzeById = null;
  35666. me.nodes = null;
  35667. me.maxWeight = null;
  35668. if (me.parameter) {
  35669. me.parameter.destroy();
  35670. me.parameter = null;
  35671. }
  35672. }
  35673. }
  35674. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsService.js
  35675. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35676. * This program are made available under the terms of the Apache License, Version 2.0
  35677. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35678. /**
  35679. * @class FindMTSPPathsService
  35680. * @deprecatedclass SuperMap.FindMTSPPathsService
  35681. * @category iServer NetworkAnalyst MTSPPath
  35682. * @classdesc 多旅行商分析服务类
  35683. * 多旅行商分析也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。
  35684. * 查找经济有效的配送路径,并给出相应的行走路线。
  35685. * 物流配送功能就是解决如何合理分配配送次序和送货路线,使配送总花费达到最小或每个配送中心的花费达到最小。
  35686. * 该类负责将客户端指定的多旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  35687. * 多旅行商分析结果通过该类支持的事件的监听函数参数获取。
  35688. * @extends {NetworkAnalystServiceBase}
  35689. * @example
  35690. * var myFindMTSPPathsService = new FindMTSPPathsService(url, {
  35691. * eventListeners: {
  35692. * "processCompleted": findMTSPPathsCompleted,
  35693. * "processFailed": findMTSPPathsError
  35694. * }
  35695. * });
  35696. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  35697. * http://{服务器地址}:{服务端口号}/iserver/services/网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  35698. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  35699. * @param {Object} options - 互服务时所需可选参数。如:
  35700. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  35701. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35702. * @param {Object} [options.headers] - 请求头。
  35703. * @usage
  35704. */
  35705. class FindMTSPPathsService extends NetworkAnalystServiceBase {
  35706. constructor(url, options) {
  35707. super(url, options);
  35708. this.CLASS_NAME = "SuperMap.FindMTSPPathsService";
  35709. }
  35710. /**
  35711. * @function FindMTSPPathsService.prototype.destroy
  35712. * @override
  35713. */
  35714. destroy() {
  35715. super.destroy();
  35716. }
  35717. /**
  35718. * @function FindMTSPPathsService..prototype.processAsync
  35719. * @description 负责将客户端的查询参数传递到服务端。
  35720. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类
  35721. */
  35722. processAsync(params) {
  35723. if (!(params instanceof FindMTSPPathsParameters)) {
  35724. return;
  35725. }
  35726. var me = this,
  35727. jsonObject,
  35728. //end = me.url.substr(me.url.length - 1, 1),
  35729. centers = me.getJson(params.isAnalyzeById, params.centers),
  35730. nodes = me.getJson(params.isAnalyzeById, params.nodes);
  35731. me.url = Util_Util.urlPathAppend(me.url, 'mtsppath');
  35732. jsonObject = {
  35733. centers: centers,
  35734. nodes: nodes,
  35735. parameter: Util_Util.toJSON(params.parameter),
  35736. hasLeastTotalCost: params.hasLeastTotalCost
  35737. };
  35738. me.request({
  35739. method: "GET",
  35740. params: jsonObject,
  35741. scope: me,
  35742. success: me.serviceProcessCompleted,
  35743. failure: me.serviceProcessFailed
  35744. });
  35745. }
  35746. /**
  35747. * @function FindMTSPPathsService.prototype.getJson
  35748. * @description 将对象转化为JSON字符串。
  35749. * @param {boolean} isAnalyzeById - 是否通过id分析
  35750. * @param {Array} params - 需要转换的数字
  35751. * @returns {Object} 转化后的JSON字符串。
  35752. */
  35753. getJson(isAnalyzeById, params) {
  35754. var jsonString = "[",
  35755. len = params ? params.length : 0;
  35756. if (isAnalyzeById === false) {
  35757. for (let i = 0; i < len; i++) {
  35758. if (i > 0) {
  35759. jsonString += ",";
  35760. }
  35761. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  35762. }
  35763. } else if (isAnalyzeById === true) {
  35764. for (let i = 0; i < len; i++) {
  35765. if (i > 0) {
  35766. jsonString += ",";
  35767. }
  35768. jsonString += params[i];
  35769. }
  35770. }
  35771. jsonString += ']';
  35772. return jsonString;
  35773. }
  35774. /**
  35775. * @function FindMTSPPathsService.prototype.toGeoJSONResult
  35776. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  35777. * @param {Object} result - 服务器返回的结果对象。
  35778. */
  35779. toGeoJSONResult(result) {
  35780. if (!result || !result.pathList) {
  35781. return null;
  35782. }
  35783. var geoJSONFormat = new GeoJSON();
  35784. result.pathList.map(function (path) {
  35785. if (path.route) {
  35786. path.route = geoJSONFormat.toGeoJSON(path.route);
  35787. }
  35788. if (path.pathGuideItems) {
  35789. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  35790. }
  35791. if (path.edgeFeatures) {
  35792. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  35793. }
  35794. if (path.nodeFeatures) {
  35795. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  35796. }
  35797. return path;
  35798. });
  35799. return result;
  35800. }
  35801. }
  35802. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathParameters.js
  35803. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35804. * This program are made available under the terms of the Apache License, Version 2.0
  35805. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35806. /**
  35807. * @class FindPathParameters
  35808. * @deprecatedclass SuperMap.FindPathParameters
  35809. * @category iServer NetworkAnalyst Path
  35810. * @classdesc 最佳路径分析参数类。最佳路径是在网络数据集中指定一些结点,按照顺序访问结点从而求解起止点之间阻抗最小的路径。
  35811. * 例如如果要顺序访问 1、2、3、4 四个结点,则需要分别找到1、2结点间的最佳路径 R1—2,2、3 间的最佳路径 R2—3 和 3、4 结点间的最佳路径 R3—4,
  35812. * 顺序访问 1、2、3、4 四个结点的最佳路径就是 R = R1—2 + R2—3 + R3—4。
  35813. * 阻抗就是指从一点到另一点的耗费,在实际应用中我们可以将距离、时间、花费等作为阻抗条件。
  35814. * 阻抗最小也就可以理解为从一点到另一点距离最短、时间最少、花费最低等。当两点间距离最短时为最短路径,它是最佳路径问题的一个特例。
  35815. * 阻抗值通过 {@link TransportationAnalystParameter#weightFieldName}设置。
  35816. * 计算最佳路径除了受阻抗影响外,还受转向字段的影响。转向值通过 {@link TransportationAnalystParameter#turnWeightField} 设置。
  35817. *
  35818. * @param {Object} options - 参数。
  35819. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 最佳路径分析经过的结点或设施点数组。该字段至少包含两个点。
  35820. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  35821. * @param {boolean} [options.hasLeastEdgeCount=false] - 是否按照弧段数最少的进行最佳路径分析。
  35822. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  35823. * @usage
  35824. */
  35825. class FindPathParameters {
  35826. constructor(options) {
  35827. /**
  35828. * @member {boolean} [FindPathParameters.prototype.isAnalyzeById=false]
  35829. * @description 是否通过节点 ID 指定路径分析的结点。
  35830. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  35831. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindPathParameters.nodes = [ID1,ID2,...];
  35832. * 反之表示通过结点坐标指定途经点,即 FindPathParameters.nodes = [{x1,y1},{x2,y2},...] 。
  35833. */
  35834. this.isAnalyzeById = false;
  35835. /**
  35836. * @member {boolean} [FindPathParameters.prototype.hasLeastEdgeCount=false]
  35837. * @description 是否按照弧段数最少的进行最佳路径分析。
  35838. * true 表示按照弧段数最少进行分析,返回弧段数最少的路径中一个阻抗最小的最佳路径;
  35839. * false 表示直接返回阻抗最小的路径,而不考虑弧段的多少。
  35840. */
  35841. this.hasLeastEdgeCount = null;
  35842. /**
  35843. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindPathParameters.prototype.nodes
  35844. * @description 最佳路径分析经过的结点或设施点数组,必设字段。该字段至少包含两个点。
  35845. * 当 FindPathParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  35846. * 当 FindPathParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  35847. */
  35848. this.nodes = null;
  35849. /**
  35850. * @member {TransportationAnalystParameter} FindPathParameters.prototype.parameter
  35851. * @description 交通网络分析通用参数。
  35852. */
  35853. this.parameter = new TransportationAnalystParameter();
  35854. Util_Util.extend(this, options);
  35855. this.CLASS_NAME = "SuperMap.FindPathParameters";
  35856. }
  35857. /**
  35858. * @function FindPathParameters.prototype.destroy
  35859. * @description 释放资源,将引用资源的属性置空。
  35860. */
  35861. destroy() {
  35862. var me = this;
  35863. me.isAnalyzeById = null;
  35864. me.hasLeastEdgeCount = null;
  35865. me.nodes = null;
  35866. if (me.parameter) {
  35867. me.parameter.destroy();
  35868. me.parameter = null;
  35869. }
  35870. }
  35871. }
  35872. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathService.js
  35873. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35874. * This program are made available under the terms of the Apache License, Version 2.0
  35875. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35876. /**
  35877. * @class FindPathService
  35878. * @deprecatedclass SuperMap.FindPathService
  35879. * @category iServer NetworkAnalyst Path
  35880. * @classdesc 最佳路径分析服务类。
  35881. * 最佳路径是在网络数据集中指定一些节点,按照节点的选择顺序,
  35882. * 顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  35883. * 该类负责将客户端指定的最佳路径分析参数传递给服务端,并接收服务端返回的结果数据。
  35884. * 最佳路径分析结果通过该类支持的事件的监听函数参数获取
  35885. * @extends {NetworkAnalystServiceBase}
  35886. * @example
  35887. * var myFindPathService = new FindPathService(url, {
  35888. * eventListeners: {
  35889. * "processCompleted": findPathCompleted,
  35890. * "processFailed": findPathError
  35891. * }
  35892. * });
  35893. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  35894. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  35895. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  35896. * @param {Object} options - 参数。
  35897. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  35898. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35899. * @param {Object} [options.headers] - 请求头。
  35900. * @usage
  35901. */
  35902. class FindPathService extends NetworkAnalystServiceBase {
  35903. constructor(url, options) {
  35904. super(url, options);
  35905. this.CLASS_NAME = "SuperMap.FindPathService";
  35906. }
  35907. /**
  35908. * @function FindPathService.prototype.destroy
  35909. * @override
  35910. */
  35911. destroy() {
  35912. super.destroy();
  35913. }
  35914. /**
  35915. * @function FindPathService.prototype.processAsync
  35916. * @description 负责将客户端的查询参数传递到服务端。
  35917. * @param {FindPathParameters} params - 最佳路径分析服务参数类
  35918. */
  35919. processAsync(params) {
  35920. if (!(params instanceof FindPathParameters)) {
  35921. return;
  35922. }
  35923. var me = this, jsonObject;
  35924. me.url = Util_Util.urlPathAppend(me.url, 'path');
  35925. jsonObject = {
  35926. hasLeastEdgeCount: params.hasLeastEdgeCount,
  35927. parameter: Util_Util.toJSON(params.parameter),
  35928. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  35929. };
  35930. me.request({
  35931. method: "GET",
  35932. params: jsonObject,
  35933. scope: me,
  35934. success: me.serviceProcessCompleted,
  35935. failure: me.serviceProcessFailed
  35936. });
  35937. }
  35938. /**
  35939. * @function FindPathService.prototype.getJson
  35940. * @description 将对象转化为JSON字符串。
  35941. * @param {boolean} isAnalyzeById - 是否通过id分析
  35942. * @param {Array} params - 需要转换的数字
  35943. * @returns {Object} 转化后的JSON字符串。
  35944. */
  35945. getJson(isAnalyzeById, params) {
  35946. var jsonString = "[",
  35947. len = params ? params.length : 0;
  35948. if (isAnalyzeById === false) {
  35949. for (let i = 0; i < len; i++) {
  35950. if (i > 0) {
  35951. jsonString += ",";
  35952. }
  35953. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  35954. }
  35955. } else if (isAnalyzeById === true) {
  35956. for (let i = 0; i < len; i++) {
  35957. if (i > 0) {
  35958. jsonString += ",";
  35959. }
  35960. jsonString += params[i];
  35961. }
  35962. }
  35963. jsonString += ']';
  35964. return jsonString;
  35965. }
  35966. /**
  35967. * @function FindMTSPPathsService.prototype.toGeoJSONResult
  35968. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  35969. * @param {Object} result - 服务器返回的结果对象。
  35970. */
  35971. toGeoJSONResult(result) {
  35972. if (!result || !result.pathList || result.pathList.length < 1) {
  35973. return null;
  35974. }
  35975. var geoJSONFormat = new GeoJSON();
  35976. result.pathList.forEach(function (path) {
  35977. if (path.route) {
  35978. path.route = geoJSONFormat.toGeoJSON(path.route);
  35979. }
  35980. if (path.pathGuideItems) {
  35981. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  35982. }
  35983. if (path.edgeFeatures) {
  35984. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  35985. }
  35986. if (path.nodeFeatures) {
  35987. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  35988. }
  35989. });
  35990. return result;
  35991. }
  35992. }
  35993. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasParameters.js
  35994. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35995. * This program are made available under the terms of the Apache License, Version 2.0
  35996. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35997. /**
  35998. * @class FindServiceAreasParameters
  35999. * @deprecatedclass SuperMap.FindServiceAreasParameters
  36000. * @category iServer NetworkAnalyst ServiceArea
  36001. * @classdesc 服务区分析参数类。
  36002. * 服务区分析是以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  36003. * 例如:计算某快餐店能够在30分钟内送达快餐的区域。
  36004. * @param {Object} options - 参数。
  36005. * @param {Array.<number>} options.weights - 每个服务站点提供服务的阻力半径,超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  36006. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 服务站点数组。
  36007. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  36008. * @param {boolean} [options.isCenterMutuallyExclusive=false] - 是否中心点互斥。
  36009. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分析。
  36010. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  36011. * @usage
  36012. */
  36013. class FindServiceAreasParameters {
  36014. constructor(options) {
  36015. /**
  36016. * @member {boolean} [FindServiceAreasParameters.prototype.isAnalyzeById=false]
  36017. * @description 是否通过节点 ID 指定路径分析的结点。
  36018. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  36019. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindServiceAreasParameters.centers = [ID1,ID2,...];
  36020. * 反之表示通过结点坐标指定途经点,即 FindServiceAreasParameters.centers = [{x1,y1},{x2,y2},...]。
  36021. */
  36022. this.isAnalyzeById = false;
  36023. /**
  36024. * @member {boolean} [FindServiceAreasParameters.prototype.isCenterMutuallyExclusive=false]
  36025. * @description 是否中心点互斥,即按照中心点的距离进行判断是否要进行互斥处理。
  36026. * 若分析出的服务区有重叠的部分,则通过设置该参数进行互斥处理。
  36027. */
  36028. this.isCenterMutuallyExclusive = false;
  36029. /**
  36030. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindServiceAreasParameters.prototype.centers
  36031. * @description 服务站点数组。
  36032. * 当该类的 iSAnalyzeById = true 时,通过结点 ID 号指定服务站点;当 iSAnalyzeById = false 时,通过点坐标指定服务站点。
  36033. */
  36034. this.centers = null;
  36035. /**
  36036. * @member {boolean} [FindServiceAreasParameters.prototype.isFromCenter=false]
  36037. * @description 是否从中心点开始分析。
  36038. * 从中心点开始分析和不从中心点开始分析,体现了服务中心和需要该服务的需求地的关系模式。
  36039. * 从中心点开始分析,是一个服务中心向服务需求地提供服务;
  36040. * 而不从中心点开始分析,是一个服务需求地主动到服务中心获得服务。
  36041. */
  36042. this.isFromCenter = false;
  36043. /**
  36044. * APIProperty: weights
  36045. * @member {Array.<number>} FindServiceAreasParameters.prototype.weights
  36046. * @description 每个服务站点提供服务的阻力半径,即超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  36047. * 该字段为一个数组,数组长度跟服务中心个数一致,按照索引顺序与站点一一对应,每个元素表示了在对每个服务中心进行服务区分析时,所用的服务半径。
  36048. */
  36049. this.weights = null;
  36050. /**
  36051. * @member {TransportationAnalystParameter} FindServiceAreasParameters.prototype.parameter
  36052. * @description 交通网络分析通用参数。
  36053. */
  36054. this.parameter = new TransportationAnalystParameter();
  36055. Util_Util.extend(this, options);
  36056. this.CLASS_NAME = "SuperMap.FindServiceAreasParameters";
  36057. }
  36058. /**
  36059. * @function FindServiceAreasParameters.prototype.destroy
  36060. * @description 释放资源,将引用资源的属性置空。
  36061. */
  36062. destroy() {
  36063. var me = this;
  36064. me.isAnalyzeById = null;
  36065. me.isCenterMutuallyExclusive = null;
  36066. me.centers = null;
  36067. me.isFromCenter = null;
  36068. me.weights = null;
  36069. if (me.parameter) {
  36070. me.parameter.destroy();
  36071. me.parameter = null;
  36072. }
  36073. }
  36074. }
  36075. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasService.js
  36076. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36077. * This program are made available under the terms of the Apache License, Version 2.0
  36078. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36079. /**
  36080. * @class FindServiceAreasService
  36081. * @deprecatedclass SuperMap.FindServiceAreasService
  36082. * @category iServer NetworkAnalyst ServiceArea
  36083. * @classdesc 服务区分析服务类。
  36084. * 服务区分析是以指定服务站点为中心,
  36085. * 在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  36086. * 该类负责将客户端指定的服务区分析参数传递给服务端,并接收服务端返回的结果数据。
  36087. * 服务区分析结果通过该类支持的事件的监听函数参数获取
  36088. * @extends {NetworkAnalystServiceBase}
  36089. * @example
  36090. * var myFindServiceAreasService = new FindServiceAreasService(url, {
  36091. * eventListeners: {
  36092. * "processCompleted": findServiceAreasCompleted,
  36093. * "processFailed": findServiceAreasError
  36094. * }
  36095. * });
  36096. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  36097. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  36098. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  36099. * @param {Object} options - 互服务时所需可选参数。如:
  36100. * @param {Object} options.eventListeners - 需要被注册的监听器对象
  36101. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36102. * @param {Object} [options.headers] - 请求头。
  36103. * @usage
  36104. */
  36105. class FindServiceAreasService extends NetworkAnalystServiceBase {
  36106. constructor(url, options) {
  36107. super(url, options);
  36108. this.CLASS_NAME = "SuperMap.FindServiceAreasService";
  36109. }
  36110. /**
  36111. * @function FindServiceAreasService.prototype.destroy
  36112. * @override
  36113. */
  36114. destroy() {
  36115. super.destroy();
  36116. }
  36117. /**
  36118. * @function FindServiceAreasService.prototype.processAsync
  36119. * @description 负责将客户端的查询参数传递到服务端。
  36120. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类
  36121. */
  36122. processAsync(params) {
  36123. if (!(params instanceof FindServiceAreasParameters)) {
  36124. return;
  36125. }
  36126. var me = this, jsonObject;
  36127. me.url = Util_Util.urlPathAppend(me.url, 'servicearea');
  36128. jsonObject = {
  36129. isFromCenter: params.isFromCenter,
  36130. isCenterMutuallyExclusive: params.isCenterMutuallyExclusive,
  36131. parameter: Util_Util.toJSON(params.parameter),
  36132. centers: me.getJson(params.isAnalyzeById, params.centers),
  36133. weights: me.getJson(true, params.weights)
  36134. };
  36135. me.request({
  36136. method: "GET",
  36137. params: jsonObject,
  36138. scope: me,
  36139. success: me.serviceProcessCompleted,
  36140. failure: me.serviceProcessFailed
  36141. });
  36142. }
  36143. /**
  36144. * @function FindServiceAreasService.prototype.getJson
  36145. * @description 将对象转化为JSON字符串。
  36146. * @param {boolean} isAnalyzeById - 是否通过id分析
  36147. * @param {Array} params - 需要转换的数字
  36148. * @returns {Object} 转化后的JSON字符串。
  36149. */
  36150. getJson(isAnalyzeById, params) {
  36151. var jsonString = "[",
  36152. len = params ? params.length : 0;
  36153. if (isAnalyzeById === false) {
  36154. for (let i = 0; i < len; i++) {
  36155. if (i > 0) {
  36156. jsonString += ",";
  36157. }
  36158. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  36159. }
  36160. } else if (isAnalyzeById === true) {
  36161. for (let i = 0; i < len; i++) {
  36162. if (i > 0) {
  36163. jsonString += ",";
  36164. }
  36165. jsonString += params[i];
  36166. }
  36167. }
  36168. jsonString += ']';
  36169. return jsonString;
  36170. }
  36171. /**
  36172. * @function FindServiceAreasService.prototype.toGeoJSONResult
  36173. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  36174. * @param {Object} result - 服务器返回的结果对象。
  36175. */
  36176. toGeoJSONResult(result) {
  36177. if (!result || !result.serviceAreaList) {
  36178. return result;
  36179. }
  36180. var geoJSONFormat = new GeoJSON();
  36181. result.serviceAreaList.map(function (serviceArea) {
  36182. if (serviceArea.serviceRegion) {
  36183. serviceArea.serviceRegion = geoJSONFormat.toGeoJSON(serviceArea.serviceRegion);
  36184. }
  36185. if (serviceArea.edgeFeatures) {
  36186. serviceArea.edgeFeatures = geoJSONFormat.toGeoJSON(serviceArea.edgeFeatures);
  36187. }
  36188. if (serviceArea.nodeFeatures) {
  36189. serviceArea.nodeFeatures = geoJSONFormat.toGeoJSON(serviceArea.nodeFeatures);
  36190. }
  36191. if (serviceArea.routes) {
  36192. serviceArea.routes = geoJSONFormat.toGeoJSON(serviceArea.routes);
  36193. }
  36194. return serviceArea;
  36195. });
  36196. return result;
  36197. }
  36198. }
  36199. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsParameters.js
  36200. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36201. * This program are made available under the terms of the Apache License, Version 2.0
  36202. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36203. /**
  36204. * @class FindTSPPathsParameters
  36205. * @deprecatedclass SuperMap.FindTSPPathsParameters
  36206. * @category iServer NetworkAnalyst TSPPath
  36207. * @classdesc 旅行商分析参数类。
  36208. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  36209. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  36210. * 旅行商分析和最佳路径分析都是在网络中寻找遍历所有站点的最经济的路径,区别是在遍历网络所有站点的过程中对结点访问顺序不同。
  36211. * 最佳路径分析必须按照指定顺序对站点进行访问,而旅行商分析是无序的路径分析。
  36212. * @param {Object} options - 参数。
  36213. * @param {boolean} [options.endNodeAssigned=false] - 是否指定终止点,将指定的途经点的最后一个点作为终止点。true 表示指定终止点,则旅行商必须最后一个访问终止点。
  36214. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点。
  36215. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
  36216. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  36217. * @usage
  36218. */
  36219. class FindTSPPathsParameters {
  36220. constructor(options) {
  36221. /**
  36222. * @member {boolean} [FindTSPPathsParameters.prototype.endNodeAssigned=false]
  36223. * @description 是否指定终止点,将指定的途经点的最后一个点作为终止点。
  36224. * true 表示指定终止点,则旅行商必须最后一个访问终止点。
  36225. */
  36226. this.endNodeAssigned = false;
  36227. /**
  36228. * @member {boolean} [FindTSPPathsParameters.prototype.isAnalyzeById=false]
  36229. * @description 是否通过节点 ID 号来指定途经点。
  36230. */
  36231. this.isAnalyzeById = false;
  36232. /**
  36233. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindTSPPathsParameters.prototype.nodes
  36234. * @description 旅行商分析途经点数组。
  36235. * 当 FindTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  36236. * 当 FindTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  36237. */
  36238. this.nodes = null;
  36239. /**
  36240. * @member {TransportationAnalystParameter} [FindTSPPathsParameters.prototype.parameter]
  36241. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  36242. * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting
  36243. * 字段,则返回结果空间信息等都为空。
  36244. */
  36245. this.parameter = new TransportationAnalystParameter();
  36246. Util_Util.extend(this, options);
  36247. this.CLASS_NAME = "SuperMap.FindTSPPathsParameters";
  36248. }
  36249. /**
  36250. * @function FindTSPPathsParameters.prototype.destroy
  36251. * @description 释放资源,将引用资源的属性置空。
  36252. */
  36253. destroy() {
  36254. var me = this;
  36255. me.endNodeAssigned = null;
  36256. me.isAnalyzeById = null;
  36257. me.nodes = null;
  36258. if (me.parameter) {
  36259. me.parameter.destroy();
  36260. me.parameter = null;
  36261. }
  36262. }
  36263. }
  36264. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsService.js
  36265. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36266. * This program are made available under the terms of the Apache License, Version 2.0
  36267. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36268. /**
  36269. * @class FindTSPPathsService
  36270. * @deprecatedclass SuperMap.FindTSPPathsService
  36271. * @category iServer NetworkAnalyst TSPPath
  36272. * @classdesc 旅行商分析服务类
  36273. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  36274. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  36275. * 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  36276. * 旅行商分析结果通过该类支持的事件的监听函数参数获取
  36277. * @extends {NetworkAnalystServiceBase}
  36278. * @example
  36279. * (start code)
  36280. * var myFindTSPPathsService = new FindTSPPathsService(url, {
  36281. * eventListeners: {
  36282. * "processCompleted": findTSPPathsCompleted,
  36283. * "processFailed": findTSPPathsError
  36284. * }
  36285. * });
  36286. * (end)
  36287. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  36288. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  36289. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  36290. * @param {Object} options - 参数。
  36291. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  36292. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36293. * @param {Object} [options.headers] - 请求头。
  36294. * @usage
  36295. */
  36296. class FindTSPPathsService extends NetworkAnalystServiceBase {
  36297. constructor(url, options) {
  36298. super(url, options);
  36299. this.CLASS_NAME = "SuperMap.FindTSPPathsService";
  36300. }
  36301. /**
  36302. * @function FindTSPPathsService.prototype.destroy
  36303. * @override
  36304. */
  36305. destroy() {
  36306. super.destroy();
  36307. }
  36308. /**
  36309. * @function FindTSPPathsService.prototype.processAsync
  36310. * @description 负责将客户端的查询参数传递到服务端。
  36311. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  36312. */
  36313. processAsync(params) {
  36314. if (!(params instanceof FindTSPPathsParameters)) {
  36315. return;
  36316. }
  36317. var me = this, jsonObject;
  36318. me.url = Util_Util.urlPathAppend(me.url, 'tsppath');
  36319. jsonObject = {
  36320. parameter: Util_Util.toJSON(params.parameter),
  36321. endNodeAssigned: params.endNodeAssigned,
  36322. nodes: me.getNodesJson(params)
  36323. };
  36324. me.request({
  36325. method: "GET",
  36326. params: jsonObject,
  36327. scope: me,
  36328. success: me.serviceProcessCompleted,
  36329. failure: me.serviceProcessFailed
  36330. });
  36331. }
  36332. /**
  36333. * @function FindTSPPathsService.prototype.getNodesJson
  36334. * @description 将节点对象转化为JSON字符串。
  36335. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  36336. * @returns {string} 转化后的JSON字符串。
  36337. */
  36338. getNodesJson(params) {
  36339. var jsonParameters = "", nodesString, i, len, nodes;
  36340. if (params.isAnalyzeById === false) {
  36341. for (nodesString = "[", i = 0, nodes = params.nodes, len = nodes.length; i < len; i++) {
  36342. if (i > 0) {
  36343. nodesString += ",";
  36344. }
  36345. nodesString += '{"x":' + nodes[i].x + ',"y":' + nodes[i].y + '}';
  36346. }
  36347. nodesString += ']';
  36348. jsonParameters += nodesString;
  36349. } else if (params.isAnalyzeById === true) {
  36350. let nodeIDsString = "[", nodes = params.nodes, len = nodes.length;
  36351. for (let i = 0; i < len; i++) {
  36352. if (i > 0) {
  36353. nodeIDsString += ",";
  36354. }
  36355. nodeIDsString += nodes[i];
  36356. }
  36357. nodeIDsString += ']';
  36358. jsonParameters += nodeIDsString;
  36359. }
  36360. return jsonParameters;
  36361. }
  36362. /**
  36363. * @function FindTSPPathsService.prototype.toGeoJSONResult
  36364. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  36365. * @param {Object} result - 服务器返回的结果对象。
  36366. */
  36367. toGeoJSONResult(result) {
  36368. if (!result || !result.tspPathList) {
  36369. return null;
  36370. }
  36371. var geoJSONFormat = new GeoJSON();
  36372. result.tspPathList.forEach(function (path) {
  36373. if (path.route) {
  36374. path.route = geoJSONFormat.toGeoJSON(path.route);
  36375. }
  36376. if (path.pathGuideItems) {
  36377. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  36378. }
  36379. if (path.edgeFeatures) {
  36380. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  36381. }
  36382. if (path.nodeFeatures) {
  36383. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  36384. }
  36385. });
  36386. return result;
  36387. }
  36388. }
  36389. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataParameters.js
  36390. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36391. * This program are made available under the terms of the Apache License, Version 2.0
  36392. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36393. /**
  36394. * @class GenerateSpatialDataParameters
  36395. * @deprecatedclass SuperMap.GenerateSpatialDataParameters
  36396. * @category iServer SpatialAnalyst GenerateSpatialData
  36397. * @classdesc 动态分段操作参数类。通过该类可以为动态分段提供参数信息。
  36398. * @param {Object} options - 参数。
  36399. * @param {string} options.routeTable - 路由数据集。
  36400. * @param {string} options.routeIDField - 路由数据集的标识字段。
  36401. * @param {string} options.eventTable - 用于生成空间数据的事件表名。
  36402. * @param {DataReturnOption} options.dataReturnOption - 设置数据返回选项。
  36403. * @param {string} [options.attributeFilter] - 属性过滤条件。
  36404. * @param {string} options.eventRouteIDField - 用于生成空间数据的事件表的路由标识字段。
  36405. * @param {string} [options.measureField] - 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  36406. * @param {string} [options.measureStartField] - 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  36407. * @param {string} [options.measureEndField] - 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  36408. * @param {string} [options.measureOffsetField] - 刻度偏移量字段。
  36409. * @param {string} [options.errorInfoField] - 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  36410. * @param {Array.<string>} [options.retainedFields] - 欲保留到结果空间数据中的字段集合(系统字段除外)。
  36411. * @usage
  36412. */
  36413. class GenerateSpatialDataParameters {
  36414. constructor(options) {
  36415. /**
  36416. * @member {string} GenerateSpatialDataParameters.prototype.routeTable
  36417. * @description 路由数据集。
  36418. */
  36419. this.routeTable = null;
  36420. /**
  36421. * @member {string} GenerateSpatialDataParameters.prototype.routeIDField
  36422. * @description 路由数据集的标识字段。
  36423. */
  36424. this.routeIDField = null;
  36425. /**
  36426. * @member {string} [GenerateSpatialDataParameters.prototype.attributeFilter]
  36427. * @description 属性过滤条件。
  36428. * 当 {@link GenerateSpatialDataParameters.prototype.dataReturnOption.dataReturnMode} 为 {@link DataReturnMode.DATASET_AND_RECORDSET} 或 {@link DataReturnMode.RECORDSET_ONLY} 时有效。
  36429. */
  36430. this.attributeFilter = null;
  36431. /**
  36432. * @member {string} GenerateSpatialDataParameters.prototype.eventTable
  36433. * @description 用于生成空间数据的事件表名。
  36434. */
  36435. this.eventTable = null;
  36436. /**
  36437. * @member {string} GenerateSpatialDataParameters.prototype.eventRouteIDField
  36438. * @description 用于生成空间数据的事件表的路由标识字段。
  36439. */
  36440. this.eventRouteIDField = null;
  36441. /**
  36442. * @member {string} [GenerateSpatialDataParameters.prototype.measureField]
  36443. * @description 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  36444. */
  36445. this.measureField = null;
  36446. /**
  36447. * @member {string} [GenerateSpatialDataParameters.prototype.measureStartField]
  36448. * @description 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  36449. */
  36450. this.measureStartField = null;
  36451. /**
  36452. * @member {string} [GenerateSpatialDataParameters.prototype.measureEndField]
  36453. * @description 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  36454. */
  36455. this.measureEndField = null;
  36456. /**
  36457. * @member {string} [GenerateSpatialDataParameters.prototype.measureOffsetField]
  36458. * @description 刻度偏移量字段。
  36459. */
  36460. this.measureOffsetField = null;
  36461. /**
  36462. * @member {string} [GenerateSpatialDataParameters.prototype.errorInfoField]
  36463. * @description 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  36464. */
  36465. this.errorInfoField = null;
  36466. /**
  36467. * @member {Array.<string>} [GenerateSpatialDataParameters.prototype.retainedFields]
  36468. * @description 欲保留到结果空间数据中的字段集合(系统字段除外)。
  36469. * 生成空间数据时,无论是否指定保留字段,路由 ID 字段、刻度偏移量字段、刻度值字段(点事件为刻度字段,线事件是起始和终止刻度字段)都会保留到结果空间数据中;
  36470. * 如果没有指定 retainedFields 参数或者 retainedFields 参数数组长度为 0,则返回所有用户字段。
  36471. */
  36472. this.retainedFields = null;
  36473. /**
  36474. * @member {DataReturnOption} GenerateSpatialDataParameters.prototype.dataReturnOption
  36475. * @description 设置数据返回的选项。
  36476. */
  36477. this.dataReturnOption = null;
  36478. if (options) {
  36479. Util_Util.extend(this, options);
  36480. }
  36481. this.CLASS_NAME = "SuperMap.GenerateSpatialDataParameters";
  36482. }
  36483. /**
  36484. * @function GenerateSpatialDataParameters.prototype.destroy
  36485. * @description 释放资源,将引用资源的属性置空。
  36486. */
  36487. destroy() {
  36488. var me = this;
  36489. if (me.routeTable) {
  36490. me.routeTable = null;
  36491. }
  36492. me.routeIDField = null;
  36493. me.attributeFilter = null;
  36494. me.eventTable = null;
  36495. me.eventRouteIDField = null;
  36496. me.measureField = null;
  36497. me.measureStartField = null;
  36498. me.measureEndField = null;
  36499. me.measureOffsetField = null;
  36500. me.errorInfoField = null;
  36501. if (me.dataReturnOption) {
  36502. me.dataReturnOption.destroy();
  36503. me.dataReturnOption = null;
  36504. }
  36505. }
  36506. }
  36507. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataService.js
  36508. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36509. * This program are made available under the terms of the Apache License, Version 2.0
  36510. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36511. /**
  36512. * @class GenerateSpatialDataService
  36513. * @deprecatedclass SuperMap.GenerateSpatialDataService
  36514. * @category iServer SpatialAnalyst GenerateSpatialData
  36515. * @classdesc 动态分段分析服务类。该类负责将客户设置的动态分段分析服务参数传递给服务端,并接收服务端返回的动态分段分析结果数据。
  36516. * 获取的结果数据包括 originResult 、result 两种,其中,originResult 为服务端返回的用 JSON 对象表示的动态分段分析结果数据,result 为服务端返回的动态分段分析结果数据。
  36517. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  36518. * @param {Object} options - 参数。</br>
  36519. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  36520. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36521. * @param {Object} [options.headers] - 请求头。
  36522. * @extends {SpatialAnalystBase}
  36523. * @example 实例化该类如下例所示:
  36524. * (start code)
  36525. * function GenerateSpatialData(){
  36526. *
  36527. * //配置数据返回选项(option)
  36528. * var option = new DataReturnOption({
  36529. * expectCount: 1000,
  36530. * dataset: "generateSpatialData",
  36531. * deleteExistResultDataset: true,
  36532. * dataReturnMode: DataReturnMode.DATASET_ONLY
  36533. * }),
  36534. * //配置动态分段参数(Parameters)
  36535. * parameters = new GenerateSpatialDataParameters({
  36536. * routeTable: "RouteDT_road@Changchun",
  36537. * routeIDField: "RouteID",
  36538. * eventTable: "LinearEventTabDT@Changchun",
  36539. * eventRouteIDField: "RouteID",
  36540. * measureField: "",
  36541. * measureStartField: "LineMeasureFrom",
  36542. * measureEndField: "LineMeasureTo",
  36543. * measureOffsetField: "",
  36544. * errorInfoField: "",
  36545. * retainedFields:[],
  36546. * dataReturnOption: option
  36547. * }),
  36548. * //配置动态分段iService
  36549. * iService = new GenerateSpatialDataService(Changchun_spatialanalyst, {
  36550. * eventListeners: {
  36551. * processCompleted: generateCompleted,
  36552. * processFailed: generateFailded
  36553. * }
  36554. * });
  36555. * //执行
  36556. * iService.processAsync(parameters);
  36557. * function Completed(generateSpatialDataEventArgs){//todo};
  36558. * function Error(generateSpatialDataEventArgs){//todo};
  36559. * (end)
  36560. * @usage
  36561. */
  36562. class GenerateSpatialDataService extends SpatialAnalystBase {
  36563. constructor(url, options) {
  36564. super(url, options);
  36565. this.CLASS_NAME = "SuperMap.GenerateSpatialDataService";
  36566. }
  36567. /**
  36568. * @function GenerateSpatialDataService.prototype.destroy
  36569. * @override
  36570. */
  36571. destroy() {
  36572. super.destroy();
  36573. }
  36574. /**
  36575. * @function GenerateSpatialDataService.prototype.processAsync
  36576. * @description 负责将客户端的动态分段服务参数传递到服务端。
  36577. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  36578. */
  36579. processAsync(params) {
  36580. if (!(params instanceof GenerateSpatialDataParameters)) {
  36581. return;
  36582. }
  36583. var me = this,
  36584. jsonParameters;
  36585. jsonParameters = me.getJsonParameters(params);
  36586. me.request({
  36587. method: "POST",
  36588. data: jsonParameters,
  36589. scope: me,
  36590. success: me.serviceProcessCompleted,
  36591. failure: me.serviceProcessFailed
  36592. });
  36593. }
  36594. /**
  36595. * @function GenerateSpatialDataService.prototype.getJsonParameters
  36596. * @description 将参数转化为 JSON 字符串。
  36597. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  36598. * @returns {string}转化后的JSON字符串。
  36599. */
  36600. getJsonParameters(params) {
  36601. var jsonParameters = "",
  36602. jsonStr = "datasets/" + params.routeTable + "/linearreferencing/generatespatialdata",
  36603. me = this;
  36604. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  36605. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  36606. jsonParameters = Util_Util.toJSON(params);
  36607. return jsonParameters;
  36608. }
  36609. }
  36610. ;// CONCATENATED MODULE: ./src/common/iServer/GeoHashGridAggParameter.js
  36611. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36612. * This program are made available under the terms of the Apache License, Version 2.0
  36613. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36614. /**
  36615. * @class GeoHashGridAggParameter
  36616. * @deprecatedclass SuperMap.GeoHashGridAggParameter
  36617. * @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  36618. * @category iServer Data FeatureResults
  36619. * @param {Object} options - 可选参数。
  36620. * @param {number} [options.precision=5] - 精度。
  36621. * @extends {BucketAggParameter}
  36622. * @usage
  36623. */
  36624. class GeoHashGridAggParameter extends BucketAggParameter {
  36625. constructor(options) {
  36626. super();
  36627. /**
  36628. * @member {number} [GeoHashGridAggParameter.prototype.precision=5]
  36629. * @description 网格中数字的精度。
  36630. */
  36631. this.precision = 5;
  36632. Util_Util.extend(this, options);
  36633. /**
  36634. * @member {BucketAggType} [GeoHashGridAggParameter.prototype.aggType=BucketAggType.GEOHASH_GRID]
  36635. * @description 格网聚合类型。
  36636. */
  36637. this.aggType = BucketAggType.GEOHASH_GRID;
  36638. this.CLASS_NAME = 'SuperMap.GeoHashGridAggParameter';
  36639. }
  36640. destroy() {
  36641. super.destroy();
  36642. this.aggType = null;
  36643. this.precision = null;
  36644. }
  36645. /**
  36646. * @function GeoHashGridAggParameter.toJsonParameters
  36647. * @description 将对象转为 JSON 格式。
  36648. * @param param 转换对象。
  36649. * @returns {Object}
  36650. */
  36651. static toJsonParameters(param) {
  36652. var parameters = {
  36653. aggName: param.aggName,
  36654. aggFieldName: param.aggFieldName,
  36655. aggType: param.aggType,
  36656. precision: param.precision
  36657. };
  36658. return Util_Util.toJson(parameters);
  36659. }
  36660. }
  36661. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryOverlayAnalystParameters.js
  36662. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36663. * This program are made available under the terms of the Apache License, Version 2.0
  36664. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36665. /**
  36666. * @class GeometryOverlayAnalystParameters
  36667. * @deprecatedclass SuperMap.GeometryOverlayAnalystParameters
  36668. * @category iServer SpatialAnalyst OverlayAnalyst
  36669. * @classdesc
  36670. * 几何对象叠加分析参数类。对指定的某两个几何对象做叠加分析。通过该类可以指定要做叠加分析的几何对象、叠加操作类型。
  36671. * @param {Object} options - 参数。
  36672. * @param {GeoJSONObject} options.operateGeometry - 叠加分析的操作几何对象。<br>
  36673. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  36674. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link GeoJSONObject}。<br>
  36675. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link GeoJSONObject}。<br>
  36676. * @param {GeoJSONObject} options.sourceGeometry - 叠加分析的源几何对象。
  36677. * @param {Array.<GeoJSONFeature>} [options.operateGeometries] - 批量叠加分析的操作几何对象数组。
  36678. * @param {Array.<GeoJSONFeature>} [options.sourceGeometries] -批量叠加分析的源几何对象数组。
  36679. * @param {OverlayOperationType} [options.operation] - 叠加操作枚举值。
  36680. * @extends {OverlayAnalystParameters}
  36681. * @usage
  36682. */
  36683. class GeometryOverlayAnalystParameters extends OverlayAnalystParameters {
  36684. constructor(options) {
  36685. super(options);
  36686. if (options && options.operateGeometry) {
  36687. this.operateGeometry = options.operateGeometry;
  36688. }
  36689. if (options && options.sourceGeometry) {
  36690. this.sourceGeometry = options.sourceGeometry;
  36691. }
  36692. if (options && options.operateGeometries) {
  36693. this.operateGeometries = options.operateGeometries;
  36694. }
  36695. if (options && options.sourceGeometries) {
  36696. this.sourceGeometries = options.sourceGeometries;
  36697. }
  36698. if (options) {
  36699. Util_Util.extend(this, options);
  36700. }
  36701. this.CLASS_NAME = "SuperMap.GeometryOverlayAnalystParameters";
  36702. }
  36703. /**
  36704. * @function GeometryOverlayAnalystParameters.prototype.destroy
  36705. * @override
  36706. */
  36707. destroy() {
  36708. super.destroy();
  36709. var me = this;
  36710. if (me.sourceGeometry) {
  36711. me.sourceGeometry.destroy();
  36712. me.sourceGeometry = null;
  36713. }
  36714. if (me.sourceGeometries) {
  36715. me.sourceGeometries.destroy();
  36716. me.sourceGeometries = null;
  36717. }
  36718. if (me.sourceGeometry) {
  36719. me.sourceGeometry.destroy();
  36720. me.sourceGeometry = null;
  36721. }
  36722. if (me.operateGeometries) {
  36723. me.operateGeometries.destroy();
  36724. me.operateGeometries = null;
  36725. }
  36726. }
  36727. /**
  36728. * @function GeometryOverlayAnalystParameters.toObject
  36729. * @param {GeometryOverlayAnalystParameters} geometryOverlayAnalystParameters - 几何对象叠加分析参数类。
  36730. * @param {GeometryOverlayAnalystParameters} tempObj - 几何对象叠加分析参数对象。
  36731. * @description 将几何对象叠加分析参数对象转换为 JSON 对象。
  36732. * @returns {Object} JSON 对象。
  36733. */
  36734. static toObject(geometryOverlayAnalystParameters, tempObj) {
  36735. for (var name in geometryOverlayAnalystParameters) {
  36736. if (name === "sourceGeometry") {
  36737. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometry);
  36738. } else if (name === "sourceGeometries") {
  36739. var sourceGeometries = [];
  36740. for (var i = 0; i < geometryOverlayAnalystParameters.sourceGeometries.length; i++) {
  36741. sourceGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometries[i]));
  36742. }
  36743. tempObj.sourceGeometries = sourceGeometries;
  36744. } else if (name === "operateGeometry") {
  36745. tempObj.operateGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometry);
  36746. } else if (name === "operateGeometries") {
  36747. var operateGeometries = [];
  36748. for (var j = 0; j < geometryOverlayAnalystParameters.operateGeometries.length; j++) {
  36749. operateGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometries[j]));
  36750. }
  36751. tempObj.operateGeometries = operateGeometries;
  36752. } else {
  36753. tempObj[name] = geometryOverlayAnalystParameters[name];
  36754. }
  36755. }
  36756. }
  36757. }
  36758. ;// CONCATENATED MODULE: ./src/common/iServer/GeometrySurfaceAnalystParameters.js
  36759. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36760. * This program are made available under the terms of the Apache License, Version 2.0
  36761. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36762. /**
  36763. * @class GeometrySurfaceAnalystParameters
  36764. * @deprecatedclass SuperMap.GeometrySurfaceAnalystParameters
  36765. * @category iServer SpatialAnalyst SurfaceAnalyst
  36766. * @classdesc 几何对象表面分析参数类。该类对几何对象表面分析所用到的参数进行设置。
  36767. * @param {Object} options - 参数。
  36768. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 表面分析的坐标点数组。
  36769. * @param {Array.<number>} options.zValues - 表面分析的坐标点的 Z 值数组。
  36770. * @param {number} [options.resolution] - 获取或设置指定中间结果(栅格数据集)的分辨率。
  36771. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  36772. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  36773. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  36774. * @extends {SurfaceAnalystParameters}
  36775. * @usage
  36776. */
  36777. class GeometrySurfaceAnalystParameters extends SurfaceAnalystParameters {
  36778. constructor(options) {
  36779. super(options);
  36780. /**
  36781. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometrySurfaceAnalystParameters.prototype.points
  36782. * @description 获取或设置用于表面分析的坐标点数组。
  36783. */
  36784. this.points = null;
  36785. /**
  36786. * @member {Array.<number>} GeometrySurfaceAnalystParameters.prototype.zValues
  36787. * @description 获取或设置用于提取操作的值。提取等值线时,将使用该数组中的值,
  36788. * 对几何对象中的坐标点数组进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  36789. */
  36790. this.zValues = null;
  36791. if (options) {
  36792. Util_Util.extend(this, options);
  36793. }
  36794. this.CLASS_NAME = "SuperMap.GeometrySurfaceAnalystParameters";
  36795. }
  36796. /**
  36797. * @function GeometrySurfaceAnalystParameters.prototype.destroy
  36798. * @override
  36799. */
  36800. destroy() {
  36801. super.destroy();
  36802. var me = this;
  36803. if (me.points) {
  36804. for (var i = 0, points = me.points, len = points.length; i < len; i++) {
  36805. points[i].destroy();
  36806. }
  36807. me.points = null;
  36808. }
  36809. me.zValues = null;
  36810. }
  36811. }
  36812. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryThiessenAnalystParameters.js
  36813. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36814. * This program are made available under the terms of the Apache License, Version 2.0
  36815. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36816. /**
  36817. * @class GeometryThiessenAnalystParameters
  36818. * @deprecatedclass SuperMap.GeometryThiessenAnalystParameters
  36819. * @constructs GeometryThiessenAnalystParameters
  36820. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  36821. * @classdesc 几何对象泰森多边形分析参数类。对指定的某个几何对象做泰森多边形分析。通过该类可以指定要做泰森多边形分析的几何对象、返回数据集名称等。
  36822. * @param {Object} options - 参数。
  36823. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 使用点数组进行分析时使用的几何对象。
  36824. * @extends {ThiessenAnalystParameters}
  36825. * @usage
  36826. */
  36827. class GeometryThiessenAnalystParameters extends ThiessenAnalystParameters {
  36828. constructor(options) {
  36829. super(options);
  36830. /**
  36831. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometryThiessenAnalystParameters.prototype.points
  36832. * @description 使用点数组进行分析时使用的几何对象。
  36833. */
  36834. this.points = null;
  36835. if (options) {
  36836. Util_Util.extend(this, options);
  36837. }
  36838. this.CLASS_NAME = "SuperMap.GeometryThiessenAnalystParameters";
  36839. }
  36840. /**
  36841. * @function GeometryThiessenAnalystParameters.prototype.destroy
  36842. * @override
  36843. */
  36844. destroy() {
  36845. super.destroy();
  36846. var me = this;
  36847. if (me.points) {
  36848. for (var i = me.points.length - 1; i >= 0; i--) {
  36849. me.points[i].destroy();
  36850. }
  36851. me.points = null;
  36852. }
  36853. }
  36854. /**
  36855. * @function GeometryThiessenAnalystParameters.toObject
  36856. * @param {GeometryThiessenAnalystParameters} geometryThiessenAnalystParameters - 几何对象泰森多边形分析参数类。
  36857. * @param {GeometryThiessenAnalystParameters} tempObj - 几何对象泰森多边形分析参数对象。
  36858. * @description 将几何对象泰森多边形分析参数对象转换为 JSON 对象。
  36859. * @returns {Object} JSON 对象。
  36860. */
  36861. static toObject(geometryThiessenAnalystParameters, tempObj) {
  36862. for (var name in geometryThiessenAnalystParameters) {
  36863. if (name === "clipRegion") {
  36864. tempObj.clipRegion = ServerGeometry.fromGeometry(geometryThiessenAnalystParameters.clipRegion);
  36865. } else {
  36866. tempObj[name] = geometryThiessenAnalystParameters[name];
  36867. }
  36868. }
  36869. }
  36870. }
  36871. ;// CONCATENATED MODULE: ./src/common/iServer/GeoprocessingService.js
  36872. /**
  36873. * @class GeoprocessingService
  36874. * @deprecatedclass SuperMap.GeoprocessingService
  36875. * @category iServer ProcessingAutomationService
  36876. * @classdesc 处理自动化服务接口的基类。
  36877. * @version 10.1.0
  36878. * @extends {CommonServiceBase}
  36879. * @param {string} url - 服务地址。
  36880. * @param {Object} options - 参数。
  36881. * @param {Events} options.events - 处理所有事件的对象。
  36882. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  36883. * @usage
  36884. */
  36885. class GeoprocessingService_GeoprocessingService extends CommonServiceBase {
  36886. constructor(url, options) {
  36887. options = options || {};
  36888. options.EVENT_TYPES = ['processCompleted', 'processFailed', 'processRunning'];
  36889. super(url, options);
  36890. this.CLASS_NAME = 'SuperMap.GeoprocessingService';
  36891. this.headers = {};
  36892. this.crossOrigin = true;
  36893. this.eventCount = 0;
  36894. }
  36895. /**
  36896. * @function GeoprocessingService.prototype.getTools
  36897. * @description 获取处理自动化工具列表。
  36898. * @param {string} identifier - 处理自动化工具ID。
  36899. */
  36900. getTools(callback) {
  36901. this._processAsync({ url: `${this.url}/list`, callback });
  36902. }
  36903. /**
  36904. * @function GeoprocessingService.prototype.getTool
  36905. * @description 获取处理自动化工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  36906. * @param {string} identifier - 处理自动化工具ID。
  36907. */
  36908. getTool(identifier, callback) {
  36909. this._processAsync({ url: `${this.url}/${identifier}`, callback });
  36910. }
  36911. /**
  36912. * @function GeoprocessingService.prototype.execute
  36913. * @description 同步执行处理自动化工具。
  36914. * @param {string} identifier - 处理自动化工具ID。
  36915. * @param {Object} parameter - 处理自动化工具的输入参数。
  36916. * @param {Object} environment - 处理自动化工具的环境参数。
  36917. */
  36918. execute(identifier, parameter, environment, callback) {
  36919. parameter = parameter ? parameter : null;
  36920. environment = environment ? environment : null;
  36921. const executeParamter = { parameter, environment };
  36922. this._processAsync({ url: `${this.url}/${identifier}/execute`, executeParamter, callback });
  36923. }
  36924. /**
  36925. * @function GeoprocessingService.prototype.submitJob
  36926. * @description 异步执行处理自动化工具。
  36927. * @param {string} identifier - 处理自动化工具ID。
  36928. * @param {Object} parameter - 处理自动化工具的输入参数。
  36929. * @param {Object} environments - 处理自动化工具的环境参数。
  36930. */
  36931. submitJob(identifier, parameter, environments, callback) {
  36932. parameter = parameter ? parameter : null;
  36933. environments = environments ? environments : null;
  36934. const asyncParamter = JSON.stringify({ parameter: parameter, environments: environments });
  36935. this._processAsync({ url: `${this.url}/${identifier}/jobs`, method: 'POST', callback, params: asyncParamter });
  36936. }
  36937. /**
  36938. * @function GeoprocessingService.prototype.waitForJobCompletion
  36939. * @description 获取处理自动化异步执行状态信息。
  36940. * @param {string} jobId - 处理自动化任务ID。
  36941. * @param {string} identifier - 处理自动化工具ID。
  36942. * @param {Object} options - 状态信息参数。
  36943. * @param {number} options.interval - 定时器时间间隔。
  36944. * @param {function} options.statusCallback - 任务状态的回调函数。
  36945. */
  36946. waitForJobCompletion(jobId, identifier, options, callback) {
  36947. const me = this;
  36948. const timer = setInterval(function () {
  36949. const serviceProcessCompleted = function (serverResult, options) {
  36950. const state = serverResult.state.runState;
  36951. if (options.statusCallback) {
  36952. options.statusCallback(state);
  36953. }
  36954. switch (state) {
  36955. case 'FINISHED':
  36956. clearInterval(timer);
  36957. me.events.triggerEvent('processCompleted', {
  36958. result: serverResult,
  36959. options
  36960. });
  36961. break;
  36962. case 'FAILED':
  36963. clearInterval(timer);
  36964. me.events.triggerEvent('processFailed', {
  36965. result: serverResult,
  36966. options
  36967. });
  36968. break;
  36969. case 'CANCELED':
  36970. clearInterval(timer);
  36971. me.events.triggerEvent('processFailed', {
  36972. result: serverResult,
  36973. options
  36974. });
  36975. break;
  36976. }
  36977. };
  36978. me._processAsync({ url: `${me.url}/${identifier}/jobs/${jobId}`, serviceProcessCompleted, callback });
  36979. }, options.interval);
  36980. }
  36981. /**
  36982. * @function GeoprocessingService.prototype.getJobInfo
  36983. * @description 获取处理自动化任务的执行信息。
  36984. * @param {string} identifier - 处理自动化工具ID。
  36985. * @param {string} jobId - 处理自动化任务ID。
  36986. */
  36987. getJobInfo(identifier, jobId, callback) {
  36988. this._processAsync({ url: `${this.url}/${identifier}/jobs/${jobId}`, callback });
  36989. }
  36990. /**
  36991. * @function GeoprocessingService.prototype.cancelJob
  36992. * @description 取消处理自动化任务的异步执行。
  36993. * @param {string} identifier - 处理自动化工具ID。
  36994. * @param {string} jobId - 处理自动化任务ID。
  36995. */
  36996. cancelJob(identifier, jobId, callback) {
  36997. this._processAsync({ url: `${this.url}/${identifier}/jobs/${jobId}/cancel`, callback });
  36998. }
  36999. /**
  37000. * @function GeoprocessingService.prototype.getJobs
  37001. * @description 获取处理自动化服务任务列表。
  37002. * @param {string} identifier - 处理自动化工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  37003. */
  37004. getJobs(identifier, callback) {
  37005. let url = `${this.url}/jobs`;
  37006. if (identifier) {
  37007. url = `${this.url}/${identifier}/jobs`;
  37008. }
  37009. this._processAsync({ url, callback });
  37010. }
  37011. /**
  37012. * @function GeoprocessingService.prototype.getResults
  37013. * @description 处理自动化工具执行的结果等,支持结果过滤。
  37014. * @param {string} identifier - 处理自动化工具ID。
  37015. * @param {string} jobId - 处理自动化任务ID。
  37016. * @param {string} filter - 输出异步结果的ID。(可选,传入filter参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  37017. */
  37018. getResults(identifier, jobId, filter, callback) {
  37019. let url = `${this.url}/${identifier}/jobs/${jobId}/results`;
  37020. if (filter) {
  37021. url = `${url}/${filter}`;
  37022. }
  37023. this._processAsync({ url, callback });
  37024. }
  37025. _processAsync({ url, method, callback, paramter, serviceProcessCompleted, serviceProcessFailed }) {
  37026. let eventId = ++this.eventCount;
  37027. let eventListeners = {
  37028. scope: this,
  37029. processCompleted: function(result) {
  37030. if (eventId === result.result.eventId && callback) {
  37031. delete result.result.eventId;
  37032. callback(result);
  37033. this.events && this.events.un(eventListeners);
  37034. return false;
  37035. }
  37036. },
  37037. processFailed: function(result) {
  37038. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  37039. callback(result);
  37040. this.events && this.events.un(eventListeners);
  37041. return false;
  37042. }
  37043. }
  37044. }
  37045. this.events.on(eventListeners);
  37046. this.request({
  37047. url: url,
  37048. method: method || 'GET',
  37049. params: paramter,
  37050. headers: { 'Content-type': 'application/json' },
  37051. scope: this,
  37052. success(result, options) {
  37053. result.eventId = eventId;
  37054. const callback = serviceProcessCompleted || this.serviceProcessCompleted.bind(this);
  37055. callback(result, options);
  37056. },
  37057. failure(result, options) {
  37058. if (result.error) {
  37059. result.error.eventId = eventId;
  37060. }
  37061. result.eventId = eventId;
  37062. const callback = serviceProcessFailed || this.serviceProcessFailed.bind(this);
  37063. callback(result, options);
  37064. }
  37065. });
  37066. }
  37067. }
  37068. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystParameters.js
  37069. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37070. * This program are made available under the terms of the Apache License, Version 2.0
  37071. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37072. /**
  37073. * @class GeoRelationAnalystParameters
  37074. * @deprecatedclass SuperMap.GeoRelationAnalystParameters
  37075. * @category iServer SpatialAnalyst GeoRelationAnalyst
  37076. * @classdesc 空间关系分析服务参数类。使用该类可以为空间关系分析服务提供所需的参数信息。
  37077. * @param {Object} options - 参数。
  37078. * @param {FilterParameter} options.sourceFilter - 空间关系分析中的源数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  37079. * @param {FilterParameter} options.referenceFilter - 空间关系分析中的参考数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  37080. * @param {SpatialRelationType} options.spatialRelationType - 指定的空间关系类型。
  37081. * @param {boolean} [options.isBorderInside] - 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  37082. * @param {boolean} [options.returnFeature] - 是否返回 Feature 信息。
  37083. * @param {boolean} [options.returnGeoRelatedOnly=true] - 仅返回满足指定空间关系的空间对象。
  37084. * @param {number} [options.startRecord=0] - 分析结果起始记录位置。
  37085. * @param {number} [options.expectCount=500] - 空间关系分析期望返回结果记录数,如果实际不足500条结果则返回所有分析结果。
  37086. * @usage
  37087. */
  37088. class GeoRelationAnalystParameters {
  37089. constructor(options) {
  37090. /**
  37091. * @member {string} GeoRelationAnalystParameters.prototype.dataset
  37092. * @description 源数据集名称。
  37093. */
  37094. this.dataset = null;
  37095. /**
  37096. * @member {FilterParameter} GeoRelationAnalystParameters.prototype.sourceFilter
  37097. * @description 空间关系分析中的源数据集查询参数。仅 ids、attributeFilter 和 fields 字段有效。
  37098. */
  37099. this.sourceFilter = null;
  37100. /**
  37101. * @member {FilterParameter} GeoRelationAnalystParameters.prototype.referenceFilter
  37102. * @description 空间关系分析中的参考数据集查询参数。仅 name,ids,attributeFilter 和 fields 字段有效。
  37103. */
  37104. this.referenceFilter = null;
  37105. /**
  37106. * @member {SpatialRelationType} GeoRelationAnalystParameters.prototype.spatialRelationType
  37107. * @description 指定的空间关系类型。
  37108. */
  37109. this.spatialRelationType = null;
  37110. /**
  37111. * @member {boolean} [GeoRelationAnalystParameters.prototype.isBorderInside]
  37112. * @description 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  37113. */
  37114. this.isBorderInside = null;
  37115. /**
  37116. * @member {boolean} [GeoRelationAnalystParameters.prototype.returnFeature]
  37117. * @description 是否返回 Feature 信息。
  37118. */
  37119. this.returnFeature = null;
  37120. /**
  37121. * @member {boolean} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=true]
  37122. * @description 是否仅返回满足指定空间关系的空间对象。
  37123. */
  37124. this.returnGeoRelatedOnly = null;
  37125. /**
  37126. * @member {number} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=0]
  37127. * @description 分析结果起始记录位置。
  37128. */
  37129. this.startRecord = 0;
  37130. /**
  37131. * @member {number} [GeoRelationAnalystParameters.prototype.expectCount=500]
  37132. * @description 空间关系分析期望返回结果记录数,如果实际不足 500 条结果则返回所有分析结果。
  37133. */
  37134. this.expectCount = 500;
  37135. if (options) {
  37136. Util_Util.extend(this, options);
  37137. }
  37138. this.CLASS_NAME = "SuperMap.GeoRelationAnalystParameters";
  37139. }
  37140. /**
  37141. * @function GeoRelationAnalystParameters.prototype.destroy
  37142. * @description 释放资源,将引用资源的属性置空。
  37143. */
  37144. destroy() {
  37145. var me = this;
  37146. if (me.sourceFilter) {
  37147. me.sourceFilter.destroy();
  37148. }
  37149. me.sourceFilter = null;
  37150. if (me.referenceFilter) {
  37151. me.referenceFilter.destroy();
  37152. }
  37153. me.referenceFilter = null;
  37154. me.dataset = null;
  37155. me.spatialRelationType = null;
  37156. me.isBorderInside = null;
  37157. me.returnFeature = null;
  37158. me.returnGeoRelatedOnly = null;
  37159. me.startRecord = null;
  37160. me.expectCount = null;
  37161. }
  37162. }
  37163. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystService.js
  37164. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37165. * This program are made available under the terms of the Apache License, Version 2.0
  37166. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37167. /**
  37168. * @class GeoRelationAnalystService
  37169. * @deprecatedclass SuperMap.GeoRelationAnalystService
  37170. * @category iServer SpatialAnalyst GeoRelationAnalyst
  37171. * @classdesc 空间关系分析服务类。该类负责将客户设置的空间关系分析服务参数传递给服务端,并接收服务端返回的空间关系分析结果数据。
  37172. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  37173. * @param {Object} options - 参数。
  37174. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  37175. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37176. * @param {Object} [options.headers] - 请求头。
  37177. * @extends {SpatialAnalystBase}
  37178. * @example 实例化该类如下例所示:
  37179. * (start code)
  37180. * function datasetGeoRelationAnalystProcess() {
  37181. * var referenceFilter = new FilterParameter({
  37182. * name:"Frame_R@Changchun",
  37183. * attributeFilter:"SmID>0"});
  37184. * var sourceFilter = new FilterParameter({
  37185. * attributeFilter:"SmID>0"});
  37186. * //初始化服务类
  37187. * var datasetGeoRelationService = new GeoRelationAnalystService(
  37188. * "http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst/"),
  37189. * //构建参数类
  37190. * datasetGeoRelationParameters = new GeoRelationAnalystParameters({
  37191. * dataset: "Park@Changchun",
  37192. * startRecord: 0,
  37193. * expectCount: 20,
  37194. * sourceFilter: sourceFilter,
  37195. * referenceFilter: referenceFilter,
  37196. * spatialRelationType: SpatialRelationType.INTERSECT,
  37197. * isBorderInside: true,
  37198. * returnFeature: true,
  37199. * returnGeoRelatedOnly: true
  37200. * });
  37201. * datasetGeoRelationService.events.on({
  37202. * "processCompleted": datasetGeoRelationAnalystCompleted,
  37203. * "processFailed": datasetGeoRelationAnalystFailed});
  37204. * //执行
  37205. * datasetGeoRelationService.processAsync(datasetGeoRelationParameters);
  37206. * }
  37207. * function Completed(datasetGeoRelationAnalystCompleted){//todo};
  37208. * function Error(datasetGeoRelationAnalystFailed){//todo};
  37209. * (end)
  37210. * @usage
  37211. */
  37212. class GeoRelationAnalystService extends SpatialAnalystBase {
  37213. constructor(url, options) {
  37214. super(url, options);
  37215. this.CLASS_NAME = "SuperMap.GeoRelationAnalystService";
  37216. }
  37217. /**
  37218. * @function GeoRelationAnalystService.prototype.destroy
  37219. * @override
  37220. */
  37221. destroy() {
  37222. super.destroy();
  37223. }
  37224. /**
  37225. * @function GeoRelationAnalystService.prototype.processAsync
  37226. * @description 负责将客户端的空间关系分析参数传递到服务端
  37227. * @param {GeoRelationAnalystParameters} parameter - 空间关系分析所需的参数信息。
  37228. */
  37229. processAsync(parameter) {
  37230. if (!(parameter instanceof GeoRelationAnalystParameters)) {
  37231. return;
  37232. }
  37233. var me = this;
  37234. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/georelation');
  37235. var jsonParameters = Util_Util.toJSON(parameter);
  37236. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  37237. me.request({
  37238. method: "POST",
  37239. data: jsonParameters,
  37240. scope: me,
  37241. success: me.serviceProcessCompleted,
  37242. failure: me.serviceProcessFailed
  37243. });
  37244. }
  37245. }
  37246. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetService.js
  37247. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37248. * This program are made available under the terms of the Apache License, Version 2.0
  37249. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37250. /**
  37251. * @class DatasetService
  37252. * @deprecatedclass SuperMap.DatasetService
  37253. * @category iServer Data Dataset
  37254. * @classdesc 数据集查询服务。
  37255. * @param {string} url - 服务的访问地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  37256. * @param {Object} options - 参数。
  37257. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  37258. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  37259. * @param {string}options.datasource - 数据源名称。
  37260. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37261. * @param {Object} [options.headers] - 请求头。
  37262. * @usage
  37263. */
  37264. class DatasetService_DatasetService extends CommonServiceBase {
  37265. constructor(url, options) {
  37266. super(url, options);
  37267. if(!options){
  37268. return;
  37269. }
  37270. /**
  37271. * @member {string} DatasetService.prototype.datasource
  37272. * @description 要查询的数据集所在的数据源名称。
  37273. */
  37274. this.datasource = null;
  37275. /**
  37276. * @member {string} DatasetService.prototype.dataset
  37277. * @description 要查询的数据集名称。
  37278. */
  37279. this.dataset = null;
  37280. this.eventCount = 0;
  37281. if (options) {
  37282. Util_Util.extend(this, options);
  37283. }
  37284. this.CLASS_NAME = "SuperMap.DatasetService";
  37285. }
  37286. /**
  37287. * @function DatasetService.prototype.destroy
  37288. * @override
  37289. */
  37290. destroy() {
  37291. super.destroy();
  37292. var me = this;
  37293. me.datasource = null;
  37294. me.dataset = null;
  37295. }
  37296. /**
  37297. * @function DatasetService.prototype.getDatasetsService
  37298. * @description 执行服务,查询数据集服务。
  37299. */
  37300. getDatasetsService(params, callback) {
  37301. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${params}/datasets`);
  37302. this.processAsync(url, 'GET', callback);
  37303. }
  37304. /**
  37305. * @function DatasetService.prototype.getDatasetService
  37306. * @description 执行服务,查询数据集信息服务。
  37307. */
  37308. getDatasetService(datasourceName, datasetName, callback) {
  37309. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${datasourceName}/datasets/name/${datasetName}`);
  37310. this.processAsync(url, 'GET', callback);
  37311. }
  37312. /**
  37313. * @function DatasetService.prototype.setDatasetService
  37314. * @description 执行服务,更改数据集信息服务。
  37315. */
  37316. setDatasetService(params, callback) {
  37317. if (!params) {
  37318. return;
  37319. }
  37320. const url = Util_Util.urlPathAppend(this.url, `datasources/name/${params.datasourceName}/datasets/name/${params.datasetName}`);
  37321. delete params.datasourceName;
  37322. this.processAsync(url, 'PUT', callback, params);
  37323. }
  37324. /**
  37325. * @function DatasetService.prototype.deleteDatasetService
  37326. * @description 执行服务,删除数据集信息服务。
  37327. */
  37328. deleteDatasetService(datasourceName, datasetName, callback) {
  37329. const url = Util_Util.urlPathAppend(this.url, `datasources/name/${datasourceName}/datasets/name/${datasetName}`);
  37330. this.processAsync(url, 'DELETE', callback);
  37331. }
  37332. processAsync(url, method, callback, params) {
  37333. let eventId = ++this.eventCount;
  37334. let eventListeners = {
  37335. scope: this,
  37336. processCompleted: function(result) {
  37337. if (eventId === result.result.eventId && callback) {
  37338. delete result.result.eventId;
  37339. callback(result);
  37340. this.events && this.events.un(eventListeners);
  37341. return false;
  37342. }
  37343. },
  37344. processFailed: function(result) {
  37345. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  37346. callback(result);
  37347. this.events && this.events.un(eventListeners);
  37348. return false;
  37349. }
  37350. }
  37351. }
  37352. this.events.on(eventListeners);
  37353. var me = this;
  37354. let requestConfig = {
  37355. url,
  37356. method,
  37357. scope: me,
  37358. success(result, options) {
  37359. result.eventId = eventId;
  37360. me.serviceProcessCompleted(result, options);
  37361. },
  37362. failure(result, options) {
  37363. if (result.error) {
  37364. result.error.eventId = eventId;
  37365. }
  37366. result.eventId = eventId;
  37367. me.serviceProcessFailed(result, options);
  37368. }
  37369. }
  37370. params && (requestConfig.data = Util_Util.toJSON(params));
  37371. me.request(requestConfig);
  37372. }
  37373. }
  37374. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesParametersBase.js
  37375. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37376. * This program are made available under the terms of the Apache License, Version 2.0
  37377. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37378. /**
  37379. * @class GetFeaturesParametersBase
  37380. * @deprecatedclass SuperMap.GetFeaturesParametersBase
  37381. * @category iServer Data FeatureResults
  37382. * @classdesc 要素查询参数基类。
  37383. * @param {Object} options - 参数。
  37384. * @param {Array.<string>} options.datasetNames - 数据集名称列表。
  37385. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  37386. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  37387. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  37388. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  37389. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  37390. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  37391. * @usage
  37392. */
  37393. class GetFeaturesParametersBase {
  37394. constructor(options) {
  37395. /**
  37396. * @member {Array.<string>} GetFeaturesParametersBase.prototype.datasetName
  37397. * @description 数据集集合中的数据集名称列表。
  37398. */
  37399. this.datasetNames = null;
  37400. /**
  37401. * @member {string} GetFeaturesParametersBase.prototype.targetEpsgCode
  37402. * @description 动态投影的目标坐标系对应的 EPSG Code,使用时需设置 returnContent 参数为 true。
  37403. */
  37404. this.targetEpsgCode = null;
  37405. /**
  37406. * @member {Object} GetFeaturesParametersBase.prototype.targetPrj
  37407. * @description 动态投影的目标坐标系。使用时需设置 returnContent 参数为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  37408. */
  37409. this.targetPrj = null;
  37410. /**
  37411. * @member {boolean} [GetFeaturesParametersBase.prototype.returnContent=true]
  37412. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  37413. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  37414. * 如果为 false,则返回的是查询结果资源的 URI。
  37415. */
  37416. this.returnContent = true;
  37417. /**
  37418. * @member {number} [GetFeaturesParametersBase.prototype.fromIndex=0]
  37419. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  37420. */
  37421. this.fromIndex = 0;
  37422. /**
  37423. * @member {number} [GetFeaturesParametersBase.prototype.toIndex=19]
  37424. * @description 查询结果的最大索引号。如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  37425. */
  37426. this.toIndex = 19;
  37427. /**
  37428. * @member {boolean} [GetFeaturesParametersBase.prototype.returnCountOnly=false]
  37429. * @description 只返回查询结果的总数。
  37430. */
  37431. this.returnCountOnly = false;
  37432. /**
  37433. * @member {number} [GetFeaturesParametersBase.prototype.maxFeatures=1000]
  37434. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  37435. */
  37436. this.maxFeatures = null;
  37437. /**
  37438. * @member {number} [GetFeaturesParametersBase.prototype.hasGeometry=true]
  37439. * @description 返回结果是否包含Geometry。
  37440. */
  37441. this.hasGeometry = true;
  37442. /**
  37443. * @member {MetricsAggParameter|GeoHashGridAggParameter} GetFeaturesParametersBase.prototype.aggregations
  37444. * @description 聚合查询参数,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  37445. */
  37446. this.aggregations = null;
  37447. Util_Util.extend(this, options);
  37448. this.CLASS_NAME = 'SuperMap.GetFeaturesParametersBase';
  37449. }
  37450. /**
  37451. *
  37452. * @function GetFeaturesParametersBase.prototype.destroy
  37453. * @description 释放资源,将引用资源的属性置空。
  37454. */
  37455. destroy() {
  37456. var me = this;
  37457. me.datasetNames = null;
  37458. me.returnContent = null;
  37459. me.fromIndex = null;
  37460. me.toIndex = null;
  37461. me.hasGeometry = null;
  37462. me.maxFeatures = null;
  37463. me.targetEpsgCode = null;
  37464. me.targetPrj = null;
  37465. if (me.aggregation) {
  37466. me.aggregation = null;
  37467. }
  37468. }
  37469. }
  37470. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsParameters.js
  37471. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37472. * This program are made available under the terms of the Apache License, Version 2.0
  37473. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37474. /**
  37475. * @class GetFeaturesByBoundsParameters
  37476. * @deprecatedclass SuperMap.GetFeaturesByBoundsParameters
  37477. * @category iServer Data FeatureResults
  37478. * @classdesc 数据集范围查询参数类,该类用于设置数据集范围查询的相关参数。
  37479. * @param {Object} options - 参数。
  37480. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 查询的范围对象。
  37481. * @param {Array.<string>} options.datasetNames - 数据集名称列表。
  37482. * @param {string} [options.attributeFilter] - 范围查询属性过滤条件。
  37483. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  37484. * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  37485. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  37486. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  37487. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  37488. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  37489. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  37490. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  37491. * @extends {GetFeaturesParametersBase}
  37492. * @usage
  37493. */
  37494. class GetFeaturesByBoundsParameters extends GetFeaturesParametersBase {
  37495. constructor(options) {
  37496. super(options);
  37497. /**
  37498. * @member {string} GetFeaturesByBoundsParameters.prototype.getFeatureMode
  37499. * @description 数据集查询模式。范围查询有 "BOUNDS","BOUNDS_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 BOUNDS_ATTRIBUTEFILTER 访问服务。
  37500. */
  37501. this.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS;
  37502. /**
  37503. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} GetFeaturesByBoundsParameters.prototype.bounds
  37504. * @description 用于查询的范围对象。
  37505. *
  37506. */
  37507. this.bounds = null;
  37508. /**
  37509. * @member {Array.<string>} GetFeaturesByBoundsParameters.prototype.fields
  37510. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  37511. */
  37512. this.fields = null;
  37513. /**
  37514. * @member {string} GetFeaturesByBoundsParameters.prototype.attributeFilter
  37515. * @description 范围查询属性过滤条件。
  37516. */
  37517. this.attributeFilter = null;
  37518. /**
  37519. * @member {SpatialQueryMode} [GetFeaturesByBoundsParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
  37520. * @description 空间查询模式常量。
  37521. */
  37522. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  37523. Util_Util.extend(this, options);
  37524. this.CLASS_NAME = 'SuperMap.GetFeaturesByBoundsParameters';
  37525. }
  37526. /**
  37527. * @function GetFeaturesByBoundsParameters.prototype.destroy
  37528. * @override
  37529. */
  37530. destroy() {
  37531. super.destroy();
  37532. var me = this;
  37533. if (me.bounds) {
  37534. me.bounds.destroy();
  37535. me.bounds = null;
  37536. }
  37537. if (me.fields) {
  37538. while (me.fields.length > 0) {
  37539. me.fields.pop();
  37540. }
  37541. me.fields = null;
  37542. }
  37543. me.attributeFilter = null;
  37544. me.spatialQueryMode = null;
  37545. me.getFeatureMode = null;
  37546. }
  37547. /**
  37548. * @function GetFeaturesByBoundsParameters.toJsonParameters
  37549. * @description 将 {@link GetFeaturesByBoundsParameters} 对象参数转换为 JSON 字符串。
  37550. * @param {GetFeaturesByBoundsParameters} params - 范围查询参数。
  37551. * @returns {string} 转化后的 JSON 字符串。
  37552. *
  37553. */
  37554. static toJsonParameters(params) {
  37555. var filterParameter, bounds, parasByBounds;
  37556. bounds = {
  37557. leftBottom: { x: params.bounds.left, y: params.bounds.bottom },
  37558. rightTop: { x: params.bounds.right, y: params.bounds.top }
  37559. };
  37560. parasByBounds = {
  37561. datasetNames: params.datasetNames,
  37562. getFeatureMode: GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS,
  37563. bounds: bounds,
  37564. spatialQueryMode: params.spatialQueryMode
  37565. };
  37566. if (params.fields) {
  37567. filterParameter = new FilterParameter();
  37568. filterParameter.name = params.datasetNames;
  37569. filterParameter.fields = params.fields;
  37570. parasByBounds.queryParameter = filterParameter;
  37571. }
  37572. if (params.attributeFilter) {
  37573. parasByBounds.attributeFilter = params.attributeFilter;
  37574. parasByBounds.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS_ATTRIBUTEFILTER;
  37575. }
  37576. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  37577. parasByBounds.maxFeatures = params.maxFeatures;
  37578. }
  37579. if (typeof params.hasGeometry === 'boolean') {
  37580. parasByBounds.hasGeometry = params.hasGeometry;
  37581. }
  37582. if (params.targetEpsgCode) {
  37583. parasByBounds.targetEpsgCode = params.targetEpsgCode;
  37584. }
  37585. if (!params.targetEpsgCode && params.targetPrj) {
  37586. parasByBounds.targetPrj = params.targetPrj;
  37587. }
  37588. if (params.aggregations) {
  37589. parasByBounds.aggregations = params.aggregations;
  37590. }
  37591. return Util_Util.toJSON(parasByBounds);
  37592. }
  37593. }
  37594. GetFeaturesByBoundsParameters.getFeatureMode = {
  37595. BOUNDS: 'BOUNDS',
  37596. BOUNDS_ATTRIBUTEFILTER: 'BOUNDS_ATTRIBUTEFILTER'
  37597. };
  37598. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesServiceBase.js
  37599. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37600. * This program are made available under the terms of the Apache License, Version 2.0
  37601. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37602. /**
  37603. * @class GetFeaturesServiceBase
  37604. * @deprecatedclass SuperMap.GetFeaturesServiceBase
  37605. * @category iServer Data FeatureResults
  37606. * @classdesc 数据服务中数据集查询服务基类。获取结果数据类型为 Object。包含 result 属性,result 的数据格式根据 format 参数决定为 GeoJSON 或者 iServerJSON。
  37607. * @extends CommonServiceBase
  37608. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  37609. * URL应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/
  37610. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  37611. * @param {Object} options - 参数。
  37612. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  37613. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  37614. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37615. * @param {Object} [options.headers] - 请求头。
  37616. * @example
  37617. * var myService = new GetFeaturesServiceBase(url, {
  37618. * eventListeners: {
  37619. * "processCompleted": getFeatureCompleted,
  37620. * "processFailed": getFeatureError
  37621. * }
  37622. * });
  37623. * @usage
  37624. */
  37625. class GetFeaturesServiceBase extends CommonServiceBase {
  37626. constructor(url, options) {
  37627. super(url, options);
  37628. options = options || {};
  37629. /**
  37630. * @member {boolean} [GetFeaturesServiceBase.prototype.returnContent=true]
  37631. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  37632. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  37633. * 如果为 false,则返回的是查询结果资源的 URI。
  37634. */
  37635. this.returnContent = true;
  37636. /**
  37637. * @member {number} [GetFeaturesServiceBase.prototype.fromIndex=0]
  37638. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  37639. */
  37640. this.fromIndex = 0;
  37641. /**
  37642. * @member {number} [GetFeaturesServiceBase.prototype.toIndex=19]
  37643. * @description 查询结果的最大索引号。
  37644. * 如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  37645. */
  37646. this.toIndex = 19;
  37647. /**
  37648. * @member {number} [GetFeaturesServiceBase.prototype.hasGeometry=true]
  37649. * @description 返回结果是否包含Geometry。
  37650. */
  37651. this.hasGeometry = true;
  37652. /**
  37653. * @member {number} [GetFeaturesServiceBase.prototype.maxFeatures=1000]
  37654. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  37655. */
  37656. this.maxFeatures = null;
  37657. /**
  37658. * @member {string} [GetFeaturesServiceBase.prototype.format=DataFormat.GEOJSON]
  37659. * @description 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。
  37660. * 参数格式为 "ISERVER","GEOJSON","FGB"。
  37661. */
  37662. this.format = DataFormat.GEOJSON;
  37663. Util_Util.extend(this, options);
  37664. this.url = Util_Util.urlPathAppend(this.url, 'featureResults');
  37665. this.CLASS_NAME = "SuperMap.GetFeaturesServiceBase";
  37666. }
  37667. /**
  37668. * @function GetFeaturesServiceBase.prototype.destroy
  37669. * @description 释放资源,将引用资源的属性置空。
  37670. */
  37671. destroy() {
  37672. super.destroy();
  37673. var me = this;
  37674. me.returnContent = null;
  37675. me.fromIndex = null;
  37676. me.toIndex = null;
  37677. me.maxFeatures = null;
  37678. me.format = null;
  37679. me.hasGeometry = null;
  37680. }
  37681. /**
  37682. * @function GetFeaturesServiceBase.prototype.processAsync
  37683. * @description 将客户端的查询参数传递到服务端。
  37684. * @param {Object} params - 查询参数。
  37685. */
  37686. processAsync(params) {
  37687. if (!params) {
  37688. return;
  37689. }
  37690. var me = this,
  37691. jsonParameters = null,
  37692. firstPara = true;
  37693. me.returnContent = params.returnContent;
  37694. me.fromIndex = params.fromIndex;
  37695. me.toIndex = params.toIndex;
  37696. me.maxFeatures = params.maxFeatures;
  37697. me.hasGeometry = params.hasGeometry;
  37698. if (me.returnContent) {
  37699. firstPara = false;
  37700. }
  37701. var isValidNumber = me.fromIndex != null && me.toIndex != null && !isNaN(me.fromIndex) && !isNaN(me.toIndex);
  37702. if (isValidNumber && me.fromIndex >= 0 && me.toIndex >= 0 && !firstPara) {
  37703. me.url = Util_Util.urlAppend(me.url, `fromIndex=${me.fromIndex}&toIndex=${me.toIndex}`);
  37704. }
  37705. if (params.returnCountOnly) {
  37706. me.url = Util_Util.urlAppend(me.url, "&returnCountOnly=" + params.returnContent)
  37707. }
  37708. jsonParameters = me.getJsonParameters(params);
  37709. me.request({
  37710. method: "POST",
  37711. data: jsonParameters,
  37712. scope: me,
  37713. success: me.serviceProcessCompleted,
  37714. failure: me.serviceProcessFailed
  37715. });
  37716. }
  37717. /**
  37718. * @function GetFeaturesServiceBase.prototype.getFeatureComplete
  37719. * @description 查询完成,执行此方法。
  37720. * @param {Object} result - 服务器返回的结果对象。
  37721. */
  37722. serviceProcessCompleted(result, options) {
  37723. var me = this;
  37724. result = Util_Util.transformResult(result);
  37725. if (me.format === DataFormat.GEOJSON && result.features) {
  37726. var geoJSONFormat = new GeoJSON();
  37727. result.features = geoJSONFormat.toGeoJSON(result.features);
  37728. }
  37729. me.events.triggerEvent("processCompleted", {result: result, options});
  37730. }
  37731. dataFormat() {
  37732. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  37733. }
  37734. }
  37735. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsService.js
  37736. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37737. * This program are made available under the terms of the Apache License, Version 2.0
  37738. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37739. /**
  37740. * @class GetFeaturesByBoundsService
  37741. * @deprecatedclass SuperMap.GetFeaturesByBoundsService
  37742. * @category iServer Data FeatureResults
  37743. * @classdesc 数据集范围查询服务类,查询与指定范围对象符合一定空间关系的矢量要素。
  37744. * @description 数据集范围查询服务类构造函数。
  37745. * @extends {GetFeaturesServiceBase}
  37746. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  37747. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  37748. * @param {Object} options - 参数。
  37749. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  37750. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  37751. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37752. * @param {Object} [options.headers] - 请求头。
  37753. * @example
  37754. * var myGetFeaturesByBoundsService = new SuperMa.GetFeaturesByBoundsService(url, {
  37755. * eventListeners: {
  37756. * "processCompleted": getFeatureCompleted,
  37757. * "processFailed": getFeatureError
  37758. * }
  37759. * });
  37760. * function getFeatureCompleted(object){//todo};
  37761. * function getFeatureError(object){//todo}
  37762. * @usage
  37763. */
  37764. class GetFeaturesByBoundsService extends GetFeaturesServiceBase {
  37765. constructor(url, options) {
  37766. super(url, options);
  37767. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsService";
  37768. }
  37769. /**
  37770. * @function GetFeaturesByBoundsService.prototype.destroy
  37771. * @override
  37772. */
  37773. destroy() {
  37774. super.destroy();
  37775. }
  37776. /**
  37777. * @function GetFeaturesByBoundsService.prototype.getJsonParameters
  37778. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry,Bounds等)。
  37779. * @param params {GetFeaturesByBoundsParameters}
  37780. * @returns {string} 转化后的 JSON 字符串。
  37781. *
  37782. */
  37783. getJsonParameters(params) {
  37784. return GetFeaturesByBoundsParameters.toJsonParameters(params);
  37785. }
  37786. }
  37787. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferParameters.js
  37788. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37789. * This program are made available under the terms of the Apache License, Version 2.0
  37790. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37791. /**
  37792. * @class GetFeaturesByBufferParameters
  37793. * @deprecatedclass SuperMap.GetFeaturesByBufferParameters
  37794. * @category iServer Data FeatureResults
  37795. * @classdesc 数据集缓冲区查询参数类。
  37796. * @param {Object} options - 参数。
  37797. * @param {number} options.bufferDistance - buffer 距离,单位与所查询图层对应的数据集单位相同。
  37798. * @param {GeoJSONObject} options.geometry - 空间查询条件。
  37799. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  37800. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  37801. * @param {string} [options.attributeFilter] - 属性查询条件。
  37802. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  37803. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  37804. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  37805. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  37806. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  37807. * @extends {GetFeaturesParametersBase}
  37808. * @usage
  37809. */
  37810. class GetFeaturesByBufferParameters extends GetFeaturesParametersBase {
  37811. constructor(options) {
  37812. super(options);
  37813. /**
  37814. * @member {number} GetFeaturesByBufferParameters.prototype.bufferDistance
  37815. * @description buffer 距离,单位与所查询图层对应的数据集单位相同。
  37816. */
  37817. this.bufferDistance = null;
  37818. /**
  37819. * @member {string} GetFeaturesByBufferParameters.prototype.attributeFilter
  37820. * @description 属性查询条件。
  37821. */
  37822. this.attributeFilter = null;
  37823. /**
  37824. * @member {GeoJSONObject} GetFeaturesByBufferParameters.prototype.geometry
  37825. * @description 空间查询条件。<br>
  37826. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。</br>
  37827. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
  37828. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  37829. */
  37830. this.geometry = null;
  37831. /**
  37832. * @member {Array.<string>} GetFeaturesByBufferParameters.prototype.fields
  37833. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  37834. */
  37835. this.fields = null;
  37836. Util_Util.extend(this, options);
  37837. this.CLASS_NAME = 'SuperMap.GetFeaturesByBufferParameters';
  37838. }
  37839. /**
  37840. * @function GetFeaturesByBufferParameters.prototype.destroy
  37841. * @override
  37842. */
  37843. destroy() {
  37844. super.destroy();
  37845. var me = this;
  37846. me.bufferDistance = null;
  37847. me.attributeFilter = null;
  37848. if (me.fields) {
  37849. while (me.fields.length > 0) {
  37850. me.fields.pop();
  37851. }
  37852. me.fields = null;
  37853. }
  37854. if (me.geometry) {
  37855. me.geometry.destroy();
  37856. me.geometry = null;
  37857. }
  37858. }
  37859. /**
  37860. * @function GetFeaturesByBufferParameters.toJsonParameters
  37861. * @description 将 GetFeaturesByBufferParameters 对象转换为 JSON 字符串。
  37862. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数对象。
  37863. * @returns {string} 转化后的 JSON 字符串。
  37864. */
  37865. static toJsonParameters(params) {
  37866. var filterParameter, paramsByBuffer, geometry;
  37867. geometry = ServerGeometry.fromGeometry(params.geometry);
  37868. paramsByBuffer = {
  37869. datasetNames: params.datasetNames,
  37870. getFeatureMode: 'BUFFER',
  37871. bufferDistance: params.bufferDistance,
  37872. geometry: geometry
  37873. };
  37874. if (params.fields) {
  37875. filterParameter = new FilterParameter();
  37876. filterParameter.name = params.datasetNames;
  37877. filterParameter.fields = params.fields;
  37878. paramsByBuffer.queryParameter = filterParameter;
  37879. }
  37880. if (params.attributeFilter) {
  37881. paramsByBuffer.attributeFilter = params.attributeFilter;
  37882. paramsByBuffer.getFeatureMode = 'BUFFER_ATTRIBUTEFILTER';
  37883. }
  37884. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  37885. paramsByBuffer.maxFeatures = params.maxFeatures;
  37886. }
  37887. if (typeof params.hasGeometry === 'boolean') {
  37888. paramsByBuffer.hasGeometry = params.hasGeometry;
  37889. }
  37890. if (params.targetEpsgCode) {
  37891. paramsByBuffer.targetEpsgCode = params.targetEpsgCode;
  37892. }
  37893. if (!params.targetEpsgCode && params.targetPrj) {
  37894. paramsByBuffer.targetPrj = params.targetPrj;
  37895. }
  37896. return Util_Util.toJSON(paramsByBuffer);
  37897. }
  37898. }
  37899. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferService.js
  37900. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37901. * This program are made available under the terms of the Apache License, Version 2.0
  37902. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37903. /**
  37904. * @class GetFeaturesByBufferService
  37905. * @deprecatedclass SuperMap.GetFeaturesByBufferService
  37906. * @category iServer Data FeatureResults
  37907. * @classdesc 数据服务中数据集缓冲区查询服务类。
  37908. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  37909. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  37910. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  37911. * @param {Object} options - 参数。
  37912. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  37913. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  37914. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37915. * @param {Object} [options.headers] - 请求头。
  37916. * @extends {GetFeaturesServiceBase}
  37917. * @example
  37918. * var myGetFeaturesByBufferService = new GetFeaturesByBufferService(url, {
  37919. * eventListeners: {
  37920. * "processCompleted": GetFeaturesCompleted,
  37921. * "processFailed": GetFeaturesError
  37922. * }
  37923. * });
  37924. * function GetFeaturesCompleted(object){//todo};
  37925. * function GetFeaturesError(object){//todo};
  37926. * @usage
  37927. */
  37928. class GetFeaturesByBufferService extends GetFeaturesServiceBase {
  37929. constructor(url, options) {
  37930. super(url, options);
  37931. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferService";
  37932. }
  37933. /**
  37934. * @function GetFeaturesByBufferService.prototype.destroy
  37935. * @override
  37936. */
  37937. destroy() {
  37938. super.destroy();
  37939. }
  37940. /**
  37941. * @function GetFeaturesByBufferService.prototype.getJsonParameters
  37942. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(IDs, SQL, Buffer, Geometry等)。
  37943. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  37944. * @returns {Object} 转化后的 JSON 字符串。
  37945. */
  37946. getJsonParameters(params) {
  37947. if (!(params instanceof GetFeaturesByBufferParameters)) {
  37948. return;
  37949. }
  37950. return GetFeaturesByBufferParameters.toJsonParameters(params);
  37951. }
  37952. }
  37953. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryParameters.js
  37954. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37955. * This program are made available under the terms of the Apache License, Version 2.0
  37956. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37957. /**
  37958. * @class GetFeaturesByGeometryParameters
  37959. * @deprecatedclass SuperMap.GetFeaturesByGeometryParameters
  37960. * @category iServer Data FeatureResults
  37961. * @classdesc 数据集几何查询参数类。该类用于设置数据集几何查询的相关参数。
  37962. * @param {Object} options - 参数。
  37963. * @param {GeoJSONObject} options.geometry - 查询的几何对象。
  37964. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  37965. * @param {string} [options.attributeFilter] - 几何查询属性过滤条件。
  37966. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  37967. * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  37968. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  37969. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  37970. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  37971. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  37972. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  37973. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  37974. * @extends {GetFeaturesParametersBase}
  37975. * @usage
  37976. */
  37977. class GetFeaturesByGeometryParameters extends GetFeaturesParametersBase {
  37978. constructor(options) {
  37979. super(options);
  37980. /**
  37981. * @member {string} GetFeaturesByGeometryParameters.prototype.getFeatureMode
  37982. * @description 数据集查询模式。几何查询有 "SPATIAL","SPATIAL_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 SPATIAL_ATTRIBUTEFILTER 访问服务。
  37983. */
  37984. this.getFeatureMode = 'SPATIAL';
  37985. /**
  37986. * @member {GeoJSONObject} GetFeaturesByGeometryParameters.prototype.geometry
  37987. * @description 用于查询的几何对象。 </br>
  37988. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。</br>
  37989. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
  37990. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  37991. */
  37992. this.geometry = null;
  37993. /**
  37994. * @member {Array.<string>} GetFeaturesByGeometryParameters.prototype.fields
  37995. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  37996. */
  37997. this.fields = null;
  37998. /**
  37999. * @member {string} GetFeaturesByGeometryParameters.prototype.attributeFilter
  38000. * @description 几何查询属性过滤条件。
  38001. */
  38002. this.attributeFilter = null;
  38003. /**
  38004. * @member {SpatialQueryMode} [GetFeaturesByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
  38005. * @description 空间查询模式常量。
  38006. */
  38007. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  38008. Util_Util.extend(this, options);
  38009. this.CLASS_NAME = 'SuperMap.GetFeaturesByGeometryParameters';
  38010. }
  38011. /**
  38012. * @function GetFeaturesByGeometryParameters.prototype.destroy
  38013. * @description 释放资源,将引用资源的属性置空。
  38014. */
  38015. destroy() {
  38016. super.destroy();
  38017. var me = this;
  38018. if (me.geometry) {
  38019. me.geometry.destroy();
  38020. me.geometry = null;
  38021. }
  38022. if (me.fields) {
  38023. while (me.fields.length > 0) {
  38024. me.fields.pop();
  38025. }
  38026. me.fields = null;
  38027. }
  38028. me.attributeFilter = null;
  38029. me.spatialQueryMode = null;
  38030. me.getFeatureMode = null;
  38031. }
  38032. /**
  38033. * @function GetFeaturesByGeometryParameters.toJsonParameters
  38034. * @description 将 GetFeaturesByGeometryParameters 对象参数转换为 JSON 字符串。
  38035. * @param {GetFeaturesByGeometryParameters} params - 查询参数对象。
  38036. * @returns {string} 转化后的 JSON 字符串。
  38037. */
  38038. static toJsonParameters(params) {
  38039. var filterParameter, geometry, parasByGeometry;
  38040. geometry = ServerGeometry.fromGeometry(params.geometry);
  38041. parasByGeometry = {
  38042. datasetNames: params.datasetNames,
  38043. getFeatureMode: 'SPATIAL',
  38044. geometry: geometry,
  38045. spatialQueryMode: params.spatialQueryMode
  38046. };
  38047. if (params.fields) {
  38048. filterParameter = new FilterParameter();
  38049. filterParameter.name = params.datasetNames;
  38050. filterParameter.fields = params.fields;
  38051. parasByGeometry.queryParameter = filterParameter;
  38052. }
  38053. if (params.attributeFilter) {
  38054. parasByGeometry.attributeFilter = params.attributeFilter;
  38055. parasByGeometry.getFeatureMode = 'SPATIAL_ATTRIBUTEFILTER';
  38056. }
  38057. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  38058. parasByGeometry.maxFeatures = params.maxFeatures;
  38059. }
  38060. if (typeof params.hasGeometry === 'boolean') {
  38061. parasByGeometry.hasGeometry = params.hasGeometry;
  38062. }
  38063. if (params.targetEpsgCode) {
  38064. parasByGeometry.targetEpsgCode = params.targetEpsgCode;
  38065. }
  38066. if (!params.targetEpsgCode && params.targetPrj) {
  38067. parasByGeometry.targetPrj = params.targetPrj;
  38068. }
  38069. if (params.aggregations) {
  38070. parasByGeometry.aggregations = params.aggregations;
  38071. }
  38072. return Util_Util.toJSON(parasByGeometry);
  38073. }
  38074. }
  38075. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryService.js
  38076. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38077. * This program are made available under the terms of the Apache License, Version 2.0
  38078. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38079. /**
  38080. * @class GetFeaturesByGeometryService
  38081. * @deprecatedclass SuperMap.GetFeaturesByGeometryService
  38082. * @category iServer Data FeatureResults
  38083. * @classdesc 数据集几何查询服务类,查询与指定几何对象符合一定空间关系的矢量要素。
  38084. * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
  38085. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data;
  38086. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data"
  38087. * @param {Object} options - 参数。
  38088. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  38089. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  38090. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38091. * @param {Object} [options.headers] - 请求头。
  38092. * @extends {GetFeaturesServiceBase}
  38093. * @example
  38094. * var myService = new GetFeaturesByGeometryService(url, {
  38095. * eventListeners: {
  38096. * "processCompleted": getFeatureCompleted,
  38097. * "processFailed": getFeatureError
  38098. * }
  38099. * });
  38100. * function getFeatureCompleted(object){//todo};
  38101. * function getFeatureError(object){//todo}
  38102. * @usage
  38103. */
  38104. class GetFeaturesByGeometryService extends GetFeaturesServiceBase {
  38105. constructor(url, options) {
  38106. super(url, options);
  38107. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryService";
  38108. }
  38109. /**
  38110. * @function GetFeaturesByGeometryService.prototype.destroy
  38111. * @override
  38112. */
  38113. destroy() {
  38114. super.destroy();
  38115. }
  38116. /**
  38117. * @function GetFeaturesByGeometryService.prototype.getJsonParameters
  38118. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  38119. * @description 将查询参数转化为 JSON 字符串。
  38120. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  38121. * @returns {Object} 转化后的 JSON 字符串。
  38122. */
  38123. getJsonParameters(params) {
  38124. return GetFeaturesByGeometryParameters.toJsonParameters(params);
  38125. }
  38126. }
  38127. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsParameters.js
  38128. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38129. * This program are made available under the terms of the Apache License, Version 2.0
  38130. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38131. /**
  38132. * @class GetFeaturesByIDsParameters
  38133. * @deprecatedclass SuperMap.GetFeaturesByIDsParameters
  38134. * @category iServer Data FeatureResults
  38135. * @classdesc ID 查询参数类。
  38136. * @param {Object} options - 参数。
  38137. * @param {Array.<number>} options.IDs - 指定查询的元素 ID 信息。
  38138. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  38139. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  38140. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  38141. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  38142. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  38143. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  38144. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  38145. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  38146. * @extends {GetFeaturesParametersBase}
  38147. * @usage
  38148. */
  38149. class GetFeaturesByIDsParameters extends GetFeaturesParametersBase {
  38150. constructor(options) {
  38151. super(options);
  38152. /**
  38153. * @member {string} GetFeaturesByIDsParameters.prototype.getFeatureMode
  38154. * @description 数据集查询模式。
  38155. */
  38156. this.getFeatureMode = 'ID';
  38157. /**
  38158. * @member {Array.<number>} GetFeaturesByIDsParameters.prototype.IDs
  38159. * @description 所要查询指定的元素 ID 信息。
  38160. */
  38161. this.IDs = null;
  38162. /**
  38163. * @member {Array.<string>} GetFeaturesByIDsParameters.prototype.fields
  38164. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  38165. */
  38166. this.fields = null;
  38167. Util_Util.extend(this, options);
  38168. this.CLASS_NAME = 'SuperMap.GetFeaturesByIDsParameters';
  38169. }
  38170. /**
  38171. * @function GetFeaturesByIDsParameters.prototype.destroy
  38172. * @override
  38173. */
  38174. destroy() {
  38175. super.destroy();
  38176. var me = this;
  38177. me.IDs = null;
  38178. me.getFeatureMode = null;
  38179. if (me.fields) {
  38180. while (me.fields.length > 0) {
  38181. me.fields.pop();
  38182. }
  38183. me.fields = null;
  38184. }
  38185. }
  38186. /**
  38187. * @function GetFeaturesByIDsParameters.toJsonParameters
  38188. * @description 将 GetFeaturesByIDsParameters 对象转换为 JSON 字符串。
  38189. * @param {GetFeaturesByIDsParameters} params - ID 查询参数对象。
  38190. * @returns {string} 转化后的 JSON 字符串。
  38191. */
  38192. static toJsonParameters(params) {
  38193. var parasByIDs, filterParameter;
  38194. parasByIDs = {
  38195. datasetNames: params.datasetNames,
  38196. getFeatureMode: 'ID',
  38197. ids: params.IDs
  38198. };
  38199. if (params.fields) {
  38200. filterParameter = new FilterParameter();
  38201. filterParameter.name = params.datasetNames;
  38202. filterParameter.fields = params.fields;
  38203. parasByIDs.queryParameter = filterParameter;
  38204. }
  38205. if (params.targetEpsgCode) {
  38206. parasByIDs.targetEpsgCode = params.targetEpsgCode;
  38207. }
  38208. if (typeof params.hasGeometry === 'boolean') {
  38209. parasByIDs.hasGeometry = params.hasGeometry;
  38210. }
  38211. if (!params.targetEpsgCode && params.targetPrj) {
  38212. parasByIDs.targetPrj = params.targetPrj;
  38213. }
  38214. if (params.aggregations) {
  38215. parasByIDs.aggregations = params.aggregations;
  38216. }
  38217. return Util_Util.toJSON(parasByIDs);
  38218. }
  38219. }
  38220. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsService.js
  38221. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38222. * This program are made available under the terms of the Apache License, Version 2.0
  38223. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38224. /**
  38225. * @class GetFeaturesByIDsService
  38226. * @deprecatedclass SuperMap.GetFeaturesByIDsService
  38227. * @category iServer Data FeatureResults
  38228. * @classdesc 数据集ID查询服务类。在数据集集合中查找指定 ID 号对应的空间地物要素。
  38229. * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
  38230. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  38231. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  38232. * @param {Object} options - 参数。
  38233. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  38234. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  38235. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38236. * @param {Object} [options.headers] - 请求头。
  38237. * @extends {GetFeaturesServiceBase}
  38238. * @example
  38239. * var myGetFeaturesByIDsService = new GetFeaturesByIDsService(url, {
  38240. * eventListeners: {
  38241. * "processCompleted": getFeatureCompleted,
  38242. * "processFailed": getFeatureError
  38243. * }
  38244. * });
  38245. * function getFeatureCompleted(object){//todo};
  38246. * function getFeatureError(object){//todo}
  38247. * @usage
  38248. */
  38249. class GetFeaturesByIDsService extends GetFeaturesServiceBase {
  38250. constructor(url, options) {
  38251. super(url, options);
  38252. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsService";
  38253. }
  38254. /**
  38255. * @function GetFeaturesByIDsService.prototype.destroy
  38256. * @override
  38257. */
  38258. destroy() {
  38259. super.destroy();
  38260. }
  38261. /**
  38262. * @function GetFeaturesByIDsService.prototype.getJsonParameters
  38263. * @description 将查询参数转化为 JSON 字符串。
  38264. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  38265. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  38266. * @returns {string} 转化后的 JSON 字符串。
  38267. */
  38268. getJsonParameters(params) {
  38269. return GetFeaturesByIDsParameters.toJsonParameters(params);
  38270. }
  38271. }
  38272. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLParameters.js
  38273. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38274. * This program are made available under the terms of the Apache License, Version 2.0
  38275. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38276. /**
  38277. * @class GetFeaturesBySQLParameters
  38278. * @deprecatedclass SuperMap.GetFeaturesBySQLParameters
  38279. * @category iServer Data FeatureResults
  38280. * @classdesc 数据集 SQL 查询参数类。
  38281. * @param {Object} options - 参数。
  38282. * @param {FilterParameter} options.queryParameter - 查询过滤条件参数。
  38283. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  38284. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  38285. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  38286. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  38287. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  38288. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  38289. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  38290. * @extends {GetFeaturesParametersBase}
  38291. * @usage
  38292. */
  38293. class GetFeaturesBySQLParameters extends GetFeaturesParametersBase {
  38294. constructor(options) {
  38295. super(options);
  38296. /**
  38297. * @member {string} GetFeaturesBySQLParameters.prototype.getFeatureMode
  38298. * @description 数据集查询模式。
  38299. */
  38300. this.getFeatureMode = 'SQL';
  38301. /**
  38302. * @member {FilterParameter} GetFeaturesBySQLParameters.prototype.queryParameter
  38303. * @description 查询过滤条件参数类。
  38304. */
  38305. this.queryParameter = null;
  38306. Util_Util.extend(this, options);
  38307. this.CLASS_NAME = 'SuperMap.GetFeaturesBySQLParameters';
  38308. }
  38309. /**
  38310. * @function GetFeaturesBySQLParameters.prototype.destroy
  38311. * @override
  38312. */
  38313. destroy() {
  38314. super.destroy();
  38315. var me = this;
  38316. me.getFeatureMode = null;
  38317. if (me.queryParameter) {
  38318. me.queryParameter.destroy();
  38319. me.queryParameter = null;
  38320. }
  38321. }
  38322. /**
  38323. * @function GetFeaturesBySQLParameters.prototype.toJsonParameters
  38324. * @description 将 GetFeaturesBySQLParameters 对象转换为 JSON 字符串。
  38325. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数对象。
  38326. * @returns {string} 转化后的 JSON 字符串。
  38327. */
  38328. static toJsonParameters(params) {
  38329. var paramsBySql = {
  38330. datasetNames: params.datasetNames,
  38331. getFeatureMode: 'SQL',
  38332. queryParameter: params.queryParameter
  38333. };
  38334. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  38335. paramsBySql.maxFeatures = params.maxFeatures;
  38336. }
  38337. if (typeof params.hasGeometry === 'boolean') {
  38338. paramsBySql.hasGeometry = params.hasGeometry;
  38339. }
  38340. if (params.aggregations) {
  38341. paramsBySql.aggregations = params.aggregations;
  38342. }
  38343. if (params.targetEpsgCode) {
  38344. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  38345. }
  38346. if (!params.targetEpsgCode && params.targetPrj) {
  38347. paramsBySql.targetPrj = params.targetPrj;
  38348. }
  38349. if (params.aggregations) {
  38350. paramsBySql.aggregations = params.aggregations;
  38351. }
  38352. return Util_Util.toJSON(paramsBySql);
  38353. }
  38354. }
  38355. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLService.js
  38356. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38357. * This program are made available under the terms of the Apache License, Version 2.0
  38358. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38359. /**
  38360. * @class GetFeaturesBySQLService
  38361. * @deprecatedclass SuperMap.GetFeaturesBySQLService
  38362. * @constructs GetFeaturesBySQLService
  38363. * @category iServer Data FeatureResults
  38364. * @classdesc 数据服务中数据集 SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  38365. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  38366. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  38367. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  38368. * @param {Object} options - 参数。
  38369. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  38370. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  38371. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38372. * @param {Object} [options.headers] - 请求头。
  38373. * @extends {GetFeaturesServiceBase}
  38374. * @example
  38375. * var myGetFeaturesBySQLService = new GetFeaturesBySQLService(url, {
  38376. * eventListeners: {
  38377. * "processCompleted": GetFeaturesCompleted,
  38378. * "processFailed": GetFeaturesError
  38379. * }
  38380. * });
  38381. * function getFeaturesCompleted(object){//todo};
  38382. * function getFeaturesError(object){//todo};
  38383. * @usage
  38384. */
  38385. class GetFeaturesBySQLService extends GetFeaturesServiceBase {
  38386. constructor(url, options) {
  38387. super(url, options);
  38388. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLService";
  38389. }
  38390. /**
  38391. * @function GetFeaturesBySQLService.prototype.destroy
  38392. * @override
  38393. */
  38394. destroy() {
  38395. super.destroy();
  38396. }
  38397. /*
  38398. * @function GetFeaturesBySQLService.prototype.getJsonParameters
  38399. * @description 将查询参数转化为 JSON 字符串。
  38400. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  38401. * @param {GetFeaturesBySQLParameters} params - 数据集SQL查询参数类。
  38402. * @returns {string} 转化后的 JSON 字符串。
  38403. */
  38404. getJsonParameters(params) {
  38405. return GetFeaturesBySQLParameters.toJsonParameters(params);
  38406. }
  38407. }
  38408. ;// CONCATENATED MODULE: ./src/common/iServer/GetFieldsService.js
  38409. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38410. * This program are made available under the terms of the Apache License, Version 2.0
  38411. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38412. /**
  38413. * @class GetFieldsService
  38414. * @deprecatedclass SuperMap.GetFieldsService
  38415. * @category iServer Data Field
  38416. * @classdesc 字段查询服务,支持查询指定数据集的中所有属性字段(field)的集合。
  38417. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  38418. * @param {Object} options - 参数。
  38419. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  38420. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  38421. * @param {string}options.datasource - 数据源名称。
  38422. * @param {string}options.dataset - 数据集名称。
  38423. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38424. * @param {Object} [options.headers] - 请求头。
  38425. * @extends {CommonServiceBase}
  38426. * @example
  38427. * var myService = new GetFieldsService(url, {eventListeners: {
  38428. * "processCompleted": getFieldsCompleted,
  38429. * "processFailed": getFieldsError
  38430. * },
  38431. * datasource: "World",
  38432. * dataset: "Countries"
  38433. * };
  38434. * @usage
  38435. */
  38436. class GetFieldsService extends CommonServiceBase {
  38437. constructor(url, options) {
  38438. super(url, options);
  38439. /**
  38440. * @member {string} GetFieldsService.prototype.datasource
  38441. * @description 要查询的数据集所在的数据源名称。
  38442. */
  38443. this.datasource = null;
  38444. /**
  38445. * @member {string} GetFieldsService.prototype.dataset
  38446. * @description 要查询的数据集名称。
  38447. */
  38448. this.dataset = null;
  38449. if (options) {
  38450. Util_Util.extend(this, options);
  38451. }
  38452. this.CLASS_NAME = "SuperMap.GetFieldsService";
  38453. }
  38454. /**
  38455. * @function GetFieldsService.prototype.destroy
  38456. * @override
  38457. */
  38458. destroy() {
  38459. super.destroy();
  38460. var me = this;
  38461. me.datasource = null;
  38462. me.dataset = null;
  38463. }
  38464. /**
  38465. * @function GetFieldsService.prototype.processAsync
  38466. * @description 执行服务,查询指定数据集的字段信息。
  38467. */
  38468. processAsync() {
  38469. var me = this;
  38470. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.datasource}/datasets/${me.dataset}/fields`);
  38471. me.request({
  38472. method: "GET",
  38473. data: null,
  38474. scope: me,
  38475. success: me.serviceProcessCompleted,
  38476. failure: me.serviceProcessFailed
  38477. });
  38478. }
  38479. }
  38480. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosParameters.js
  38481. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38482. * This program are made available under the terms of the Apache License, Version 2.0
  38483. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38484. /**
  38485. * @class GetGridCellInfosParameters
  38486. * @deprecatedclass SuperMap.GetGridCellInfosParameters
  38487. * @category iServer Data Grid
  38488. * @classdesc 数据服务栅格查询参数类。
  38489. * @param {Object} options - 参数。
  38490. * @param {string} options.datasetName - 数据集名称。
  38491. * @param {string} options.dataSourceName - 数据源名称。
  38492. * @param {number} options.X - 地理位置 X 轴。
  38493. * @param {number} options.Y - 地理位置 Y 轴。
  38494. * @usage
  38495. */
  38496. class GetGridCellInfosParameters {
  38497. constructor(options) {
  38498. /**
  38499. * @member {string} GetGridCellInfosParameters.prototype.datasetName
  38500. * @description 数据集名称。
  38501. */
  38502. this.datasetName = null;
  38503. /**
  38504. * @member {string} GetGridCellInfosParameters.prototype.dataSourceName
  38505. * @description 数据源名称。
  38506. */
  38507. this.dataSourceName = null;
  38508. /**
  38509. * @member {number} GetGridCellInfosParameters.prototype.X
  38510. * @description 要查询的地理位置 X 轴。
  38511. */
  38512. this.X = null;
  38513. /**
  38514. * @member {number} GetGridCellInfosParameters.prototype.Y
  38515. * @description 要查询的地理位置 Y 轴。
  38516. */
  38517. this.Y = null;
  38518. Util_Util.extend(this, options);
  38519. this.CLASS_NAME = "SuperMap.GetGridCellInfosParameters";
  38520. }
  38521. /**
  38522. * @function GetGridCellInfosParameters.prototype.destroy
  38523. * @description 释放资源,将引用的资源属性置空。
  38524. */
  38525. destroy() {
  38526. var me = this;
  38527. me.datasetName = null;
  38528. me.dataSourceName = null;
  38529. me.X = null;
  38530. me.Y = null;
  38531. }
  38532. }
  38533. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosService.js
  38534. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38535. * This program are made available under the terms of the Apache License, Version 2.0
  38536. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38537. /**
  38538. * @class GetGridCellInfosService
  38539. * @deprecatedclass SuperMap.GetGridCellInfosService
  38540. * @category iServer Data Grid
  38541. * @classdesc 数据栅格查询服务,支持查询指定地理位置的栅格信息。
  38542. * @param {string} url - 服务地址。例如: http://localhost:8090/iserver/services/data-jingjin/rest/data
  38543. * @param {Object} options - 参数。
  38544. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  38545. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  38546. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38547. * @param {Object} [options.headers] - 请求头。
  38548. * @extends {CommonServiceBase}
  38549. * @example
  38550. * var myService = new GetGridCellInfosService(url, {eventListeners: {
  38551. * "processCompleted": queryCompleted,
  38552. * "processFailed": queryError
  38553. * }
  38554. * });
  38555. * @usage
  38556. */
  38557. class GetGridCellInfosService extends CommonServiceBase {
  38558. constructor(url, options) {
  38559. super(url, options);
  38560. /**
  38561. * @member {string} GetGridCellInfosService.prototype.datasetName
  38562. * @description 数据集名称。
  38563. */
  38564. this.datasetName = null;
  38565. /**
  38566. * @member {string} GetGridCellInfosService.prototype.dataSourceName
  38567. * @description 数据源名称。
  38568. */
  38569. this.dataSourceName = null;
  38570. /**
  38571. * @member {string} GetGridCellInfosService.prototype.datasetType
  38572. * @description 数据集类型。
  38573. */
  38574. this.datasetType = null;
  38575. /**
  38576. * @member {number} GetGridCellInfosService.prototype.X
  38577. * @description 要查询的地理位置X轴
  38578. */
  38579. this.X = null;
  38580. /**
  38581. * @member {number} GetGridCellInfosService.prototype.Y
  38582. * @description 要查询的地理位置Y轴
  38583. */
  38584. this.Y = null;
  38585. if (options) {
  38586. Util_Util.extend(this, options);
  38587. }
  38588. this.eventCount = 0;
  38589. this.CLASS_NAME = "SuperMap.GetGridCellInfosService";
  38590. }
  38591. /**
  38592. * @function GetGridCellInfosService.prototype.destroy
  38593. * @override
  38594. */
  38595. destroy() {
  38596. super.destroy();
  38597. var me = this;
  38598. me.X = null;
  38599. me.Y = null;
  38600. me.datasetName = null;
  38601. me.dataSourceName = null;
  38602. me.datasetType = null;
  38603. }
  38604. /**
  38605. * @function GetGridCellInfosService.prototype.processAsync
  38606. * @description 执行服务,查询数据集信息。
  38607. * @param {GetGridCellInfosParameters} params - 查询参数。
  38608. */
  38609. processAsync(params, callback) {
  38610. if (!(params instanceof GetGridCellInfosParameters)) {
  38611. return;
  38612. }
  38613. Util_Util.extend(this, params);
  38614. var me = this;
  38615. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.dataSourceName}/datasets/${me.datasetName}`);
  38616. me.queryRequest(me.getDatasetInfoCompleted.bind(me), me.getDatasetInfoFailed.bind(me), callback);
  38617. }
  38618. /**
  38619. * @function GetGridCellInfosService.prototype.queryRequest
  38620. * @description 执行服务,查询。
  38621. * @callback {function} successFun - 成功后执行的函数。
  38622. * @callback {function} failedFunc - 失败后执行的函数。
  38623. */
  38624. queryRequest(successFun, failedFunc, callback) {
  38625. let eventId = ++this.eventCount;
  38626. let eventListeners = {
  38627. scope: this,
  38628. processCompleted: function(result) {
  38629. if (eventId === result.result.eventId && callback) {
  38630. delete result.result.eventId;
  38631. callback(result);
  38632. this.events && this.events.un(eventListeners);
  38633. return false;
  38634. }
  38635. },
  38636. processFailed: function(result) {
  38637. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  38638. callback(result);
  38639. this.events && this.events.un(eventListeners);
  38640. return false;
  38641. }
  38642. }
  38643. }
  38644. this.events.on(eventListeners);
  38645. var me = this;
  38646. me.request({
  38647. method: "GET",
  38648. data: null,
  38649. scope: me,
  38650. success(result, options) {
  38651. result.eventId = eventId;
  38652. successFun(result, options, callback);
  38653. },
  38654. failure(result, options) {
  38655. if (result.error) {
  38656. result.error.eventId = eventId;
  38657. }
  38658. result.eventId = eventId;
  38659. failedFunc(result, options);
  38660. }
  38661. });
  38662. }
  38663. /**
  38664. * @function GetGridCellInfosService.prototype.getDatasetInfoCompleted
  38665. * @description 数据集查询完成,执行此方法。
  38666. * @param {Object} result - 服务器返回的结果对象。
  38667. */
  38668. getDatasetInfoCompleted(result, options, callback) {
  38669. var me = this;
  38670. result = Util_Util.transformResult(result);
  38671. me.datasetType = result.datasetInfo.type;
  38672. me.queryGridInfos(callback);
  38673. }
  38674. /**
  38675. * @function GetGridCellInfosService.prototype.queryGridInfos
  38676. * @description 执行服务,查询数据集栅格信息。
  38677. */
  38678. queryGridInfos(callback) {
  38679. var me = this;
  38680. me.url = Util_Util.urlPathAppend(me.url, me.datasetType == 'GRID' ? 'gridValue' : 'imageValue');
  38681. if (me.X != null && me.Y != null) {
  38682. me.url = Util_Util.urlAppend(me.url, `x=${me.X}&y=${me.Y}`);
  38683. }
  38684. me.queryRequest(me.serviceProcessCompleted.bind(me), me.serviceProcessFailed.bind(me), callback);
  38685. }
  38686. /**
  38687. * @function GetGridCellInfosService.prototype.getDatasetInfoFailed
  38688. * @description 数据集查询失败,执行此方法。
  38689. * @param {Object} result - 服务器返回的结果对象。
  38690. */
  38691. getDatasetInfoFailed(result, options) {
  38692. var me = this;
  38693. me.serviceProcessFailed(result, options);
  38694. }
  38695. }
  38696. ;// CONCATENATED MODULE: ./src/common/iServer/Theme.js
  38697. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38698. * This program are made available under the terms of the Apache License, Version 2.0
  38699. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38700. /**
  38701. * @class CommonTheme
  38702. * @aliasclass Theme
  38703. * @deprecatedclass SuperMap.Theme
  38704. * @category iServer Map Theme
  38705. * @classdesc 专题图基类。
  38706. * @param {string} type - 专题图类型。
  38707. * @param {Object} options - 可选参数。
  38708. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  38709. * @usage
  38710. */
  38711. class Theme {
  38712. constructor(type, options) {
  38713. if (!type) {
  38714. return this;
  38715. }
  38716. /**
  38717. * @member {ThemeMemoryData} CommonTheme.prototype.memoryData
  38718. * @description 专题图内存数据。<br>
  38719. * 用内存数据制作专题图的方式与表达式制作专题图的方式互斥,前者优先级较高。
  38720. * 第一个参数代表专题值,即数据集中用来做专题图的字段或表达式的值;第二个参数代表外部值。在制作专题图时,会用外部值代替专题值来制作相应的专题图。
  38721. */
  38722. this.memoryData = null;
  38723. /**
  38724. * @member {string} CommonTheme.prototype.type
  38725. * @description 专题图类型。
  38726. */
  38727. this.type = type;
  38728. if (options) {
  38729. Util_Util.extend(this, options);
  38730. }
  38731. this.CLASS_NAME = "SuperMap.Theme";
  38732. }
  38733. /**
  38734. * @function CommonTheme.prototype.destroy
  38735. * @description 释放资源,将引用资源的属性置空。
  38736. */
  38737. destroy() {
  38738. var me = this;
  38739. if (me.memoryData) {
  38740. me.memoryData.destroy();
  38741. me.memoryData = null;
  38742. }
  38743. me.type = null;
  38744. }
  38745. /**
  38746. * @function CommonTheme.prototype.toServerJSONObject
  38747. * @description 转换成对应的 JSON 格式对象。
  38748. * @returns {Object} 对应的 JSON 格式对象。
  38749. */
  38750. toServerJSONObject() {
  38751. //return 子类实现
  38752. return;
  38753. }
  38754. }
  38755. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTextStyle.js
  38756. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38757. * This program are made available under the terms of the Apache License, Version 2.0
  38758. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38759. /**
  38760. * @class ServerTextStyle
  38761. * @deprecatedclass SuperMap.ServerTextStyle
  38762. * @category iServer Map Theme
  38763. * @classdesc 服务端文本风格类。该类用于定义文本风格的相关属性。
  38764. * @param {Object} options - 可选参数。
  38765. * @param {TextAlignment} [options.align=TextAlignment.BASELINECENTER] - 文本的对齐方式。
  38766. * @param {ServerColor} [options.backColor] - 文本的背景色。默认 backColor = new ServerColor(255, 255, 255)。
  38767. * @param {ServerColor} [options.foreColor] - 文本的前景色。默认 foreColor = new ServerColor(0, 0, 0)。
  38768. * @param {boolean} [options.backOpaque=false] - 文本背景是否不透明。
  38769. * @param {boolean} [options.sizeFixed=true] - 文本大小是否固定。
  38770. * @param {number} [options.fontHeight=6] - 文本字体的高度。
  38771. * @param {number} [options.fontWidth=0] - 文本字体的宽度。
  38772. * @param {number} [options.fontWeight=400] - 文本字体的磅数。
  38773. * @param {string} [options.fontName='Times New Roman'] - 文本字体的名称。
  38774. * @param {boolean} [options.bold=false] - 文本是否为粗体字。
  38775. * @param {boolean} [options.italic=false] - 文本是否采用斜体。
  38776. * @param {number} [options.italicAngle=0] - 字体倾斜角度。
  38777. * @param {boolean} [options.shadow=false] - 文本是否有阴影。
  38778. * @param {boolean} [options.strikeout=false] - 文本字体是否加删除线。
  38779. * @param {boolean} [options.outline=false] - 是否以轮廓的方式来显示文本的背景。
  38780. * @param {number} [options.opaqueRate=0] - 注记文字的不透明度。
  38781. * @param {boolean} [options.underline=false] - 文本字体是否加下划线。
  38782. * @param {number} [options.rotation=0.0] - 文本旋转的角度。
  38783. * @usage
  38784. */
  38785. class ServerTextStyle {
  38786. constructor(options) {
  38787. /**
  38788. * @member {TextAlignment} [ServerTextStyle.prototype.align= TextAlignment.BASELINECENTER]
  38789. * @description 文本的对齐方式。
  38790. */
  38791. this.align = TextAlignment.BASELINECENTER;
  38792. /**
  38793. * @member {ServerColor} [ServerTextStyle.prototype.backColor=(255, 255, 255)]
  38794. * @description 文本的背景色。
  38795. */
  38796. this.backColor = new ServerColor(255, 255, 255);
  38797. /**
  38798. * @member {ServerColor} [ServerTextStyle.prototype.foreColor=(0, 0, 0)]
  38799. * @description 文本的前景色。
  38800. */
  38801. this.foreColor = new ServerColor(0, 0, 0);
  38802. /**
  38803. * @member {boolean} [ServerTextStyle.prototype.backOpaque=false]
  38804. * @description 文本背景是否不透明。true 表示文本背景不透明。
  38805. */
  38806. this.backOpaque = false;
  38807. /**
  38808. * @member {boolean} [ServerTextStyle.prototype.sizeFixed=true]
  38809. * @description 文本大小是否固定。设置为 true,表示图片为固定像素大小,具体大小请参考 fontHeight。当设为 false 时,图片会随着地图缩放而缩放。
  38810. */
  38811. this.sizeFixed = true;
  38812. /**
  38813. * @member {number} [ServerTextStyle.prototype.fontHeight=6]
  38814. * @description 文本字体的高度,单位与 sizeFixed 有关,当 sizeFixed 为 False 时,即非固定文本大小时使用地图坐标单位,
  38815. * 如地理坐标系下的地图中单位为度;当 sizeFixed 为 True 时,单位为毫米(mm)。
  38816. */
  38817. this.fontHeight = 6;
  38818. /**
  38819. * @member {number} [ServerTextStyle.prototype.fontWidth=0]
  38820. * @description 文本字体的宽度。字体的宽度以英文字符为标准,由于一个中文字符相当于两个英文字符。
  38821. */
  38822. this.fontWidth = 0;
  38823. /**
  38824. * @member {number} [ServerTextStyle.prototype.fontWeight=400]
  38825. * @description 文本字体的磅数。表示粗体的具体数值。取值范围为从0-900之间的整百数。
  38826. */
  38827. this.fontWeight = 400;
  38828. /**
  38829. * @member {string} [ServerTextStyle.prototype.fontName="Times New Roman"]
  38830. * @description 文本字体的名称。
  38831. */
  38832. this.fontName = "Times New Roman";
  38833. /**
  38834. * @member {boolean} [ServerTextStyle.prototype.bold=false]
  38835. * @description 文本是否为粗体字。true 表示为粗体。false 表示文本不是粗体字。
  38836. */
  38837. this.bold = false;
  38838. /**
  38839. * @member {boolean} [ServerTextStyle.prototype.italic=false]
  38840. * @description 文本是否采用斜体。true 表示采用斜体。
  38841. */
  38842. this.italic = false;
  38843. /**
  38844. * @member {number} [ServerTextStyle.prototype.italicAngle=0]
  38845. * @description 字体倾斜角度。正负度之间,以度为单位,精确到0.1度。当倾斜角度为0度,为系统默认的字体倾斜样式。
  38846. * 正负度是指以纵轴为起始零度线,其纵轴左侧为正,右侧为负。允许的最大角度为60,最小-60。大于60按照60处理,小于-60按照-60处理。目前只对标签专题图有效。
  38847. */
  38848. this.italicAngle = 0;
  38849. /**
  38850. * @member {boolean} [ServerTextStyle.prototype.shadow=false]
  38851. * @description 文本是否有阴影。true 表示给文本增加阴影。false 表示文本没有阴影。
  38852. */
  38853. this.shadow = false;
  38854. /**
  38855. * @member {boolean} [ServerTextStyle.prototype.strikeout=false]
  38856. * @description 文本字体是否加删除线。true 表示加删除线。false 表示文本字体不加删除线。
  38857. */
  38858. this.strikeout = false;
  38859. /**
  38860. * @member {boolean} [ServerTextStyle.prototype.outline=false]
  38861. * @description 是否以轮廓的方式来显示文本的背景。true 表示以轮廓的方式来显示文本的背景。false 表示不以轮廓的方式来显示文本的背景。
  38862. */
  38863. this.outline = false;
  38864. /**
  38865. * @member {number} [ServerTextStyle.prototype.opaqueRate=0]
  38866. * @description 注记文字的不透明度。不透明度的范围为0-100。0表示透明。
  38867. */
  38868. this.opaqueRate = 0;
  38869. /**
  38870. * @member {boolean} [ServerTextStyle.prototype.underline=false]
  38871. * @description 文本字体是否加下划线。true 表示加下划线。
  38872. */
  38873. this.underline = false;
  38874. /**
  38875. * @member {number} [ServerTextStyle.prototype.rotation=0.0]
  38876. * @description 文本旋转的角度。逆时针方向为正方向,单位为度,精确到0.1度。
  38877. */
  38878. this.rotation = 0.0;
  38879. if (options) {
  38880. Util_Util.extend(this, options);
  38881. }
  38882. this.CLASS_NAME = "SuperMap.ServerTextStyle";
  38883. }
  38884. /**
  38885. * @function ServerTextStyle.prototype.destroy
  38886. * @description 释放资源,将引用资源的属性置空。
  38887. */
  38888. destroy() {
  38889. var me = this;
  38890. me.align = null;
  38891. if (me.backColor) {
  38892. me.backColor.destroy();
  38893. me.backColor = null;
  38894. }
  38895. if (me.foreColor) {
  38896. me.foreColor.destroy();
  38897. me.foreColor = null;
  38898. }
  38899. me.backOpaque = null;
  38900. me.sizeFixed = null;
  38901. me.fontHeight = null;
  38902. me.fontWidth = null;
  38903. me.fontWeight = null;
  38904. me.fontName = null;
  38905. me.bold = null;
  38906. me.italic = null;
  38907. me.italicAngle = null;
  38908. me.shadow = null;
  38909. me.strikeout = null;
  38910. me.outline = null;
  38911. me.opaqueRate = null;
  38912. me.underline = null;
  38913. me.rotation = null;
  38914. }
  38915. /**
  38916. * @function ServerTextStyle.fromObj
  38917. * @description 从传入对象获服务端文本风格类。
  38918. * @param {Object} obj - 传入对象
  38919. * @returns {ServerTextStyle} 返回服务端文本风格对象
  38920. */
  38921. static fromObj(obj) {
  38922. var res = new ServerTextStyle(obj);
  38923. Util_Util.copy(res, obj);
  38924. res.backColor = ServerColor.fromJson(obj.backColor);
  38925. res.foreColor = ServerColor.fromJson(obj.foreColor);
  38926. return res;
  38927. }
  38928. }
  38929. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelItem.js
  38930. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38931. * This program are made available under the terms of the Apache License, Version 2.0
  38932. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38933. /**
  38934. * @class ThemeLabelItem
  38935. * @deprecatedclass SuperMap.ThemeLabelItem
  38936. * @category iServer Map Theme
  38937. * @classdesc 分段标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注。
  38938. * 值得注意的是,分段标签专题图允许用户通过 rangeExpression 字段指定用于分段的数值型字段,
  38939. * 同一范围段内的标签具有相同的显示风格,其中每一个范围段就是一个专题图子项,
  38940. * 每一个子项都具有其名称、风格、起始值和终止值。注意:每个分段所表示的范围为 [Start, End)。例如:标签专题图的分段点有两个子项,
  38941. * 他们所代表的分段区间分别为[0,5),[5,10)。那么需要分别设置 ThemeLabelItem[0].start=0,
  38942. * ThemeLabelItem[0].end=5,SuperMap.ThemeLabelItem[1].start=5,SuperMap.ThemeLabelItem[1].end=10。
  38943. * @param {Object} options - 可选参数。
  38944. * @param {string} [options.caption] - 子项的名称。
  38945. * @param {number} [options.end=0] - 子项的终止值。
  38946. * @param {number} [options.start=0] - 子项的分段起始值。
  38947. * @param {boolean} [options.visible=true] - 子项是否可见。
  38948. * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
  38949. * @usage
  38950. */
  38951. class ThemeLabelItem {
  38952. constructor(options) {
  38953. /**
  38954. * @member {string} [ThemeLabelItem.prototype.caption]
  38955. * @description 标签专题子项的标题。
  38956. */
  38957. this.caption = null;
  38958. /**
  38959. * @member {number} [ThemeLabelItem.prototype.end=0]
  38960. * @description 标签专题图子项的终止值。如果该子项是分段中最后一个子项,那么该终止值就是分段的最大值;
  38961. * 如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常。
  38962. */
  38963. this.end = 0;
  38964. /**
  38965. * @member {number} [ThemeLabelItem.prototype.start=0]
  38966. * @description 标签专题图子项的分段起始值。如果该子项是分段中第一项,那么该起始值就是分段的最小值;
  38967. * 如果该子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  38968. */
  38969. this.start = 0;
  38970. /**
  38971. * @member {boolean} [ThemeLabelItem.prototype.visible=true]
  38972. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  38973. */
  38974. this.visible = true;
  38975. /**
  38976. * @member {ServerTextStyle} ThemeLabelItem.prototype.style
  38977. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  38978. * uniformMixedStyle(标签文本的复合风格),ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  38979. */
  38980. this.style = new ServerTextStyle();
  38981. if (options) {
  38982. Util_Util.extend(this, options);
  38983. }
  38984. this.CLASS_NAME = "SuperMap.ThemeLabelItem";
  38985. }
  38986. /**
  38987. * @function ThemeLabelItem.prototype.destroy
  38988. * @description 释放资源,将引用资源的属性置空。
  38989. */
  38990. destroy() {
  38991. var me = this;
  38992. me.caption = null;
  38993. me.end = null;
  38994. me.start = null;
  38995. if (me.style) {
  38996. me.style.destroy();
  38997. me.style = null;
  38998. }
  38999. me.visible = null;
  39000. }
  39001. /**
  39002. * @function ThemeLabelItem.fromObj
  39003. * @description 从传入对象获取分段标签专题图的子项类。
  39004. * @param {Object} obj - 传入对象。
  39005. * @returns {ThemeLabelItem} ThemeLabelItem 对象。
  39006. */
  39007. static fromObj(obj) {
  39008. if (!obj) {
  39009. return;
  39010. }
  39011. var t = new ThemeLabelItem();
  39012. Util_Util.copy(t, obj);
  39013. return t;
  39014. }
  39015. }
  39016. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUniqueItem.js
  39017. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39018. * This program are made available under the terms of the Apache License, Version 2.0
  39019. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39020. /**
  39021. * @class ThemeUniqueItem
  39022. * @deprecatedclass SuperMap.ThemeUniqueItem
  39023. * @category iServer Map Theme
  39024. * @classdesc 单值专题图子项类。单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有 5 种不同值,则该行政区划图有 5 个专题图子项。
  39025. * @param {Object} options - 参数。
  39026. * @param {string} options.unique - 子项的单值字段。
  39027. * @param {string} [options.caption] - 子项的标题。
  39028. * @param {ServerStyle} [options.style] - 子项的风格。
  39029. * @param {boolean} [options.visible=true] - 子项是否可见。
  39030. * @usage
  39031. */
  39032. class ThemeUniqueItem {
  39033. constructor(options) {
  39034. /**
  39035. * @member {string} [ThemeUniqueItem.prototype.caption]
  39036. * @description 单值专题图子项的标题。
  39037. */
  39038. this.caption = null;
  39039. /**
  39040. * @member {ServerStyle} [ThemeUniqueItem.prototype.style]
  39041. * @description 单值专题图子项的显示风格。
  39042. */
  39043. this.style = new ServerStyle();
  39044. /**
  39045. * @member {string} ThemeUniqueItem.prototype.unique
  39046. * @description 单值专题图子项的值,可以为数字、字符串等。
  39047. */
  39048. this.unique = null;
  39049. /**
  39050. * @member {boolean} [ThemeUniqueItem.prototype.visible=true]
  39051. * @description 单值专题图子项的可见性。
  39052. */
  39053. this.visible = true;
  39054. if (options) {
  39055. Util_Util.extend(this, options);
  39056. }
  39057. this.CLASS_NAME = "SuperMap.ThemeUniqueItem";
  39058. }
  39059. /**
  39060. * @function ThemeUniqueItem.prototype.destroy
  39061. * @description 释放资源,将引用资源的属性置空。
  39062. */
  39063. destroy() {
  39064. var me = this;
  39065. me.caption = null;
  39066. me.unique = null;
  39067. if (me.style) {
  39068. me.style.destroy();
  39069. me.style = null;
  39070. }
  39071. me.visible = null;
  39072. }
  39073. /**
  39074. * @function ThemeUniqueItem.prototype.toServerJSONObject
  39075. * @description 转换成对应的 JSON 格式对象。
  39076. * @returns {Object} 对应的 JSON 格式对象。
  39077. */
  39078. toServerJSONObject() {
  39079. var obj = {};
  39080. obj = Util_Util.copyAttributes(obj, this);
  39081. if (obj.style) {
  39082. if (obj.style.toServerJSONObject) {
  39083. obj.style = obj.style.toServerJSONObject();
  39084. }
  39085. }
  39086. return obj;
  39087. }
  39088. /**
  39089. * @function ThemeUniqueItem.fromObj
  39090. * @description 从传入对象获取单值专题图子项类。
  39091. * @param {Object} obj - 传入对象。
  39092. * @returns {ThemeUniqueItem} ThemeUniqueItem 对象。
  39093. */
  39094. static fromObj(obj) {
  39095. var res = new ThemeUniqueItem();
  39096. Util_Util.copy(res, obj);
  39097. res.style = ServerStyle.fromJson(obj.style);
  39098. return res;
  39099. }
  39100. }
  39101. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeOffset.js
  39102. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39103. * This program are made available under the terms of the Apache License, Version 2.0
  39104. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39105. /**
  39106. * @class ThemeOffset
  39107. * @deprecatedclass SuperMap.ThemeOffset
  39108. * @category iServer Map Theme
  39109. * @classdesc 专题图中文本或符号相对于要素内点的偏移量设置类。
  39110. * 通过该类可以设置专题图中标记文本或符号的偏移量以及偏移量是否随地图缩放而改变。
  39111. * @param {Object} options - 可选参数。
  39112. * @param {boolean} [options.offsetFixed=false] - 当前专题图是否固定标记文本或符号的偏移量。
  39113. * @param {string} [options.offsetX='0.0'] - 专题图中文本或符号相对于要素内点的水平偏移量。
  39114. * @param {string} [options.offsetY='0.0'] - 专题图中文本或符号相对于要素内点的垂直偏移量。
  39115. * @usage
  39116. */
  39117. class ThemeOffset {
  39118. constructor(options) {
  39119. /**
  39120. * @member {boolean} [ThemeOffset.prototype.offsetFixed=false]
  39121. * @description 当前专题图是否固定标记文本或符号的偏移量。所谓固定偏移量,指文本或符号的偏移量不随地图的缩放而变化。
  39122. */
  39123. this.offsetFixed = false;
  39124. /**
  39125. * @member {string} [ThemeOffset.prototype.offsetX=0.0]
  39126. * @description 专题图中文本或符号相对于要素内点的水平偏移量。偏移量的单位为地图单位。
  39127. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么水平偏移量为2。
  39128. */
  39129. this.offsetX = "0.0";
  39130. /**
  39131. * @member {string} [ThemeOffset.prototype.offsetY=0.0]
  39132. * @description 专题图中文本或符号相对于要素内点的垂直偏移量。偏移量的单位为地图单位。
  39133. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么垂直偏移量为2。
  39134. */
  39135. this.offsetY = "0.0";
  39136. if (options) {
  39137. Util_Util.extend(this, options);
  39138. }
  39139. this.CLASS_NAME = "SuperMap.ThemeOffset";
  39140. }
  39141. /**
  39142. * @function ThemeOffset.prototype.destroy
  39143. * @description 释放资源,将引用资源的属性置空。
  39144. */
  39145. destroy() {
  39146. var me = this;
  39147. me.offsetFixed = null;
  39148. me.offsetX = null;
  39149. me.offsetY = null;
  39150. }
  39151. /**
  39152. * @function ThemeOffset.fromObj
  39153. * @description 从传入对象获取专题图中文本或符号相对于要素内点的偏移量设置类。
  39154. * @param {Object} obj - 传入对象。
  39155. * @returns {ThemeOffset} ThemeOffset 对象。
  39156. */
  39157. static fromObj(obj) {
  39158. if (!obj) {
  39159. return;
  39160. }
  39161. var res = new ThemeOffset();
  39162. Util_Util.copy(res, obj);
  39163. return res;
  39164. }
  39165. }
  39166. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMixedTextStyle.js
  39167. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39168. * This program are made available under the terms of the Apache License, Version 2.0
  39169. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39170. /**
  39171. * @class LabelMixedTextStyle
  39172. * @deprecatedclass SuperMap.LabelMixedTextStyle
  39173. * @category iServer Map Theme
  39174. * @classdesc 标签文本复合风格类。
  39175. * 该类主要用于对标签专题图中标签的文本内容进行风格设置。通过该类用户可以使标签的文字显示不同的风格,比如文本 “喜马拉雅山”,通过本类可以将前三个字用红色显示,后两个字用蓝色显示。对同一文本设置不同的风格实质上是对文本的字符进行分段,同一分段内的字符具有相同的显示风格。对字符分段有两种方式,一种是利用分隔符对文本进行分段;另一种是根据分段索引值进行分段:</br>
  39176. * 1.利用分隔符对文本进行分段: 比如文本 “5&109” 被分隔符 “&” 分为 “5” 和 “109” 两部分,
  39177. * 在显示时,“5” 和分隔符 “&” 使用同一个风格,字符串 “109” 使用相同的风格。<br>
  39178. * 2.利用分段索引值进行分段: 文本中字符的索引值是以0开始的整数,比如文本 “珠穆朗玛峰”,
  39179. * 第一个字符(“珠”)的索引值为 0,第二个字符(“穆”)的索引值为 1,以此类推;当设置分段索引值为 1,3,4,9 时,
  39180. * 字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),可以看出索引号为 0 的字符(即“珠” )在第一个分段内,
  39181. * 索引号为 1,2 的字符(即“穆”、“朗”)位于第二个分段内,索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  39182. * @param {Object} options - 可选参数。
  39183. * @param {ServerTextStyle} [options.defaultStyle] - 默认的文本复合风格。
  39184. * @param {string} [options.separator] - 文本的分隔符。
  39185. * @param {boolean} [options.separatorEnabled=false] - 文本的分隔符是否有效。
  39186. * @param {Array.<number>} [options.splitIndexes] - 分段索引值,分段索引值用来对文本中的字符进行分段。
  39187. * @param {Array.<ServerTextStyle>} [options.styles] - 文本样式集合。
  39188. * @usage
  39189. */
  39190. class LabelMixedTextStyle {
  39191. constructor(options) {
  39192. /**
  39193. * @member {ServerTextStyle} LabelMixedTextStyle.prototype.defaultStyle
  39194. * @description 默认的文本复合风格,即 ServerTextStyle 各字段的默认值。
  39195. */
  39196. this.defaultStyle = null;
  39197. /**
  39198. * @member {string} LabelMixedTextStyle.prototype.separator
  39199. * @description 文本的分隔符,分隔符的风格与前一个字符的风格一样。文本的分隔符是一个将文本分割开的符号,
  39200. * 比如文本 “5_109” 被 “ _ ” 分隔为 “5” 和 “109” 两部分,假设有风格数组:style1、style2。
  39201. * 在显示时,“5” 和分隔符 “ _ ” 使用 Style1 风格渲染,字符串 “109” 使用 Style2 的风格。
  39202. */
  39203. this.separator = null;
  39204. /**
  39205. * @member {boolean} [LabelMixedTextStyle.prototype.separatorEnabled=false]
  39206. * @description 文本的分隔符是否有效。分隔符有效时利用分隔符对文本进行分段;无效时根据文本中字符的位置进行分段。
  39207. * 分段后,同一分段内的字符具有相同的显示风格。
  39208. */
  39209. this.separatorEnabled = false;
  39210. /**
  39211. * @member {Array.<number>} LabelMixedTextStyle.prototype.splitIndexes
  39212. * @description 分段索引值,分段索引值用来对文本中的字符进行分段。
  39213. * 文本中字符的索引值是以 0 开始的整数,比如文本“珠穆朗玛峰”,第一个字符(“珠”)的索引值为0,第二个字符(“穆”)的索引值为 1,
  39214. * 以此类推;当设置分段索引值数组为 [1,3,4,9] 时,字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),
  39215. * 可以看出索引号为 0 的字符(即 “珠”)在第一个分段内,索引号为 1,2 的字符(即 “穆”、“朗”)位于第二个分段内,
  39216. * 索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  39217. */
  39218. this.splitIndexes = null;
  39219. /**
  39220. * @member {Array.<ServerTextStyle>} LabelMixedTextStyle.prototype.styles
  39221. * @description 文本样式集合。文本样式集合中的样式根据索引与不同分段一一对应,
  39222. * 如果有分段没有风格对应则使用 defaultStyle。
  39223. */
  39224. this.styles = new ServerTextStyle();
  39225. if (options) {
  39226. Util_Util.extend(this, options);
  39227. }
  39228. this.CLASS_NAME = "SuperMap.LabelMixedTextStyle"
  39229. }
  39230. /**
  39231. * @function LabelMixedTextStyle.prototype.destroy
  39232. * @description 释放资源,将引用资源的属性置空。
  39233. */
  39234. destroy() {
  39235. var me = this;
  39236. if (me.defaultStyle) {
  39237. me.defaultStyle.destroy();
  39238. me.defaultStyle = null;
  39239. }
  39240. me.separator = null;
  39241. me.separatorEnabled = null;
  39242. if (me.splitIndexes) {
  39243. me.splitIndexes = null;
  39244. }
  39245. if (me.styles) {
  39246. for (var i = 0, styles = me.styles, len = styles.length; i < len; i++) {
  39247. styles[i].destroy();
  39248. }
  39249. me.styles = null;
  39250. }
  39251. }
  39252. /**
  39253. * @function LabelMixedTextStyle.fromObj
  39254. * @description 从传入对象获取标签文本复合风格类。
  39255. * @param {Object} obj - 传入对象。
  39256. * @returns {LabelMixedTextStyle} 返回新的 LabelMixedTextStyle 对象。
  39257. */
  39258. static fromObj(obj) {
  39259. if (!obj) {
  39260. return;
  39261. }
  39262. var res = new LabelMixedTextStyle();
  39263. var stys = obj.styles;
  39264. Util_Util.copy(res, obj);
  39265. res.defaultStyle = new ServerTextStyle(obj.defaultStyle);
  39266. if (stys) {
  39267. res.styles = [];
  39268. for (var i = 0, len = stys.length; i < len; i++) {
  39269. res.styles.push(new ServerTextStyle(stys[i]));
  39270. }
  39271. }
  39272. return res;
  39273. }
  39274. }
  39275. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelText.js
  39276. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39277. * This program are made available under the terms of the Apache License, Version 2.0
  39278. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39279. /**
  39280. * @class ThemeLabelText
  39281. * @deprecatedclass SuperMap.ThemeLabelText
  39282. * @category iServer Map Theme
  39283. * @classdesc 标签中文本风格类。
  39284. * 通过该类可以设置标签中的文本字体大小和显示风格。
  39285. * @param {Object} options - 参数。
  39286. * @param {number} [options.maxTextHeight=0] - 标签中文本的最大高度。
  39287. * @param {number} [options.maxTextWidth=0] - 标签中文本的最大宽度。
  39288. * @param {number} [options.minTextHeight=0] - 标签中文本的最小高度。
  39289. * @param {number} [options.minTextWidth=0] - 标签中文本的最小宽度。
  39290. * @param {ServerTextStyle} [options.uniformStyle] - 统一文本风格。
  39291. * @param {LabelMixedTextStyle} [options.uniformMixedStyle] - 标签专题图统一的文本复合风格。
  39292. * @usage
  39293. */
  39294. class ThemeLabelText {
  39295. constructor(options) {
  39296. /**
  39297. * @member {number} [ThemeLabelText.prototype.maxTextHeight=0]
  39298. * @description 标签中文本的最大高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  39299. * 当放大后的文本高度超过最大高度之后就不再放大。高度单位为毫米。
  39300. */
  39301. this.maxTextHeight = 0;
  39302. /**
  39303. * @member {number} [ThemeLabelText.prototype.maxTextWidth=0]
  39304. * @description 标签中文本的最大宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  39305. * 当放大后的文本宽度超过最大高度之后就不再放大。宽度单位为毫米。
  39306. */
  39307. this.maxTextWidth = 0;
  39308. /**
  39309. * @member {number} [ThemeLabelText.prototype.minTextHeight=0]
  39310. * @description 标签中文本的最小高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  39311. * 当缩小后的文本高度小于最小高度之后就不再缩小。高度单位为毫米。
  39312. */
  39313. this.minTextHeight = 0;
  39314. /**
  39315. * @member {number} [ThemeLabelText.prototype.minTextWidth=0]
  39316. * @description 标签中文本的最小宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  39317. * 当缩小后的文本宽度小于最小宽度之后就不再缩小。宽度单位为毫米。
  39318. */
  39319. this.minTextWidth = 0;
  39320. /**
  39321. * @member {ServerTextStyle} [ThemeLabelText.prototype.uniformStyle]
  39322. * @description 统一文本风格。当标签专题图子项的个数大于等于1时,
  39323. * uniformStyle 不起作用,各标签的风格使用子项中设置的风格。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  39324. * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  39325. */
  39326. this.uniformStyle = new ServerTextStyle();
  39327. /**
  39328. *@member {LabelMixedTextStyle} [ThemeLabelText.prototype.uniformMixedStyle]
  39329. *@description 标签专题图统一的文本复合风格。通过该类可以使同一个标签中的文字使用多种风格显示。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  39330. * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  39331. */
  39332. this.uniformMixedStyle = null;
  39333. if (options) {
  39334. Util_Util.extend(this, options);
  39335. }
  39336. this.CLASS_NAME = "SuperMap.ThemeLabelText";
  39337. }
  39338. /**
  39339. * @function ThemeLabelText.prototype.destroy
  39340. * @description 释放资源,将引用资源的属性置空。
  39341. */
  39342. destroy() {
  39343. var me = this;
  39344. me.maxTextHeight = null;
  39345. me.maxTextWidth = null;
  39346. me.minTextHeight = null;
  39347. me.minTextWidth = null;
  39348. if (me.uniformStyle) {
  39349. me.uniformStyle.destroy();
  39350. me.uniformStyle = null;
  39351. }
  39352. if (me.uniformMixedStyle) {
  39353. me.uniformMixedStyle.destroy();
  39354. me.uniformMixedStyle = null;
  39355. }
  39356. }
  39357. /**
  39358. * @function ThemeLabelText.fromObj
  39359. * @description 从传入对象获取标签中文本风格类。
  39360. * @param {Object} obj - 传入对象。
  39361. * @returns {ThemeLabelText} ThemeLabelText 对象。
  39362. */
  39363. static fromObj(obj) {
  39364. if (!obj) {
  39365. return;
  39366. }
  39367. var res = new ThemeLabelText();
  39368. Util_Util.copy(res, obj);
  39369. res.uniformStyle = ServerTextStyle.fromObj(obj.uniformStyle);
  39370. res.uniformMixedStyle = LabelMixedTextStyle.fromObj(obj.uniformMixedStyle);
  39371. return res;
  39372. }
  39373. }
  39374. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelAlongLine.js
  39375. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39376. * This program are made available under the terms of the Apache License, Version 2.0
  39377. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39378. /**
  39379. * @class ThemeLabelAlongLine
  39380. * @deprecatedclass SuperMap.ThemeLabelAlongLine
  39381. * @category iServer Map Theme
  39382. * @classdesc 标签沿线标注样式类。
  39383. * @param {Object} options - 可选参数。
  39384. * @param {boolean} [options.isAlongLine=true] - 是否沿线显示文本。
  39385. * @param {AlongLineDirection} [options.alongLineDirection=AlongLineDirection.LB_TO_RT] - 标签沿线标注方向。
  39386. * @param {boolean} [options.angleFixed=false] - 当沿线显示文本时,是否将文本角度固定。
  39387. * @param {boolean} [options.repeatedLabelAvoided=false] - 沿线循环标注时是否避免标签重复标注。
  39388. * @param {boolean} [options.repeatIntervalFixed=false] - 循环标注间隔是否固定。
  39389. * @param {number} [options.labelRepeatInterval=0] - 沿线且循环标注时循环标注的间隔。
  39390. * @usage
  39391. */
  39392. class ThemeLabelAlongLine {
  39393. constructor(options) {
  39394. /**
  39395. * @member {boolean} [ThemeLabelAlongLine.prototype.isAlongLine=true]
  39396. * @description 是否沿线显示文本。true 表示沿线显示文本,false 表示正常显示文本。
  39397. */
  39398. this.isAlongLine = true;
  39399. /**
  39400. * @member {AlongLineDirection} [ThemeLabelAlongLine.prototype.alongLineDirection=AlongLineDirection.LB_TO_RT]
  39401. * @description 标签沿线标注方向。
  39402. */
  39403. this.alongLineDirection = AlongLineDirection.LB_TO_RT;
  39404. /**
  39405. * @member {boolean} [ThemeLabelAlongLine.prototype.angleFixed=false]
  39406. * @description 当沿线显示文本时,是否将文本角度固定。true 表示按固定文本角度显示文本,false 表示按照沿线角度显示文本。
  39407. * 如果固定角度,则所有标签均按所设置的文本风格中字体的旋转角度来显示,不考虑沿线标注的方向;
  39408. * 如果不固定角度,在显示标签时会同时考虑字体的旋转角度和沿线标注的方向。
  39409. */
  39410. this.angleFixed = false;
  39411. /**
  39412. * @member {boolean} ThemeLabelAlongLine.prototype.repeatedLabelAvoided
  39413. * @description 沿线循环标注时是否避免标签重复标注。
  39414. */
  39415. this.repeatedLabelAvoided = false;
  39416. /**
  39417. * @member {boolean} [ThemeLabelAlongLine.prototype.repeatIntervalFixed=false]
  39418. * @description 循环标注间隔是否固定。true 表示使用固定循环标注间隔,即使用逻辑坐标来显示循环标注间隔;
  39419. * false 表示循环标注间隔随地图的缩放而变化,即使用地理坐标来显示循环标注间隔。
  39420. */
  39421. this.repeatIntervalFixed = false;
  39422. /**
  39423. * @member {number} [ThemeLabelAlongLine.prototype.labelRepeatInterval=0]
  39424. * @description 沿线且循环标注时循环标注的间隔。长度的单位与地图的地理单位一致。只有设定 RepeatedLabelAvoided 为 true
  39425. * 的时候,labelRepeatInterval 属性才有效。
  39426. */
  39427. this.labelRepeatInterval = 0;
  39428. if (options) {
  39429. Util_Util.extend(this, options);
  39430. }
  39431. this.CLASS_NAME = "SuperMap.ThemeLabelAlongLine";
  39432. }
  39433. /**
  39434. * @function ThemeLabelAlongLine.prototype.destroy
  39435. * @description 释放资源,将引用资源的属性置空。
  39436. */
  39437. destroy() {
  39438. var me = this;
  39439. me.isAlongLine = null;
  39440. me.alongLineDirection = null;
  39441. me.angleFixed = null;
  39442. me.repeatedLabelAvoided = null;
  39443. me.repeatIntervalFixed = null;
  39444. me.labelRepeatInterval = null;
  39445. }
  39446. /**
  39447. * @function ThemeLabelAlongLine.fromObj
  39448. * @description 从传入对象获取标签沿线标注样式类。
  39449. * @param {Object} obj - 传入对象。
  39450. * @returns {ThemeLabelAlongLine} ThemeLabelAlongLine 对象。
  39451. */
  39452. static fromObj(obj) {
  39453. if (!obj) {
  39454. return;
  39455. }
  39456. var t = new ThemeLabelAlongLine();
  39457. Util_Util.copy(t, obj);
  39458. return t;
  39459. }
  39460. }
  39461. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelBackground.js
  39462. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39463. * This program are made available under the terms of the Apache License, Version 2.0
  39464. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39465. /**
  39466. * @class ThemeLabelBackground
  39467. * @deprecatedclass SuperMap.ThemeLabelBackground
  39468. * @category iServer Map Theme
  39469. * @classdesc 标签背景风格类。通过该类可以设置标签的背景形状和风格。
  39470. * @param {Object} options - 可选参数。
  39471. * @param {LabelBackShape} [options.labelBackShape=LabelBackShape.NONE] - 标签专题图中标签背景的形状枚举类。
  39472. * @param {ServerStyle} [options.backStyle] - 标签专题图中标签背景风格。
  39473. * @usage
  39474. */
  39475. class ThemeLabelBackground {
  39476. constructor(options) {
  39477. /**
  39478. * @member {LabelBackShape} [ThemeLabelBackground.prototype.labelBackShape=LabelBackShape.NONE]
  39479. * @description 标签专题图中标签背景风格。当背景形状
  39480. * labelBackShape 属性设为 NONE(即无背景形状)时,backStyle 属性无效。
  39481. */
  39482. this.labelBackShape = LabelBackShape.NONE;
  39483. /**
  39484. * @member {ServerStyle} [ThemeLabelBackground.prototype.backStyle]
  39485. * @description 标签专题图中标签背景的形状枚举类。背景类型可以是矩形、圆角矩形、菱形、椭圆形、三角形和符号等,即不使用任何的形状作为标签的背景。
  39486. */
  39487. this.backStyle = new ServerStyle();
  39488. if (options) {
  39489. Util_Util.extend(this, options);
  39490. }
  39491. this.CLASS_NAME = "SuperMap.ThemeLabelBackground";
  39492. }
  39493. /**
  39494. * @function ThemeLabelBackground.prototype.destroy
  39495. * @description 释放资源,将引用资源的属性置空。
  39496. */
  39497. destroy() {
  39498. var me = this;
  39499. me.labelBackShape = null;
  39500. if (me.backStyle) {
  39501. me.backStyle.destroy();
  39502. me.backStyle = null;
  39503. }
  39504. }
  39505. /**
  39506. * @function ThemeLabelBackground.fromObj
  39507. * @description 从传入对象获取标签背景风格类。
  39508. * @param {Object} obj - 传入对象。
  39509. * @returns {ThemeLabelBackground} ThemeLabelBackground 对象。
  39510. */
  39511. static fromObj(obj) {
  39512. if (!obj) {
  39513. return;
  39514. }
  39515. var t = new ThemeLabelBackground();
  39516. t.labelBackShape = obj.labelBackShape;
  39517. t.backStyle = ServerStyle.fromJson(obj.backStyle);
  39518. return t;
  39519. }
  39520. }
  39521. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabel.js
  39522. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39523. * This program are made available under the terms of the Apache License, Version 2.0
  39524. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39525. /**
  39526. * @class ThemeLabel
  39527. * @deprecatedclass SuperMap.ThemeLabel
  39528. * @category iServer Map Theme
  39529. * @classdesc 标签专题图类。
  39530. * @extends CommonTheme
  39531. * @param {Object} options - 参数。
  39532. * @param {Array.<ThemeLabelItem>} options.items - 子项数组。
  39533. * @param {string} options.labelExpression - 标注字段表达式。
  39534. * @param {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} options.matrixCells - 矩阵标签元素数组。
  39535. * @param {ThemeLabelAlongLine} [options.alongLine] - 标签沿线标注方向样式类。
  39536. * @param {ThemeLabelBackground} [options.background] - 标签的背景风格类。
  39537. * @param {LabelOverLengthMode} [options.labelOverLengthMode=LabelOverLengthMode.NONE] - 超长标签的处理模式枚举类。
  39538. * @param {number} [options.maxLabelLength=256] - 标签在每一行显示的最大长度。
  39539. * @param {number} [options.numericPrecision=0] - 通过该字段设置其显示的精度。
  39540. * @param {ThemeOffset} [options.offset] - 指定标签专题图中标记文本相对于要素内点的偏移量对象。
  39541. * @param {boolean} [options.overlapAvoided=true] - 是否允许以文本避让方式显示文本。
  39542. * @param {string} [options.rangeExpression] - 制作分段标签专题的分段字段或字段表达式。
  39543. * @param {boolean} [options.smallGeometryLabeled=false] - 是否显示长度大于被标注对象本身长度的标签。
  39544. * @param {ThemeLabelText} options.text - 标签中文本风格。
  39545. * @param {number} [options.textSpace=0] - 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  39546. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  39547. * @usage
  39548. */
  39549. class ThemeLabel extends Theme {
  39550. constructor(options) {
  39551. super("LABEL", options);
  39552. /**
  39553. * @member {ThemeLabelAlongLine} [ThemeLabel.prototype.alongLine]
  39554. * @description 标签沿线标注方向样式类。
  39555. * 在该类中可以设置标签是否沿线标注以及沿线标注的多种方式。沿线标注属性只适用于线数据集专题图。
  39556. */
  39557. this.alongLine = new ThemeLabelAlongLine();
  39558. /**
  39559. * @member {ThemeLabelBackground} [ThemeLabel.prototype.background]
  39560. * @description 标签专题图中标签的背景风格类。通过该字段可以设置标签的背景形状和风格。
  39561. */
  39562. this.background = new ThemeLabelBackground();
  39563. /**
  39564. * @member {Array.<ThemeLabelItem>} [ThemeLabel.prototype.items]
  39565. * @description 分段标签专题图的子项数组。分段标签专题图使用 rangeExpression
  39566. * 指定数字型的字段作为分段数据,items 中的每个子对象的 [start,end) 分段值必须来源于属性 rangeExpression 的字段值。每个子项拥有自己的风格。
  39567. */
  39568. this.items = null;
  39569. /**
  39570. * @member {Array.<ThemeLabelUniqueItem>} ThemeLabel.prototype.uniqueItems
  39571. * @description 单值标签专题图子项数组。单值标签专题图使用 uniqueExpression单值标签专题图子项集合。
  39572. */
  39573. this.uniqueItems = null;
  39574. /**
  39575. * @member {string} ThemeLabel.prototype.labelExpression
  39576. * @description 标注字段表达式。系统将 labelExpression 对应的字段或字段表达式的值以标签的形式显示在图层中。
  39577. */
  39578. this.labelExpression = null;
  39579. /**
  39580. * @member {LabelOverLengthMode} [ThemeLabel.prototype.labelOverLengthMode=LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  39581. * @description 对于标签的长度超过设置的标签最大长度 maxLabelLength 时称为超长标签。
  39582. */
  39583. this.labelOverLengthMode = LabelOverLengthMode.NONE;
  39584. /**
  39585. * @member {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} ThemeLabel.prototype.matrixCells
  39586. * @description 矩阵标签元素数组,用于制作矩阵标签专题图。
  39587. * 数组中可以放置符号类型的矩阵标签元素和图片类型的矩阵标签元素。
  39588. */
  39589. this.matrixCells = null;
  39590. /**
  39591. * @member {number} [ThemeLabel.prototype.maxLabelLength=256]
  39592. * @description 标签在每一行显示的最大长度,一个中文为两个字符。
  39593. * 如果超过最大长度,可以采用两种方式来处理,一种是换行的模式进行显示,另一种是以省略号方式显示。单位为字符。
  39594. */
  39595. this.maxLabelLength = 256;
  39596. /**
  39597. * @member {number} [ThemeLabel.prototype.numericPrecision=0]
  39598. * @description 如果显示的标签内容为数字,通过该字段设置其显示的精度。例如标签对应的数字是8071.64529347,
  39599. * 如果该属性为0时,显示8071;为1时,显示8071.6;为3时,则是8071.645。
  39600. */
  39601. this.numericPrecision = 0;
  39602. /**
  39603. * @member {ThemeOffset} [ThemeLabel.prototype.offset]
  39604. * @description 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  39605. */
  39606. this.offset = new ThemeOffset();
  39607. /**
  39608. * @member {boolean} [ThemeLabel.prototype.overlapAvoided=true]
  39609. * @description 是否允许以文本避让方式显示文本。true 表示自动避免文本叠盖。只针对该标签专题图层中的文本数据。
  39610. * 在标签重叠度很大的情况下,即使使用自动避让功能,可能也无法完全避免标签重叠现象。
  39611. */
  39612. this.overlapAvoided = true;
  39613. /**
  39614. * @member {string} ThemeLabel.prototype.rangeExpression
  39615. * @description 制作分段标签专题的分段字段或字段表达式。该表达式对应的字段(或者字段表达式)的值应该为数值型。
  39616. * 该字段与 items 分段子项联合使用,每个子项的起始值 [start,end)来源于 rangeExpression 字段值。
  39617. * 最后 labelExpression 指定的标签字段(标签专题图要显示的具体内容)会根据分段子项的风格进行分段显示。
  39618. */
  39619. this.rangeExpression = null;
  39620. /**
  39621. * @member {string} ThemeLabel.prototype.uniqueExpression
  39622. * @description 用于制作单值专题图的字段或字段表达式。
  39623. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。必须与labelExpression一起使用。
  39624. */
  39625. this.uniqueExpression = null;
  39626. /**
  39627. * @member {boolean} [ThemeLabel.prototype.smallGeometryLabeled=false]
  39628. * @description 是否显示长度大于被标注对象本身长度的标签。在标签的长度大于线或者面对象本身的长度时,
  39629. * 如果该值为 true,则标签文字会叠加在一起显示,为了清楚完整的显示该标签,
  39630. * 可以采用换行模式来显示标签,但必须保证每行的长度小于对象本身的长度。
  39631. */
  39632. this.smallGeometryLabeled = false;
  39633. /**
  39634. * @member {ThemeLabelText} ThemeLabel.prototype.text
  39635. * @description 标签中文本风格。
  39636. */
  39637. this.text = new ThemeLabelText();
  39638. /**
  39639. * @member {number} [ThemeLabel.prototype.textSpace=0]
  39640. * @description 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  39641. */
  39642. this.textSpace = 0;
  39643. if (options) {
  39644. Util_Util.extend(this, options);
  39645. }
  39646. this.CLASS_NAME = "SuperMap.ThemeLabel";
  39647. }
  39648. /**
  39649. * @function ThemeLabel.prototype.destroy
  39650. * @override
  39651. */
  39652. destroy() {
  39653. super.destroy();
  39654. var me = this;
  39655. me.alongLine = null;
  39656. if (me.background) {
  39657. me.background.destroy();
  39658. me.background = null;
  39659. }
  39660. if (me.items) {
  39661. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  39662. items[i].destroy();
  39663. }
  39664. me.items = null;
  39665. }
  39666. if (me.uniqueItems) {
  39667. for (var j = 0, uniqueItems = me.uniqueItems, uniqueLen = uniqueItems.length; j < uniqueLen; j++) {
  39668. uniqueItems[j].destory();
  39669. }
  39670. me.uniqueItems = null;
  39671. }
  39672. me.labelExpression = null;
  39673. me.labelOverLengthMode = null;
  39674. me.matrixCells = null;
  39675. me.maxLabelLength = null;
  39676. me.numericPrecision = null;
  39677. me.overlapAvoided = null;
  39678. me.rangeExpression = null;
  39679. me.uniqueExpression = null;
  39680. if (me.offset) {
  39681. me.offset.destroy();
  39682. me.offset = null;
  39683. }
  39684. me.overlapAvoided = null;
  39685. me.smallGeometryLabeled = null;
  39686. if (me.text) {
  39687. me.text.destroy();
  39688. me.text = null;
  39689. }
  39690. me.textSpace = null;
  39691. }
  39692. /**
  39693. * @function ThemeLabel.prototype.toJSON
  39694. * @description 将themeLabel对象转化为 JSON 字符串。
  39695. * @returns {string} 返回转换后的 JSON 字符串。
  39696. */
  39697. toJSON() {
  39698. return Util_Util.toJSON(this.toServerJSONObject());
  39699. }
  39700. /**
  39701. * @function ThemeLabel.prototype.toServerJSONObject
  39702. * @description 转换成对应的 JSON 格式对象。
  39703. * @returns {Object} 对应的 JSON 格式对象。
  39704. */
  39705. toServerJSONObject() {
  39706. var obj = {};
  39707. obj.type = this.type;
  39708. obj.memoryData = this.memoryData;
  39709. if (this.alongLine) {
  39710. obj.alongLine = this.alongLine.isAlongLine;
  39711. obj.alongLineDirection = this.alongLine.alongLineDirection;
  39712. obj.angleFixed = this.alongLine.angleFixed;
  39713. obj.isLabelRepeated = this.alongLine.isLabelRepeated;
  39714. obj.labelRepeatInterval = this.alongLine.labelRepeatInterval;
  39715. obj.repeatedLabelAvoided = this.alongLine.repeatedLabelAvoided;
  39716. obj.repeatIntervalFixed = this.alongLine.repeatIntervalFixed;
  39717. }
  39718. if (this.offset) {
  39719. obj.offsetFixed = this.offset.offsetFixed;
  39720. obj.offsetX = this.offset.offsetX;
  39721. obj.offsetY = this.offset.offsetY;
  39722. }
  39723. if (this.text) {
  39724. obj.maxTextHeight = this.text.maxTextHeight;
  39725. obj.maxTextWidth = this.text.maxTextWidth;
  39726. obj.minTextHeight = this.text.minTextHeight;
  39727. obj.minTextWidth = this.text.minTextWidth;
  39728. obj.uniformStyle = this.text.uniformStyle;
  39729. obj.uniformMixedStyle = this.text.uniformMixedStyle;
  39730. }
  39731. if (this.background) {
  39732. obj.labelBackShape = this.background.labelBackShape;
  39733. obj.backStyle = this.background.backStyle;
  39734. }
  39735. obj.labelOverLengthMode = this.labelOverLengthMode;
  39736. obj.maxLabelLength = this.maxLabelLength;
  39737. obj.smallGeometryLabeled = this.smallGeometryLabeled;
  39738. obj.rangeExpression = this.rangeExpression;
  39739. obj.uniqueExpression = this.uniqueExpression;
  39740. obj.numericPrecision = this.numericPrecision;
  39741. obj.items = this.items;
  39742. obj.uniqueItems = this.uniqueItems;
  39743. obj.labelExpression = this.labelExpression;
  39744. obj.overlapAvoided = this.overlapAvoided;
  39745. obj.matrixCells = this.matrixCells;
  39746. obj.textSpace = this.textSpace;
  39747. return obj;
  39748. }
  39749. /**
  39750. * @function ThemeLabel.fromObj
  39751. * @description 从传入对象获取标签专题图类。
  39752. * @param {Object} obj - 传入对象。
  39753. * @returns {ThemeLabel} ThemeLabel 对象。
  39754. */
  39755. static fromObj(obj) {
  39756. if (!obj) {
  39757. return;
  39758. }
  39759. var lab = new ThemeLabel();
  39760. var itemsL = obj.items, itemsU = obj.uniqueItems, cells = obj.matrixCells;
  39761. obj.matrixCells = null;
  39762. Util_Util.copy(lab, obj);
  39763. lab.alongLine = ThemeLabelAlongLine.fromObj(obj);
  39764. lab.background = ThemeLabelBackground.fromObj(obj);
  39765. if (itemsL) {
  39766. lab.items = [];
  39767. for (var i = 0, len = itemsL.length; i < len; i++) {
  39768. lab.items.push(ThemeLabelItem.fromObj(itemsL[i]));
  39769. }
  39770. }
  39771. if (itemsU) {
  39772. lab.uniqueItems = [];
  39773. for (let j = 0, uniqueLen = itemsU.length; j < uniqueLen; j++) {
  39774. lab.uniqueItems.push(ThemeUniqueItem.fromObj(itemsU[j]));
  39775. }
  39776. }
  39777. if (cells) {
  39778. lab.matrixCells = [];
  39779. for (let i = 0, len = cells.length; i < len; i++) {
  39780. //TODO
  39781. //lab.matrixCells.push(LabelMatrixCell.fromObj(cells[i]));
  39782. }
  39783. }
  39784. lab.offset = ThemeOffset.fromObj(obj);
  39785. lab.text = ThemeLabelText.fromObj(obj);
  39786. return lab;
  39787. }
  39788. }
  39789. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUnique.js
  39790. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39791. * This program are made available under the terms of the Apache License, Version 2.0
  39792. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39793. /**
  39794. * @class ThemeUnique
  39795. * @deprecatedclass SuperMap.ThemeUnique
  39796. * @category iServer Map Theme
  39797. * @classdesc 单值专题图。单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。单值专题图多用于具有分类属性的地图上,
  39798. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。尤其是有交叉或重叠现象时,此类不推荐使用,例如:民族分布区等。
  39799. * @extends {CommonTheme}
  39800. * @param {Object} options - 参数。
  39801. * @param {Array.<ThemeUniqueItem>} options.items - 子项类数组。
  39802. * @param {string} options.uniqueExpression - 指定单值专题图的字段或字段表达式。
  39803. * @param {ServerStyle} [options.defaultStyle] - 未参与单值专题图制作的对象的显示风格。
  39804. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  39805. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  39806. * @usage
  39807. */
  39808. class ThemeUnique extends Theme {
  39809. constructor(options) {
  39810. super("UNIQUE", options);
  39811. /**
  39812. * @member {ServerStyle} ThemeUnique.prototype.defaultStyle
  39813. * @description 未参与单值专题图制作的对象的显示风格。
  39814. * 通过单值专题图子项数组 (items)可以指定某些要素参与单值专题图制作,对于那些没有被包含的要素,即不参加单值专题表达的要素,使用该风格显示。
  39815. */
  39816. this.defaultStyle = new ServerStyle();
  39817. /**
  39818. * @member {Array.<ThemeUniqueItem>} ThemeUnique.prototype.items
  39819. * @description 单值专题图子项类数组。
  39820. * 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,
  39821. * Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有5种不同值,则该行政区划图有 5 个专题图子项。
  39822. */
  39823. this.items = null;
  39824. /**
  39825. * @member {string} ThemeUnique.prototype.uniqueExpression
  39826. * @description 用于制作单值专题图的字段或字段表达式。
  39827. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。
  39828. */
  39829. this.uniqueExpression = null;
  39830. /**
  39831. * @member {ColorGradientType} [ThemeUnique.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  39832. * @description 渐变颜色枚举类。
  39833. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  39834. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。
  39835. * 但如果为某几个子项的风格进行单独设置后(设置了 ThemeUniqueItem 或 ThemeRangeItem 类中Style属性),
  39836. * 该配色方案对于这几个子项将不起作用。
  39837. */
  39838. this.colorGradientType = ColorGradientType.YELLOW_RED;
  39839. if (options) {
  39840. Util_Util.extend(this, options);
  39841. }
  39842. this.CLASS_NAME = "SuperMap.ThemeUnique";
  39843. }
  39844. /**
  39845. * @function ThemeUnique.prototype.destroy
  39846. * @override
  39847. */
  39848. destroy() {
  39849. super.destroy();
  39850. var me = this;
  39851. me.uniqueExpression = null;
  39852. me.colorGradientType = null;
  39853. if (me.items) {
  39854. if (me.items.length > 0) {
  39855. for (var item in me.items) {
  39856. me.items[item].destroy();
  39857. me.items[item] = null;
  39858. }
  39859. }
  39860. me.items = null;
  39861. }
  39862. if (me.defaultStyle) {
  39863. me.defaultStyle.destroy();
  39864. me.defaultStyle = null;
  39865. }
  39866. }
  39867. /**
  39868. * @function ThemeUnique.prototype.toServerJSONObject
  39869. * @description 转换成对应的 JSON 格式对象。
  39870. * @returns {Object} 对应的 JSON 格式对象。
  39871. */
  39872. toServerJSONObject() {
  39873. var obj = {};
  39874. obj = Util_Util.copyAttributes(obj, this);
  39875. if (obj.defaultStyle) {
  39876. if (obj.defaultStyle.toServerJSONObject) {
  39877. obj.defaultStyle = obj.defaultStyle.toServerJSONObject();
  39878. }
  39879. }
  39880. if (obj.items) {
  39881. var items = [],
  39882. len = obj.items.length;
  39883. for (var i = 0; i < len; i++) {
  39884. items.push(obj.items[i].toServerJSONObject());
  39885. }
  39886. obj.items = items;
  39887. }
  39888. return obj;
  39889. }
  39890. /**
  39891. * @function ThemeUnique.fromObj
  39892. * @description 从传入对象获取单值专题图类。
  39893. * @param {Object} obj - 传入对象。
  39894. * @returns {ThemeUnique} ThemeUnique 对象。
  39895. */
  39896. static fromObj(obj) {
  39897. var res = new ThemeUnique();
  39898. var uItems = obj.items;
  39899. var len = uItems ? uItems.length : 0;
  39900. Util_Util.extend(res, obj);
  39901. res.items = [];
  39902. res.defaultStyle = ServerStyle.fromJson(obj.defaultStyle);
  39903. for (var i = 0; i < len; i++) {
  39904. res.items.push(ThemeUniqueItem.fromObj(uItems[i]));
  39905. }
  39906. return res;
  39907. }
  39908. }
  39909. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphAxes.js
  39910. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39911. * This program are made available under the terms of the Apache License, Version 2.0
  39912. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39913. /**
  39914. * @class ThemeGraphAxes
  39915. * @deprecatedclass SuperMap.ThemeGraphAxes
  39916. * @category iServer Map Theme
  39917. * @classdesc 统计专题图坐标轴样式类。
  39918. * @param {Object} options - 参数。
  39919. * @param {ServerColor} [options.axesColor=(0, 0, 0)] - 坐标轴颜色。
  39920. * @param {boolean} [options.axesDisplayed=false] - 是否显示坐标轴。
  39921. * @param {boolean} [options.axesGridDisplayed=false] - 是否在统计图坐标轴上显示网格。
  39922. * @param {boolean} [options.axesTextDisplayed=false] - 是否显示坐标轴的文本标注。
  39923. * @param {ServerTextStyle} [options.axesTextStyle] - 统计符号的最大最小尺寸。
  39924. * @usage
  39925. */
  39926. class ThemeGraphAxes {
  39927. constructor(options) {
  39928. /**
  39929. * @member {ServerColor} [ThemeGraphAxes.prototype.axesColor=(0, 0, 0)]
  39930. * @description 坐标轴颜色。当 axesDisplayed = true 时有效。
  39931. */
  39932. this.axesColor = new ServerColor(0, 0, 0);
  39933. /**
  39934. * @member {boolean} [ThemeGraphAxes.prototype.axesDisplayed=false]
  39935. * @description 是否显示坐标轴。<br>
  39936. * 由于饼状图和环状图无坐标轴,故该属性以及所有与坐标轴设置相关的属性都不适用于它们。并且只有当该值为 true 时,其它设置坐标轴的属性才起作用。
  39937. */
  39938. this.axesDisplayed = false;
  39939. /**
  39940. * @member {boolean} [ThemeGraphAxes.prototype.axesGridDisplayed=false]
  39941. * @description 是否在统计图坐标轴上显示网格。
  39942. */
  39943. this.axesGridDisplayed = false;
  39944. /**
  39945. * @member {boolean} [ThemeGraphAxes.prototype.axesTextDisplayed=false]
  39946. * @description 是否显示坐标轴的文本标注。
  39947. */
  39948. this.axesTextDisplayed = false;
  39949. /**
  39950. * @member {ServerTextStyle} ThemeGraphAxes.prototype.axesTextStyle
  39951. * @description 坐标轴文本风格。当 axesTextDisplayed = true 时有效。
  39952. */
  39953. this.axesTextStyle = new ServerTextStyle();
  39954. if (options) {
  39955. Util_Util.extend(this, options);
  39956. }
  39957. this.CLASS_NAME = "SuperMap.ThemeGraphAxes";
  39958. }
  39959. /**
  39960. * @function ThemeGraphAxes.prototype.destroy
  39961. * @description 释放资源,将引用资源的属性置空。
  39962. */
  39963. destroy() {
  39964. var me = this;
  39965. if (me.axesColor) {
  39966. me.axesColor.destroy();
  39967. me.axesColor = null;
  39968. }
  39969. me.axesDisplayed = null;
  39970. me.axesGridDisplayed = null;
  39971. me.axesTextDisplayed = null;
  39972. if (me.axesTextStyle) {
  39973. me.axesTextStyle.destroy();
  39974. me.axesTextStyle = null;
  39975. }
  39976. }
  39977. /**
  39978. * @function ThemeGraphAxes.fromObj
  39979. * @description 从传入对象获取统计专题图坐标轴样式类。
  39980. * @param {Object} obj - 传入对象。
  39981. * @returns {ThemeGraphAxes} ThemeGraphAxes 对象。
  39982. */
  39983. static fromObj(obj) {
  39984. if (!obj) {
  39985. return;
  39986. }
  39987. var res = new ThemeGraphAxes();
  39988. Util_Util.copy(res, obj);
  39989. res.axesColor = ServerColor.fromJson(obj.axesColor);
  39990. res.axesTextStyle = ServerTextStyle.fromObj(obj.axesTextStyle);
  39991. return res;
  39992. }
  39993. }
  39994. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphSize.js
  39995. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39996. * This program are made available under the terms of the Apache License, Version 2.0
  39997. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39998. /**
  39999. * @class ThemeGraphSize
  40000. * @deprecatedclass SuperMap.ThemeGraphSize
  40001. * @category iServer Map Theme
  40002. * @classdesc 统计专题图符号尺寸类。
  40003. * @param {Object} options - 参数。
  40004. * @param {number} [options.maxGraphSize=0] - 统计图中显示的最大图表尺寸基准值。
  40005. * @param {number} [options.minGraphSize=0] - 统计图中显示的最小图表尺寸基准值。
  40006. * @usage
  40007. */
  40008. class ThemeGraphSize {
  40009. constructor(options) {
  40010. /**
  40011. * @member {number} [ThemeGraphSize.prototype.maxGraphSize=0]
  40012. * @description 获取或设置统计图中显示的最大图表尺寸基准值,单位为像素。
  40013. */
  40014. this.maxGraphSize = 0;
  40015. /**
  40016. * @member {number} [ThemeGraphSize.prototype.minGraphSize=0]
  40017. * @description 获取或设置统计图中显示的最小图表尺寸基准值,单位为像素。
  40018. */
  40019. this.minGraphSize = 0;
  40020. if (options) {
  40021. Util_Util.extend(this, options);
  40022. }
  40023. this.CLASS_NAME = "SuperMap.ThemeGraphSize";
  40024. }
  40025. /**
  40026. * @function ThemeGraphSize.prototype.destroy
  40027. * @description 释放资源,将引用资源的属性置空。
  40028. */
  40029. destroy() {
  40030. var me = this;
  40031. me.maxGraphSize = null;
  40032. me.minGraphSize = null;
  40033. }
  40034. /**
  40035. * @function ThemeGraphSize.fromObj
  40036. * @description 从传入对象获统计专题图符号尺寸类。
  40037. * @param {Object} obj - 传入对象。
  40038. * @returns {ThemeGraphSize} ThemeGraphSize 对象。
  40039. */
  40040. static fromObj(obj) {
  40041. var res = new ThemeGraphSize();
  40042. Util_Util.copy(res, obj);
  40043. return res;
  40044. }
  40045. }
  40046. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphText.js
  40047. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40048. * This program are made available under the terms of the Apache License, Version 2.0
  40049. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40050. /**
  40051. * @class ThemeGraphText
  40052. * @deprecatedclass SuperMap.ThemeGraphText
  40053. * @category iServer Map Theme
  40054. * @classdesc 统计图文字标注风格类。
  40055. * @param {Object} options - 可选参数。
  40056. * @param {boolean} [options.graphTextDisplayed=false] - 是否显示统计图上的文字标注。
  40057. * @param {ThemeGraphTextFormat} [options.graphTextFormat=ThemeGraphTextFormat.CAPTION] - 统计专题图文本显示格式。
  40058. * @param {ServerTextStyle} [options.graphTextStyle] - 统计图上的文字标注风格。
  40059. * @usage
  40060. */
  40061. class ThemeGraphText {
  40062. constructor(options) {
  40063. /**
  40064. * @member {boolean} [ThemeGraphText.prototype.graphTextDisplayed=false]
  40065. * @description 是否显示统计图上的文字标注。
  40066. */
  40067. this.graphTextDisplayed = false;
  40068. /**
  40069. * @member {ThemeGraphTextFormat} [ThemeGraphText.prototype.graphTextFormat=ThemeGraphTextFormat.CAPTION]
  40070. * @description 统计专题图文本显示格式。
  40071. * 文本显示格式包括百分数、真实数值、标题、标题+百分数、标题+真实数值。
  40072. */
  40073. this.graphTextFormat = ThemeGraphTextFormat.CAPTION;
  40074. /**
  40075. * @member {ServerTextStyle} ThemeGraphText.prototype.graphTextStyle
  40076. * @description 统计图上的文字标注风格。
  40077. */
  40078. this.graphTextStyle = new ServerTextStyle();
  40079. if (options) {
  40080. Util_Util.extend(this, options);
  40081. }
  40082. this.CLASS_NAME = "SuperMap.ThemeGraphText";
  40083. }
  40084. /**
  40085. * @function ThemeGraphText.prototype.destroy
  40086. * @description 释放资源,将引用资源的属性置空。
  40087. */
  40088. destroy() {
  40089. var me = this;
  40090. me.graphTextDisplayed = null;
  40091. me.graphTextFormat = null;
  40092. if (me.graphTextStyle) {
  40093. me.graphTextStyle.destroy();
  40094. me.graphTextStyle = null;
  40095. }
  40096. }
  40097. /**
  40098. * @function ThemeGraphText.fromObj
  40099. * @description 从传入对象获取统计图文字标注风格类。
  40100. * @param {Object} obj - 传入对象。
  40101. * @returns {ThemeGraphText} ThemeGraphText 对象。
  40102. */
  40103. static fromObj(obj) {
  40104. var res = new ThemeGraphText();
  40105. Util_Util.copy(res, obj);
  40106. res.graphTextStyle = ServerTextStyle.fromObj(obj.graphTextStyle);
  40107. return res;
  40108. }
  40109. }
  40110. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphItem.js
  40111. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40112. * This program are made available under the terms of the Apache License, Version 2.0
  40113. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40114. /**
  40115. * @class ThemeGraphItem
  40116. * @deprecatedclass SuperMap.ThemeGraphItem
  40117. * @category iServer Map Theme
  40118. * @classdesc 统计专题图子项类。
  40119. * @param {Object} options - 参数。
  40120. * @param {string} [options.caption] - 专题图子项的名称。
  40121. * @param {string} options.graphExpression - 统计专题图的专题变量。
  40122. * @param {Array.<number>} [options.memoryDoubleValues] - 内存数组方式制作专题图时的值数组。
  40123. * @param {ServerStyle} [options.uniformStyle] - 统计专题图子项的显示风格。
  40124. * @usage
  40125. */
  40126. class ThemeGraphItem {
  40127. constructor(options) {
  40128. /**
  40129. * @member {string} [ThemeGraphItem.prototype.caption]
  40130. * @description 专题图子项的名称。
  40131. */
  40132. this.caption = null;
  40133. /**
  40134. * @member {string} ThemeGraphItem.prototype.graphExpression
  40135. * @description 统计专题图的专题变量。专题变量可以是一个字段或字段表达式。字段必须为数值型;表达式只能为数值型的字段间的运算。
  40136. */
  40137. this.graphExpression = null;
  40138. /**
  40139. * @member {Array.<number>} [ThemeGraphItem.prototype.memoryDoubleValues]
  40140. * @description 内存数组方式制作专题图时的值数组。<br>
  40141. * 内存数组方式制作专题图时,只对 SmID 值在键数组({@link ThemeGraph#memoryKeys})中的记录制作专题图。
  40142. * 值数组的数值个数必须与键数组中数值的个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  40143. * 比如:利用面积字段和周长字段(即有两个统计专题图子项 )作为专题变量制作统计专题图。
  40144. */
  40145. this.memoryDoubleValues = null;
  40146. /**
  40147. * @member {ServerStyle} [ThemeGraphItem.prototype.uniformStyle]
  40148. * @description 统计专题图子项的显示风格。
  40149. * 每一个统计专题图子项都对应一种显示风格。
  40150. */
  40151. this.uniformStyle = new ServerStyle();
  40152. if (options) {
  40153. Util_Util.extend(this, options);
  40154. }
  40155. this.CLASS_NAME = "SuperMap.ThemeGraphItem";
  40156. }
  40157. /**
  40158. * @function ThemeGraphItem.prototype.destroy
  40159. * @description 释放资源,将引用资源的属性置空。
  40160. */
  40161. destroy() {
  40162. var me = this;
  40163. me.caption = null;
  40164. me.graphExpression = null;
  40165. me.memoryDoubleValues = null;
  40166. me.uniformStyle = null;
  40167. }
  40168. /**
  40169. * @function ThemeGraphItem.fromObj
  40170. * @description 从传入对象获取统计专题图子项类。
  40171. * @param {Object} obj - 传入对象。
  40172. * @returns {ThemeGraphItem} ThemeGraphItem 对象。
  40173. */
  40174. static fromObj(obj) {
  40175. if (!obj) {
  40176. return;
  40177. }
  40178. var res = new ThemeGraphItem();
  40179. Util_Util.copy(res, obj);
  40180. res.uniformStyle = ServerStyle.fromJson(obj.uniformStyle);
  40181. return res;
  40182. }
  40183. }
  40184. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraph.js
  40185. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40186. * This program are made available under the terms of the Apache License, Version 2.0
  40187. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40188. /**
  40189. * @class ThemeGraph
  40190. * @deprecatedclass SuperMap.ThemeGraph
  40191. * @category iServer Map Theme
  40192. * @classdesc 统计专题图类。
  40193. * @extends {CommonTheme}
  40194. * @param {Object} options - 参数。
  40195. * @param {Array.<ThemeGraphItem>} options.items - 统计专题图子项集合。
  40196. * @param {number} [options.barWidth=0] - 柱状专题图中每一个柱的宽度。
  40197. * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 统计图中地理要素的值与图表尺寸间的映射关系。
  40198. * @param {ThemeGraphAxes} [options.graphAxes] - 统计图中坐标轴样式相关信息。
  40199. * @param {ThemeGraphSize} [options.graphSize=0] - 统计符号的最大最小尺寸。
  40200. * @param {boolean} [options.graphSizeFixed=false] - 缩放地图时统计图符号是否固定大小。
  40201. * @param {ThemeGraphText} [options.graphText] - 统计图上的文字是否可见以及文字标注风格。
  40202. * @param {GraphAxesTextDisplayMode} [options.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE] - 统计专题图坐标轴文本显示模式。
  40203. * @param {ThemeGraphType} [options.graphType=ThemeGraphType.AREA] - 统计专题图类型。
  40204. * @param {Array.<number>} [options.memoryKeys] - 以内存数组方式制作专题图时的键数组。
  40205. * @param {boolean} [options.negativeDisplayed=false] - 专题图中是否显示属性为负值的数据。
  40206. * @param {ThemeOffset} [options.offset] - 统计图相对于要素内点的偏移量。
  40207. * @param {boolean} [options.overlapAvoided=true] - 统计图是否采用避让方式显示。
  40208. * @param {number} [options.roseAngle=0] - 统计图中玫瑰图或三维玫瑰图用于等分的角度。
  40209. * @param {number} [options.startAngle=0] - 饼状统计图扇形的起始角度。
  40210. * @usage
  40211. */
  40212. class ThemeGraph extends Theme {
  40213. constructor(options) {
  40214. super("GRAPH", options);
  40215. /**
  40216. * @member {number} [ThemeGraph.prototype.barWidth=0]
  40217. * @description 柱状专题图中每一个柱的宽度。使用地图坐标单位。
  40218. * 只有选择的统计图类型为柱状图(柱状图、三维柱状图、堆叠柱状图、三维堆叠柱状图)时,此项才可设置。
  40219. */
  40220. this.barWidth = 0;
  40221. /**
  40222. * @member {GraduatedMode} [ThemeGraph.prototype.graduatedMode=GraduatedMode.CONSTANT]
  40223. * @description 统计图中地理要素的值与图表尺寸间的映射关系(常数、对数、平方根),即分级方式。
  40224. * 分级主要是为了减少制作统计专题图中数据大小之间的差异,使得统计图的视觉效果比较好,同时不同类别之间的比较也还是有意义的。
  40225. * 提供三种分级模式:常数、对数和平方根,对于有值为负数的字段,不可以采用对数和平方根的分级方式。不同的等级方式用于确定符号大小的数值是不相同的。
  40226. */
  40227. this.graduatedMode = GraduatedMode.CONSTANT;
  40228. /**
  40229. * @member {ThemeGraphAxes} ThemeGraph.prototype.graphAxes
  40230. * @description 用于设置统计图中坐标轴样式相关信息,如坐标轴颜色、是否显示、坐标文本样式等。
  40231. */
  40232. this.graphAxes = new ThemeGraphAxes();
  40233. /**
  40234. * @member {ThemeGraphSize} [ThemeGraph.prototype.graphSize=0]
  40235. * @description 用于设置统计符号的最大最小尺寸。
  40236. */
  40237. this.graphSize = new ThemeGraphSize();
  40238. /**
  40239. * @member {boolean} [ThemeGraph.prototype.graphSizeFixed=false]
  40240. * @description 缩放地图时统计图符号是否固定大小。即统计图符号将随地图缩放。
  40241. */
  40242. this.graphSizeFixed = false;
  40243. /**
  40244. * @member {ThemeGraphText} ThemeGraph.prototype.graphText
  40245. * @description 统计图上的文字是否可见以及文字标注风格。
  40246. */
  40247. this.graphText = new ThemeGraphText();
  40248. /**
  40249. * @member {ThemeGraphType} [ThemeGraph.prototype.graphType=ThemeGraphType.AREA]
  40250. * @description 统计专题图类型。SuperMap 提供了多种类型的统计图,
  40251. * 分别为面积图、阶梯图、折线图、点状图、柱状图、三维柱状图、饼图、三维饼图、玫瑰图、三维玫瑰图、堆叠柱状图、三维堆叠柱状图、环状图。默认为面积图。
  40252. */
  40253. this.graphType = ThemeGraphType.AREA;
  40254. /**
  40255. * @member {GraphAxesTextDisplayMode} [ThemeGraph.prototype.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE]
  40256. * @description 统计专题图坐标轴文本显示模式。
  40257. */
  40258. this.graphAxesTextDisplayMode = GraphAxesTextDisplayMode.NONE;
  40259. /**
  40260. * @member {Array.<ThemeGraphItem>} ThemeGraph.prototype.items
  40261. * @description 统计专题图子项集合。
  40262. * 统计专题图可以基于多个变量,反映多种属性,即可以将多个专题变量的值绘制在一个统计图上。每一个专题变量对应的统计图即为一个专题图子项。
  40263. * 对于每个专题图子项可以为其设置标题、风格,甚至可以将该子项再制作成范围分段专题图。
  40264. */
  40265. this.items = null;
  40266. /**
  40267. * @member {Array.<number>} ThemeGraph.prototype.memoryKeys
  40268. * @description 以内存数组方式制作专题图时的键数组。
  40269. * 键数组内的数值代表 SmID 值,它与 {@link ThemeGraphItem} 类中的值数组({@link ThemeGraphItem#memoryDoubleValues})要关联起来应用。
  40270. * 键数组中数值的个数必须要与值数组的数值个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  40271. * 目前所有的专题图都支持以内存数组的方式制作专题图,但统计专题图与其他专题图指定内存数组的方式不同,
  40272. * 统计专题图使用 memoryKeys 指定内存数组,而其他专题图则使用 memoryData 来指定内存数组。
  40273. * @example
  40274. * memoryKeys 的使用方法如下:
  40275. * function addThemeGraph() {
  40276. * removeTheme();
  40277. * //创建统计专题图对象,ThemeGraph 必设 items。
  40278. * //专题图参数 ThemeParameters 必设 theme(即以设置好的分段专题图对象)、dataSourceName 和 datasetName
  40279. * var style1 = new ServerStyle({
  40280. * fillForeColor: new ServerColor(92,73,234),
  40281. * lineWidth: 0.1
  40282. * }),
  40283. * style2 = new ServerStyle({
  40284. * fillForeColor: new ServerColor(211,111,240),
  40285. * lineWidth: 0.1
  40286. * }),
  40287. * item1 = new ThemeGraphItem({
  40288. * memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
  40289. * caption: "1992-1995人口增长率",
  40290. * graphExpression: "Pop_Rate95",
  40291. * uniformStyle: style1
  40292. * }),
  40293. * item2 = new ThemeGraphItem({
  40294. * //以内存数组方式制作专题图时的值数组
  40295. * memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
  40296. * caption: "1995-1999人口增长率", //专题图子项的名称
  40297. * graphExpression: "Pop_Rate99", //统计专题图的专题变量
  40298. * uniformStyle: style2 //统计专题图子项的显示风格
  40299. * }),
  40300. * themeGraph = new ThemeGraph({
  40301. * //以内存数组方式制作专题图时的键数组,键数组内的数值代表 SmID 值
  40302. * memoryKeys:[1,2,4,8,10,12],
  40303. * items: new Array(item1,item2),
  40304. * barWidth: 0.03,
  40305. * //统计图中地理要素的值与图表尺寸间的映射关系为平方根
  40306. * graduatedMode: GraduatedMode.SQUAREROOT,
  40307. * //graphAxes用于设置统计图中坐标轴样式相关信息
  40308. * graphAxes: new ThemeGraphAxes({
  40309. * axesDisplayed: true
  40310. * }),
  40311. * graphSize: new ThemeGraphSize({
  40312. * maxGraphSize: 1,
  40313. * minGraphSize: 0.35
  40314. * }),
  40315. * //统计图上的文字是否可见以及文字标注风格
  40316. * graphText: new ThemeGraphText({
  40317. * graphTextDisplayed: true,
  40318. * graphTextFormat: ThemeGraphTextFormat.VALUE,
  40319. * graphTextStyle: new ServerTextStyle({
  40320. * sizeFixed: true,
  40321. * fontHeight: 9,
  40322. * fontWidth: 5
  40323. * })
  40324. * }),
  40325. * //统计专题图类型为三维柱状图
  40326. * graphType: ThemeGraphType.BAR3D
  40327. * }),
  40328. * //专题图参数对象
  40329. * themeParameters = new ThemeParameters({
  40330. * themes: [themeGraph],
  40331. * dataSourceNames: ["Jingjin"],
  40332. * datasetNames: ["BaseMap_R"]
  40333. * }),
  40334. * //与服务端交互
  40335. * themeService=new ThemeService(url, {
  40336. * eventListeners: {
  40337. * "processCompleted": ThemeCompleted,
  40338. * "processFailed": themeFailed
  40339. * }
  40340. * });
  40341. * themeService.processAsync(themeParameters);
  40342. * }
  40343. */
  40344. this.memoryKeys = null;
  40345. /**
  40346. * @member {boolean} [ThemeGraph.prototype.negativeDisplayed=false]
  40347. * @description 专题图中是否显示属性为负值的数据。true 表示显示;false 不显示。
  40348. */
  40349. this.negativeDisplayed = false;
  40350. /**
  40351. * @member {ThemeOffset} ThemeGraph.prototype.offset
  40352. * @description 用于设置统计图相对于要素内点的偏移量。
  40353. */
  40354. this.offset = new ThemeOffset();
  40355. /**
  40356. * @member {boolean} ThemeGraph.prototype.overlapAvoided
  40357. * @description 统计图是否采用避让方式显示。<br>
  40358. * 1.对数据集制作统计专题图:当统计图采用避让方式显示时,如果 overlapAvoided 为 true,则在统计图重叠度很大的情况下,
  40359. * 会出现无法完全避免统计图重叠的现象;如果 overlapAvoided 为 false,会过滤掉一些统计图,从而保证所有的统计图均不重叠。<br>
  40360. * 2.对数据集同时制作统计专题图和标签专题图:当统计图不显示子项文本时,标签专题图的标签即使和统计图重叠,两者也都可正常显示;
  40361. * 当统计图显示子项文本时,如果统计图中的子项文本和标签专题图中的标签不重叠,则两者均正常显示;如果重叠,则会过滤掉统计图的子项文本,只显示标签。
  40362. */
  40363. this.overlapAvoided = true;
  40364. /**
  40365. * @member {number} [ThemeGraph.prototype.roseAngle=0]
  40366. * @description 统计图中玫瑰图或三维玫瑰图用于等分的角度,默认为 0 度,精确到 0.1 度。在角度为0或者大于 360 度的情况下均使用 360 度来等分制作统计图的字段数。
  40367. */
  40368. this.roseAngle = 0;
  40369. /**
  40370. * @member {number} [ThemeGraph.prototype.startAngle=0]
  40371. * @description 饼状统计图扇形的起始角度。精确到 0.1 度,以水平方向为正向。只有选择的统计图类型为饼状图(饼图、三维饼图、玫瑰图、三维玫瑰图)时,此项才可设置。
  40372. */
  40373. this.startAngle = 0;
  40374. if (options) {
  40375. Util_Util.extend(this, options);
  40376. }
  40377. this.CLASS_NAME = "SuperMap.ThemeGraph";
  40378. }
  40379. /**
  40380. * @function ThemeGraph.prototype.destroy
  40381. * @override
  40382. */
  40383. destroy() {
  40384. super.destroy();
  40385. var me = this;
  40386. me.barWidth = null;
  40387. me.graduatedMode = null;
  40388. if (me.graphAxes) {
  40389. me.graphAxes.destroy();
  40390. me.graphAxes = null;
  40391. }
  40392. if (me.graphSize) {
  40393. me.graphSize.destroy();
  40394. me.graphSize = null;
  40395. }
  40396. me.graphSizeFixed = null;
  40397. if (me.graphText) {
  40398. me.graphText.destroy();
  40399. me.graphText = null;
  40400. }
  40401. me.graphType = null;
  40402. if (me.items) {
  40403. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  40404. items[i].destroy();
  40405. }
  40406. me.items = null;
  40407. }
  40408. me.memoryKeys = null;
  40409. me.negativeDisplayed = null;
  40410. if (me.offset) {
  40411. me.offset.destroy();
  40412. me.offset = null;
  40413. }
  40414. me.overlapAvoided = null;
  40415. me.roseAngle = null;
  40416. me.startAngle = null;
  40417. me.graphAxesTextDisplayMode = null;
  40418. }
  40419. /**
  40420. * @function ThemeGraph.prototype.toJSON
  40421. * @description 将 ThemeGraph 对象转化为 JSON 字符串。
  40422. * @returns {string} 返回转换后的 JSON 字符串。
  40423. */
  40424. toJSON() {
  40425. return Util_Util.toJSON(this.toServerJSONObject());
  40426. }
  40427. /**
  40428. * @function ThemeGraph.prototype.toServerJSONObject
  40429. * @description 转换成对应的 JSON 格式对象。
  40430. * @returns {Object} 对应的 JSON 格式对象。
  40431. */
  40432. toServerJSONObject() {
  40433. var obj = {};
  40434. obj.type = this.type;
  40435. if (this.graphText) {
  40436. obj.graphTextDisplayed = this.graphText.graphTextDisplayed;
  40437. obj.graphTextFormat = this.graphText.graphTextFormat;
  40438. obj.graphTextStyle = this.graphText.graphTextStyle;
  40439. }
  40440. if (this.graphAxes) {
  40441. obj.axesColor = this.graphAxes.axesColor;
  40442. obj.axesDisplayed = this.graphAxes.axesDisplayed;
  40443. obj.axesGridDisplayed = this.graphAxes.axesGridDisplayed;
  40444. obj.axesTextDisplayed = this.graphAxes.axesTextDisplayed;
  40445. obj.axesTextStyle = this.graphAxes.axesTextStyle;
  40446. }
  40447. if (this.graphSize) {
  40448. obj.maxGraphSize = this.graphSize.maxGraphSize;
  40449. obj.minGraphSize = this.graphSize.minGraphSize;
  40450. }
  40451. if (this.offset) {
  40452. obj.offsetFixed = this.offset.offsetFixed;
  40453. obj.offsetX = this.offset.offsetX;
  40454. obj.offsetY = this.offset.offsetY;
  40455. }
  40456. obj.barWidth = this.barWidth;
  40457. obj.graduatedMode = this.graduatedMode;
  40458. obj.graphSizeFixed = this.graphSizeFixed;
  40459. obj.graphType = this.graphType;
  40460. obj.graphAxesTextDisplayMode = this.graphAxesTextDisplayMode;
  40461. obj.items = this.items;
  40462. obj.memoryKeys = this.memoryKeys;
  40463. obj.negativeDisplayed = this.negativeDisplayed;
  40464. obj.overlapAvoided = this.overlapAvoided;
  40465. obj.roseAngle = this.roseAngle;
  40466. obj.startAngle = this.startAngle;
  40467. return obj;
  40468. }
  40469. /**
  40470. * @function ThemeGraph.fromObj
  40471. * @description 从传入对象获取统计专题图类。
  40472. * @param {Object} obj - 传入对象。
  40473. * @returns {ThemeGraph} ThemeGraph 对象。
  40474. */
  40475. static fromObj(obj) {
  40476. var res = new ThemeGraph();
  40477. var itemsG = obj.items;
  40478. var len = itemsG ? itemsG.length : 0;
  40479. Util_Util.copy(res, obj);
  40480. res.items = [];
  40481. res.graphAxes = ThemeGraphAxes.fromObj(obj);
  40482. res.graphSize = ThemeGraphSize.fromObj(obj);
  40483. res.graphText = ThemeGraphText.fromObj(obj);
  40484. res.offset = ThemeOffset.fromObj(obj);
  40485. for (var i = 0; i < len; i++) {
  40486. res.items.push(ThemeGraphItem.fromObj(itemsG[i]));
  40487. }
  40488. return res;
  40489. }
  40490. }
  40491. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeDotDensity.js
  40492. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40493. * This program are made available under the terms of the Apache License, Version 2.0
  40494. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40495. /**
  40496. * @class ThemeDotDensity
  40497. * @deprecatedclass SuperMap.ThemeDotDensity
  40498. * @category iServer Map Theme
  40499. * @classdesc 点密度专题图。点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。点的多少和所代表的意义由地图的内容确定。
  40500. * 点密度专题图利用图层的某一数值属性信息(专题值)映射为不同等级,每一级别使用不同数量或表现为密度的点符号来表示。
  40501. * 该专题值在各个分区内的分布情况,体现不同区域的相对数量差异。多用于具有数量特征的地图上,
  40502. * 比如表示不同地区的粮食产量、GDP、人口等的分级,主要针对区域或面状的要素,因而,点密度专题图适用于面数据集。
  40503. * 注意:点密度专题图中点的分布是随机的,并不代表实际的分布位置。即使在相关设置完全相同的情况下,
  40504. * 每次制作出的专题图,点的数量相同,但点的位置都有差异。
  40505. * @extends {CommonTheme}
  40506. * @param {Object} options - 参数。
  40507. * @param {string} options.dotExpression - 创建点密度专题图的字段或字段表达式。
  40508. * @param {ServerStyle} [options.style] - 点密度专题图中点的风格。
  40509. * @param {number} [options.value] - 专题图中每一个点所代表的数值。
  40510. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  40511. * @usage
  40512. */
  40513. class ThemeDotDensity extends Theme {
  40514. constructor(options) {
  40515. super("DOTDENSITY", options);
  40516. /**
  40517. * @member {string} ThemeDotDensity.prototype.dotExpression
  40518. * @description 创建点密度专题图的字段或字段表达式。点的数目或密集程度的来源。
  40519. */
  40520. this.dotExpression = null;
  40521. /**
  40522. * @member {ServerStyle} ThemeDotDensity.prototype.style
  40523. * @description 点密度专题图中点的风格。
  40524. */
  40525. this.style = new ServerStyle();
  40526. /**
  40527. * @member {number} ThemeDotDensity.prototype.value
  40528. * @description 专题图中每一个点所代表的数值。<br>
  40529. * 点值的确定与地图比例尺以及点的大小有关。地图比例尺越大,相应的图面范围也越大,
  40530. * 点相应就可以越多,此时点值就可以设置相对小一些。点形状越大,
  40531. * 点值相应就应该设置的小一些。点值过大或过小都是不合适的。
  40532. */
  40533. this.value = null;
  40534. if (options) {
  40535. Util_Util.extend(this, options);
  40536. }
  40537. this.CLASS_NAME = "SuperMap.ThemeDotDensity";
  40538. }
  40539. /**
  40540. * @function ThemeDotDensity.prototype.destroy
  40541. * @description 释放资源,将引用资源的属性置空。
  40542. */
  40543. destroy() {
  40544. var me = this;
  40545. me.dotExpression = null;
  40546. me.value = null;
  40547. if (me.style) {
  40548. me.style.destroy();
  40549. me.style = null;
  40550. }
  40551. }
  40552. /**
  40553. * @function ThemeDotDensity.prototype.toServerJSONObject
  40554. * @description 转换成对应的 JSON 格式对象。
  40555. * @returns {Object} 对应的 JSON 格式对象。
  40556. */
  40557. toServerJSONObject() {
  40558. var obj = {};
  40559. obj = Util_Util.copyAttributes(obj, this);
  40560. if (obj.style) {
  40561. if (obj.style.toServerJSONObject) {
  40562. obj.style = obj.style.toServerJSONObject();
  40563. }
  40564. }
  40565. return obj;
  40566. }
  40567. /**
  40568. * @function ThemeDotDensity.fromObj
  40569. * @description 从传入对象获取点密度专题图中点的风格。
  40570. * @param {Object} obj - 传入对象。
  40571. * @returns {ThemeDotDensity} ThemeDotDensity 对象。
  40572. */
  40573. static fromObj(obj) {
  40574. if (!obj) {
  40575. return;
  40576. }
  40577. var res = new ThemeDotDensity();
  40578. Util_Util.copy(res, obj);
  40579. res.style = ServerStyle.fromJson(obj.style);
  40580. return res;
  40581. }
  40582. }
  40583. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbolStyle.js
  40584. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40585. * This program are made available under the terms of the Apache License, Version 2.0
  40586. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40587. /**
  40588. * @class ThemeGraduatedSymbolStyle
  40589. * @deprecatedclass SuperMap.ThemeGraduatedSymbolStyle
  40590. * @category iServer Map Theme
  40591. * @classdesc 等级符号专题图正负零值显示风格类。
  40592. * @param {Object} options - 参数。
  40593. * @param {boolean} [options.negativeDisplayed=false] - 是否显示负值。
  40594. * @param {ServerStyle} [options.negativeStyle] - 负值的等级符号风格。
  40595. * @param {ServerStyle} [options.positiveStyle] - 正值的等级符号风格。
  40596. * @param {boolean} [options.zeroDisplayed=false] - 是否显示 0 值。
  40597. * @param {ServerStyle} [options.zeroStyle] - 0 值的等级符号风格。
  40598. * @usage
  40599. */
  40600. class ThemeGraduatedSymbolStyle {
  40601. constructor(options) {
  40602. /**
  40603. * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.negativeDisplayed=false]
  40604. * @description 是否显示负值。
  40605. */
  40606. this.negativeDisplayed = false;
  40607. /**
  40608. * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.negativeStyle]
  40609. * @description 负值的等级符号风格。
  40610. */
  40611. this.negativeStyle = new ServerStyle();
  40612. /**
  40613. * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.positiveStyle]
  40614. * @description 正值的等级符号风格。
  40615. */
  40616. this.positiveStyle = new ServerStyle();
  40617. /**
  40618. * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.zeroDisplayed=false]
  40619. * @description 是否显示 0 值。
  40620. */
  40621. this.zeroDisplayed = false;
  40622. /**
  40623. * @member {ServerStyle} ThemeGraduatedSymbolStyle.prototype.zeroStyle
  40624. * @description 0 值的等级符号风格。
  40625. */
  40626. this.zeroStyle = new ServerStyle();
  40627. if (options) {
  40628. Util_Util.extend(this, options);
  40629. }
  40630. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbolStyle";
  40631. }
  40632. /**
  40633. * @function ThemeGraduatedSymbolStyle.prototype.destroy
  40634. * @description 释放资源,将引用资源的属性置空。
  40635. */
  40636. destroy() {
  40637. var me = this;
  40638. me.negativeDisplayed = null;
  40639. me.negativeStyle = null;
  40640. me.positiveStyle = null;
  40641. me.zeroDisplayed = null;
  40642. me.zeroStyle = null;
  40643. }
  40644. /**
  40645. * @function ThemeGraduatedSymbolStyle.fromObj
  40646. * @description 从传入对象获取等级符号专题图正负零值显示风格类。
  40647. * @param {Object} obj - 传入对象。
  40648. * @returns {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbolStyle 对象。
  40649. */
  40650. static fromObj(obj) {
  40651. if (!obj) {
  40652. return;
  40653. }
  40654. var res = new ThemeGraduatedSymbolStyle();
  40655. Util_Util.copy(res, obj);
  40656. res.negativeStyle = ServerStyle.fromJson(obj.negativeStyle);
  40657. res.positiveStyle = ServerStyle.fromJson(obj.positiveStyle);
  40658. res.zeroStyle = ServerStyle.fromJson(obj.zeroStyle);
  40659. return res;
  40660. }
  40661. }
  40662. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbol.js
  40663. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40664. * This program are made available under the terms of the Apache License, Version 2.0
  40665. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40666. /**
  40667. * @class ThemeGraduatedSymbol
  40668. * @deprecatedclass SuperMap.ThemeGraduatedSymbol
  40669. * @category iServer Map Theme
  40670. * @classdesc 等级符号专题图。
  40671. * @extends {CommonTheme}
  40672. * @param {Object} options - 参数。
  40673. * @param {ThemeGraduatedSymbolStyle} options.style - 等级符号专题图正负零值显示风格类。
  40674. * @param {string} options.expression - 等级符号专题图的字段或字段表达式。
  40675. * @param {number} [options.baseValue=0] - 等级符号专题图的基准值,单位同专题变量的单位。
  40676. * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 等级符号专题图分级模式。
  40677. * @param {ThemeOffset} [options.offset] - 指定等级符号专题图中标记文本相对于要素内点的偏移量对象。
  40678. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  40679. * @usage
  40680. */
  40681. class ThemeGraduatedSymbol extends Theme {
  40682. constructor(options) {
  40683. super("GRADUATEDSYMBOL", options);
  40684. /**
  40685. * @member {number} [ThemeGraduatedSymbol.prototype.baseValue=0]
  40686. * @description 等级符号专题图的基准值,单位同专题变量的单位。<br>
  40687. * 依据此值系统会自动根据分级方式计算其余值对应的符号大小,每个符号的显示大小等于
  40688. * ThemeValueSection.positiveStyle(或 zeroStyle,negativeStyle).markerSize * value / basevalue,
  40689. * 其中 value 是 expression 所指定字段对应的值经过分级计算之后的值。默认值为0,建议通过多次尝试设置该值才能达到较好的显示效果。
  40690. */
  40691. this.baseValue = 0;
  40692. /**
  40693. * @member {string} ThemeGraduatedSymbol.prototype.expression
  40694. * @description 用于创建等级符号专题图的字段或字段表达式,字段或字段表达式应为数值型。
  40695. */
  40696. this.expression = null;
  40697. /**
  40698. * @member {GraduatedMode} [ThemeGraduatedSymbol.prototype.graduatedMode=GraduatedMode.CONSTANT]
  40699. * @description 等级符号专题图分级模式。<br>
  40700. * 分级主要是为了减少制作等级符号专题图中数据大小之间的差异。如果数据之间差距较大,则可以采用对数或者平方根的分级方式来进行,
  40701. * 这样就减少了数据之间的绝对大小的差异,使得等级符号图的视觉效果比较好,同时不同类别之间的比较也是有意义的。
  40702. * 有三种分级模式:常数、对数和平方根,对于有值为负数的字段,在用对数或平方根方式分级时,默认对负数取正。
  40703. * 不同的分级模式用于确定符号大小的数值是不相同的:常数按照字段的原始数据进行;对数则是对每条记录对应的专题变量取自然对数;
  40704. * 平方根则是对其取平方根,然后用最终得到的结果来确定其等级符号的大小。
  40705. */
  40706. this.graduatedMode = GraduatedMode.CONSTAN;
  40707. /**
  40708. * @member {ThemeOffset} [ThemeGraduatedSymbol.prototype.offset]
  40709. * @description 用于设置等级符号图相对于要素内点的偏移量。
  40710. */
  40711. this.offset = new ThemeOffset();
  40712. /**
  40713. * @member {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbol.prototype.style
  40714. * @description 用于设置等级符号图正负和零值显示风格。
  40715. */
  40716. this.style = new ThemeGraduatedSymbolStyle();
  40717. if (options) {
  40718. Util_Util.extend(this, options);
  40719. }
  40720. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbol";
  40721. }
  40722. /**
  40723. * @function ThemeGraduatedSymbol.prototype.destroy
  40724. * @description 释放资源,将引用资源的属性置空。
  40725. */
  40726. destroy() {
  40727. super.destroy();
  40728. var me = this;
  40729. me.expression = null;
  40730. me.graduatedMode = GraduatedMode.CONSTANT;
  40731. if (me.offset) {
  40732. me.offset.destroy();
  40733. me.offset = null;
  40734. }
  40735. if (me.style) {
  40736. me.style.destroy();
  40737. me.style = null;
  40738. }
  40739. }
  40740. /**
  40741. * @function ThemeGraduatedSymbol.prototype.toJSON
  40742. * @description 将 themeLabel 对象转化为 JSON 字符串。
  40743. * @returns {string} 返回转换后的 JSON 字符串。
  40744. */
  40745. toJSON() {
  40746. return Util_Util.toJSON(this.toServerJSONObject());
  40747. }
  40748. /**
  40749. * @function ThemeGraduatedSymbol.prototype.toServerJSONObject
  40750. * @description 转换成对应的 JSON 格式对象。
  40751. * @returns {Object} 对应的 JSON 格式对象。
  40752. */
  40753. toServerJSONObject() {
  40754. var obj = {};
  40755. obj.type = this.type;
  40756. obj.memoryData = this.memoryData;
  40757. obj.baseValue = this.baseValue;
  40758. obj.expression = this.expression;
  40759. obj.graduatedMode = this.graduatedMode;
  40760. if (this.offset) {
  40761. obj.offsetFixed = this.offset.offsetFixed;
  40762. obj.offsetX = this.offset.offsetX;
  40763. obj.offsetY = this.offset.offsetY;
  40764. }
  40765. if (this.style) {
  40766. obj.negativeStyle = this.style.negativeStyle;
  40767. obj.negativeDisplayed = this.style.negativeDisplayed;
  40768. obj.positiveStyle = this.style.positiveStyle;
  40769. obj.zeroDisplayed = this.style.zeroDisplayed;
  40770. obj.zeroStyle = this.style.zeroStyle;
  40771. }
  40772. return obj;
  40773. }
  40774. /**
  40775. * @function ThemeGraduatedSymbol.fromObj
  40776. * @description 从传入对象获取等级符号专题图。
  40777. * @param {Object} obj - 传入对象。
  40778. * @returns {ThemeGraduatedSymbol} 等级符号专题图对象。
  40779. */
  40780. static fromObj(obj) {
  40781. if (!obj) {
  40782. return;
  40783. }
  40784. var res = new ThemeGraduatedSymbol();
  40785. Util_Util.copy(res, obj);
  40786. res.offset = ThemeOffset.fromObj(obj);
  40787. res.style = ThemeGraduatedSymbolStyle.fromObj(obj);
  40788. return res;
  40789. }
  40790. }
  40791. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRangeItem.js
  40792. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40793. * This program are made available under the terms of the Apache License, Version 2.0
  40794. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40795. /**
  40796. * @class ThemeRangeItem
  40797. * @deprecatedclass SuperMap.ThemeRangeItem
  40798. * @category iServer Map Theme
  40799. * @classdesc 范围分段专题图子项类。在分段专题图中,字段值按照某种分段模式被分成多个范围段,
  40800. * 每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  40801. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为[start, end)。
  40802. * @param {Object} options - 参数。
  40803. * @param {string} [options.caption] - 子项的标题。
  40804. * @param {number} [options.end=0] - 子项的终止值。
  40805. * @param {number} [options.start=0] - 子项的起始值。
  40806. * @param {ServerStyle} options.style - 子项的风格。
  40807. * @param {boolean} [options.visible=true] - 子项是否可见。
  40808. * @usage
  40809. */
  40810. class ThemeRangeItem {
  40811. constructor(options) {
  40812. /**
  40813. * @member {string} [ThemeRangeItem.prototype.caption]
  40814. * @description 分段专题图子项的标题。
  40815. */
  40816. this.caption = null;
  40817. /**
  40818. * @member {number} [ThemeRangeItem.prototype.end=0]
  40819. * @description 分段专题图子项的终止值,即该段专题值范围的最大值。<br>
  40820. * 如果该子项是分段中最后一个子项,则该终止值应大于分段字段(ThemeRange 类的 rangeExpression 属性)的最大值,若该终止值小于分段字段最大值,
  40821. * 则剩余部分由内部随机定义其颜色;如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常;
  40822. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  40823. */
  40824. this.end = 0;
  40825. /**
  40826. * @member {number} [ThemeRangeItem.prototype.start=0]
  40827. * @description 分段专题图子项的起始值,即该段专题值范围的最小值。<br>
  40828. * 如果该子项是分段中第一个子项,那么该起始值就是分段的最小值;如果子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  40829. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  40830. */
  40831. this.start = 0;
  40832. /**
  40833. * @member {ServerStyle} ThemeRangeItem.prototype.style
  40834. * @description 分段专题图子项的风格。
  40835. * 每一个分段专题图子项都对应一种显示风格。
  40836. */
  40837. this.style = new ServerStyle();
  40838. /**
  40839. * @member {boolean} [ThemeRangeItem.prototype.visible=true]
  40840. * @description 分段专题图子项是否可见。
  40841. */
  40842. this.visible = true;
  40843. if (options) {
  40844. Util_Util.extend(this, options);
  40845. }
  40846. this.CLASS_NAME = "SuperMap.ThemeRangeItem";
  40847. }
  40848. /**
  40849. * @function ThemeRangeItem.prototype.destroy
  40850. * @description 释放资源,将引用资源的属性置空。
  40851. */
  40852. destroy() {
  40853. var me = this;
  40854. me.caption = null;
  40855. me.end = null;
  40856. me.start = null;
  40857. if (me.style) {
  40858. me.style.destroy();
  40859. me.style = null;
  40860. }
  40861. me.visible = null;
  40862. }
  40863. /**
  40864. * @function ThemeRangeItem.prototypetoServerJSONObject
  40865. * @description 转换成对应的 JSON 格式对象。
  40866. * @returns {Object} 对应的 JSON 格式对象。
  40867. */
  40868. toServerJSONObject() {
  40869. var obj = {};
  40870. obj = Util_Util.copyAttributes(obj, this);
  40871. if (obj.style) {
  40872. if (obj.style.toServerJSONObject) {
  40873. obj.style = obj.style.toServerJSONObject();
  40874. }
  40875. }
  40876. return obj;
  40877. }
  40878. /**
  40879. * @function ThemeRangeItem.fromObj
  40880. * @description 从传入对象获取范围分段专题图子项类。
  40881. * @param {Object} obj - 传入对象。
  40882. * @returns {ThemeRangeItem} ThemeRangeItem 对象。
  40883. */
  40884. static fromObj(obj) {
  40885. if (!obj) {
  40886. return;
  40887. }
  40888. var res = new ThemeRangeItem();
  40889. Util_Util.copy(res, obj);
  40890. res.style = ServerStyle.fromJson(obj.style);
  40891. return res;
  40892. }
  40893. }
  40894. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRange.js
  40895. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40896. * This program are made available under the terms of the Apache License, Version 2.0
  40897. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40898. /**
  40899. * @class ThemeRange
  40900. * @deprecatedclass SuperMap.ThemeRange
  40901. * @category iServer Map Theme
  40902. * @classdesc 范围分段专题图。
  40903. * 范围分段专题图是按照指定的分段方法(如:等距离分段法)对字段的属性值进行分段,使用不同的颜色或符号(线型、填充)表示不同范围段落的属性值在整体上的分布情况,体现区域的差异。
  40904. * 在分段专题图中,专题值按照某种分段方式被分成多个范围段,要素根据各自的专题值被分配到其中一个范围段中,在同一个范围段中的要素使用相同的颜色,填充,符号等风格进行显示。
  40905. * 分段专题图所基于的专题变量必须为数值型,分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  40906. * @extends {CommonTheme}
  40907. * @param {Object} options - 参数。
  40908. * @param {Array.<ThemeRangeItem>} options.items - 子项数组。
  40909. * @param {string} options.rangeExpression - 分段字段表达式。
  40910. * @param {number} options.rangeParameter - 分段参数。
  40911. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段模式。
  40912. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  40913. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  40914. * @usage
  40915. */
  40916. class ThemeRange extends Theme {
  40917. constructor(options) {
  40918. super("RANGE", options);
  40919. /**
  40920. * @member {string} ThemeRange.prototype.precision
  40921. * @description 精准度。
  40922. */
  40923. this.precision = '1.0E-12';
  40924. /**
  40925. * @member {Array.<ThemeRangeItem>} ThemeRange.prototype.items
  40926. * @description 分段专题图子项数组。<br>
  40927. * 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  40928. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为 [start, end)。
  40929. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按照您设置的值对分段结果进行调整。
  40930. */
  40931. this.items = null;
  40932. /**
  40933. * @member {string} ThemeRange.prototype.rangeExpression
  40934. * @description 分段字段表达式。<br>
  40935. * 由于范围分段专题图基于各种分段方法根据一定的距离进行分段,因而范围分段专题图所基于的字段值的数据类型必须为数值型。对于字段表达式,只能为数值型的字段间的运算。
  40936. */
  40937. this.rangeExpression = null;
  40938. /**
  40939. * @member {RangeMode} [ThemeRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
  40940. * @description 分段专题图的分段模式。<br>
  40941. * 在分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  40942. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  40943. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  40944. */
  40945. this.rangeMode = RangeMode.EQUALINTERVAL;
  40946. /**
  40947. * @member {number} ThemeRange.prototype.rangeParameter
  40948. * @description 分段参数。
  40949. * 当分段模式为等距离分段法,平方根分段,对数分段法,等计数分段法其中一种模式时,该参数用于设置分段个数;当分段模式为标准差分段法时,
  40950. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  40951. */
  40952. this.rangeParameter = 0;
  40953. /**
  40954. * @member {ColorGradientType} [ThemeRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  40955. * @description 渐变颜色枚举类。<br>
  40956. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  40957. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。但如果为某几个子项的风格进行单独设置后(设置了 {@link ThemeUniqueItem} 或 {@link ThemeRangeItem} 类中Style属性),
  40958. * 该配色方案对于这几个子项将不起作用。
  40959. */
  40960. this.colorGradientType = ColorGradientType.YELLOW_RED;
  40961. if (options) {
  40962. Util_Util.extend(this, options);
  40963. }
  40964. this.CLASS_NAME = "SuperMap.ThemeRange";
  40965. }
  40966. /**
  40967. * @function ThemeRange.prototype.destroy
  40968. * @override
  40969. */
  40970. destroy() {
  40971. super.destroy();
  40972. var me = this;
  40973. if (me.items) {
  40974. if (me.items.length > 0) {
  40975. for (var item in me.items) {
  40976. me.items[item].destroy();
  40977. me.items[item] = null;
  40978. }
  40979. }
  40980. me.items = null;
  40981. }
  40982. me.rangeExpression = null;
  40983. me.rangeMode = null;
  40984. me.rangeParameter = null;
  40985. me.colorGradientType = null;
  40986. }
  40987. /**
  40988. * @function ThemeRange.fromObj
  40989. * @description 从传入对象获取范围分段专题图类。
  40990. * @param {Object} obj - 传入对象。
  40991. * @returns {ThemeRange} ThemeRange 对象。
  40992. */
  40993. static fromObj(obj) {
  40994. if (!obj) {
  40995. return;
  40996. }
  40997. var res = new ThemeRange();
  40998. Util_Util.copy(res, obj);
  40999. var itemsR = obj.items;
  41000. var len = itemsR ? itemsR.length : 0;
  41001. res.items = [];
  41002. for (var i = 0; i < len; i++) {
  41003. res.items.push(ThemeRangeItem.fromObj(itemsR[i]));
  41004. }
  41005. return res;
  41006. }
  41007. }
  41008. ;// CONCATENATED MODULE: ./src/common/iServer/UGCLayer.js
  41009. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41010. * This program are made available under the terms of the Apache License, Version 2.0
  41011. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41012. /**
  41013. * @class UGCLayer
  41014. * @deprecatedclass SuperMap.UGCLayer
  41015. * @category iServer Map Layer
  41016. * @classdesc SuperMap 图层类。
  41017. * @param {Object} options - 参数。
  41018. * @param {Bounds} options.bounds - 图层范围。
  41019. * @param {string} options.name - 图层的名称。
  41020. * @param {UGCLayerType} options.type - 图层类型。
  41021. * @param {string} [options.caption] - 图层的标题。
  41022. * @param {string} [options.description] - 图层的描述信息。
  41023. * @param {boolean} [options.queryable] - 图层中的对象是否可以查询。
  41024. * @param {boolean} [options.subUGCLayers] - 是否允许图层的符号大小随图缩放。
  41025. * @param {boolean} [options.visible=false] - 地图对象在同一范围内时,是否重叠显示。
  41026. * @usage
  41027. */
  41028. class UGCLayer {
  41029. constructor(options) {
  41030. options = options || {};
  41031. /**
  41032. * @member {Bounds} UGCLayer.prototype.bounds
  41033. * @description 图层范围。
  41034. */
  41035. this.bounds = null;
  41036. /**
  41037. * @member {string} [UGCLayer.prototype.caption]
  41038. * @description 图层的标题。默认情况下图层的标题与图层的名称一致。在图例、图层控制列表中显示的图层名称就是该图层的标题值。
  41039. */
  41040. this.caption = null;
  41041. /**
  41042. * @member {string} UGCLayer.prototype.description
  41043. * @description 图层的描述信息。
  41044. */
  41045. this.description = null;
  41046. /**
  41047. * @member {string} UGCLayer.prototype.name
  41048. * @description 图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该属性区分大小写。
  41049. */
  41050. this.name = null;
  41051. /**
  41052. * @member {boolean} UGCLayer.prototype.queryable
  41053. * @description 图层中的对象是否可以查询。
  41054. */
  41055. this.queryable = null;
  41056. /**
  41057. * @member {Array} UGCLayer.prototype.subLayers
  41058. * @description 子图层集。
  41059. */
  41060. this.subLayers = null;
  41061. /**
  41062. * @member {UGCLayerType} UGCLayer.prototype.type
  41063. * @description 图层类型。
  41064. */
  41065. this.type = null;
  41066. /**
  41067. * @member {boolean} UGCLayer.prototype.visible
  41068. * @description 地图对象在同一范围内时,是否重叠显示。
  41069. */
  41070. this.visible = null;
  41071. Util_Util.extend(this, options);
  41072. this.CLASS_NAME = "SuperMap.UGCLayer";
  41073. }
  41074. /**
  41075. * @function UGCLayer.prototype.destroy
  41076. * @description 释放资源,将引用资源的属性置空。
  41077. */
  41078. destroy() {
  41079. var me = this;
  41080. Util_Util.reset(me);
  41081. }
  41082. /**
  41083. * @function UGCLayer.prototype.fromJson
  41084. * @description 将服务端 JSON 对象转换成当前客户端对象。
  41085. * @param {Object} jsonObject - 要转换的 JSON 对象。
  41086. */
  41087. fromJson(jsonObject) {
  41088. jsonObject = jsonObject ? jsonObject : {};
  41089. Util_Util.extend(this, jsonObject);
  41090. var b = this.bounds;
  41091. if (b) {
  41092. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  41093. }
  41094. }
  41095. /**
  41096. * @function UGCLayer.prototype.toServerJSONObject
  41097. * @description 转换成对应的 JSON 格式对象。
  41098. * @returns {Object} 对应的 JSON 格式对象。
  41099. */
  41100. toServerJSONObject() {
  41101. var jsonObject = {};
  41102. jsonObject = Util_Util.copyAttributes(jsonObject, this);
  41103. if (jsonObject.bounds) {
  41104. if (jsonObject.bounds.toServerJSONObject) {
  41105. jsonObject.bounds = jsonObject.bounds.toServerJSONObject();
  41106. }
  41107. }
  41108. return jsonObject;
  41109. }
  41110. }
  41111. ;// CONCATENATED MODULE: ./src/common/iServer/UGCMapLayer.js
  41112. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41113. * This program are made available under the terms of the Apache License, Version 2.0
  41114. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41115. /**
  41116. * @class UGCMapLayer
  41117. * @deprecatedclass SuperMap.UGCMapLayer
  41118. * @category iServer Map Layer
  41119. * @classdesc SuperMap 地图图层类。
  41120. * @extends {UGCLayer}
  41121. * @param {Object} options - 可选参数。
  41122. * @param {boolean} [options.completeLineSymbolDisplayed] - 是否显示完整线型。
  41123. * @param {number} [options.maxScale] - 地图最大比例尺。
  41124. * @param {number} [options.minScale] - 地图最小比例尺。
  41125. * @param {number} [options.minVisibleGeometrySize] - 几何对象的最小可见大小,以像素为单位。
  41126. * @param {number} [options.opaqueRate] - 图层的不透明度。
  41127. * @param {boolean} [options.symbolScalable] - 是否允许图层的符号大小随图缩放。
  41128. * @param {number} [options.symbolScale] - 图层的符号缩放基准比例尺。
  41129. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  41130. * @param {OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 地图的压盖过滤显示选项,当overlapDisplayed 为 false 时有效。
  41131. * @usage
  41132. */
  41133. class UGCMapLayer extends UGCLayer {
  41134. constructor(options) {
  41135. options = options || {};
  41136. super(options);
  41137. /**
  41138. * @member {boolean} UGCMapLayer.prototype.completeLineSymbolDisplayed
  41139. * @description 是否显示完整线型。
  41140. */
  41141. this.completeLineSymbolDisplayed = null;
  41142. /**
  41143. * @member {number} UGCMapLayer.prototype.maxScale
  41144. * @description 地图最大比例尺。
  41145. */
  41146. this.maxScale = null;
  41147. /**
  41148. * @member {number} UGCMapLayer.prototype.minScale
  41149. * @description 地图最小比例尺。
  41150. */
  41151. this.minScale = null;
  41152. /**
  41153. * @member {number} UGCMapLayer.prototype.minVisibleGeometrySize
  41154. * @description 几何对象的最小可见大小,以像素为单位。
  41155. */
  41156. this.minVisibleGeometrySize = null;
  41157. /**
  41158. * @member {number} UGCMapLayer.prototype.opaqueRate
  41159. * @description 图层的不透明度。
  41160. */
  41161. this.opaqueRate = null;
  41162. /**
  41163. * @member {boolean} UGCMapLayer.prototype.symbolScalable
  41164. * @description 是否允许图层的符号大小随图缩放。
  41165. */
  41166. this.symbolScalable = null;
  41167. /**
  41168. * @member {number} UGCMapLayer.prototype.symbolScale
  41169. * @description 图层的符号缩放基准比例尺。
  41170. */
  41171. this.symbolScale = null;
  41172. /**
  41173. * @member {boolean} [UGCMapLayer.prototype.overlapDisplayed=false]
  41174. * @description 地图对象在同一范围内时,是否重叠显示。
  41175. */
  41176. this.overlapDisplayed = null;
  41177. /**
  41178. * @member {OverlapDisplayedOptions} UGCMapLayer.prototype.overlapDisplayedOptions
  41179. * @description 地图的压盖过滤显示选项,当 overlapDisplayed 为 false 时有效。
  41180. */
  41181. this.overlapDisplayedOptions = null;
  41182. this.CLASS_NAME = "SuperMap.UGCMapLayer";
  41183. }
  41184. /**
  41185. * @function UGCMapLayer.prototype.destroy
  41186. * @override
  41187. */
  41188. destroy() {
  41189. super.destroy();
  41190. Util_Util.reset(this);
  41191. }
  41192. /**
  41193. * @function UGCMapLayer.prototype.fromJson
  41194. * @description 将服务端 JSON 对象转换成当前客户端对象。
  41195. * @param {Object} jsonObject - 要转换的 JSON 对象。
  41196. */
  41197. fromJson(jsonObject) {
  41198. super.fromJson(jsonObject);
  41199. }
  41200. /**
  41201. * @function UGCMapLayer.prototype.toServerJSONObject
  41202. * @description 转换成对应的 JSON 格式对象。
  41203. * @returns {Object} 对应的 JSON 格式对象。
  41204. */
  41205. toServerJSONObject() {
  41206. return super.toServerJSONObject();
  41207. }
  41208. }
  41209. ;// CONCATENATED MODULE: ./src/common/iServer/JoinItem.js
  41210. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41211. * This program are made available under the terms of the Apache License, Version 2.0
  41212. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41213. /**
  41214. * @class JoinItem
  41215. * @deprecatedclass SuperMap.JoinItem
  41216. * @category iServer Data FeatureResults
  41217. * @classdesc 连接信息类。
  41218. * 该类用于矢量数据集与外部表的连接。外部表可以为另一个矢量数据集(其中纯属性数据集中没有空间几何信息)所对应的 DBMS 表,也可以是用户自建的业务表。
  41219. * 需要注意的是,矢量数据集与外部表必须属于同一数据源。表之间的联系的建立有两种方式,一种是连接(join),一种是关联(link)。
  41220. * 连接,实际上是依据相同的字段将一个外部表追加到指定的表;而关联是基于一个相同的字段定义了两个表格之间的联系,但不是实际的追加。
  41221. * 用于连接两个表的字段的名称不一定相同,但类型必须一致。当两个表格之间建立了连接,通过对主表进行操作,可以对外部表进行查询,制作专题图以及分析等。
  41222. * 当两个表格之间是一对一或多对一的关系时,可以使用 join 连接。当为多对一的关系时,允许指定多个字段之间的关联。
  41223. *(注意:JoinItem 目前支持左连接和内连接,不支持全连接和右连接,UDB 引擎不支持内连接。并且用于建立连接的两个表必须在同一个数据源下。)
  41224. * @param {Object} options - 参数。
  41225. * @param {string} options.foreignTableName - 外部表的名称。
  41226. * @param {string} options.joinFilter - 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  41227. * @param {JoinType} options.joinType - 两个表之间连接类型。
  41228. * @example 下面以 SQL 查询说明 joinItem 的使用方法:
  41229. *(start code)
  41230. * function queryBySQL() {
  41231. * // 设置与外部表的连接信息
  41232. * var joinItem = new JoinItem({
  41233. * foreignTableName: "foreignTable",
  41234. * joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
  41235. * joinType: "LEFTJOIN"
  41236. * })
  41237. * var queryParam, queryBySQLParams, queryBySQLService;
  41238. * // 设置查询参数,在查询参数中添加joinItem关联条件信息
  41239. * queryParam = new FilterParameter({
  41240. * name: "Countries@World",
  41241. * joinItems: [joinItem]
  41242. * }),
  41243. * queryBySQLParams = new QueryBySQLParameters({
  41244. * queryParams: [queryParam]
  41245. * }),
  41246. * queryBySQLService = new QueryBySQLService(url, {
  41247. * eventListeners: { "processCompleted": processCompleted, "processFailed": processFailed}
  41248. * });
  41249. * queryBySQLService.processAsync(queryBySQLParams);
  41250. * }
  41251. * function processCompleted(queryEventArgs) {//todo}
  41252. * function processFailed(e) {//todo}
  41253. * (end)
  41254. * @usage
  41255. */
  41256. class JoinItem {
  41257. constructor(options) {
  41258. /**
  41259. * @member {string} JoinItem.prototype.foreignTableName
  41260. * @description 外部表的名称。
  41261. * 如果外部表的名称是以 “表名@数据源名” 命名方式,则该属性只需赋值表名。
  41262. * 例如:外部表 Name@changchun,Name 为表名,changchun 为数据源名称,则该属性的赋值应为:Name。
  41263. */
  41264. this.foreignTableName = null;
  41265. /**
  41266. * @member {string} JoinItem.prototype.joinFilter
  41267. * @description 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  41268. * 例如,将房屋面数据集(Building)的 district 字段与房屋拥有者的纯属性数据集(Owner)的 region 字段相连接,
  41269. * 两个数据集对应的表名称分别为 Table_Building 和 Table_Owner,
  41270. * 则连接表达式为 Table_Building.district = Table_Owner.region。
  41271. * 当有多个字段相连接时,用 AND 将多个表达式相连。
  41272. */
  41273. this.joinFilter = null;
  41274. /**
  41275. * @member {JoinType} JoinItem.prototype.joinType
  41276. * @description 两个表之间连接类型。
  41277. * 连接类型决定了对两个表进行连接查询后返回的记录的情况。
  41278. */
  41279. this.joinType = null;
  41280. if (options) {
  41281. Util_Util.extend(this, options);
  41282. }
  41283. this.CLASS_NAME = "SuperMap.JoinItem";
  41284. }
  41285. /**
  41286. * @function JoinItem.prototype.destroy
  41287. * @description 释放资源,将引用资源的属性置空。
  41288. */
  41289. destroy() {
  41290. var me = this;
  41291. me.foreignTableName = null;
  41292. me.joinFilter = null;
  41293. me.joinType = null;
  41294. }
  41295. /**
  41296. * @function JoinItem.prototype.toServerJSONObject
  41297. * @description 转换成对应的 JSON 格式对象。
  41298. */
  41299. toServerJSONObject() {
  41300. var dataObj = {};
  41301. dataObj = Util_Util.copyAttributes(dataObj, this);
  41302. //joinFilter基本是个纯属性对象,这里不再做转换
  41303. return dataObj;
  41304. }
  41305. }
  41306. ;// CONCATENATED MODULE: ./src/common/iServer/UGCSubLayer.js
  41307. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41308. * This program are made available under the terms of the Apache License, Version 2.0
  41309. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41310. /**
  41311. * @class UGCSubLayer
  41312. * @deprecatedclass SuperMap.UGCSubLayer
  41313. * @category iServer Map Layer
  41314. * @classdesc 地图服务图层属性信息类。影像图层(Image)、专题图层(ServerTheme)、栅格图层(Grid)、矢量图层(Vector)等图层均继承该类。
  41315. * @extends {UGCMapLayer}
  41316. * @param {Object} options - 参数。
  41317. * @param {DatasetInfo} options.datasetInfo - 数据集信息。
  41318. * @param {string} [options.displayFilter] - 图层显示过滤条件。
  41319. * @param {JoinItem} [options.joinItems] - 连接信息类。
  41320. * @param {string} [options.representationField] - 存储制图表达信息的字段。
  41321. * @param {LayerType} [options.ugcLayerType] - 图层类型。
  41322. * @usage
  41323. */
  41324. class UGCSubLayer extends UGCMapLayer {
  41325. constructor(options) {
  41326. options = options || {};
  41327. super(options);
  41328. /**
  41329. * @member {DatasetInfo} UGCSubLayer.prototype.datasetInfo
  41330. * @description 数据集信息。
  41331. */
  41332. this.datasetInfo = null;
  41333. /**
  41334. * @member {string} UGCSubLayer.prototype.displayFilter
  41335. * @description 图层显示过滤条件。
  41336. */
  41337. this.displayFilter = null;
  41338. /**
  41339. * @member {JoinItem} UGCSubLayer.prototype.joinItems
  41340. * @description 连接信息类。
  41341. */
  41342. this.joinItems = null;
  41343. /**
  41344. * @member {string} UGCSubLayer.prototype.representationField
  41345. * @description 存储制图表达信息的字段。
  41346. */
  41347. this.representationField = null;
  41348. /**
  41349. * @member {LayerType} UGCSubLayer.prototype.ugcLayerType
  41350. * @description 图层类型。
  41351. */
  41352. this.ugcLayerType = null;
  41353. this.CLASS_NAME = "SuperMap.UGCSubLayer";
  41354. }
  41355. /**
  41356. * @function UGCSubLayer.prototype.fromJson
  41357. * @description 将服务端 JSON 对象转换成当前客户端对象。
  41358. * @param {Object} jsonObject - 要转换的 JSON 对象。
  41359. */
  41360. fromJson(jsonObject) {
  41361. super.fromJson(jsonObject);
  41362. if (this.datasetInfo) {
  41363. this.datasetInfo = new DatasetInfo(this.datasetInfo);
  41364. }
  41365. if (this.joinItems && this.joinItems.length) {
  41366. var newJoinItems = [];
  41367. for (var i = 0; i < this.joinItems.length; i++) {
  41368. newJoinItems[i] = new JoinItem(this.joinItems[i]);
  41369. }
  41370. this.joinItems = newJoinItems;
  41371. }
  41372. }
  41373. /**
  41374. * @function UGCSubLayer.prototype.destroy
  41375. * @override
  41376. */
  41377. destroy() {
  41378. super.destroy();
  41379. Util_Util.reset(this);
  41380. }
  41381. /**
  41382. * @function UGCSubLayer.prototype.toServerJSONObject
  41383. * @description 转换成对应的 JSON 格式对象。
  41384. * @returns {Object} 对应的 JSON 格式对象。
  41385. */
  41386. toServerJSONObject() {
  41387. var jsonObject = super.toServerJSONObject();
  41388. if (jsonObject.joinItems) {
  41389. var joinItems = [];
  41390. for (var i = 0; i < jsonObject.joinItems.length; i++) {
  41391. if (jsonObject.joinItems[i].toServerJSONObject) {
  41392. joinItems[i] = jsonObject.joinItems[i].toServerJSONObject();
  41393. }
  41394. }
  41395. jsonObject.joinItems = joinItems;
  41396. }
  41397. if (jsonObject.datasetInfo) {
  41398. if (jsonObject.datasetInfo.toServerJSONObject) {
  41399. jsonObject.datasetInfo = jsonObject.datasetInfo.toServerJSONObject();
  41400. }
  41401. }
  41402. return jsonObject;
  41403. }
  41404. }
  41405. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTheme.js
  41406. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41407. * This program are made available under the terms of the Apache License, Version 2.0
  41408. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41409. /**
  41410. * @class ServerTheme
  41411. * @deprecatedclass SuperMap.ServerTheme
  41412. * @category iServer Map Theme
  41413. * @classdesc SuperMap 专题图图层类。
  41414. * @extends {UGCSubLayer}
  41415. * @param {CommonTheme} theme - 专题图对象。
  41416. * @param {LonLat} themeElementPosition - 专题图元素位置。
  41417. * @usage
  41418. */
  41419. class ServerTheme extends UGCSubLayer {
  41420. constructor(options) {
  41421. options = options || {};
  41422. super(options);
  41423. /**
  41424. * @member {CommonTheme} ServerTheme.prototype.theme
  41425. * @description 专题图对象。
  41426. */
  41427. this.theme = null;
  41428. /**
  41429. * @member {LonLat} ServerTheme.prototype.themeElementPosition
  41430. * @description 专题图元素位置。
  41431. */
  41432. this.themeElementPosition = null;
  41433. this.CLASS_NAME = "SuperMap.ServerTheme";
  41434. }
  41435. /**
  41436. * @function ServerTheme.prototype.destroy
  41437. * @description 释放资源,将引用资源的属性置空。
  41438. * @override
  41439. */
  41440. destroy() {
  41441. super.destroy();
  41442. Util_Util.reset(this);
  41443. }
  41444. /**
  41445. * @function ServerTheme.prototype.fromJson
  41446. * @description 将服务端 JSON 对象转换成当前客户端对象。
  41447. * @param {Object} jsonObject - 要转换的 JSON 对象。
  41448. */
  41449. fromJson(jsonObject) {
  41450. super.fromJson(jsonObject);
  41451. var themeObj = this.theme;
  41452. var themeT = themeObj && themeObj.type;
  41453. switch (themeT) {
  41454. case 'LABEL':
  41455. this.theme = ThemeLabel.fromObj(themeObj);
  41456. break;
  41457. case 'UNIQUE':
  41458. this.theme = ThemeUnique.fromObj(themeObj);
  41459. break;
  41460. case 'GRAPH':
  41461. this.theme = ThemeGraph.fromObj(themeObj);
  41462. break;
  41463. case 'DOTDENSITY':
  41464. this.theme = ThemeDotDensity.fromObj(themeObj);
  41465. break;
  41466. case 'GRADUATEDSYMBOL':
  41467. this.theme = ThemeGraduatedSymbol.fromObj(themeObj);
  41468. break;
  41469. case 'RANGE':
  41470. this.theme = ThemeRange.fromObj(themeObj);
  41471. break;
  41472. default:
  41473. break;
  41474. }
  41475. if (this.themeElementPosition) {
  41476. //待测试
  41477. this.themeElementPosition = new LonLat(this.themeElementPosition.x, this.themeElementPosition.y);
  41478. }
  41479. }
  41480. /**
  41481. * @function ServerTheme.prototype.toServerJSONObject
  41482. * @description 转换成对应的 JSON 格式对象。
  41483. */
  41484. toServerJSONObject() {
  41485. //普通属性直接赋值
  41486. var jsonObject = super.toServerJSONObject();
  41487. if (jsonObject.themeElementPosition) {
  41488. if (jsonObject.themeElementPosition.toServerJSONObject) {
  41489. jsonObject.themeElementPosition = jsonObject.themeElementPosition.toServerJSONObject();
  41490. }
  41491. }
  41492. if (jsonObject.theme) {
  41493. if (jsonObject.theme.toServerJSONObject) {
  41494. jsonObject.theme = jsonObject.theme.toServerJSONObject();
  41495. }
  41496. }
  41497. return jsonObject;
  41498. }
  41499. }
  41500. ;// CONCATENATED MODULE: ./src/common/iServer/Grid.js
  41501. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41502. * This program are made available under the terms of the Apache License, Version 2.0
  41503. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41504. /**
  41505. * @class Grid
  41506. * @deprecatedclass SuperMap.Grid
  41507. * @category iServer Map Layer
  41508. * @classdesc SuperMap 栅格图层类。
  41509. * @extends {UGCSubLayer}
  41510. * @param {Object} options - 可选参数。
  41511. * @param {Array.<Object>} [options.colorDictionary] - 颜色对照表对象。
  41512. * @param {number} [options.brightness] - Grid 图层的亮度。
  41513. * @param {ColorGradientType} [options.colorGradientType] - 颜色渐变枚举。
  41514. * @param {ServerColor} [options.colors] - 颜色表对象。
  41515. * @param {number} [options.contrast] - Grid 图层的对比度。
  41516. * @param {GridType} [options.gridType] - 格网类型。
  41517. * @param {number} [options.horizontalSpacing] - 格网水平间隔大小。
  41518. * @param {boolean} [options.sizeFixed] - 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  41519. * @param {ServerStyle} [options.solidStyle] - 格网实线的样式。
  41520. * @param {ServerColor} [options.specialColor] - 栅格数据集无值数据的颜色。
  41521. * @param {number} [options.specialValue] - 图层的特殊值。
  41522. * @param {boolean} [options.specialValueTransparent] - 图层的特殊值(specialValue)所处区域是否透明。
  41523. * @param {number} [options.verticalSpacing] - 格网垂直间隔大小。
  41524. * @usage
  41525. */
  41526. class Grid extends UGCSubLayer {
  41527. constructor(options) {
  41528. options = options || {};
  41529. super(options);
  41530. /**
  41531. * @member {Array.<ColorDictionary>} Grid.prototype.colorDictionarys
  41532. * @description 颜色对照表对象。
  41533. */
  41534. this.colorDictionarys = null;
  41535. /**
  41536. * @member {number} Grid.prototype.brightness
  41537. * @description Grid 图层的亮度。
  41538. */
  41539. this.brightness = null;
  41540. /**
  41541. * @member {ColorGradientType} Grid.prototype.colorGradientType
  41542. * @description 渐变颜色枚举值。
  41543. */
  41544. this.colorGradientType = null;
  41545. /**
  41546. * @member {ServerColor} Grid.prototype.colors
  41547. * @description 颜色表对象。
  41548. */
  41549. this.colors = null;
  41550. /**
  41551. * @member {number} Grid.prototype.contrast
  41552. * @description Grid 图层的对比度。
  41553. */
  41554. this.contrast = null;
  41555. /**
  41556. * @member {ServerStyle} Grid.prototype.dashStyle
  41557. * @description 栅格数据集特殊值数据的颜色。
  41558. */
  41559. this.dashStyle = null;
  41560. /**
  41561. * @member {GridType} Grid.prototype.gridType
  41562. * @description 格网类型。
  41563. */
  41564. this.gridType = null;
  41565. /**
  41566. * @member {number} Grid.prototype.horizontalSpacing
  41567. * @description 格网水平间隔大小。
  41568. */
  41569. this.horizontalSpacing = null;
  41570. /**
  41571. * @member {boolean} Grid.prototype.sizeFixed
  41572. * @description 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  41573. */
  41574. this.sizeFixed = null;
  41575. /**
  41576. * @member {ServerStyle} Grid.prototype.solidStyle
  41577. * @description 格网实线的样式。
  41578. */
  41579. this.solidStyle = null;
  41580. /**
  41581. * @member {ServerColor} Grid.prototype.specialColor
  41582. * @description 栅格数据集无值数据的颜色。
  41583. */
  41584. this.specialColor = null;
  41585. /**
  41586. * @member {number} Grid.prototype.specialValue
  41587. * @description 图层的特殊值。
  41588. */
  41589. this.specialValue = null;
  41590. /**
  41591. * @member {boolean} Grid.prototype.specialValueTransparent
  41592. * @description 图层的特殊值(specialValue)所处区域是否透明。
  41593. */
  41594. this.specialValueTransparent = null;
  41595. /**
  41596. * @member {number} Grid.prototype.verticalSpacing
  41597. * @description 格网垂直间隔大小。
  41598. */
  41599. this.verticalSpacing = null;
  41600. this.CLASS_NAME = "SuperMap.Grid";
  41601. }
  41602. /**
  41603. * @function Grid.prototype.destroy
  41604. * @description 释放资源,将引用资源的属性置空。
  41605. */
  41606. destroy() {
  41607. super.destroy();
  41608. Util_Util.reset(this);
  41609. }
  41610. /**
  41611. * @function Grid.prototype.fromJson
  41612. * @description 将服务端 JSON 对象转换成当前客户端对象。
  41613. * @param {Object} jsonObject - 要转换的 JSON 对象。
  41614. */
  41615. fromJson(jsonObject) {
  41616. super.fromJson(jsonObject);
  41617. if (this.specialColor) {
  41618. this.specialColor = new ServerColor(this.specialColor.red,
  41619. this.specialColor.green,
  41620. this.specialColor.blue);
  41621. }
  41622. if (this.colors) {
  41623. var colors = [],
  41624. color;
  41625. for (var i in this.colors) {
  41626. color = this.colors[i];
  41627. colors.push(new ServerColor(color.red, color.green, color.blue));
  41628. }
  41629. this.colors = colors;
  41630. }
  41631. if (this.dashStyle) {
  41632. this.dashStyle = new ServerStyle(this.dashStyle);
  41633. }
  41634. if (this.solidStyle) {
  41635. this.solidStyle = new ServerStyle(this.solidStyle);
  41636. }
  41637. if (this.colorDictionary) {
  41638. var colorDics = [],
  41639. colorDic;
  41640. for (var key in this.colorDictionary) {
  41641. colorDic = this.colorDictionary[key];
  41642. colorDics.push(new ColorDictionary({elevation: key, color: colorDic}));
  41643. }
  41644. this.colorDictionarys = colorDics;
  41645. }
  41646. delete this.colorDictionary;
  41647. }
  41648. /**
  41649. * @function Grid.prototype.toServerJSONObject
  41650. * @description 转换成对应的 JSON 对象。
  41651. * @returns JSON 对象。
  41652. */
  41653. toServerJSONObject() {
  41654. var jsonObject = super.toServerJSONObject();
  41655. if (jsonObject.dashStyle) {
  41656. if (jsonObject.dashStyle.toServerJSONObject) {
  41657. jsonObject.dashStyle = jsonObject.dashStyle.toServerJSONObject();
  41658. }
  41659. }
  41660. if (jsonObject.solidStyle) {
  41661. if (jsonObject.solidStyle.toServerJSONObject) {
  41662. jsonObject.solidStyle = jsonObject.solidStyle.toServerJSONObject();
  41663. }
  41664. }
  41665. return jsonObject;
  41666. }
  41667. }
  41668. ;// CONCATENATED MODULE: ./src/common/iServer/Image.js
  41669. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41670. * This program are made available under the terms of the Apache License, Version 2.0
  41671. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41672. /**
  41673. * @class UGCImage
  41674. * @deprecatedclass SuperMap.Image
  41675. * @category iServer Map Layer
  41676. * @classdesc SuperMap 影像图层类
  41677. * @extends {UGCSubLayer}
  41678. * @param {Object} options - 可选参数。
  41679. * @param {ColorSpaceType} [options.colorSpaceType] - 返回影像图层的色彩显示模式。
  41680. * @param {number} [options.brightness] - 影像图层的亮度。
  41681. * @param {Array.<number>} [options.displayBandIndexes] - 返回当前影像图层显示的波段索引。
  41682. * @param {number} [options.contrast] - 影像图层的对比度。
  41683. * @param {boolean} [options.transparent] - 是否背景透明。
  41684. * @param {ServerColor} [options.transparentColor] - 返回背景透明色。
  41685. * @param {number} [options.transparentColorTolerance] - 背景透明色容限。
  41686. * @usage
  41687. * @private
  41688. */
  41689. class UGCImage extends UGCSubLayer {
  41690. constructor(options) {
  41691. options = options || {};
  41692. super(options);
  41693. /**
  41694. * @member {number} UGCImage.prototype.brightness
  41695. * @description 影像图层的亮度。
  41696. */
  41697. this.brightness = null;
  41698. /**
  41699. * @member {ColorSpaceType} UGCImage.prototype.colorSpaceType
  41700. * @description 返回影像图层的色彩显示模式。
  41701. */
  41702. this.colorSpaceType = null;
  41703. /**
  41704. * @member {number} UGCImage.prototype.contrast
  41705. * @description 影像图层的对比度。
  41706. */
  41707. this.contrast = null;
  41708. /**
  41709. * @member {Array.<number>} UGCImage.prototype.displayBandIndexes
  41710. * @description 返回当前影像图层显示的波段索引。
  41711. */
  41712. this.displayBandIndexes = null;
  41713. /**
  41714. * @member {boolean} UGCImage.prototype.transparent
  41715. * @description 是否背景透明。
  41716. */
  41717. this.transparent = null;
  41718. /**
  41719. * @member {ServerColor} UGCImage.prototype.transparentColor
  41720. * @description 返回背景透明色。
  41721. */
  41722. this.transparentColor = null;
  41723. /**
  41724. * @member {number} UGCImage.prototype.transparentColorTolerance
  41725. * @description 背景透明色容限。
  41726. */
  41727. this.transparentColorTolerance = null;
  41728. this.CLASS_NAME = "SuperMap.Image";
  41729. }
  41730. /**
  41731. * @function UGCImage.prototype.destroy
  41732. * @override
  41733. */
  41734. destroy() {
  41735. super.destroy();
  41736. Util_Util.reset(this);
  41737. }
  41738. /**
  41739. * @function UGCImage.prototype.fromJson
  41740. * @description 将服务端 JSON 对象转换成当前客户端对象。
  41741. * @param {Object} jsonObject - 要转换的 JSON 对象。
  41742. */
  41743. fromJson(jsonObject) {
  41744. super.fromJson(jsonObject);
  41745. if (this.transparentColor) {
  41746. this.transparentColor = new ServerColor(this.transparentColor.red,
  41747. this.transparentColor.green,
  41748. this.transparentColor.blue);
  41749. }
  41750. }
  41751. /**
  41752. * @function UGCImage.prototype.toServerJSONObject
  41753. * @description 转换成对应的 JSON 格式对象。
  41754. */
  41755. toServerJSONObject() {
  41756. return super.toServerJSONObject();
  41757. }
  41758. }
  41759. ;// CONCATENATED MODULE: ./src/common/iServer/Vector.js
  41760. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41761. * This program are made available under the terms of the Apache License, Version 2.0
  41762. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41763. /**
  41764. * @class Vector
  41765. * @deprecatedclass SuperMap.Vector
  41766. * @category iServer Map Layer
  41767. * @classdesc SuperMap 矢量图层类。
  41768. * @extends {UGCSubLayer}
  41769. * @param {Object} options - 可选参数。
  41770. * @param {ServerStyle} [options.style] - 矢量图层的风格。
  41771. * @usage
  41772. */
  41773. class Vector_Vector extends UGCSubLayer {
  41774. constructor(options) {
  41775. options = options || {};
  41776. super(options);
  41777. /**
  41778. * @member {ServerStyle} Vector.prototype.style
  41779. * @description 矢量图层的风格。
  41780. */
  41781. this.style = null;
  41782. this.CLASS_NAME = "SuperMap.Vector";
  41783. }
  41784. /**
  41785. * @function Vector.prototype.destroy
  41786. * @description 销毁对象,将其属性置空。
  41787. * @override
  41788. */
  41789. destroy() {
  41790. super.destroy();
  41791. Util_Util.reset(this);
  41792. }
  41793. /**
  41794. * @function Vector.prototype.fromJson
  41795. * @description 将服务端 JSON 对象转换成当前客户端对象。
  41796. * @param {Object} jsonObject - 要转换的 JSON 对象。
  41797. */
  41798. fromJson(jsonObject) {
  41799. super.fromJson(jsonObject);
  41800. var sty = this.style;
  41801. if (sty) {
  41802. this.style = new ServerStyle(sty);
  41803. }
  41804. }
  41805. /**
  41806. * @function Vector.prototype.toServerJSONObject
  41807. * @description 转换成对应的 JSON 格式对象。
  41808. * @returns {Object} 对应的 JSON 格式对象
  41809. */
  41810. toServerJSONObject() {
  41811. var jsonObject = super.toServerJSONObject();
  41812. if (jsonObject.style) {
  41813. if (jsonObject.style.toServerJSONObject) {
  41814. jsonObject.style = jsonObject.style.toServerJSONObject();
  41815. }
  41816. }
  41817. return jsonObject;
  41818. }
  41819. }
  41820. ;// CONCATENATED MODULE: ./src/common/iServer/GetLayersInfoService.js
  41821. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41822. * This program are made available under the terms of the Apache License, Version 2.0
  41823. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41824. /**
  41825. * @class GetLayersInfoService
  41826. * @deprecatedclass SuperMap.GetLayersInfoService
  41827. * @category iServer Map Layer
  41828. * @classdesc 获取图层信息服务类构造函数。
  41829. * @extends {CommonServiceBase}
  41830. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  41831. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  41832. * 如 http://localhost:8090/iserver/services/map-world/rest/maps/World 。
  41833. * 如果查询临时图层的信息,请指定完成的url,包含临时图层ID信息,如:
  41834. * http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/resourceID
  41835. * @param {Object} options - 参数。
  41836. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  41837. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  41838. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41839. * @param {Object} [options.headers] - 请求头。
  41840. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  41841. * @usage
  41842. */
  41843. class GetLayersInfoService extends CommonServiceBase {
  41844. constructor(url, options) {
  41845. super(url, options);
  41846. /**
  41847. * @member {boolean} GetLayersInfoService.prototype.isTempLayers
  41848. * @description 当前url对应的图层是否是临时图层。
  41849. */
  41850. this.isTempLayers = false;
  41851. if (options) {
  41852. Util_Util.extend(this, options);
  41853. }
  41854. this.CLASS_NAME = "SuperMap.GetLayersInfoService";
  41855. }
  41856. /**
  41857. * @function GetLayersInfoService.prototype.destroy
  41858. * @override
  41859. */
  41860. destroy() {
  41861. super.destroy();
  41862. Util_Util.reset(this);
  41863. }
  41864. /**
  41865. * @function GetLayersInfoService.prototype.processAsync
  41866. * @description 负责将客户端的更新参数传递到服务端。
  41867. */
  41868. processAsync() {
  41869. var me = this,
  41870. method = "GET";
  41871. if (!me.isTempLayers) {
  41872. me.url = Util_Util.urlPathAppend(me.url, 'layers');
  41873. }
  41874. me.request({
  41875. method: method,
  41876. params: null,
  41877. scope: me,
  41878. success: me.serviceProcessCompleted,
  41879. failure: me.serviceProcessFailed
  41880. });
  41881. }
  41882. /**
  41883. * @function GetLayersInfoService.prototype.serviceProcessCompleted
  41884. * @description 编辑完成,执行此方法。
  41885. * @param {Object} result - 服务器返回的结果对象。
  41886. */
  41887. serviceProcessCompleted(result, options) {
  41888. var me = this, existRes, layers, len;
  41889. result = Util_Util.transformResult(result);
  41890. existRes = !!result && result.length > 0;
  41891. layers = existRes ? result[0].subLayers.layers : null;
  41892. len = layers ? layers.length : 0;
  41893. me.handleLayers(len, layers);
  41894. me.events.triggerEvent("processCompleted", {result: result[0], options});
  41895. }
  41896. /**
  41897. * TODO 专题图时候可能会用到
  41898. * @function GetLayersInfoService.prototype.handleLayers
  41899. * @description 处理 iServer 新增图层组数据 (subLayers.layers 中可能还会含有 subLayers.layers)
  41900. * @param {number} len - subLayers.layers的长度
  41901. * @param {Array.<number>} layers - subLayers.layers的长度数组
  41902. */
  41903. handleLayers(len, layers) {
  41904. var me = this, tempLayer;
  41905. if (len) {
  41906. for (var i = 0; i < len; i++) {
  41907. if (layers[i].subLayers && layers[i].subLayers.layers && layers[i].subLayers.layers.length > 0) {
  41908. me.handleLayers(layers[i].subLayers.layers.length, layers[i].subLayers.layers);
  41909. } else {
  41910. var type = layers[i].ugcLayerType;
  41911. switch (type) {
  41912. case 'THEME':
  41913. tempLayer = new ServerTheme();
  41914. tempLayer.fromJson(layers[i]);
  41915. layers[i] = tempLayer;
  41916. break;
  41917. case 'GRID':
  41918. tempLayer = new Grid();
  41919. tempLayer.fromJson(layers[i]);
  41920. layers[i] = tempLayer;
  41921. break;
  41922. case 'IMAGE':
  41923. tempLayer = new UGCImage();
  41924. tempLayer.fromJson(layers[i]);
  41925. layers[i] = tempLayer;
  41926. break;
  41927. case 'VECTOR':
  41928. tempLayer = new Vector_Vector();
  41929. tempLayer.fromJson(layers[i]);
  41930. layers[i] = tempLayer;
  41931. break;
  41932. default:
  41933. break;
  41934. }
  41935. }
  41936. }
  41937. }
  41938. }
  41939. }
  41940. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystParameters.js
  41941. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41942. * This program are made available under the terms of the Apache License, Version 2.0
  41943. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41944. /**
  41945. * @class InterpolationAnalystParameters
  41946. * @deprecatedclass SuperMap.InterpolationAnalystParameters
  41947. * @category iServer SpatialAnalyst InterpolationAnalyst
  41948. * @classdesc 插值分析参数类。
  41949. * @param {Object} options - 参数。
  41950. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  41951. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  41952. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  41953. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。
  41954. * @param {string} [options.dataset] - 待分析的数据集名称。当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  41955. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  41956. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  41957. * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
  41958. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  41959. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  41960. * @param {PixelFormat} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  41961. * @param {string} [options.InterpolationAnalystType="dataset"] - 插值分析类型("dataset" 或 "geometry")。
  41962. * @usage
  41963. */
  41964. class InterpolationAnalystParameters {
  41965. constructor(options) {
  41966. if (!options) {
  41967. return;
  41968. }
  41969. /**
  41970. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} InterpolationAnalystParameters.prototype.bounds
  41971. * @description 插值分析的范围,用于确定结果栅格数据集的范围。
  41972. * 如果缺省,则默认为原数据集的范围。鉴于此插值方法为内插方法,原数据集的范围内的插值结果才相对有参考价值,
  41973. * 因此建议此参数不大于原数据集范围。
  41974. */
  41975. this.bounds = null;
  41976. /**
  41977. * @member {number} [InterpolationAnalystParameters.prototype.searchRadius=0]
  41978. * @description 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  41979. * 计算某个位置的 Z 值时,会以该位置为圆心,以查找范围的值为半径,落在这个范围内的采样点都将参与运算。
  41980. * 该值需要根据待插值点数据的分布状况和点数据集范围进行设置。
  41981. */
  41982. this.searchRadius = 0;
  41983. /**
  41984. * @member {string} InterpolationAnalystParameters.prototype.zValueFieldName
  41985. * @description 数据集插值分析中,用于指定进行插值分析的目标字段名,插值分析不支持文本类型的字段。
  41986. * 含义为每个插值点在插值过程中的权重,可以将所有点此字段值设置为 1,即所有点在整体插值中权重相同。
  41987. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  41988. */
  41989. this.zValueFieldName = null;
  41990. /**
  41991. * @member {number} [InterpolationAnalystParameters.prototype.zValueScale=1]
  41992. * @description 用于进行插值分析值的缩放比率。
  41993. * 参加插值分析的值将乘以该参数值后再进行插值,也就是对进行插值分析的值进行统一的扩大或缩小。
  41994. */
  41995. this.zValueScale = 1;
  41996. /**
  41997. * @member {number} InterpolationAnalystParameters.prototype.resolution
  41998. * @description 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  41999. * 该值不能超过待分析数据集的范围边长。
  42000. * 且该值设置时,应该考虑点数据集范围大小来取值,一般为结果栅格行列值(即结果栅格数据集范围除以分辨率),在 500 以内可以较好地体现密度走势。
  42001. */
  42002. this.resolution = null;
  42003. /**
  42004. * @member {FilterParameter} [InterpolationAnalystParameters.prototype.filterQueryParameter]
  42005. * @description 过滤条件,对分析数据集中的点进行过滤,设置为 null 表示对数据集中的所有点进行分析。
  42006. */
  42007. this.filterQueryParameter = null;
  42008. /**
  42009. * @member {string} InterpolationAnalystParameters.prototype.outputDatasetName
  42010. * @description 插值分析结果数据集的名称。
  42011. */
  42012. this.outputDatasetName = null;
  42013. /**
  42014. * @member {string} InterpolationAnalystParameters.prototype.outputDatasourceName
  42015. * @description 插值分析结果数据源的名称。
  42016. */
  42017. this.outputDatasourceName = null;
  42018. /**
  42019. * @member {PixelFormat} [InterpolationAnalystParameters.prototype.pixelFormat]
  42020. * @description 指定结果栅格数据集存储的像素格式。支持存储的像素格式有 BIT16、BIT32、DOUBLE、SINGLE、UBIT1、UBIT4、UBIT8、UBIT24、UBIT32。
  42021. */
  42022. this.pixelFormat = null;
  42023. /**
  42024. * @member {string} [InterpolationAnalystParameters.prototype.dataset]
  42025. * @description 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。
  42026. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  42027. */
  42028. this.dataset = null;
  42029. /**
  42030. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [InterpolationAnalystParameters.prototype.inputPoints]
  42031. * @description 用于做插值分析的离散点(离散点包括Z值)集合。
  42032. * 当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  42033. * 通过离散点直接进行插值分析不需要指定输入数据集inputDatasourceName,inputDatasetName以及zValueFieldName。
  42034. */
  42035. this.inputPoints = null;
  42036. /**
  42037. * @member {string} [InterpolationAnalystParameters.prototype.InterpolationAnalystType="dataset"]
  42038. * @description 插值分析类型。插值分析包括数据集插值分析和几何插值分析两类,
  42039. * "dataset" 表示对数据集进行插值分析,"geometry" 表示对离散点数组进行插值分析。
  42040. */
  42041. this.InterpolationAnalystType = "dataset";
  42042. /**
  42043. * @member {ClipParameter} InterpolationAnalystParameters.prototype.clipParam
  42044. * @description 对插值分析结果进行裁剪的参数。
  42045. */
  42046. this.clipParam = null;
  42047. Util_Util.extend(this, options);
  42048. this.CLASS_NAME = "SuperMap.InterpolationAnalystParameters";
  42049. }
  42050. /**
  42051. * @function InterpolationAnalystParameters.prototype.destroy
  42052. * @description 释放资源,将引用资源的属性置空。
  42053. */
  42054. destroy() {
  42055. var me = this;
  42056. me.bounds = null;
  42057. me.searchRadius = null;
  42058. me.zValueFieldName = null;
  42059. me.zValueScale = null;
  42060. me.resolution = null;
  42061. me.filterQueryParameter = null;
  42062. me.outputDatasetName = null;
  42063. me.pixelFormat = null;
  42064. }
  42065. /**
  42066. * @function InterpolationAnalystParameters.toObject
  42067. * @param {InterpolationAnalystParameters} interpolationAnalystParameters - 插值分析参数类。
  42068. * @param {InterpolationAnalystParameters} tempObj - 插值分析参数对象。
  42069. * @description 将插值分析参数对象转换成 JSON 对象。
  42070. * @returns JSON 对象。
  42071. */
  42072. static toObject(interpolationAnalystParameters, tempObj) {
  42073. for (var name in interpolationAnalystParameters) {
  42074. if (name === "inputPoints" && interpolationAnalystParameters.InterpolationAnalystType === "geometry") {
  42075. var objs = [];
  42076. for (var i = 0; i < interpolationAnalystParameters.inputPoints.length; i++) {
  42077. var item = interpolationAnalystParameters.inputPoints[i];
  42078. var obj = {
  42079. x: item.x,
  42080. y: item.y,
  42081. z: item.tag
  42082. };
  42083. objs.push(obj);
  42084. }
  42085. tempObj[name] = objs;
  42086. } else {
  42087. tempObj[name] = interpolationAnalystParameters[name];
  42088. }
  42089. }
  42090. }
  42091. }
  42092. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationRBFAnalystParameters.js
  42093. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42094. * This program are made available under the terms of the Apache License, Version 2.0
  42095. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42096. /**
  42097. * @class InterpolationRBFAnalystParameters
  42098. * @deprecatedclass SuperMap.InterpolationRBFAnalystParameters
  42099. * @category iServer SpatialAnalyst InterpolationAnalyst
  42100. * @classdesc 样条插值(径向基函数插值法)分析参数类。
  42101. * @extends {InterpolationAnalystParameters}
  42102. * @param {Object} options - 参数。
  42103. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  42104. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  42105. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  42106. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  42107. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  42108. * @param {number} [options.smooth=0.1] - 光滑系数,该值表示插值函数曲线与点的逼近程度,值域为0到1。
  42109. * @param {number} [options.tension=40] - 张力系数,用于调整结果栅格数据表面的特性。
  42110. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置参与插值运算的点数。
  42111. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  42112. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  42113. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  42114. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  42115. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  42116. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  42117. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  42118. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(InterpolationAnalystType)为 dataset 时。此为必选参数。
  42119. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。此为必选参数。
  42120. * @example
  42121. * var myInterpolationRBFAnalystParameters = new InterpolationRBFAnalystParameters({
  42122. * dataset:"SamplesP@Interpolation",
  42123. * smooth: 0.1,
  42124. * tension: 40,
  42125. * searchMode: "QUADTREE",
  42126. * maxPointCountForInterpolation: 20,
  42127. * maxPointCountInNode: 5,
  42128. * pixelFormat: "BIT16",
  42129. * zValueFieldName: "AVG_TMP",
  42130. * resolution: 3000,
  42131. * filterQueryParameter: {
  42132. * attributeFilter: ""
  42133. * },
  42134. * outputDatasetName: "myRBF"
  42135. * });
  42136. * @usage
  42137. */
  42138. class InterpolationRBFAnalystParameters extends InterpolationAnalystParameters {
  42139. constructor(options) {
  42140. super(options);
  42141. /**
  42142. * @member {number} [InterpolationRBFAnalystParameters.prototype.smooth=0.1]
  42143. * @description 光滑系数,值域为 0 到 1,常用取值如 0、0.001、0.01、0.1、和 0.5。
  42144. * 该值表示插值函数曲线与点的逼近程度,此数值越大,函数曲线与点的偏差越大,反之越小。
  42145. */
  42146. this.smooth = 0.1;
  42147. /**
  42148. * @member {number} [InterpolationRBFAnalystParameters.prototype.tension=40]
  42149. * @description 张力系数,常用取值如 0、1、5 和 10。
  42150. * 用于调整结果栅格数据表面的特性,张力越大,插值时每个点对计算结果影响越小,反之越大。
  42151. */
  42152. this.tension = 40;
  42153. /**
  42154. * @member {SearchMode} InterpolationRBFAnalystParameters.prototype.searchMode
  42155. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  42156. * 具体如下:
  42157. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  42158. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  42159. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  42160. */
  42161. this.searchMode = null;
  42162. /**
  42163. * @member {number} [InterpolationRBFAnalystParameters.prototype.expectedCount=12]
  42164. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  42165. */
  42166. this.expectedCount = 12;
  42167. /**
  42168. * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountForInterpolation=200]
  42169. * @description 【块查找】方式下,最多参与插值的点数。
  42170. */
  42171. this.maxPointCountForInterpolation = 200;
  42172. /**
  42173. * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountInNode=50]
  42174. * @description 【块查找】方式下,单个块内最多参与运算点数。
  42175. */
  42176. this.maxPointCountInNode = 50;
  42177. if (options) {
  42178. Util_Util.extend(this, options);
  42179. }
  42180. this.CLASS_NAME = "SuperMap.InterpolationRBFAnalystParameters";
  42181. }
  42182. /**
  42183. * @function InterpolationRBFAnalystParameters.prototype.destroy
  42184. * @description 释放资源,将引用资源的属性置空。
  42185. */
  42186. destroy() {
  42187. super.destroy();
  42188. var me = this;
  42189. me.smooth = null;
  42190. me.tension = null;
  42191. me.searchMode = null;
  42192. me.expectedCount = null;
  42193. me.maxPointCountForInterpolation = null;
  42194. me.maxPointCountInNode = null;
  42195. }
  42196. /**
  42197. * @function InterpolationRBFAnalystParameters.toObject
  42198. * @param {InterpolationRBFAnalystParameters} datasetInterpolationRBFAnalystParameters - 样条插值(径向基函数插值法)分析参数类。
  42199. * @param {InterpolationRBFAnalystParameters} tempObj - 样条插值(径向基函数插值法)分析参数对象。
  42200. * @description 将样条插值(径向基函数插值法)分析参数对象转换为 JSON 对象。
  42201. * @returns JSON 对象。
  42202. */
  42203. static toObject(datasetInterpolationRBFAnalystParameters, tempObj) {
  42204. for (var name in datasetInterpolationRBFAnalystParameters) {
  42205. tempObj[name] = datasetInterpolationRBFAnalystParameters[name];
  42206. }
  42207. }
  42208. }
  42209. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationDensityAnalystParameters.js
  42210. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42211. * This program are made available under the terms of the Apache License, Version 2.0
  42212. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42213. /**
  42214. * @class InterpolationDensityAnalystParameters
  42215. * @deprecatedclass SuperMap.InterpolationDensityAnalystParameters
  42216. * @category iServer SpatialAnalyst InterpolationAnalyst
  42217. * @classdesc 点密度插值分析参数类。
  42218. * @param {Object} options - 参数。
  42219. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  42220. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  42221. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  42222. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  42223. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。此为必选参数。
  42224. * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
  42225. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  42226. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  42227. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  42228. * @param {string} [options.dataset] - 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
  42229. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时,此为必选参数。
  42230. * @extends {InterpolationAnalystParameters}
  42231. * @example
  42232. * var myInterpolationDensityAnalystParameters = new InterpolationDensityAnalystParameters({
  42233. * dataset: "SamplesP@Interpolation",
  42234. * searchRadius: "100000",
  42235. * pixelFormat: "BIT16",
  42236. * zValueFieldName: "AVG_TMP",
  42237. * resolution: 3000,
  42238. * filterQueryParameter: {
  42239. * attributeFilter: ""
  42240. * },
  42241. * outputDatasetName: "myDensity"
  42242. * });
  42243. * @usage
  42244. */
  42245. class InterpolationDensityAnalystParameters extends InterpolationAnalystParameters {
  42246. constructor(options) {
  42247. super(options);
  42248. if (options) {
  42249. Util_Util.extend(this, options);
  42250. }
  42251. this.CLASS_NAME = "SuperMap.InterpolationDensityAnalystParameters";
  42252. }
  42253. /**
  42254. * @function InterpolationDensityAnalystParameters.prototype.destroy
  42255. * @description 释放资源,将引用资源的属性置空。
  42256. */
  42257. destroy() {
  42258. super.destroy();
  42259. }
  42260. }
  42261. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationIDWAnalystParameters.js
  42262. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42263. * This program are made available under the terms of the Apache License, Version 2.0
  42264. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42265. /**
  42266. * @class InterpolationIDWAnalystParameters
  42267. * @deprecatedclass SuperMap.InterpolationIDWAnalystParameters
  42268. * @category iServer SpatialAnalyst InterpolationAnalyst
  42269. * @classdesc 反距离加权插值(IDW)分析参数类。
  42270. * @param {Object} options - 参数。
  42271. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  42272. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  42273. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  42274. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  42275. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  42276. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  42277. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置查找半径,即参与运算点的查找范围,与点数据集单位相同。
  42278. * @param {number} [options.power=2] - 距离权重计算的幂次。
  42279. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  42280. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  42281. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  42282. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  42283. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  42284. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,此为必选参数。
  42285. * @extends {InterpolationAnalystParameters}
  42286. * @example 例如:
  42287. * var myInterpolationIDWAnalystParameters = new InterpolationIDWAnalystParameters({
  42288. * dataset:"SamplesP@Interpolation",
  42289. * power: 2,
  42290. * searchMode: "KDTREE_FIXED_COUNT",
  42291. * expectedCount: 12,
  42292. * pixelFormat: "BIT16",
  42293. * zValueFieldName: "AVG_TMP",
  42294. * resolution: 3000,
  42295. * filterQueryParameter: {
  42296. * attributeFilter: ""
  42297. * },
  42298. * outputDatasetName: "myIDW"
  42299. * });
  42300. * @usage
  42301. */
  42302. class InterpolationIDWAnalystParameters extends InterpolationAnalystParameters {
  42303. constructor(options) {
  42304. super(options);
  42305. /**
  42306. * @member {number} [InterpolationIDWAnalystParameters.prototype.power=2]
  42307. * @description 距离权重计算的幂次。
  42308. * 该值决定了权值下降的速度,幂次越大,随距离的增大权值下降越快,距离预测点越远的点的权值也越小。
  42309. * 理论上,参数值必须大于0,但是0.5到3之间时运算结果更合理,因此推荐值为0.5~3。
  42310. */
  42311. this.power = 2;
  42312. /**
  42313. * @member {SearchMode} InterpolationIDWAnalystParameters.prototype.searchMode
  42314. * @description 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  42315. * 具体如下:
  42316. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  42317. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  42318. */
  42319. this.searchMode = null;
  42320. /**
  42321. * @member {number} [InterpolationIDWAnalystParameters.prototype.expectedCount=12]
  42322. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  42323. */
  42324. this.expectedCount = 12;
  42325. if (options) {
  42326. Util_Util.extend(this, options);
  42327. }
  42328. this.CLASS_NAME = "SuperMap.InterpolationIDWAnalystParameters";
  42329. }
  42330. /**
  42331. * @function InterpolationIDWAnalystParameters.prototype.destroy
  42332. * @description 释放资源,将引用资源的属性置空。
  42333. */
  42334. destroy() {
  42335. super.destroy();
  42336. var me = this;
  42337. me.power = null;
  42338. me.searchMode = null;
  42339. me.expectedCount = null;
  42340. }
  42341. }
  42342. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationKrigingAnalystParameters.js
  42343. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42344. * This program are made available under the terms of the Apache License, Version 2.0
  42345. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42346. /**
  42347. * @class InterpolationKrigingAnalystParameters
  42348. * @deprecatedclass SuperMap.InterpolationKrigingAnalystParameters
  42349. * @category iServer SpatialAnalyst InterpolationAnalyst
  42350. * @classdesc 克吕金插值分析参数类。通过该类可以设置克吕金插值分析所需的参数。
  42351. * 克吕金(Kriging)法为地统计学上一种空间数据内插处理方法,主要的目的是利用各数据点间变异数(variance)的大小来推求某一未知点与各已知点的权重关系,
  42352. * 再由各数据点的值和其与未知点的权重关系推求未知点的值。Kriging 法最大的特色不仅是提供一个最小估计误差的预测值,并且可明确地指出误差值的大小。
  42353. * 一般而言,许多地质参数,如地形面,本身即具有连续性,故在一段距离内的任两点必有空间上的关系。反之,在一不规则面上的两点若相距甚远,
  42354. * 则在统计意义上可视为互为独立 (stastically indepedent)。这种随距离而改变的空间上连续性,可用半变异图 (semivariogram) 来表现。
  42355. * 因此,若想由已知的散乱点来推求某一未知点的值,则可利用半变异图推求各已知点与未知点的空间关系,即以下四个参数:<br>
  42356. * 1.块金值(nugget):当采样点间距为0时,理论上半变异函数值为0,但时间上两采样点非常接近时半变异函数值并不为0,即产生了块金效应,
  42357. * 对应的半变异函数值为块金值。块金值可能由于测量误差或者空间变异产生。<br>
  42358. * 2.基台值(sill):随着采样点间距的不断增大,半变异函数的值趋向一个稳定的常数,该常数成为基台值。到达基台值后,半变异函数的值不再随采样点间距而改变,
  42359. * 即大于此间距的采样点不再具有空间相关性。<br>
  42360. * 3.偏基台值:基台值与块金值的差值。<br>
  42361. * 4.自相关阈值(range):也称变程,是半变异函数值达到基台值时,采样点的间距。超过自相关阈值的采样点不再具有空间相关性,将不对预测结果产生影响。<br>
  42362. * 然后,由此空间参数推求半变异数,由各数据点间的半变异数可推求未知点与已知点间的权重关系,进而推求出未知点的值。
  42363. * 克吕金法的优点是以空间统计学作为其坚实的理论基础,物理含义明确;不但能估计测定参数的空间变异分布,而且还可以估算参数的方差分布。克吕金法的缺点是计算步骤较烦琐,
  42364. * 计算量大,且变异函数有时需要根据经验人为选定。
  42365. *
  42366. * 由上述可知,半变异函数是克吕金插值的关键,因此选择合适的半变异函数模型非常重要,SuperMap 提供了以下三种半变异函数模型:<br>
  42367. * 1.指数型(EXPONENTIAL):适用于空间相关关系随样本间距的增加呈指数递减的情况,其空间自相关关系在样本间距的无穷远处完全消失。<br>
  42368. * 2.球型(SPHERICAL):适用于空间自相关关系随样本间距的增加而逐渐减少,直到超出一定的距离时空间自相关关系消失的情况。<br>
  42369. * 3.高斯型(GAUSSIAN):适用于半变异函数值渐进地逼近基台值的情况。<br>
  42370. *
  42371. * 半变异函数中,有一个关键参数即插值的字段值的期望(平均值),由于对于此参数的不同处理方法而衍生出了不同的 Kriging 方法。SuperMap的插值功能基于以下三种常用 Kriging 算法:<br>
  42372. * 1.简单克吕金(Simple Kriging):该方法假定用于插值的字段值的期望(平均值)为已知的某一常数。<br>
  42373. * 2.普通克吕金(Kriging):该方法假定用于插值的字段值的期望(平均值)未知且恒定。它利用一定的数学函数,通过对给定的空间点进行拟合来估算单元格的值,
  42374. * 生成格网数据集。它不仅可以生成一个表面,还可以给出预测结果的精度或者确定性的度量。因此,此方法计算精度较高,常用于地学领域。<br>
  42375. * 3.泛克吕金(Universal Kriging):该方法假定用于插值的字段值的期望(平均值)是未知的变量。在样点数据中存在某种主导趋势且该趋势可以通过某一个确定
  42376. * 的函数或者多项式进行拟合的情况下,适用泛克吕金插值法。<br>
  42377. * @param {Object} options - 参数。
  42378. * @param {string} options.type - 克吕金插值的类型。
  42379. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  42380. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  42381. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  42382. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  42383. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
  42384. * @param {number} [options.mean] - 【简单克吕金】类型下,插值字段的平均值。
  42385. * @param {number} [options.angle=0] - 克吕金算法中旋转角度值。
  42386. * @param {number} [options.nugget=0] - 克吕金算法中块金效应值。
  42387. * @param {number} [options.range=0] - 克吕金算法中自相关阈值,单位与原数据集单位相同。
  42388. * @param {number} [options.sill=0] - 克吕金算法中基台值。
  42389. * @param {string} [options.variogramMode="SPHERICAL"] - 克吕金插值时的半变函数类型。
  42390. * @param {string} [options.exponent='exp1'] - 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数,可选值为 exp1、exp2。
  42391. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数;【定长查找】方式下,设置查找的最小点数。
  42392. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  42393. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  42394. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  42395. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  42396. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  42397. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  42398. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  42399. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如 ”数据集名称@数据源别名” 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。
  42400. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时。
  42401. * @extends {InterpolationAnalystParameters}
  42402. * @example 例如:
  42403. * var myInterpolationKrigingAnalystParameters = new InterpolationKrigingAnalystParameters({
  42404. * dataset:"SamplesP@Interpolation",
  42405. * type: "KRIGING",
  42406. * angle: 0,
  42407. * mean: 5,
  42408. * nugget: 30,
  42409. * range: 50,
  42410. * sill: 300,
  42411. * variogramMode: "EXPONENTIAL",
  42412. * searchMode: "QUADTREE",
  42413. * maxPointCountForInterpolation: 20,
  42414. * maxPointCountInNode: 5,
  42415. * pixelFormat: "BIT16",
  42416. * zValueFieldName: "AVG_TMP",
  42417. * resolution: 30000,
  42418. * filterQueryParameter: {
  42419. * attributeFilter: ""
  42420. * },
  42421. * outputDatasetName: "myKriging"
  42422. * });
  42423. * @usage
  42424. */
  42425. class InterpolationKrigingAnalystParameters extends InterpolationAnalystParameters {
  42426. constructor(options) {
  42427. super(options);
  42428. /**
  42429. * @member {InterpolationAlgorithmType} InterpolationKrigingAnalystParameters.prototype.type
  42430. * @description 克吕金插值的类型。
  42431. * 具体如下:<br>
  42432. * {KRIGING} 普通克吕金插值法。
  42433. * {SimpleKriging} 简单克吕金插值法。
  42434. * {UniversalKriging} 泛克吕金插值法。
  42435. */
  42436. this.type = null;
  42437. /**
  42438. * @member {number} InterpolationKrigingAnalystParameters.prototype.mean
  42439. * @description 【简单克吕金】方式下,插值字段的平均值。
  42440. * 即采样点插值字段值总和除以采样点数目。
  42441. */
  42442. this.mean = null;
  42443. /**
  42444. * @member {number} [InterpolationKrigingAnalystParameters.prototype.angle=0]
  42445. * @description 克吕金算法中旋转角度值。
  42446. * 此角度值指示了每个查找邻域相对于水平方向逆时针旋转的角度。
  42447. */
  42448. this.angle = 0;
  42449. /**
  42450. * @member {number} [InterpolationKrigingAnalystParameters.prototype.nugget=0]
  42451. * @description 克吕金算法中块金效应值。
  42452. */
  42453. this.nugget = 0;
  42454. /**
  42455. * @member {number} [InterpolationKrigingAnalystParameters.prototype.range=0]
  42456. * @description 克吕金算法中自相关阈值,单位与原数据集单位相同。
  42457. */
  42458. this.range = 0;
  42459. /**
  42460. * @member {number} [InterpolationKrigingAnalystParameters.prototype.sill=0]
  42461. * @description 克吕金算法中基台值。
  42462. */
  42463. this.sill = 0;
  42464. /**
  42465. * @member {VariogramMode} [InterpolationKrigingAnalystParameters.prototype.variogramMode=VariogramMode.SPHERICAL]
  42466. * @description 克吕金插值时的半变函数类型。
  42467. * 用户所选择的半变函数类型会影响未知点的预测,特别是曲线在原点处的不同形状有重要意义。
  42468. * 曲线在原点处越陡,则较近领域对该预测值的影响就越大,因此输出表面就会越不光滑。
  42469. */
  42470. this.variogramMode = VariogramMode.SPHERICAL;
  42471. /**
  42472. * @member {Exponent} [InterpolationKrigingAnalystParameters.prototype.exponent=Exponent.EXP1]
  42473. * @description 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数。
  42474. */
  42475. this.exponent = Exponent.EXP1;
  42476. /**
  42477. * @member {SearchMode} InterpolationKrigingAnalystParameters.prototype.searchMode
  42478. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。此为必选参数。
  42479. * 简单克吕金和泛克吕金不支持块查找。
  42480. * 具体如下:<br>
  42481. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。<br>
  42482. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。<br>
  42483. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  42484. */
  42485. this.searchMode = null;
  42486. /**
  42487. * @member {number} [InterpolationKrigingAnalystParameters.prototype.expectedCount=12]
  42488. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数,默认值为12。
  42489. * 【定长查找】方式下,设置查找的最小点数,默认值为12。
  42490. */
  42491. this.expectedCount = 12;
  42492. /**
  42493. * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=200]
  42494. * @description 【块查找】方式下,最多参与插值的点数。
  42495. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  42496. */
  42497. this.maxPointCountForInterpolation = 200;
  42498. /**
  42499. * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountInNode=50]
  42500. * @description 【块查找】方式下,设置单个块内最多参与运算点数。
  42501. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  42502. */
  42503. this.maxPointCountInNode = 50;
  42504. if (options) {
  42505. Util_Util.extend(this, options);
  42506. }
  42507. this.CLASS_NAME = "SuperMap.InterpolationKrigingAnalystParameters";
  42508. }
  42509. /**
  42510. * @function InterpolationKrigingAnalystParameters.prototype.destroy
  42511. * @description 释放资源,将引用资源的属性置空。
  42512. */
  42513. destroy() {
  42514. super.destroy();
  42515. var me = this;
  42516. me.type = null;
  42517. me.mean = null;
  42518. me.angle = null;
  42519. me.nugget = null;
  42520. me.range = null;
  42521. me.sill = null;
  42522. me.variogramMode = null;
  42523. me.exponent = null;
  42524. me.searchMode = null;
  42525. me.expectedCount = null;
  42526. me.maxPointCountForInterpolation = null;
  42527. me.maxPointCountInNode = null;
  42528. }
  42529. }
  42530. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystService.js
  42531. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42532. * This program are made available under the terms of the Apache License, Version 2.0
  42533. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42534. /**
  42535. * @class InterpolationAnalystService
  42536. * @deprecatedclass SuperMap.InterpolationAnalystService
  42537. * @category iServer SpatialAnalyst InterpolationAnalyst
  42538. * @classdesc 插值分析服务类。
  42539. * 插值分析可以将有限的采样点数据,通过插值算法对采样点周围的数值情况进行预测,可以掌握研究区域内数据的总体分布状况,从而使采样的离散点不仅仅反映其所在位置的数值情况,
  42540. * 还可以反映区域的数值分布。目前SuperMap iServer的插值功能提供从点数据集插值得到栅格数据集的功能,支持以下常用的内插方法,
  42541. * 包括:反距离加权插值、克吕金(Kriging)插值法、样条(径向基函数,Radial Basis Function)插值、点密度插值。
  42542. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  42543. * @param {Object} options - 参数。
  42544. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  42545. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  42546. * @param {Object} [options.headers] - 请求头。
  42547. * @extends {SpatialAnalystBase}
  42548. * @example 例如:
  42549. * (start code)
  42550. * var myTInterpolationAnalystService = new InterpolationAnalystService(url);
  42551. * myTInterpolationAnalystService.events.on({
  42552. * "processCompleted": processCompleted,
  42553. * "processFailed": processFailed
  42554. * }
  42555. * );
  42556. * (end)
  42557. * @usage
  42558. */
  42559. class InterpolationAnalystService extends SpatialAnalystBase {
  42560. constructor(url, options) {
  42561. super(url, options);
  42562. /**
  42563. * @member {string} InterpolationAnalystService.prototype.mode
  42564. * @description 插值分析类型。
  42565. */
  42566. this.mode = null;
  42567. if (options) {
  42568. Util_Util.extend(this, options);
  42569. }
  42570. }
  42571. /**
  42572. * @function InterpolationAnalystService.prototype.destroy
  42573. * @description 释放资源,将引用资源的属性置空。
  42574. */
  42575. destroy() {
  42576. super.destroy();
  42577. this.mode = null;
  42578. this.CLASS_NAME = "SuperMap.InterpolationAnalystService";
  42579. }
  42580. /**
  42581. * @function InterpolationAnalystService.prototype.processAsync
  42582. * @description 负责将客户端的查询参数传递到服务端。
  42583. * @param {InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationRBFAnalystParameters|InterpolationKrigingAnalystParameters} parameter - 插值分析参数类。
  42584. */
  42585. processAsync(parameter) {
  42586. var parameterObject = {};
  42587. var me = this;
  42588. if (parameter instanceof InterpolationDensityAnalystParameters) {
  42589. me.mode = 'Density';
  42590. if (parameter.InterpolationAnalystType === 'geometry') {
  42591. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/density');
  42592. } else {
  42593. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/density');
  42594. }
  42595. } else if (parameter instanceof InterpolationIDWAnalystParameters) {
  42596. me.mode = 'IDW';
  42597. if (parameter.InterpolationAnalystType === 'geometry') {
  42598. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/idw');
  42599. } else {
  42600. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/idw');
  42601. }
  42602. } else if (parameter instanceof InterpolationRBFAnalystParameters) {
  42603. me.mode = 'RBF';
  42604. if (parameter.InterpolationAnalystType === 'geometry') {
  42605. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/rbf');
  42606. } else {
  42607. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/rbf');
  42608. }
  42609. } else if (parameter instanceof InterpolationKrigingAnalystParameters) {
  42610. me.mode = 'Kriging';
  42611. if (parameter.InterpolationAnalystType === 'geometry') {
  42612. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/kriging');
  42613. } else {
  42614. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/kriging');
  42615. }
  42616. }
  42617. InterpolationAnalystParameters.toObject(parameter, parameterObject);
  42618. var jsonParameters = Util_Util.toJSON(parameterObject);
  42619. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  42620. me.request({
  42621. method: "POST",
  42622. data: jsonParameters,
  42623. scope: me,
  42624. success: me.serviceProcessCompleted,
  42625. failure: me.serviceProcessFailed
  42626. });
  42627. }
  42628. }
  42629. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  42630. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42631. * This program are made available under the terms of the Apache License, Version 2.0
  42632. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42633. /**
  42634. * @class KernelDensityJobParameter
  42635. * @deprecatedclass SuperMap.KernelDensityJobParameter
  42636. * @category iServer ProcessingService DensityAnalyst
  42637. * @classdesc 核密度分析服务参数类。
  42638. * @param {Object} options - 参数。
  42639. * @param {string} options.datasetName - 数据集名。
  42640. * @param {string} options.fields - 权重索引。
  42641. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  42642. * @param {number} [options.resolution=80] - 分辨率。
  42643. * @param {number} [options.method=0] - 分析方法。
  42644. * @param {number} [options.meshType=0] - 分析类型。
  42645. * @param {number} [options.radius=300] - 分析的影响半径。
  42646. * @param {AnalystSizeUnit} [options.meshSizeUnit=AnalystSizeUnit.METER] - 网格大小单位。
  42647. * @param {AnalystSizeUnit} [options.radiusUnit=AnalystSizeUnit.METER] - 搜索半径单位。
  42648. * @param {AnalystAreaUnit} [options.areaUnit=AnalystAreaUnit.SQUAREMILE] - 面积单位。
  42649. * @param {OutputSetting} [options.output] - 输出参数设置。
  42650. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  42651. * @usage
  42652. */
  42653. class KernelDensityJobParameter {
  42654. constructor(options) {
  42655. if (!options) {
  42656. return;
  42657. }
  42658. /**
  42659. * @member {string} KernelDensityJobParameter.prototype.datasetName
  42660. * @description 数据集名。
  42661. */
  42662. this.datasetName = "";
  42663. /**
  42664. * @member {SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject} [KernelDensityJobParameter.prototype.query]
  42665. * @description 分析范围。
  42666. */
  42667. this.query = "";
  42668. /**
  42669. * @member {number} [KernelDensityJobParameter.prototype.resolution=80]
  42670. * @description 网格大小。
  42671. */
  42672. this.resolution = 80;
  42673. /**
  42674. * @member {number} [KernelDensityJobParameter.prototype.method=0]
  42675. * @description 分析方法。
  42676. */
  42677. this.method = 0;
  42678. /**
  42679. * @member {number} [KernelDensityJobParameter.prototype.meshType=0]
  42680. * @description 分析类型。
  42681. */
  42682. this.meshType = 0;
  42683. /**
  42684. * @member {string} KernelDensityJobParameter.prototype.fields
  42685. * @description 权重索引。
  42686. */
  42687. this.fields = "";
  42688. /**
  42689. * @member {number} [KernelDensityJobParameter.prototype.radius=300]
  42690. * @description 分析的影响半径。
  42691. */
  42692. this.radius = 300;
  42693. /**
  42694. * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
  42695. * @description 网格大小单位。
  42696. */
  42697. this.meshSizeUnit = AnalystSizeUnit.METER;
  42698. /**
  42699. * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.radiusUnit=AnalystSizeUnit.METER]
  42700. * @description 搜索半径单位。
  42701. */
  42702. this.radiusUnit = AnalystSizeUnit.METER;
  42703. /**
  42704. * @member {AnalystAreaUnit} [KernelDensityJobParameter.prototype.areaUnit=AnalystAreaUnit.SQUAREMILE]
  42705. * @description 面积单位。
  42706. */
  42707. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  42708. /**
  42709. * @member {OutputSetting} KernelDensityJobParameter.prototype.output
  42710. * @description 输出参数设置类。
  42711. */
  42712. this.output = null;
  42713. /**
  42714. * @member {MappingParameters} [KernelDensityJobParameter.prototype.mappingParameters]
  42715. * @description 分析后结果可视化的参数类。
  42716. */
  42717. this.mappingParameters = null;
  42718. Util_Util.extend(this, options);
  42719. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  42720. }
  42721. /**
  42722. * @function KernelDensityJobParameter.prototype.destroy
  42723. * @description 释放资源,将引用资源的属性置空。
  42724. */
  42725. destroy() {
  42726. this.datasetName = null;
  42727. this.query = null;
  42728. this.resolution = null;
  42729. this.method = null;
  42730. this.radius = null;
  42731. this.meshType = null;
  42732. this.fields = null;
  42733. this.meshSizeUnit = null;
  42734. this.radiusUnit = null;
  42735. this.areaUnit = null;
  42736. if (this.output instanceof OutputSetting) {
  42737. this.output.destroy();
  42738. this.output = null;
  42739. }
  42740. if (this.mappingParameters instanceof MappingParameters) {
  42741. this.mappingParameters.destroy();
  42742. this.mappingParameters = null;
  42743. }
  42744. }
  42745. /**
  42746. * @function KernelDensityJobParameter.toObject
  42747. * @param {KernelDensityJobParameter} kernelDensityJobParameter - 核密度分析服务参数类。
  42748. * @param {KernelDensityJobParameter} tempObj - 核密度分析服务参数对象。
  42749. * @description 将核密度分析服务参数对象转换为 JSON 对象。
  42750. * @returns JSON 对象。
  42751. */
  42752. static toObject(kernelDensityJobParameter, tempObj) {
  42753. for (var name in kernelDensityJobParameter) {
  42754. if (name === "datasetName") {
  42755. tempObj['input'] = tempObj['input'] || {};
  42756. tempObj['input'][name] = kernelDensityJobParameter[name];
  42757. continue;
  42758. }
  42759. if (name === "output") {
  42760. tempObj['output'] = tempObj['output'] || {};
  42761. tempObj['output'] = kernelDensityJobParameter[name];
  42762. continue;
  42763. }
  42764. tempObj['analyst'] = tempObj['analyst'] || {};
  42765. if (name === 'query' && kernelDensityJobParameter[name]) {
  42766. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  42767. } else {
  42768. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  42769. }
  42770. if (name === 'mappingParameters') {
  42771. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  42772. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  42773. }
  42774. }
  42775. }
  42776. }
  42777. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  42778. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42779. * This program are made available under the terms of the Apache License, Version 2.0
  42780. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42781. /**
  42782. * @class KernelDensityJobsService
  42783. * @deprecatedclass SuperMap.KernelDensityJobsService
  42784. * @category iServer ProcessingService DensityAnalyst
  42785. * @classdesc 核密度分析服务类
  42786. * @extends {ProcessingServiceBase}
  42787. * @param {string} url - 服务地址。
  42788. * @param {Object} options - 可选参数。
  42789. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  42790. * @param {Object} [options.headers] - 请求头。
  42791. * @usage
  42792. */
  42793. class KernelDensityJobsService extends ProcessingServiceBase {
  42794. constructor(url, options) {
  42795. super(url, options);
  42796. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/density');
  42797. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  42798. }
  42799. /**
  42800. * @function KernelDensityJobsService.prototype.destroy
  42801. * @override
  42802. */
  42803. destroy() {
  42804. super.destroy();
  42805. }
  42806. /**
  42807. * @function KernelDensityJobsService.prototype.getKernelDensityJobs
  42808. * @description 获取核密度分析任务
  42809. */
  42810. getKernelDensityJobs() {
  42811. super.getJobs(this.url);
  42812. }
  42813. /**
  42814. * @function KernelDensityJobsService.prototype.getKernelDensityJobs
  42815. * @description 获取指定id的核密度分析服务
  42816. * @param {string} id - 指定要获取数据的id
  42817. */
  42818. getKernelDensityJob(id) {
  42819. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  42820. }
  42821. /**
  42822. * @function KernelDensityJobsService.prototype.addKernelDensityJob
  42823. * @description 新建核密度分析服务
  42824. * @param {KernelDensityJobParameter} params - 核密度分析服务参数类。
  42825. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  42826. */
  42827. addKernelDensityJob(params, seconds) {
  42828. super.addJob(this.url, params, KernelDensityJobParameter, seconds);
  42829. }
  42830. }
  42831. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMatrixCell.js
  42832. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42833. * This program are made available under the terms of the Apache License, Version 2.0
  42834. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42835. /**
  42836. * @class LabelMatrixCell
  42837. * @deprecatedclass SuperMap.LabelMatrixCell
  42838. * @category iServer Map Theme
  42839. * @classdesc 矩阵标签元素抽象类。该类可以包含 n*n 个矩阵标签元素,矩阵标签元素的类型可以是图片,符号,标签专题图等。
  42840. * 符号类型的矩阵标签元素类、图片类型的矩阵标签元素类和专题图类型的矩阵标签元素类均继承自该类。
  42841. * @usage
  42842. */
  42843. class LabelMatrixCell {
  42844. constructor() {
  42845. this.CLASS_NAME = "LabelMatrixCell";
  42846. }
  42847. }
  42848. ;// CONCATENATED MODULE: ./src/common/iServer/LabelImageCell.js
  42849. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42850. * This program are made available under the terms of the Apache License, Version 2.0
  42851. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42852. /**
  42853. * @class LabelImageCell
  42854. * @deprecatedclass SuperMap.LabelImageCell
  42855. * @category iServer Map Theme
  42856. * @classdesc 图片类型的矩阵标签元素类。该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  42857. * 矩阵标签专题图是标签专题图(ThemeLabel)的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  42858. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  42859. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  42860. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 是一个二维数组,
  42861. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  42862. * @extends {LabelMatrixCell}
  42863. * @param {Object} options - 可选参数。
  42864. * @param {number} [options.height=0] - 设置图片的高度,单位为毫米。
  42865. * @param {string} [options.pathField] - 设置矩阵标签元素所使用图片的路径。
  42866. * @param {number} [options.rotation=0.0] - 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  42867. * @param {number} [options.width=0] - 设置图片的宽度,单位为毫米。
  42868. * @param {boolean} [options.sizeFixed=false] - 是否固定图片的大小。
  42869. * @usage
  42870. */
  42871. class LabelImageCell extends LabelMatrixCell {
  42872. constructor(options) {
  42873. super(options);
  42874. /**
  42875. * @member {number} LabelImageCell.prototype.height
  42876. * @description 设置图片的高度,单位为毫米。
  42877. */
  42878. this.height = 0;
  42879. /**
  42880. * @member {string} LabelImageCell.prototype.pathField
  42881. * @description 设置矩阵标签元素所使用的图片路径对应的字段名。
  42882. */
  42883. this.pathField = null;
  42884. /**
  42885. * @member {number} [LabelImageCell.prototype.rotation=0.0]
  42886. * @description 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  42887. */
  42888. this.rotation = 0.0;
  42889. /**
  42890. * @member {number} LabelImageCell.prototype.width
  42891. * @description 设置图片的宽度,单位为毫米。
  42892. */
  42893. this.width = 0;
  42894. /**
  42895. * @member {boolean} [LabelImageCell.prototype.sizeFixed=false]
  42896. * @description 是否固定图片的大小。
  42897. */
  42898. this.sizeFixed = false;
  42899. /**
  42900. * @member {string} LabelImageCell.prototype.type
  42901. * @description 制作矩阵专题图时是必须的。
  42902. */
  42903. this.type = "IMAGE";
  42904. if (options) {
  42905. Util_Util.extend(this, options);
  42906. }
  42907. this.CLASS_NAME = "SuperMap.LabelImageCell";
  42908. }
  42909. /**
  42910. * @function LabelImageCell.prototype.destroy
  42911. * @description 释放资源,将引用资源的属性置空。
  42912. */
  42913. destroy() {
  42914. var me = this;
  42915. me.height = null;
  42916. me.pathField = null;
  42917. me.rotation = null;
  42918. me.width = null;
  42919. me.sizeFixed = null;
  42920. }
  42921. }
  42922. ;// CONCATENATED MODULE: ./src/common/iServer/LabelSymbolCell.js
  42923. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42924. * This program are made available under the terms of the Apache License, Version 2.0
  42925. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42926. /**
  42927. * @class LabelSymbolCell
  42928. * @deprecatedclass SuperMap.LabelSymbolCell
  42929. * @category iServer Map Theme
  42930. * @classdesc 符号类型的矩阵标签元素类。
  42931. * 该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  42932. * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  42933. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  42934. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  42935. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属性是一个二维数组,
  42936. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  42937. * @extends {LabelMatrixCell}
  42938. * @param {Object} options - 参数。
  42939. * @param {ServerStyle} options.style - 获取或设置符号样式。
  42940. * @param {string} options.symbolIDField - 符号 ID 或符号 ID 所对应的字段名称。
  42941. * @usage
  42942. */
  42943. class LabelSymbolCell extends LabelMatrixCell {
  42944. constructor(options) {
  42945. super(options);
  42946. /**
  42947. * @member {ServerStyle} LabelSymbolCell.prototype.style
  42948. * @description 获取或设置符号样式—— {@link ServerStyle} 对象,包括符号大小({@link ServerStyle#markerSize})
  42949. * 和符号旋转({@link ServerStyle#markerAngle})角度,其中用于设置符号 ID 的属性({@link ServerStyle#markerSymbolID})在此处不起作用。
  42950. */
  42951. this.style = new ServerStyle();
  42952. /**
  42953. * @member {string} LabelSymbolCell.prototype.symbolIDField
  42954. * @description 获取或设置符号 ID 或符号 ID 所对应的字段名称。
  42955. */
  42956. this.symbolIDField = null;
  42957. /**
  42958. * @member {string} LabelSymbolCell.prototype.type
  42959. * @description 制作矩阵专题图时是必须的。
  42960. */
  42961. this.type = "SYMBOL";
  42962. if (options) {
  42963. Util_Util.extend(this, options);
  42964. }
  42965. this.CLASS_NAME = "SuperMap.LabelSymbolCell";
  42966. }
  42967. /**
  42968. * @function LabelSymbolCell.prototype.destroy
  42969. * @description 释放资源,将引用资源的属性置空。
  42970. */
  42971. destroy() {
  42972. var me = this;
  42973. if (me.style) {
  42974. me.style.destroy();
  42975. me.style = null;
  42976. }
  42977. me.symbolIDField = null;
  42978. }
  42979. }
  42980. ;// CONCATENATED MODULE: ./src/common/iServer/LabelThemeCell.js
  42981. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  42982. * This program are made available under the terms of the Apache License, Version 2.0
  42983. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42984. /**
  42985. * @class LabelThemeCell
  42986. * @deprecatedclass SuperMap.LabelThemeCell
  42987. * @category iServer Map Theme
  42988. * @classdesc 专题图类型的矩阵标签元素类。
  42989. * 该类继承自 {@link LabelMatrixCell} 类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  42990. * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  42991. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  42992. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  42993. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属性是一个二维数组,
  42994. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  42995. * @extends {LabelMatrixCell}
  42996. * @param {Object} options -参数。
  42997. * @param {ThemeLabel} options.themeLabel - 作为矩阵标签元素的标签专题图类。
  42998. * @usage
  42999. */
  43000. class LabelThemeCell extends LabelMatrixCell {
  43001. constructor(options) {
  43002. super(options);
  43003. /**
  43004. * @member {ThemeLabel} LabelThemeCell.prototype.themeLabel
  43005. * @description 使用专题图对象作为矩阵标签的一个元素。
  43006. */
  43007. this.themeLabel = new ThemeLabel();
  43008. /**
  43009. * @member {string} LabelThemeCell.prototype.type
  43010. * @description 制作矩阵专题图时是必须的。
  43011. */
  43012. this.type = "THEME";
  43013. if (options) {
  43014. Util_Util.extend(this, options);
  43015. }
  43016. this.CLASS_NAME = " SuperMap.LabelThemeCell";
  43017. }
  43018. /**
  43019. * @function LabelThemeCell.prototype.destroy
  43020. * @description 释放资源,将引用资源的属性置空。
  43021. */
  43022. destroy() {
  43023. var me = this;
  43024. if (me.themeLabel) {
  43025. me.themeLabel.destroy();
  43026. me.themeLabel = null;
  43027. }
  43028. }
  43029. }
  43030. ;// CONCATENATED MODULE: ./src/common/iServer/LayerStatus.js
  43031. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43032. * This program are made available under the terms of the Apache License, Version 2.0
  43033. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43034. /**
  43035. * @class LayerStatus
  43036. * @deprecatedclass SuperMap.LayerStatus
  43037. * @category iServer Map TempLayersSet
  43038. * @classdesc 子图层显示参数类。该类存储了各个子图层的名字和是否可见的状态。
  43039. * @param {Object} options - 参数。
  43040. * @param {string} options.layerName - 图层名称。
  43041. * @param {boolean} [options.isVisible=true] - 图层是否可见,true 表示可见。
  43042. * @param {string} [options.displayFilter] - 图层显示 SQL 过滤条件。
  43043. * @usage
  43044. */
  43045. class LayerStatus {
  43046. constructor(options) {
  43047. /**
  43048. * @member {string} LayerStatus.prototype.layerName
  43049. * @description 获取或设置图层名称。
  43050. */
  43051. this.layerName = null;
  43052. /**
  43053. * @member {boolean} LayerStatus.prototype.isVisible
  43054. * @description 获取或设置图层是否可见,true 表示可见。
  43055. */
  43056. this.isVisible = null;
  43057. /**
  43058. * @member {string} [LayerStatus.prototype.displayFilter]
  43059. * @description 图层显示 SQL 过滤条件,如 layerStatus.displayFilter = "smid < 10",表示仅显示 smid 值小于 10 的对象。
  43060. */
  43061. this.displayFilter = null;
  43062. /**
  43063. * @member {Object} [LayerStatus.prototype.fieldValuesDisplayFilter]
  43064. * @property {Array.<number>} values - 要过滤的值。
  43065. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  43066. * @property {string} fieldValuesDisplayMode - 目前有两个 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  43067. */
  43068. this.fieldValuesDisplayFilter = null;
  43069. if (options) {
  43070. Util_Util.extend(this, options);
  43071. }
  43072. this.CLASS_NAME = "SuperMap.LayerStatus";
  43073. }
  43074. /**
  43075. * @function LayerStatus.prototype.destroy
  43076. * @description 释放资源,将引用资源的属性置空。
  43077. */
  43078. destroy() {
  43079. var me = this;
  43080. me.layerName = null;
  43081. me.isVisible = null;
  43082. me.displayFilter = null;
  43083. }
  43084. /**
  43085. * @function LayerStatus.prototype.toJSON
  43086. * @description 生成对应的 JSON。
  43087. * @returns {Object} 对应的 JSON。
  43088. */
  43089. toJSON() {
  43090. var json = '{';
  43091. json += '"type":"UGC",';
  43092. var v = [];
  43093. if (this.layerName) {
  43094. v.push('"name":"' + this.layerName + '"');
  43095. v.push('"visible":' + this.isVisible);
  43096. }
  43097. if (this.displayFilter) {
  43098. v.push('"displayFilter":"' + this.displayFilter + '"');
  43099. }
  43100. if (this.minScale || this.minScale == 0) {
  43101. v.push('"minScale":' + this.minScale);
  43102. }
  43103. if (this.maxScale || this.maxScale == 0) {
  43104. v.push('"maxScale":' + this.maxScale);
  43105. }
  43106. if (this.fieldValuesDisplayFilter) {
  43107. v.push('"fieldValuesDisplayFilter":' + Util_Util.toJSON(this.fieldValuesDisplayFilter));
  43108. }
  43109. json += v;
  43110. json += '}';
  43111. return json;
  43112. }
  43113. }
  43114. ;// CONCATENATED MODULE: ./src/common/iServer/LinkItem.js
  43115. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43116. * This program are made available under the terms of the Apache License, Version 2.0
  43117. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43118. /**
  43119. * @class LinkItem
  43120. * @deprecatedclass SuperMap.LinkItem
  43121. * @constructs LinkItem
  43122. * @category iServer Data FeatureResults
  43123. * @classdesc 关联信息类。该类用于矢量数据集与外部表的关联。外部表是另一个数据集(其中纯属性数据集中没有空间几何信息)中的 DBMS 表,
  43124. * 矢量数据集与外部表可以属于不同的数据源,但数据源类型目前只支持 SQL Server 和 Oracle 类型。使用 LinkItem 时,
  43125. * 空间数据和属性数据必须满足关联条件,即主空间数据集与外部属性表之间存在关联字段。{@link LinkItem}
  43126. * 只支持左连接,UDB、PostgreSQL 和 DB2 数据源不支持 {@link LinkItem};另外,用于建立关联关系的两个表可以不在同一个数据源下。注意:<br>
  43127. * 1.使用 {@link LinkItem} 的约束条件为:空间数据和属性数据必须有关联条件,即主空间数据集与外部属性表之间存在关联字段;<br>
  43128. * 2.使用外关联表制作专题图时,所关联的字段必须设置表名,例如,如果所关联的字段为 BaseMap_R 数据集的 SmID,就要写成 BaseMap_R.SMID。
  43129. * @param {Object} options - 参数。
  43130. * @param {DatasourceConnectionInfo} options.datasourceConnectionInfo - 关联的外部数据源信息。
  43131. * @param {Array.<string>} options.foreignKeys - 主空间数据集的外键。
  43132. * @param {string} options.foreignTable - 关联的外部属性表的名称。
  43133. * @param {Array.<string>} options.linkFields - 欲保留的外部属性表的字段。
  43134. * @param {string} options.linkFilter - 与外部属性表的连接条件。
  43135. * @param {string} options.name - 此关联信息对象的名称。
  43136. * @param {Array.<string>} options.primaryKeys - 关联的外部属性表的主键。
  43137. * @example 下面以 SQL 查询说明 linkitem 的使用方法:
  43138. * function queryBySQL() {
  43139. * // 设置关联的外部数据库信息,alias表示数据库别名
  43140. * var dc = new DatasourceConnectionInfo({
  43141. * dataBase: "RelQuery",
  43142. * server: "{ip}:{port}",
  43143. * user: "sa",
  43144. * password: "map",
  43145. * driver: "SQL Server",
  43146. * connect: true,
  43147. * OpenLinkTable: false,
  43148. * alias: "RelQuery",
  43149. * engineType: EngineType.SQLPLUS,
  43150. * readOnly: false,
  43151. * exclusive: false
  43152. * });
  43153. * // 设置关联信息
  43154. * var linkItem = new LinkItem({
  43155. * datasourceConnectionInfo: dc,
  43156. * foreignKeys: ["name"],
  43157. * foreignTable: "Pop_2011",
  43158. * linkFields: ["SmID as Pid","pop"],
  43159. * name: "link",
  43160. * primatryKeys: ["name"],
  43161. * });
  43162. * // 设置查询参数,在查询参数中添加linkItem关联条件信息
  43163. * var queryParam, queryBySQLParams, queryBySQLService;
  43164. * queryParam = new FilterParameter({
  43165. * name: "Province@RelQuery",
  43166. * fields: ["SmID","name"],
  43167. * attributeFilter: "SmID<7",
  43168. * linkItems: [linkItem]
  43169. * }),
  43170. * queryBySQLParams = new QueryBySQLParameters({
  43171. * queryParams: [queryParam]
  43172. * }),
  43173. * queryBySQLService = new QueryBySQLService(url, {
  43174. * eventListeners: {
  43175. * "processCompleted": processCompleted,
  43176. * "processFailed": processFailed
  43177. * }
  43178. * });
  43179. * queryBySQLService.processAsync(queryBySQLParams);
  43180. * }
  43181. * function processCompleted(queryEventArgs) {//todo}
  43182. * function processFailed(e) {//todo}
  43183. * @usage
  43184. */
  43185. class LinkItem {
  43186. constructor(options) {
  43187. /**
  43188. * @member {DatasourceConnectionInfo} LinkItem.prototype.datasourceConnectionInfo
  43189. * @description 关联的外部数据源信息。
  43190. */
  43191. this.datasourceConnectionInfo = null;
  43192. /**
  43193. * @member {Array.<string>} LinkItem.prototype.foreignKeys
  43194. * @description 主空间数据集的外键。
  43195. */
  43196. this.foreignKeys = null;
  43197. /**
  43198. * @member {string} LinkItem.prototype.foreignTable
  43199. * @description 关联的外部属性表的名称,目前仅支持 Supermap 管理的表,即另一个矢量数据集所对应的 DBMS 表。
  43200. */
  43201. this.foreignTable = null;
  43202. /**
  43203. * @member {Array.<string>} LinkItem.prototype.linkFields
  43204. * @description 欲保留的外部属性表的字段。如果不设置字段或者设置的字段在外部属性表中不存在的话则不返回任何外部属性表的属性信息。如果欲保留的外部表字段与主表字段存在同名,则还需要指定一个不存在字段名作为外部表的字段别名。
  43205. */
  43206. this.linkFields = null;
  43207. /**
  43208. * @member {string} LinkItem.prototype.linkFilter
  43209. * @description 与外部属性表的连接条件。
  43210. */
  43211. this.linkFilter = null;
  43212. /**
  43213. * @member {string} LinkItem.prototype.name
  43214. * @description 此关联信息对象的名称。
  43215. */
  43216. this.name = null;
  43217. /**
  43218. * @member {Array.<string>} LinkItem.prototype.primaryKeys
  43219. * @description 需要关联的外部属性表的主键。
  43220. */
  43221. this.primaryKeys = null;
  43222. if (options) {
  43223. Util_Util.extend(this, options);
  43224. }
  43225. this.CLASS_NAME = "SuperMap.LinkItem";
  43226. }
  43227. /**
  43228. * @function LinkItem.prototype.destroy
  43229. * @description 释放资源,将引用资源的属性置空。
  43230. */
  43231. destroy() {
  43232. var me = this;
  43233. if (me.datasourceConnectionInfo instanceof DatasourceConnectionInfo) {
  43234. me.datasourceConnectionInfo.destroy();
  43235. me.datasourceConnectionInfo = null;
  43236. }
  43237. me.foreignKeys = null;
  43238. me.foreignTable = null;
  43239. me.linkFields = null;
  43240. me.linkFilter = null;
  43241. me.name = null;
  43242. me.primaryKeys = null;
  43243. }
  43244. }
  43245. ;// CONCATENATED MODULE: ./src/common/iServer/MapService.js
  43246. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43247. * This program are made available under the terms of the Apache License, Version 2.0
  43248. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43249. /**
  43250. * @class MapService
  43251. * @deprecatedclass SuperMap.MapService
  43252. * @category iServer Map
  43253. * @classdesc 地图信息服务类。
  43254. * @extends {CommonServiceBase}
  43255. * @example
  43256. * var myMapService = new MapService(url, {
  43257. * eventListeners:{
  43258. * "processCompleted": MapServiceCompleted,
  43259. * "processFailed": MapServiceFailed
  43260. * }
  43261. * });
  43262. *
  43263. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  43264. * @param {Object} options - 参数。
  43265. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  43266. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  43267. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43268. * @param {Object} [options.headers] - 请求头。
  43269. * @usage
  43270. */
  43271. class MapService_MapService extends CommonServiceBase {
  43272. constructor(url, options) {
  43273. super(url, options);
  43274. /**
  43275. * @member {string} MapService.prototype.projection
  43276. * @description 根据投影参数获取地图状态信息。如"EPSG:4326"
  43277. */
  43278. this.projection = null;
  43279. this.CLASS_NAME = "SuperMap.MapService";
  43280. if (options) {
  43281. Util_Util.extend(this, options);
  43282. }
  43283. var me = this;
  43284. if (me.projection) {
  43285. var arr = me.projection.split(":");
  43286. if (arr instanceof Array) {
  43287. if (arr.length === 2) {
  43288. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[1]}"}`)}`)
  43289. }
  43290. if (arr.length === 1) {
  43291. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[0]}"}`)}`)
  43292. }
  43293. }
  43294. }
  43295. this.eventCount = 0;
  43296. }
  43297. /**
  43298. * @function destroy
  43299. * @description 释放资源,将引用的资源属性置空。
  43300. */
  43301. destroy() {
  43302. super.destroy();
  43303. var me = this;
  43304. if (me.events) {
  43305. me.events.un(me.eventListeners);
  43306. me.events.listeners = null;
  43307. me.events.destroy();
  43308. me.events = null;
  43309. me.eventListeners = null;
  43310. }
  43311. }
  43312. /**
  43313. * @function MapService.prototype.processAsync
  43314. * @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
  43315. */
  43316. processAsync(callback) {
  43317. let eventId = ++this.eventCount;
  43318. let eventListeners = {
  43319. scope: this,
  43320. processCompleted: function(result) {
  43321. if (eventId === result.result.eventId && callback) {
  43322. delete result.result.eventId;
  43323. callback(result);
  43324. this.events && this.events.un(eventListeners);
  43325. return false;
  43326. }
  43327. },
  43328. processFailed: function(result) {
  43329. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  43330. callback(result);
  43331. this.events && this.events.un(eventListeners);
  43332. return false;
  43333. }
  43334. }
  43335. }
  43336. this.events.on(eventListeners);
  43337. var me = this;
  43338. me.request({
  43339. method: "GET",
  43340. scope: me,
  43341. success(result, options) {
  43342. result.eventId = eventId;
  43343. this.serviceProcessCompleted(result, options);
  43344. },
  43345. failure(result, options) {
  43346. if (result.error) {
  43347. result.error.eventId = eventId;
  43348. }
  43349. result.eventId = eventId;
  43350. this.serviceProcessFailed(result, options);
  43351. }
  43352. });
  43353. }
  43354. /*
  43355. * Method: getMapStatusCompleted
  43356. * 获取地图状态完成,执行此方法。
  43357. *
  43358. * Parameters:
  43359. * {Object} result - 服务器返回的结果对象。
  43360. */
  43361. serviceProcessCompleted(result, options) {
  43362. var me = this;
  43363. result = Util_Util.transformResult(result);
  43364. var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
  43365. var isCodeValid = result.code && codeStatus;
  43366. if (!result.code || isCodeValid) {
  43367. me.events && me.events.triggerEvent("processCompleted", {result: result, options});
  43368. } else {
  43369. ////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
  43370. me.events.triggerEvent("processFailed", {error: result, options});
  43371. }
  43372. }
  43373. }
  43374. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisParameters.js
  43375. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43376. * This program are made available under the terms of the Apache License, Version 2.0
  43377. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43378. /**
  43379. * @class MathExpressionAnalysisParameters
  43380. * @deprecatedclass SuperMap.MathExpressionAnalysisParameters
  43381. * @category iServer SpatialAnalyst GridMathAnalyst
  43382. * @classdesc 栅格代数运算参数类。
  43383. * @param {Object} options - 参数。
  43384. * @param {string} options.dataset - 指定栅格代数运算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:BaseMap_P@Jingjin。
  43385. * @param {string} options.resultGridName - 指定结果数据集名称。
  43386. * @param {string} options.expression - 指定的栅格运算表达式。如:[DatasourceAlias1.Raster1]*2-10。
  43387. * @param {string} options.targetDatasource - 指定存储结果数据集的数据源。
  43388. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.extractRegion] - 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  43389. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  43390. * @param {boolean} [options.isZip=false] - 是否对结果数据集进行压缩处理。
  43391. * @param {boolean} [options.ignoreNoValue=false] - 是否忽略无值栅格数据。true 表示忽略无值数据,即无值栅格不参与运算。
  43392. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  43393. * @usage
  43394. */
  43395. class MathExpressionAnalysisParameters {
  43396. constructor(options) {
  43397. if (!options) {
  43398. return;
  43399. }
  43400. /**
  43401. * @member {string} MathExpressionAnalysisParameters.prototype.dataset
  43402. * @description 要用来做栅格代数运算数据源中数据集的名称。
  43403. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  43404. *
  43405. */
  43406. this.dataset = null;
  43407. /**
  43408. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [MathExpressionAnalysisParameters.prototype.extractRegion]
  43409. * @description 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  43410. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  43411. */
  43412. this.extractRegion = null;
  43413. /**
  43414. * @member {string} MathExpressionAnalysisParameters.prototype.expression
  43415. * @description 指定的栅格运算表达式。如:"[DatasourceAlias1.Raster1]*2-10"。
  43416. */
  43417. this.expression = null;
  43418. /**
  43419. * @member {boolean} [MathExpressionAnalysisParameters.prototype.isZip=false]
  43420. * @description 是否对结果数据集进行压缩处理。
  43421. */
  43422. this.isZip = false;
  43423. /**
  43424. * @member {boolean} [MathExpressionAnalysisParameters.prototype.ignoreNoValue=false]
  43425. * @description 是否忽略无值栅格数据。
  43426. */
  43427. this.ignoreNoValue = false;
  43428. /**
  43429. * @member {string} MathExpressionAnalysisParameters.prototype.targetDatasource
  43430. * @description 指定存储结果数据集的数据源。
  43431. */
  43432. this.targetDatasource = null;
  43433. /**
  43434. * @member {string} MathExpressionAnalysisParameters.prototype.resultGridName
  43435. * @description 指定结果数据集名称。
  43436. */
  43437. this.resultGridName = null;
  43438. /**
  43439. * @member {boolean} [MathExpressionAnalysisParameters.prototype.deleteExistResultDataset=false]
  43440. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  43441. */
  43442. this.deleteExistResultDataset = false;
  43443. Util_Util.extend(this, options);
  43444. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisParameters"
  43445. }
  43446. /**
  43447. * @function MathExpressionAnalysisParameters.prototype.destroy
  43448. * @description 释放资源,将引用资源的属性置空。
  43449. */
  43450. destroy() {
  43451. var me = this;
  43452. me.dataset = null;
  43453. me.bounds = null;
  43454. me.expression = null;
  43455. me.isZip = true;
  43456. me.ignoreNoValue = true;
  43457. me.targetDatasource = null;
  43458. me.resultGridName = null;
  43459. me.deleteExistResultDataset = null;
  43460. }
  43461. /**
  43462. * @function MathExpressionAnalysisParameters.toObject
  43463. * @param {Object} mathExpressionAnalysisParameters - 栅格代数运算参数。
  43464. * @param {Object} tempObj - 目标对象。
  43465. * @description 生成栅格代数运算对象。
  43466. */
  43467. static toObject(mathExpressionAnalysisParameters, tempObj) {
  43468. for (var name in mathExpressionAnalysisParameters) {
  43469. if (name !== "dataset") {
  43470. tempObj[name] = mathExpressionAnalysisParameters[name];
  43471. }
  43472. if (name === "extractRegion") {
  43473. if (mathExpressionAnalysisParameters[name]) {
  43474. var bs = mathExpressionAnalysisParameters[name].components[0].components;
  43475. var region = {},
  43476. points = [],
  43477. type = "REGION";
  43478. var len = bs.length;
  43479. for (var i = 0; i < len - 1; i++) {
  43480. var poi = {};
  43481. poi["x"] = bs[i].x;
  43482. poi["y"] = bs[i].y;
  43483. points.push(poi);
  43484. }
  43485. region["points"] = points;
  43486. region["type"] = type;
  43487. tempObj[name] = region;
  43488. }
  43489. }
  43490. }
  43491. }
  43492. }
  43493. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisService.js
  43494. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43495. * This program are made available under the terms of the Apache License, Version 2.0
  43496. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43497. /**
  43498. * @class MathExpressionAnalysisService
  43499. * @deprecatedclass SuperMap.MathExpressionAnalysisService
  43500. * @category iServer SpatialAnalyst GridMathAnalyst
  43501. * @classdesc 栅格代数运算服务类。
  43502. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  43503. * @param {Object} options - 参数。
  43504. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  43505. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43506. * @param {Object} [options.headers] - 请求头。
  43507. * @extends {SpatialAnalystBase}
  43508. * @example 例如:
  43509. * (start code)
  43510. * var myMathExpressionAnalysisService = new MathExpressionAnalysisService(url);
  43511. * myMathExpressionAnalysisService.on({
  43512. * "processCompleted": processCompleted,
  43513. * "processFailed": processFailed
  43514. * }
  43515. * );
  43516. * (end)
  43517. * @usage
  43518. */
  43519. class MathExpressionAnalysisService extends SpatialAnalystBase {
  43520. constructor(url, options) {
  43521. super(url, options);
  43522. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisService";
  43523. }
  43524. /**
  43525. * @override
  43526. */
  43527. destroy() {
  43528. super.destroy();
  43529. }
  43530. /**
  43531. * @function MathExpressionAnalysisService.prototype.processAsync
  43532. * @description 负责将客户端的查询参数传递到服务端。
  43533. * @param {MathExpressionAnalysisParameters} parameter - 栅格代数运算参数类。
  43534. */
  43535. processAsync(parameter) {
  43536. var me = this;
  43537. var parameterObject = {};
  43538. if (parameter instanceof MathExpressionAnalysisParameters) {
  43539. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/mathanalyst');
  43540. }
  43541. MathExpressionAnalysisParameters.toObject(parameter, parameterObject);
  43542. var jsonParameters = Util_Util.toJSON(parameterObject);
  43543. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  43544. me.request({
  43545. method: "POST",
  43546. data: jsonParameters,
  43547. scope: me,
  43548. success: me.serviceProcessCompleted,
  43549. failure: me.serviceProcessFailed
  43550. });
  43551. }
  43552. }
  43553. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureParameters.js
  43554. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43555. * This program are made available under the terms of the Apache License, Version 2.0
  43556. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43557. /**
  43558. * @class MeasureParameters
  43559. * @deprecatedclass SuperMap.MeasureParameters
  43560. * @category iServer Map Measure
  43561. * @classdesc 量算参数类。
  43562. * @param {GeoJSONObject} geometry - 要量算的几何对象。
  43563. * @param {Object} options - 可选参数。
  43564. * @param {Unit} [options.unit=Unit.METER] - 量算单位。
  43565. * @param {string} [options.prjCoordSys] - 用来指定该量算操作所使用的投影。
  43566. * @param {string} [options.distanceMode="Geodesic"] - 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  43567. * @usage
  43568. */
  43569. class MeasureParameters {
  43570. constructor(geometry, options) {
  43571. if (!geometry) {
  43572. return;
  43573. }
  43574. /**
  43575. * @member {GeoJSONObject} MeasureParameters.prototype.geometry
  43576. * @description 要量算的几何对象。<br>
  43577. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  43578. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  43579. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。
  43580. */
  43581. this.geometry = geometry;
  43582. /**
  43583. * @member {Unit} [MeasureParameters.prototype.unit=Unit.METER]
  43584. * @description 量算单位。即量算结果以米为单位。
  43585. */
  43586. this.unit = Unit.METER;
  43587. /**
  43588. * @member {string} [MeasureParameters.prototype.prjCoordSys]
  43589. * @description 用来指定该量算操作所使用的投影。
  43590. */
  43591. this.prjCoordSys = null;
  43592. /**
  43593. * @member {string} [MeasureParameters.prototype.distanceMode="Geodesic"]
  43594. * @description 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  43595. * @example
  43596. * var param = new MeasureParameters(getmetry,{distanceMode:'Planar'});
  43597. */
  43598. this.distanceMode = null;
  43599. if (options) {
  43600. Util_Util.extend(this, options);
  43601. }
  43602. this.CLASS_NAME = "SuperMap.MeasureParameters";
  43603. }
  43604. /**
  43605. * @function MeasureParameters.prototype.destroy
  43606. * @description 释放资源,将引用资源的属性置空。
  43607. */
  43608. destroy() {
  43609. var me = this;
  43610. me.geometry = null;
  43611. me.unit = null;
  43612. me.prjCoordSys = null;
  43613. }
  43614. }
  43615. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureService.js
  43616. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43617. * This program are made available under the terms of the Apache License, Version 2.0
  43618. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43619. /**
  43620. * @class MeasureService
  43621. * @deprecatedclass SuperMap.MeasureService
  43622. * @category iServer Map Measure
  43623. * @classdesc 量算服务类。
  43624. * 该类负责将量算参数传递到服务端,并获取服务端返回的量算结果。
  43625. * @extends {CommonServiceBase}
  43626. * @example
  43627. * var myMeasuerService = new MeasureService(url, {
  43628. * measureMode: MeasureMode.DISTANCE,
  43629. * eventListeners:{
  43630. * "processCompleted": measureCompleted
  43631. * }
  43632. * });
  43633. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  43634. * @param {Object} options - 参数。
  43635. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  43636. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  43637. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43638. * @param {Object} [options.headers] - 请求头。
  43639. * @param {MeasureMode} options.measureMode - 量算模式,包括距离量算模式和面积量算模式。
  43640. * @usage
  43641. */
  43642. class MeasureService_MeasureService extends CommonServiceBase {
  43643. constructor(url, options) {
  43644. super(url, options);
  43645. /**
  43646. * @member {MeasureMode} [MeasureService.prototype.measureMode=MeasureMode.DISTANCE]
  43647. * @description 量算模式,包括距离量算模式和面积量算模式。
  43648. */
  43649. this.measureMode = MeasureMode.DISTANCE;
  43650. if (options) {
  43651. Util_Util.extend(this, options);
  43652. }
  43653. this.eventCount = 0;
  43654. this.CLASS_NAME = "SuperMap.MeasureService";
  43655. }
  43656. /**
  43657. * @override
  43658. */
  43659. destroy() {
  43660. super.destroy();
  43661. var me = this;
  43662. me.measureMode = null;
  43663. }
  43664. /**
  43665. * @function MeasureService.prototype.processAsync
  43666. * @description 负责将客户端的量算参数传递到服务端。
  43667. * @param {MeasureParameters} params - 量算参数。
  43668. */
  43669. processAsync(params, callback) {
  43670. if (!(params instanceof MeasureParameters)) {
  43671. return;
  43672. }
  43673. let eventId = ++this.eventCount;
  43674. let eventListeners = {
  43675. scope: this,
  43676. processCompleted: function(result) {
  43677. if (eventId === result.result.eventId && callback) {
  43678. delete result.result.eventId;
  43679. callback(result);
  43680. this.events && this.events.un(eventListeners);
  43681. return false;
  43682. }
  43683. },
  43684. processFailed: function(result) {
  43685. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  43686. callback(result);
  43687. this.events && this.events.un(eventListeners);
  43688. return false;
  43689. }
  43690. }
  43691. }
  43692. this.events.on(eventListeners);
  43693. var me = this,
  43694. geometry = params.geometry,
  43695. pointsCount = 0,
  43696. point2ds = null;
  43697. if (!geometry) {
  43698. return;
  43699. }
  43700. me.url = Util_Util.urlPathAppend(me.url, me.measureMode === MeasureMode.AREA ? 'area' : 'distance');
  43701. var serverGeometry = ServerGeometry.fromGeometry(geometry);
  43702. if (!serverGeometry) {
  43703. return;
  43704. }
  43705. pointsCount = serverGeometry.parts[0];
  43706. point2ds = serverGeometry.points.splice(0, pointsCount);
  43707. var prjCoordSysTemp, prjCodeTemp, paramsTemp;
  43708. if (params.prjCoordSys) {
  43709. if (typeof (params.prjCoordSys) === "object") {
  43710. prjCodeTemp = params.prjCoordSys.projCode;
  43711. prjCoordSysTemp = '{"epsgCode"' + prjCodeTemp.substring(prjCodeTemp.indexOf(":"), prjCodeTemp.length) + "}";
  43712. } else if (typeof (params.prjCoordSys) === "string") {
  43713. prjCoordSysTemp = '{"epsgCode"' + params.prjCoordSys.substring(params.prjCoordSys.indexOf(":"), params.prjCoordSys.length) + "}";
  43714. }
  43715. paramsTemp = {
  43716. "point2Ds": Util_Util.toJSON(point2ds),
  43717. "unit": params.unit,
  43718. "prjCoordSys": prjCoordSysTemp,
  43719. "distanceMode": params.distanceMode || 'Geodesic'
  43720. };
  43721. } else {
  43722. paramsTemp = {"point2Ds": Util_Util.toJSON(point2ds), "unit": params.unit, "distanceMode": params.distanceMode || 'Geodesic'};
  43723. }
  43724. me.request({
  43725. method: "GET",
  43726. params: paramsTemp,
  43727. scope: me,
  43728. success(result, options) {
  43729. result.eventId = eventId;
  43730. this.serviceProcessCompleted(result, options);
  43731. },
  43732. failure(result, options) {
  43733. if (result.error) {
  43734. result.error.eventId = eventId;
  43735. }
  43736. result.eventId = eventId;
  43737. this.serviceProcessFailed(result, options);
  43738. }
  43739. });
  43740. }
  43741. }
  43742. ;// CONCATENATED MODULE: ./src/common/iServer/OverlapDisplayedOptions.js
  43743. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43744. * This program are made available under the terms of the Apache License, Version 2.0
  43745. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43746. /**
  43747. * @class OverlapDisplayedOptions
  43748. * @deprecatedclass SuperMap.OverlapDisplayedOptions
  43749. * @category iServer Map Layer
  43750. * @classdesc 地图压盖过滤显示选项。在文本或专题图元素显示较密集的区域,文本之间或专题元素之间会发生相互压盖的现象,
  43751. * 该类可以分别控制各种类型的对象的压盖显示情况,进而很好地处理地图中各种类型对象的压盖显示问题。
  43752. * @param {Object} options - 可选参数。
  43753. * @param {boolean} [options.allowPointOverlap=true] - 点和点压盖时是否显示压盖的点对象。
  43754. * @param {boolean} [options.allowPointWithTextDisplay=true] - 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  43755. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  43756. * @param {boolean} [options.allowTextOverlap=false] - 文本压盖时是否显示压盖的文本对象。
  43757. * @param {boolean} [options.allowTextAndPointOverlap=true] - 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  43758. * @param {boolean} [options.allowThemeGraduatedSymbolOverlap=false] - 等级符号元素压盖时是否显示压盖的等级符号元素。
  43759. * @param {boolean} [options.allowThemeGraphOverlap=false] - 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  43760. * @param {number} [options.horizontalOverlappedSpaceSize=0] - 两个对象之间的横向压盖间距,单位为 0.1 毫米,跟 verticalOverlappedSpaceSize 结合使用,
  43761. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  43762. * @param {number} [options.verticalOverlappedSpaceSize=0] - 两个对象之间的纵向压盖间距,单位为 0.1 毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  43763. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  43764. * @usage
  43765. */
  43766. class OverlapDisplayedOptions {
  43767. constructor(options) {
  43768. options = options || {};
  43769. /**
  43770. * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointOverlap=true]
  43771. * @description 点和点压盖时是否显示压盖的点对象。
  43772. */
  43773. this.allowPointOverlap = true;
  43774. /**
  43775. * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointWithTextDisplay=true]
  43776. * @description 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  43777. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  43778. */
  43779. this.allowPointWithTextDisplay = true;
  43780. /**
  43781. * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextOverlap=false]
  43782. * @description 文本压盖时是否显示压盖的文本对象。
  43783. */
  43784. this.allowTextOverlap = false;
  43785. /**
  43786. * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextAndPointOverlap=true]
  43787. * @description 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  43788. */
  43789. this.allowTextAndPointOverlap = true;
  43790. /**
  43791. * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraduatedSymbolOverlap=false]
  43792. * @description 等级符号元素压盖时是否显示压盖的等级符号元素。
  43793. */
  43794. this.allowThemeGraduatedSymbolOverlap = false;
  43795. /**
  43796. * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraphOverlap=false]
  43797. * @description 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  43798. */
  43799. this.allowThemeGraphOverlap = false;
  43800. /**
  43801. * @member {number} [OverlapDisplayedOptions.prototype.horizontalOverlappedSpaceSize=0]
  43802. * @description 两个对象之间的横向压盖间距,单位为0.1毫米,跟 verticalOverlappedSpaceSize 结合使用,
  43803. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  43804. */
  43805. this.horizontalOverlappedSpaceSize = 0;
  43806. /**
  43807. * @member {number} [OverlapDisplayedOptions.prototype.verticalOverlappedSpaceSize=0]
  43808. * @description 两个对象之间的纵向压盖间距,单位为0.1毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  43809. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  43810. */
  43811. this.verticalOverlappedSpaceSize = 0;
  43812. Util_Util.extend(this, options);
  43813. this.ugcLayer = new UGCLayer(options);
  43814. this.CLASS_NAME = "SuperMap.OverlapDisplayedOptions";
  43815. }
  43816. /**
  43817. * @function OverlapDisplayedOptions.prototype.destroy
  43818. * @description 释放资源,将资源的属性置空。
  43819. */
  43820. destroy() {
  43821. Util_Util.reset(this);
  43822. }
  43823. /**
  43824. * @function OverlapDisplayedOptions.prototype.fromJson
  43825. * @description 将服务端 JSON 对象转换成当前客户端对象。
  43826. * @param {Object} jsonObject - 要转换的 JSON 对象。
  43827. */
  43828. fromJson(jsonObject) {
  43829. this.ugcLayer.fromJson.apply(this, [jsonObject]);
  43830. }
  43831. /**
  43832. * @function OverlapDisplayedOptions.prototype.toServerJSONObject
  43833. * @description 转换成对应的 JSON 格式对象。
  43834. * @returns {Object} 对应的 JSON 格式对象。
  43835. */
  43836. toServerJSONObject() {
  43837. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  43838. return jsonObject;
  43839. }
  43840. /**
  43841. * @function OverlapDisplayedOptions.prototype.toString
  43842. * @description 转换成对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  43843. * @returns {string} 对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  43844. */
  43845. toString() {
  43846. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  43847. var str = "{";
  43848. for (var attr in jsonObject) {
  43849. if (jsonObject.hasOwnProperty(attr)) {
  43850. str += "'" + attr + "':" + jsonObject[attr] + ",";
  43851. }
  43852. }
  43853. str = str.substr(0, str.length - 1);
  43854. str += "}";
  43855. return str;
  43856. }
  43857. }
  43858. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystService.js
  43859. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43860. * This program are made available under the terms of the Apache License, Version 2.0
  43861. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43862. /**
  43863. * @class OverlayAnalystService
  43864. * @deprecatedclass SuperMap.OverlayAnalystService
  43865. * @category iServer SpatialAnalyst OverlayAnalyst
  43866. * @classdesc 叠加分析服务类。
  43867. * 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  43868. * 叠加分析结果通过该类支持的事件的监听函数参数获取
  43869. * @param {string} url - 服务地址。如http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  43870. * @param {Object} options - 参数。
  43871. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  43872. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43873. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  43874. * @param {Object} [options.headers] - 请求头。
  43875. * @extends {CommonServiceBase}
  43876. * @example 例如:
  43877. * (start code)
  43878. * var myOverlayAnalystService = new OverlayAnalystService(url, {
  43879. * eventListeners: {
  43880. * "processCompleted": OverlayCompleted,
  43881. * "processFailed": OverlayFailed
  43882. * }
  43883. * });
  43884. * (end)
  43885. * @usage
  43886. */
  43887. class OverlayAnalystService extends SpatialAnalystBase {
  43888. constructor(url, options) {
  43889. super(url, options);
  43890. /**
  43891. * @member {string} OverlayAnalystService.prototype.mode
  43892. * @description 叠加分析类型
  43893. */
  43894. this.mode = null;
  43895. if (options) {
  43896. Util_Util.extend(this, options);
  43897. }
  43898. this.CLASS_NAME = "SuperMap.OverlayAnalystService";
  43899. }
  43900. /**
  43901. * @override
  43902. */
  43903. destroy() {
  43904. super.destroy();
  43905. this.mode = null;
  43906. }
  43907. /**
  43908. * @function OverlayAnalystService.prototype.processAsync
  43909. * @description 负责将客户端的查询参数传递到服务端。
  43910. * @param {OverlayAnalystParameters} parameter - 叠加分析参数类。
  43911. */
  43912. processAsync(parameter) {
  43913. var parameterObject = {};
  43914. var me = this;
  43915. if (parameter instanceof DatasetOverlayAnalystParameters) {
  43916. me.mode = "datasets";
  43917. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.sourceDataset + '/overlay');
  43918. DatasetOverlayAnalystParameters.toObject(parameter, parameterObject);
  43919. } else if (parameter instanceof GeometryOverlayAnalystParameters) {
  43920. me.mode = "geometry";
  43921. //支持传入多个几何要素进行叠加分析
  43922. if(parameter.operateGeometries && parameter.sourceGeometries){
  43923. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay/batch');
  43924. me.url = Util_Util.urlAppend(me.url, 'ignoreAnalystParam=true');
  43925. }else {
  43926. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay');
  43927. }
  43928. GeometryOverlayAnalystParameters.toObject(parameter, parameterObject);
  43929. }
  43930. this.returnContent = true;
  43931. var jsonParameters = Util_Util.toJSON(parameterObject);
  43932. me.request({
  43933. method: "POST",
  43934. data: jsonParameters,
  43935. scope: me,
  43936. success: me.serviceProcessCompleted,
  43937. failure: me.serviceProcessFailed
  43938. });
  43939. }
  43940. dataFormat() {
  43941. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  43942. }
  43943. }
  43944. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  43945. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43946. * This program are made available under the terms of the Apache License, Version 2.0
  43947. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43948. /**
  43949. * @class OverlayGeoJobParameter
  43950. * @deprecatedclass SuperMap.OverlayGeoJobParameter
  43951. * @category iServer ProcessingService OverlayAnalyst
  43952. * @classdesc 叠加分析任务参数类。
  43953. * @param {Object} options - 参数。
  43954. * @param {string} options.datasetName - 数据集名。
  43955. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  43956. * @param {string} options.srcFields - 输入数据需要保留的字段。
  43957. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  43958. * @param {string} [options.mode] - 叠加分析模式。
  43959. * @param {OutputSetting} [options.output] - 输出参数设置。
  43960. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  43961. * @usage
  43962. */
  43963. class OverlayGeoJobParameter {
  43964. constructor(options) {
  43965. if (!options) {
  43966. return;
  43967. }
  43968. /**
  43969. * @member {string} OverlayGeoJobParameter.prototype.datasetName
  43970. * @description 数据集名。
  43971. */
  43972. this.datasetName = "";
  43973. /**
  43974. * @member {string} OverlayGeoJobParameter.prototype.datasetOverlay
  43975. * @description 叠加对象所在的数据集名称。
  43976. */
  43977. this.datasetOverlay = "";
  43978. /**
  43979. * @member {string} [OverlayGeoJobParameter.prototype.mode]
  43980. * @description 叠加分析模式。
  43981. */
  43982. this.mode = "";
  43983. /**
  43984. * @member {string} OverlayGeoJobParameter.prototype.srcFields
  43985. * @description 输入数据需要保留的字段。
  43986. */
  43987. this.srcFields = "";
  43988. /**
  43989. * @member {string} OverlayGeoJobParameter.prototype.overlayFields
  43990. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  43991. */
  43992. this.overlayFields = "";
  43993. /**
  43994. * @member {OutputSetting} [OverlayGeoJobParameter.prototype.output]
  43995. * @description 输出参数设置类。
  43996. */
  43997. this.output = null;
  43998. /**
  43999. * @member {MappingParameters} [OverlayGeoJobParameter.prototype.mappingParameters]
  44000. * @description 分析后结果可视化的参数类。
  44001. */
  44002. this.mappingParameters = null;
  44003. Util_Util.extend(this, options);
  44004. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  44005. }
  44006. /**
  44007. * @function OverlayGeoJobParameter.prototype.destroy
  44008. * @description 释放资源,将资源的属性置空。
  44009. */
  44010. destroy() {
  44011. this.datasetName = null;
  44012. this.datasetOverlay = null;
  44013. this.mode = null;
  44014. this.srcFields = null;
  44015. this.overlayFields = null;
  44016. if (this.output instanceof OutputSetting) {
  44017. this.output.destroy();
  44018. this.output = null;
  44019. }
  44020. if (this.mappingParameters instanceof MappingParameters) {
  44021. this.mappingParameters.destroy();
  44022. this.mappingParameters = null;
  44023. }
  44024. }
  44025. /**
  44026. * @function OverlayGeoJobParameter.toObject
  44027. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  44028. * @param {Object} tempObj - 目标对象。
  44029. * @description 生成点聚合分析任务对象。
  44030. */
  44031. static toObject(OverlayGeoJobParameter, tempObj) {
  44032. for (var name in OverlayGeoJobParameter) {
  44033. if (name == "datasetName") {
  44034. tempObj['input'] = tempObj['input'] || {};
  44035. tempObj['input'][name] = OverlayGeoJobParameter[name];
  44036. continue;
  44037. }
  44038. if (name === "output") {
  44039. tempObj['output'] = tempObj['output'] || {};
  44040. tempObj['output'] = OverlayGeoJobParameter[name];
  44041. continue;
  44042. }
  44043. tempObj['analyst'] = tempObj['analyst'] || {};
  44044. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  44045. if(name === 'mappingParameters'){
  44046. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  44047. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  44048. }
  44049. }
  44050. }
  44051. }
  44052. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  44053. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44054. * This program are made available under the terms of the Apache License, Version 2.0
  44055. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44056. /**
  44057. * @class OverlayGeoJobsService
  44058. * @deprecatedclass SuperMap.OverlayGeoJobsService
  44059. * @category iServer ProcessingService OverlayAnalyst
  44060. * @classdesc 叠加分析任务类。
  44061. * @param {string} url - 服务地址。
  44062. * @param {Object} options - 参数。
  44063. * @param {Events} options.events - 处理所有事件的对象。
  44064. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  44065. * @param {number} options.index - 服务访问地址在数组中的位置。
  44066. * @param {number} options.length - 服务访问地址数组长度。
  44067. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44068. * @param {Object} [options.headers] - 请求头。
  44069. * @usage
  44070. */
  44071. class OverlayGeoJobsService extends ProcessingServiceBase {
  44072. constructor(url, options) {
  44073. super(url, options);
  44074. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  44075. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  44076. }
  44077. /**
  44078. * @override
  44079. */
  44080. destroy() {
  44081. super.destroy();
  44082. }
  44083. /**
  44084. * @function OverlayGeoJobsService.prototype.getOverlayGeoJobs
  44085. * @description 获取叠加分析任务
  44086. */
  44087. getOverlayGeoJobs() {
  44088. super.getJobs(this.url);
  44089. }
  44090. /**
  44091. * @function OverlayGeoJobsService.prototype.getOverlayGeoJob
  44092. * @description 获取指定id的叠加分析任务
  44093. * @param {string} id - 指定要获取数据的id
  44094. */
  44095. getOverlayGeoJob(id) {
  44096. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  44097. }
  44098. /**
  44099. * @function OverlayGeoJobsService.prototype.addOverlayGeoJob
  44100. * @description 新建点叠加析服务
  44101. * @param {OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  44102. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  44103. */
  44104. addOverlayGeoJob(params, seconds) {
  44105. super.addJob(this.url, params, OverlayGeoJobParameter, seconds);
  44106. }
  44107. }
  44108. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsParameters.js
  44109. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44110. * This program are made available under the terms of the Apache License, Version 2.0
  44111. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44112. /**
  44113. * @class QueryByBoundsParameters
  44114. * @deprecatedclass SuperMap.QueryByBoundsParameters
  44115. * @category iServer Map QueryResults
  44116. * @classdesc Bounds 查询参数类。该类用于设置 Bounds 查询的相关参数。
  44117. * @extends {QueryParameters}
  44118. * @param {Object} options - 参数。
  44119. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 指定的查询范围。
  44120. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  44121. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  44122. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  44123. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  44124. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  44125. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  44126. * @param {number} [options.startRecord=0] - 查询起始记录号。
  44127. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  44128. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  44129. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  44130. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  44131. * @usage
  44132. */
  44133. class QueryByBoundsParameters extends QueryParameters {
  44134. constructor(options) {
  44135. options = options || {};
  44136. super(options);
  44137. /**
  44138. * @member {boolean} [QueryByBoundsParameters.prototype.returnContent=true]
  44139. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  44140. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  44141. * 为 false,则返回的是查询结果资源的 URI。
  44142. */
  44143. this.returnContent = true;
  44144. /**
  44145. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} QueryByBoundsParameters.prototype.bounds
  44146. * @description 指定的查询范围。
  44147. */
  44148. this.bounds = null;
  44149. Util_Util.extend(this, options);
  44150. this.CLASS_NAME = "SuperMap.QueryByBoundsParameters";
  44151. }
  44152. /**
  44153. * @function QueryByBoundsParameters.prototype.destroy
  44154. * @description 释放资源,将引用资源的属性置空。
  44155. */
  44156. destroy() {
  44157. super.destroy();
  44158. var me = this;
  44159. me.returnContent = null;
  44160. if (me.bounds) {
  44161. me.bounds = null;
  44162. }
  44163. }
  44164. }
  44165. ;// CONCATENATED MODULE: ./src/common/iServer/QueryServiceBase.js
  44166. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44167. * This program are made available under the terms of the Apache License, Version 2.0
  44168. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44169. /**
  44170. * @class QueryService
  44171. * @deprecatedclass SuperMap.QueryService
  44172. * @category iServer Map QueryResults
  44173. * @classdesc 查询服务基类。
  44174. * @extends {CommonServiceBase}
  44175. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  44176. * @param {Object} options - 参数。
  44177. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  44178. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  44179. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44180. * @param {Object} [options.headers] - 请求头。
  44181. * @example
  44182. * var myService = new QueryService(url, {
  44183. * eventListeners: {
  44184. * "processCompleted": queryCompleted,
  44185. * "processFailed": queryError
  44186. * }
  44187. * };
  44188. * @usage
  44189. */
  44190. class QueryServiceBase extends CommonServiceBase {
  44191. constructor(url, options) {
  44192. super(url, options);
  44193. /**
  44194. * @member {boolean} QueryService.prototype.returnContent
  44195. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  44196. */
  44197. this.returnContent = false;
  44198. /**
  44199. * @member {string} QueryService.prototype.format
  44200. * @description 查询结果返回格式,目前支持iServerJSON、GeoJSON、FGB三种格式。参数格式为"ISERVER","GEOJSON","FGB"。
  44201. */
  44202. this.format = DataFormat.GEOJSON;
  44203. this.returnFeatureWithFieldCaption = false;
  44204. if (options) {
  44205. Util_Util.extend(this, options);
  44206. }
  44207. this.CLASS_NAME = "SuperMap.QueryService";
  44208. if (!this.url) {
  44209. return;
  44210. }
  44211. if (options && options.format) {
  44212. this.format = options.format.toUpperCase();
  44213. }
  44214. this.url = Util_Util.urlPathAppend(this.url,'queryResults');
  44215. }
  44216. /**
  44217. * @function QueryService.prototype.destroy
  44218. * @description 释放资源,将引用资源的属性置空。
  44219. */
  44220. destroy() {
  44221. super.destroy();
  44222. var me = this;
  44223. me.returnContent = null;
  44224. me.format = null;
  44225. }
  44226. /**
  44227. * @function QueryService.prototype.processAsync
  44228. * @description 负责将客户端的查询参数传递到服务端。
  44229. * @param {QueryParameters} params - 查询参数。
  44230. */
  44231. processAsync(params) {
  44232. if (!(params instanceof QueryParameters)) {
  44233. return;
  44234. }
  44235. var me = this,
  44236. returnCustomResult = null,
  44237. jsonParameters = null;
  44238. me.returnContent = params.returnContent;
  44239. jsonParameters = me.getJsonParameters(params);
  44240. if (!me.returnContent) {
  44241. //仅供三维使用 获取高亮图片的bounds
  44242. returnCustomResult = params.returnCustomResult;
  44243. if (returnCustomResult) {
  44244. me.url = Util_Util.urlAppend(me.url, 'returnCustomResult=' + returnCustomResult);
  44245. }
  44246. }
  44247. me.returnFeatureWithFieldCaption = params.returnFeatureWithFieldCaption;
  44248. me.request({
  44249. method: "POST",
  44250. data: jsonParameters,
  44251. scope: me,
  44252. success: me.serviceProcessCompleted,
  44253. failure: me.serviceProcessFailed
  44254. });
  44255. }
  44256. /**
  44257. * @function QueryService.prototype.serviceProcessCompleted
  44258. * @description 查询完成,执行此方法。
  44259. * @param {Object} result - 服务器返回的结果对象。
  44260. */
  44261. serviceProcessCompleted(result, options) {
  44262. var me = this;
  44263. result = Util_Util.transformResult(result);
  44264. var geoJSONFormat = new GeoJSON();
  44265. if (result && result.recordsets) {
  44266. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  44267. if (recordsets[i].features) {
  44268. if (me.returnFeatureWithFieldCaption === true) {
  44269. recordsets[i].features.map((feature) => {
  44270. feature.fieldNames = recordsets[i].fieldCaptions;
  44271. return feature;
  44272. })
  44273. }
  44274. if (me.format === DataFormat.GEOJSON) {
  44275. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  44276. }
  44277. }
  44278. }
  44279. }
  44280. me.events.triggerEvent("processCompleted", {
  44281. result: result,
  44282. options
  44283. });
  44284. }
  44285. dataFormat() {
  44286. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  44287. }
  44288. /**
  44289. * @function QueryService.prototype.getQueryParameters
  44290. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  44291. * @param {Object} params - JSON 字符串表示的查询参数。
  44292. * @returns {QueryParameters} 返回转化后的 QueryParameters 对象。
  44293. */
  44294. getQueryParameters(params) {
  44295. return new QueryParameters({
  44296. customParams: params.customParams,
  44297. expectCount: params.expectCount,
  44298. networkType: params.networkType,
  44299. queryOption: params.queryOption,
  44300. queryParams: params.queryParams,
  44301. startRecord: params.startRecord,
  44302. prjCoordSys: params.prjCoordSys,
  44303. holdTime: params.holdTime
  44304. });
  44305. }
  44306. }
  44307. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsService.js
  44308. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44309. * This program are made available under the terms of the Apache License, Version 2.0
  44310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44311. /**
  44312. * @class QueryByBoundsService
  44313. * @deprecatedclass SuperMap.QueryByBoundsService
  44314. * @category iServer Map QueryResults
  44315. * @classdesc Bounds 查询服务类。
  44316. * @augments {QueryService}
  44317. * @example
  44318. * (start end)
  44319. * var myQueryByBoundsService = new QueryByBoundsService(url, {
  44320. * eventListeners: {
  44321. * "processCompleted": queryCompleted,
  44322. * "processFailed": queryError
  44323. * }
  44324. * });
  44325. * function queryCompleted(object){//todo};
  44326. * function queryError(object){//todo};
  44327. * (end)
  44328. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  44329. * @param {Object} options - 参数。
  44330. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  44331. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  44332. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44333. * @param {Object} [options.headers] - 请求头。
  44334. * @usage
  44335. */
  44336. class QueryByBoundsService extends QueryServiceBase {
  44337. constructor(url, options) {
  44338. super(url, options);
  44339. this.CLASS_NAME = "SuperMap.QueryByBoundsService";
  44340. }
  44341. /**
  44342. * @override
  44343. */
  44344. destroy() {
  44345. super.destroy();
  44346. }
  44347. /**
  44348. * @function QueryByBoundsService.prototype.getJsonParameters
  44349. * @description 将查询参数转化为 JSON 字符串。
  44350. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds 等)。
  44351. * @param {QueryByBoundsParameters} params - Bounds 查询参数。
  44352. * @returns {Object} 转化后的 JSON 字符串。
  44353. */
  44354. getJsonParameters(params) {
  44355. if (!(params instanceof QueryByBoundsParameters)) {
  44356. return null;
  44357. }
  44358. var me = this,
  44359. jsonParameters = "",
  44360. qp = null,
  44361. bounds = params.bounds;
  44362. qp = me.getQueryParameters(params);
  44363. jsonParameters += "'queryMode':'BoundsQuery','queryParameters':";
  44364. jsonParameters += Util_Util.toJSON(qp);
  44365. jsonParameters += ",'bounds': {'rightTop':{'y':" + bounds.top + ",'x':" +
  44366. bounds.right + "},'leftBottom':{'y':" + bounds.bottom + ",'x':" + bounds.left + "}}";
  44367. jsonParameters = "{" + jsonParameters + "}";
  44368. return jsonParameters;
  44369. }
  44370. }
  44371. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceParameters.js
  44372. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44373. * This program are made available under the terms of the Apache License, Version 2.0
  44374. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44375. /**
  44376. * @class QueryByDistanceParameters
  44377. * @deprecatedclass SuperMap.QueryByDistanceParameters
  44378. * @category iServer Map QueryResults
  44379. * @classdesc Distance 查询参数类。
  44380. * 该类用于设置 Distance 查询的相关参数。
  44381. * @extends {QueryParameters}
  44382. * @param {Object} options - 参数。
  44383. * @param {GeoJSONObject} options.geometry - 用于查询的几何对象。
  44384. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  44385. * @param {number} options.distance - 查询距离,单位与所查询图层对应的数据集单位相同。距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。此为必选参数。
  44386. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  44387. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  44388. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  44389. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  44390. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  44391. * @param {number} [options.startRecord=0] - 查询起始记录号。
  44392. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  44393. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  44394. * @param {boolean} [options.isNearest=false] - 是否为最近距离查询。
  44395. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  44396. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  44397. * @usage
  44398. */
  44399. class QueryByDistanceParameters extends QueryParameters {
  44400. constructor(options) {
  44401. options = options || {};
  44402. super(options);
  44403. /**
  44404. * @member {number} [QueryByDistanceParameters.prototype.distance=0]
  44405. * @description 查询距离,单位与所查询图层对应的数据集单位相同。
  44406. * 距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。
  44407. */
  44408. /**
  44409. * @member {GeoJSONObject} QueryByDistanceParameters.prototype.geometry
  44410. * @description 用于查询的地理对象。<br>
  44411. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。<br>
  44412. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  44413. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  44414. */
  44415. this.geometry = null;
  44416. /**
  44417. * @member {boolean} [QueryByDistanceParameters.prototype.isNearest=false]
  44418. * @description 是否为最近距离查询。<br>
  44419. * 建议该属性与 expectCount(继承自 {@link QueryParameters})属性联合使用。
  44420. * 当该属性为 true 时,即表示查找最近地物,如果查询结果数大于期望返回的结果记录数(expectCount),
  44421. * 则查找结果为查询总记录中距离中心最近的 expectCount 个地物。
  44422. * 当该属性为不为 true 时,如果查询结果数大于期望返回的结果记录数(expectCount),
  44423. * 则查找结果为从查询总记录中随机抽取的 expectCount 个地物。
  44424. * 目前查询结果不支持按远近距离排序。
  44425. */
  44426. this.isNearest = null;
  44427. /**
  44428. * @member {boolean} [QueryByDistanceParameters.prototype.returnContent=true]
  44429. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  44430. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  44431. * 为 false,则返回的是查询结果资源的 URI。
  44432. */
  44433. this.returnContent = true;
  44434. Util_Util.extend(this, options);
  44435. this.CLASS_NAME = "SuperMap.QueryByDistanceParameters";
  44436. }
  44437. /**
  44438. * @function QueryByDistanceParameters.prototype.destroy
  44439. * @description 释放资源,将引用资源的属性置空。
  44440. */
  44441. destroy() {
  44442. super.destroy();
  44443. var me = this;
  44444. me.returnContent = null;
  44445. me.distance = null;
  44446. me.isNearest = null;
  44447. if (me.geometry) {
  44448. me.geometry.destroy();
  44449. me.geometry = null;
  44450. }
  44451. }
  44452. }
  44453. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceService.js
  44454. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44455. * This program are made available under the terms of the Apache License, Version 2.0
  44456. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44457. /**
  44458. * @class QueryByDistanceService
  44459. * @deprecatedclass SuperMap.QueryByDistanceService
  44460. * @category iServer Map QueryResults
  44461. * @classdesc Distance查询服务类。
  44462. * @extends {QueryServiceBase}
  44463. * @example
  44464. * var myQueryByDistService = new QueryByDistanceService(url, {
  44465. * eventListeners: {
  44466. * "processCompleted": queryCompleted,
  44467. * "processFailed": queryError
  44468. * }
  44469. * });
  44470. * function queryCompleted(object){//todo};
  44471. * function queryError(object){//todo};
  44472. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  44473. * @param {Object} options - 参数。
  44474. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  44475. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  44476. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44477. * @param {Object} [options.headers] - 请求头。
  44478. * @usage
  44479. */
  44480. class QueryByDistanceService extends QueryServiceBase {
  44481. constructor(url, options) {
  44482. super(url, options);
  44483. this.CLASS_NAME = "SuperMap.QueryByDistanceService";
  44484. }
  44485. /**
  44486. * @override
  44487. */
  44488. destroy() {
  44489. super.destroy();
  44490. }
  44491. /**
  44492. * @function QueryByDistanceService.prototype.getJsonParameters
  44493. * @description 将查询参数转化为 JSON 字符串。
  44494. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  44495. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  44496. * @returns {Object} 转化后的 JSON 字符串。
  44497. */
  44498. getJsonParameters(params) {
  44499. if (!(params instanceof QueryByDistanceParameters)) {
  44500. return;
  44501. }
  44502. var me = this,
  44503. jsonParameters = "",
  44504. qp = me.getQueryParameters(params);
  44505. var sg = ServerGeometry.fromGeometry(params.geometry);
  44506. jsonParameters += params.isNearest ? "'queryMode':'FindNearest','queryParameters':" : "'queryMode':'DistanceQuery','queryParameters':";
  44507. jsonParameters += Util_Util.toJSON(qp);
  44508. jsonParameters += ",'geometry':" + Util_Util.toJSON(sg) + ",'distance':" + params.distance;
  44509. jsonParameters = "{" + jsonParameters + "}";
  44510. return jsonParameters;
  44511. }
  44512. }
  44513. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryParameters.js
  44514. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44515. * This program are made available under the terms of the Apache License, Version 2.0
  44516. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44517. /**
  44518. * @class QueryByGeometryParameters
  44519. * @deprecatedclass SuperMap.QueryByGeometryParameters
  44520. * @category iServer Map QueryResults
  44521. * @classdesc Geometry 查询参数类。
  44522. * 该类用于设置 Geometry查询的相关参数。
  44523. * @extends {QueryParameters}
  44524. * @param {Object} options - 参数。
  44525. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  44526. * @param {GeoJSONObject} options.geometry - 查询的几何对象。
  44527. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  44528. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  44529. * @param {Object} [options.prjCoordSys] -自定义参数,供SuperMap Online提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  44530. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  44531. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  44532. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  44533. * @param {number} [options.startRecord=0] - 查询起始记录号。
  44534. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  44535. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  44536. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  44537. * @param {SpatialQueryMode} [spatialQueryMode=SpatialQueryMode.INTERSECT] - 空间查询模式。
  44538. * @usage
  44539. */
  44540. class QueryByGeometryParameters extends QueryParameters {
  44541. constructor(options) {
  44542. options = options || {};
  44543. super(options);
  44544. /**
  44545. * @member {boolean} [QueryByGeometryParameters.prototype.returnContent=true]
  44546. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。<br>
  44547. * 如果为 true,则直接返回新创建资源,即查询结果的表述。<br>
  44548. * 为 false,则返回的是查询结果资源的 URI。
  44549. */
  44550. this.returnContent = true;
  44551. /**
  44552. * @member {GeoJSONObject} QueryByGeometryParameters.prototype.geometry
  44553. * @description 用于查询的几何对象。<br>
  44554. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLat}|{@link mapboxgl.Point}|{@link GeoJSONObject}。<br>
  44555. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  44556. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  44557. */
  44558. this.geometry = null;
  44559. /**
  44560. * @member {SpatialQueryMode} [QueryByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.INTERSECT]
  44561. * @description 空间查询模式。
  44562. */
  44563. this.spatialQueryMode = SpatialQueryMode.INTERSECT;
  44564. Util_Util.extend(this, options);
  44565. this.CLASS_NAME = "SuperMap.QueryByGeometryParameters";
  44566. }
  44567. /**
  44568. * @function QueryByGeometryParameters.prototype.destroy
  44569. * @description 释放资源,将引用资源的属性置空。
  44570. */
  44571. destroy() {
  44572. super.destroy();
  44573. var me = this;
  44574. me.returnContent = null;
  44575. me.geometry = null;
  44576. me.spatialQueryMode = null;
  44577. }
  44578. }
  44579. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryService.js
  44580. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44581. * This program are made available under the terms of the Apache License, Version 2.0
  44582. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44583. /**
  44584. * @class QueryByGeometryService
  44585. * @deprecatedclass SuperMap.QueryByGeometryService
  44586. * @category iServer Map QueryResults
  44587. * @classdesc Geometry查询服务类。
  44588. * @extends {QueryServiceBase}
  44589. * @example
  44590. * var myQueryByGeometryService = new QueryByGeometryService(url, {
  44591. * eventListeners: {
  44592. * "processCompleted": queryCompleted,
  44593. * "processFailed": queryError
  44594. * }
  44595. * });
  44596. * function queryCompleted(object){//todo};
  44597. * function queryError(object){//todo};
  44598. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  44599. * @param {Object} options - 参数。
  44600. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  44601. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  44602. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44603. * @param {Object} [options.headers] - 请求头。
  44604. * @usage
  44605. */
  44606. class QueryByGeometryService extends QueryServiceBase {
  44607. constructor(url, options) {
  44608. super(url, options);
  44609. this.CLASS_NAME = "SuperMap.QueryByGeometryService";
  44610. }
  44611. /**
  44612. * @override
  44613. */
  44614. destroy() {
  44615. super.destroy();
  44616. }
  44617. /**
  44618. * @function QueryByGeometryService.prototype.getJsonParameters
  44619. * @description 将查询参数转化为 JSON 字符串。
  44620. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  44621. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  44622. * @returns {Object} 转化后的 JSON 字符串。
  44623. */
  44624. getJsonParameters(params) {
  44625. if (!(params instanceof QueryByGeometryParameters)) {
  44626. return;
  44627. }
  44628. var me = this,
  44629. jsonParameters = "",
  44630. qp = null,
  44631. geometry = params.geometry,
  44632. sg = ServerGeometry.fromGeometry(geometry);
  44633. qp = me.getQueryParameters(params);
  44634. jsonParameters += "'queryMode':'SpatialQuery','queryParameters':";
  44635. jsonParameters += Util_Util.toJSON(qp) + ",'geometry':" + Util_Util.toJSON(sg)
  44636. + ",'spatialQueryMode':" + Util_Util.toJSON(params.spatialQueryMode);
  44637. jsonParameters = "{" + jsonParameters + "}";
  44638. return jsonParameters;
  44639. }
  44640. }
  44641. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLParameters.js
  44642. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44643. * This program are made available under the terms of the Apache License, Version 2.0
  44644. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44645. /**
  44646. * @class QueryBySQLParameters
  44647. * @deprecatedclass SuperMap.QueryBySQLParameters
  44648. * @category iServer Map QueryResults
  44649. * @classdesc SQL 查询参数类。
  44650. * 该类用于设置 SQL 查询的相关参数。
  44651. * @extends {QueryParameters}
  44652. * @param {Object} options - 参数。
  44653. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  44654. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  44655. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  44656. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  44657. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  44658. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  44659. * @param {number} [options.startRecord=0] - 查询起始记录号。
  44660. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  44661. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  44662. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  44663. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  44664. * @usage
  44665. */
  44666. class QueryBySQLParameters extends QueryParameters {
  44667. constructor(options) {
  44668. options = options || {};
  44669. super(options);
  44670. /**
  44671. * @member {boolean} [QueryBySQLParameters.prototype.returnContent=true]
  44672. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  44673. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  44674. * 为 false,则返回的是查询结果资源的 URI。
  44675. */
  44676. this.returnContent = true;
  44677. Util_Util.extend(this, options);
  44678. this.CLASS_NAME = "SuperMap.QueryBySQLParameters";
  44679. }
  44680. /**
  44681. * @function QueryBySQLParameters.prototype.destroy
  44682. * @description 释放资源,将引用资源的属性置空。
  44683. */
  44684. destroy() {
  44685. super.destroy();
  44686. var me = this;
  44687. me.returnContent = null;
  44688. }
  44689. }
  44690. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLService.js
  44691. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44692. * This program are made available under the terms of the Apache License, Version 2.0
  44693. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44694. /**
  44695. * @class QueryBySQLService
  44696. * @deprecatedclass SuperMap.QueryBySQLService
  44697. * @category iServer Map QueryResults
  44698. * @classdesc SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  44699. * @extends {QueryServiceBase}
  44700. * @example
  44701. * var queryParam = new FilterParameter({
  44702. * name: "Countries@World.1",
  44703. * attributeFilter: "Pop_1994>1000000000 and SmArea>900"
  44704. * });
  44705. * var queryBySQLParams = new QueryBySQLParameters({
  44706. * queryParams: [queryParam]
  44707. * });
  44708. * var myQueryBySQLService = new QueryBySQLService(url, {eventListeners: {
  44709. * "processCompleted": queryCompleted,
  44710. * "processFailed": queryError
  44711. * }
  44712. * });
  44713. * queryBySQLService.processAsync(queryBySQLParams);
  44714. * function queryCompleted(object){//todo};
  44715. * function queryError(object){//todo};
  44716. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  44717. * @param {Object} options - 参数。
  44718. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  44719. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  44720. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44721. * @param {Object} [options.headers] - 请求头。
  44722. * @usage
  44723. */
  44724. class QueryBySQLService extends QueryServiceBase {
  44725. constructor(url, options) {
  44726. super(url, options);
  44727. this.CLASS_NAME = "SuperMap.QueryBySQLService";
  44728. }
  44729. /**
  44730. * @override
  44731. */
  44732. destroy() {
  44733. super.destroy();
  44734. }
  44735. /**
  44736. * @function QueryBySQLService.prototype.getJsonParameters
  44737. * @description 将查询参数转化为 JSON 字符串。
  44738. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  44739. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  44740. * @returns {Object} 转化后的 JSON 字符串。
  44741. */
  44742. getJsonParameters(params) {
  44743. if (!(params instanceof QueryBySQLParameters)) {
  44744. return;
  44745. }
  44746. var me = this,
  44747. jsonParameters = "",
  44748. qp = null;
  44749. qp = me.getQueryParameters(params);
  44750. jsonParameters += "'queryMode':'SqlQuery','queryParameters':";
  44751. jsonParameters += Util_Util.toJSON(qp);
  44752. jsonParameters = "{" + jsonParameters + "}";
  44753. return jsonParameters;
  44754. }
  44755. }
  44756. ;// CONCATENATED MODULE: ./src/common/iServer/QueryService.js
  44757. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44758. * This program are made available under the terms of the Apache License, Version 2.0
  44759. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44760. /**
  44761. * @class QueryService
  44762. * @category iServer Map QueryResults
  44763. * @classdesc 地图查询服务类。
  44764. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  44765. * @extends {ServiceBase}
  44766. * @param {string} url - 服务地址。
  44767. * @param {Object} options - 参数。
  44768. * @param {string} [options.proxy] - 服务代理地址。
  44769. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  44770. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44771. * @param {Object} [options.headers] - 请求头。
  44772. * @example
  44773. * new QueryService(url)
  44774. * .queryByBounds(param,function(result){
  44775. * //doSomething
  44776. * })
  44777. * @usage
  44778. */
  44779. class QueryService_QueryService {
  44780. constructor(url, options) {
  44781. this.options = options || {};
  44782. this.url = url;
  44783. }
  44784. /**
  44785. * @function QueryService.prototype.queryByBounds
  44786. * @description Bounds 查询地图服务。
  44787. * @param {QueryByBoundsParameters} params - Bounds 查询参数类。
  44788. * @param {RequestCallback} callback - 回调函数。
  44789. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  44790. */
  44791. queryByBounds(params, callback, resultFormat) {
  44792. var me = this;
  44793. var queryService = new QueryByBoundsService(me.url, {
  44794. proxy: me.options.proxy,
  44795. withCredentials: me.options.withCredentials,
  44796. crossOrigin: me.options.crossOrigin,
  44797. headers: me.options.headers,
  44798. eventListeners: {
  44799. scope: me,
  44800. processCompleted: callback,
  44801. processFailed: callback
  44802. },
  44803. format: me._processFormat(resultFormat)
  44804. });
  44805. queryService.processAsync(params);
  44806. }
  44807. /**
  44808. * @function QueryService.prototype.queryByDistance
  44809. * @description 地图距离查询服务。
  44810. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  44811. * @param {RequestCallback} callback - 回调函数。
  44812. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型
  44813. */
  44814. queryByDistance(params, callback, resultFormat) {
  44815. var me = this;
  44816. var queryByDistanceService = new QueryByDistanceService(me.url, {
  44817. proxy: me.options.proxy,
  44818. withCredentials: me.options.withCredentials,
  44819. crossOrigin: me.options.crossOrigin,
  44820. headers: me.options.headers,
  44821. eventListeners: {
  44822. scope: me,
  44823. processCompleted: callback,
  44824. processFailed: callback
  44825. },
  44826. format: resultFormat
  44827. });
  44828. queryByDistanceService.processAsync(params);
  44829. }
  44830. /**
  44831. * @function QueryService.prototype.queryBySQL
  44832. * @description 地图 SQL 查询服务。
  44833. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  44834. * @param {RequestCallback} callback - 回调函数。
  44835. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  44836. */
  44837. queryBySQL(params, callback, resultFormat) {
  44838. var me = this;
  44839. var queryBySQLService = new QueryBySQLService(me.url, {
  44840. proxy: me.options.proxy,
  44841. withCredentials: me.options.withCredentials,
  44842. crossOrigin: me.options.crossOrigin,
  44843. headers: me.options.headers,
  44844. eventListeners: {
  44845. scope: me,
  44846. processCompleted: callback,
  44847. processFailed: callback
  44848. },
  44849. format: resultFormat
  44850. });
  44851. queryBySQLService.processAsync(params);
  44852. }
  44853. /**
  44854. * @function QueryService.prototype.queryByGeometry
  44855. * @description 地图几何查询服务。
  44856. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  44857. * @param {RequestCallback} callback - 回调函数。
  44858. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  44859. */
  44860. queryByGeometry(params, callback, resultFormat) {
  44861. var me = this;
  44862. var queryByGeometryService = new QueryByGeometryService(me.url, {
  44863. proxy: me.options.proxy,
  44864. withCredentials: me.options.withCredentials,
  44865. crossOrigin: me.options.crossOrigin,
  44866. headers: me.options.headers,
  44867. eventListeners: {
  44868. scope: me,
  44869. processCompleted: callback,
  44870. processFailed: callback
  44871. },
  44872. format: resultFormat
  44873. });
  44874. queryByGeometryService.processAsync(params);
  44875. }
  44876. _processFormat(resultFormat) {
  44877. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  44878. }
  44879. }
  44880. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureParameters.js
  44881. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44882. * This program are made available under the terms of the Apache License, Version 2.0
  44883. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44884. /**
  44885. * @class RouteCalculateMeasureParameters
  44886. * @deprecatedclass SuperMap.RouteCalculateMeasureParameters
  44887. * @category iServer SpatialAnalyst RouteCalculateMeasure
  44888. * @classdesc 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  44889. * @param {Object} options - 参数。
  44890. * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  44891. * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} options.point - 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  44892. * @param {number} [options.tolerance] - 容限值。
  44893. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。
  44894. * @usage
  44895. */
  44896. class RouteCalculateMeasureParameters {
  44897. constructor(options) {
  44898. if (!options) {
  44899. return this;
  44900. }
  44901. /**
  44902. * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteCalculateMeasureParameters.prototype.sourceRoute
  44903. * @description 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  44904. */
  44905. this.sourceRoute = null;
  44906. /**
  44907. * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} RouteCalculateMeasureParameters.prototype.point
  44908. * @description 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  44909. */
  44910. this.point = null;
  44911. /**
  44912. * @member {number} [RouteCalculateMeasureParameters.prototype.tolerance]
  44913. * @description 容限值。
  44914. */
  44915. this.tolerance = null;
  44916. /**
  44917. * @member {boolean} [RouteCalculateMeasureParameters.prototype.isIgnoreGap=false]
  44918. * @description 是否忽略子对象之间的距离。
  44919. */
  44920. this.isIgnoreGap = false;
  44921. Util_Util.extend(this, options);
  44922. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureParameters";
  44923. }
  44924. /**
  44925. * @function RouteCalculateMeasureParameters.prototype.destroy
  44926. * @description 释放资源,将引用资源的属性置空。
  44927. */
  44928. destroy() {
  44929. var me = this;
  44930. me.sourceRoute = null;
  44931. me.point = null;
  44932. if (me.tolerance) {
  44933. me.tolerance = null;
  44934. }
  44935. if (me.isIgnoreGap) {
  44936. me.isIgnoreGap = false;
  44937. }
  44938. }
  44939. }
  44940. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureService.js
  44941. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44942. * This program are made available under the terms of the Apache License, Version 2.0
  44943. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44944. /**
  44945. * @class RouteCalculateMeasureService
  44946. * @deprecatedclass SuperMap.RouteCalculateMeasureService
  44947. * @category iServer SpatialAnalyst RouteCalculateMeasure
  44948. * @classdesc 基于路由对象计算指定点 M 值操作的服务类。
  44949. * 该类负责将客户设置的计算指定点的 M 值参数传递给服务端,并接收服务端返回的
  44950. * 指定点的 M 值。通过该类支持的事件的监听函数参数获取。
  44951. * @extends {SpatialAnalystBase}
  44952. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  44953. * @param {Object} options - 参数。
  44954. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  44955. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  44956. * @param {Object} [options.headers] - 请求头。
  44957. * @example 实例化该类如下例所示:
  44958. * (start code)
  44959. * var parameters = new RouteCalculateMeasureParameters({
  44960. * "sourceRoute":{
  44961. * "type":"LINEM",
  44962. * "parts":[4],
  44963. * "points":[
  44964. * {
  44965. * "measure":0,
  44966. * "y":-6674.466867067764,
  44967. * "x":3817.3527876130133
  44968. * },
  44969. * {
  44970. * "measure":199.57954019411724,
  44971. * "y":-6670.830929417594,
  44972. * "x":3617.806369901496
  44973. * },
  44974. * {
  44975. * "measure":609.3656478634477,
  44976. * "y":-6877.837541432356,
  44977. * "x":3264.1498746678444
  44978. * },
  44979. * {
  44980. * "measure":936.0174126282958,
  44981. * "y":-7038.687780615184,
  44982. * "x":2979.846206068903
  44983. * }
  44984. * ]
  44985. * },
  44986. * "tolerance":1,
  44987. * "point":{
  44988. * "x":3330.7754269417,
  44989. * "y":-6838.8394457216
  44990. * },
  44991. * "isIgnoreGap":false
  44992. * });
  44993. *
  44994. * var routeCalculateMeasureService = new RouteCalculateMeasureService(spatialAnalystURL, {
  44995. * eventListeners:{
  44996. * processCompleted:calculateCompleted,
  44997. * processFailed:calculateFailded
  44998. * }
  44999. * );
  45000. * routeCalculateMeasureService.processAsync(parameters);
  45001. *
  45002. * //执行
  45003. * function calculateCompleted(){todo}
  45004. * function calculateFailded(){todo}
  45005. * (end)
  45006. * @usage
  45007. */
  45008. class RouteCalculateMeasureService extends SpatialAnalystBase {
  45009. constructor(url, options) {
  45010. super(url, options);
  45011. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureService";
  45012. }
  45013. /**
  45014. * @override
  45015. */
  45016. destroy() {
  45017. super.destroy();
  45018. }
  45019. /**
  45020. * @function RouteCalculateMeasureService.prototype.processAsync
  45021. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  45022. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  45023. */
  45024. processAsync(params) {
  45025. if (!(params instanceof RouteCalculateMeasureParameters)) {
  45026. return;
  45027. }
  45028. var me = this, jsonParameters;
  45029. jsonParameters = me.getJsonParameters(params);
  45030. me.request({
  45031. method: "POST",
  45032. data: jsonParameters,
  45033. scope: me,
  45034. success: me.serviceProcessCompleted,
  45035. failure: me.serviceProcessFailed
  45036. });
  45037. }
  45038. /**
  45039. * @function RouteCalculateMeasureService.prototype.getJsonParameters
  45040. * @description 将参数转化为 JSON 字符串。
  45041. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  45042. * @returns {Object} 转化后的 JSON 字符串。
  45043. */
  45044. getJsonParameters(params) {
  45045. var jsonParameters, jsonStr = "geometry/calculatemeasure", me = this;
  45046. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  45047. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  45048. jsonParameters = Util_Util.toJSON(params);
  45049. return jsonParameters;
  45050. }
  45051. }
  45052. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorParameters.js
  45053. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45054. * This program are made available under the terms of the Apache License, Version 2.0
  45055. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45056. /**
  45057. * @class RouteLocatorParameters
  45058. * @deprecatedclass SuperMap.RouteLocatorParameters
  45059. * @category iServer SpatialAnalyst RouteLocator
  45060. * @classdesc 路由对象定位空间对象的参数类。
  45061. * 参数有两种方式,分别为 Geometry 和 Dataset 两种,前者需要指定 sourceRoute 对象作为参数,后者需要 dataset,routeIDField,routeID 三个参数。如果用户两种参数均设置,优先选择 Dataset 方式。
  45062. * @param {Object} options - 参数。
  45063. * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。
  45064. * @param {number} options.measure - 定位点的 M 值。只当路由对象定位点时有意义。
  45065. * @param {string} [options.type] - 类型:点 or 线。
  45066. * @param {number} [options.offset=0] - 定位点偏移量。只当路由对象定位点时有意义。
  45067. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。即不忽略子对象之间的距离。
  45068. * @param {number} [options.startMeasure] - 定位线的起始 M 值。只当路由对象定位线时有意义。
  45069. * @param {number} [options.endMeasure] - 定位线的终止 M 值。只当路由对象定位线时有意义。
  45070. * @usage
  45071. */
  45072. class RouteLocatorParameters {
  45073. constructor(options) {
  45074. if (!options) {
  45075. return this;
  45076. }
  45077. /**
  45078. * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteLocatorParameters.prototype.sourceRoute
  45079. * @description 路由对象。
  45080. */
  45081. this.sourceRoute = null;
  45082. /**
  45083. * @member {string} RouteLocatorParameters.prototype.dataset
  45084. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  45085. */
  45086. this.dataset = null;
  45087. /**
  45088. * @member {string} RouteLocatorParameters.prototype.routeIDField
  45089. * @description 路由对象所在的字段名称。
  45090. *
  45091. */
  45092. this.routeIDField = null;
  45093. /**
  45094. * @member {number} RouteLocatorParameters.prototype.routeID
  45095. * @description 路由对象标识。
  45096. *
  45097. */
  45098. this.routeID = null;
  45099. /**
  45100. * @member {string} [RouteLocatorParameters.prototype.type]
  45101. * @description 类型:点 or 线。
  45102. * 可选值为:
  45103. * LINE :根据起始 M 值及终止 M 值定位线对象。
  45104. * POINT : 根据 M 值定位点对象。
  45105. */
  45106. this.type = null;
  45107. /**
  45108. * @member {number} RouteLocatorParameters.prototype.measure
  45109. * @description 定位点的 M 值。只当路由对象定位点时有意义。
  45110. */
  45111. this.measure = null;
  45112. /**
  45113. * @member {number} [RouteLocatorParameters.prototype.offset=0]
  45114. * @description 定位点偏移量。只当路由对象定位点时有意义。
  45115. */
  45116. this.offset = 0;
  45117. /**
  45118. * @member {boolean} [RouteLocatorParameters.prototype.isIgnoreGap=false]
  45119. * @description 是否忽略子对象之间的距离。
  45120. */
  45121. this.isIgnoreGap = false;
  45122. /**
  45123. * @member {number} [RouteLocatorParameters.prototype.startMeasure]
  45124. * @description 定位线的起始 M 值。只当路由对象定位线时有意义。
  45125. */
  45126. this.startMeasure = null;
  45127. /**
  45128. * @member {number} [RouteLocatorParameters.prototype.endMeasure]
  45129. * @description 定位线的终止 M 值。只当路由对象定位线时有意义。
  45130. */
  45131. this.endMeasure = null;
  45132. var routeFromClient = options.sourceRoute;
  45133. var routeHandle = {};
  45134. if (routeFromClient && routeFromClient instanceof Geometry_Geometry && routeFromClient.components) {
  45135. routeHandle.type = routeFromClient.type;
  45136. routeHandle.parts = routeFromClient.parts;
  45137. var parts = [];
  45138. for (var i = 0, len = routeFromClient.components.length; i < len; i++) {
  45139. parts = parts.concat(routeFromClient.components[i].components);
  45140. }
  45141. routeHandle.points = parts;
  45142. options.sourceRoute = routeHandle;
  45143. }
  45144. Util_Util.extend(this, options);
  45145. this.CLASS_NAME = "SuperMap.RouteLocatorParameters";
  45146. }
  45147. /**
  45148. * @function RouteLocatorParameters.prototype.destroy
  45149. * @description 释放资源,将引用资源的属性置空。
  45150. */
  45151. destroy() {
  45152. var me = this;
  45153. me.sourceRoute = null;
  45154. me.type = null;
  45155. me.measure = null;
  45156. me.offset = 0;
  45157. me.isIgnoreGap = false;
  45158. me.startMeasure = null;
  45159. me.endMeasure = null;
  45160. me.dataset = null;
  45161. me.routeID = null;
  45162. me.routeIDField = null;
  45163. }
  45164. }
  45165. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorService.js
  45166. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45167. * This program are made available under the terms of the Apache License, Version 2.0
  45168. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45169. /**
  45170. * @class RouteLocatorService
  45171. * @deprecatedclass SuperMap.RouteLocatorService
  45172. * @category iServer SpatialAnalyst RouteLocator
  45173. * @classdesc 路由对象定位空间对象的服务类。
  45174. * @extends {SpatialAnalystBase}
  45175. * @param {string} url -服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  45176. * @param {Object} options - 参数。
  45177. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  45178. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45179. * @param {Object} [options.headers] - 请求头。
  45180. * @example 实例化该类如下例所示:
  45181. * (start code)
  45182. * var routeLocatorParameters_point = new RouteLocatorParameters({
  45183. * "sourceRoute":{
  45184. * "type":"LINEM",
  45185. * "parts":[4],
  45186. * "points":[
  45187. * {
  45188. * "measure":0,
  45189. * "y":-6674.466867067764,
  45190. * "x":3817.3527876130133
  45191. * },
  45192. * {
  45193. * "measure":199.57954019411724,
  45194. * "y":-6670.830929417594,
  45195. * "x":3617.806369901496
  45196. * },
  45197. * {
  45198. * "measure":609.3656478634477,
  45199. * "y":-6877.837541432356,
  45200. * "x":3264.1498746678444
  45201. * },
  45202. * {
  45203. * "measure":936.0174126282958,
  45204. * "y":-7038.687780615184,
  45205. * "x":2979.846206068903
  45206. * }
  45207. * ]
  45208. * },
  45209. * "type":"POINT",
  45210. * "measure":10,
  45211. * "offset":3,
  45212. * "isIgnoreGap":true
  45213. * });
  45214. * var routeLocatorService = new RouteLocatorService(spatialAnalystURL, {
  45215. * eventListeners:{
  45216. * processCompleted:routeLocatorCompleted,
  45217. * processFailed:routeLocatorFailded
  45218. * }
  45219. * );
  45220. * routeLocatorService.processAsync(routeLocatorParameters_point);
  45221. *
  45222. * //执行
  45223. * function routeLocatorCompleted(){todo}
  45224. * function routeLocatorFailded(){todo}
  45225. * (end)
  45226. * @usage
  45227. */
  45228. class RouteLocatorService extends SpatialAnalystBase {
  45229. constructor(url, options) {
  45230. super(url, options);
  45231. this.CLASS_NAME = "SuperMap.RouteLocatorService";
  45232. }
  45233. /**
  45234. * @override
  45235. */
  45236. destroy() {
  45237. super.destroy();
  45238. }
  45239. /**
  45240. * @function RouteLocatorService.prototype.processAsync
  45241. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  45242. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  45243. */
  45244. processAsync(params) {
  45245. if (!(params instanceof RouteLocatorParameters)) {
  45246. return;
  45247. }
  45248. var me = this, jsonParameters;
  45249. jsonParameters = me.getJsonParameters(params);
  45250. me.request({
  45251. method: "POST",
  45252. data: jsonParameters,
  45253. scope: me,
  45254. success: me.serviceProcessCompleted,
  45255. failure: me.serviceProcessFailed
  45256. });
  45257. }
  45258. /**
  45259. * @function RouteLocatorService.prototype.processAsync
  45260. * @description 将参数转化为 JSON 字符串。
  45261. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  45262. * @returns {Object} 转化后的JSON字符串。
  45263. */
  45264. getJsonParameters(params) {
  45265. var jsonParameters, jsonStr = "geometry/routelocator", me = this;
  45266. if (params.dataset) {
  45267. jsonStr = "datasets/" + params.dataset + "/linearreferencing/routelocator";
  45268. params.sourceRoute = null;
  45269. }
  45270. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  45271. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  45272. jsonParameters = Util_Util.toJSON(params);
  45273. return jsonParameters;
  45274. }
  45275. }
  45276. ;// CONCATENATED MODULE: ./src/common/iServer/ServerFeature.js
  45277. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45278. * This program are made available under the terms of the Apache License, Version 2.0
  45279. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45280. /**
  45281. * @class ServerFeature
  45282. * @deprecatedclass SuperMap.ServerFeature
  45283. * @category iServer Data Feature
  45284. * @classdesc 服务端矢量要素类。该类描述了服务端返回的矢量要素的相关信息,包括字段和几何信息。
  45285. * @param {ServerGeometry} geometry - 矢量要素的几何信息。
  45286. * @param {Object} options - 参数。
  45287. * @param {Array.<string>} [options.fieldNames] - 矢量要素的属性字段名集合。
  45288. * @param {Array.<string>} [options.fieldValues] - 矢量要素的属性字段值集合。
  45289. * @usage
  45290. */
  45291. class ServerFeature {
  45292. constructor(options) {
  45293. /**
  45294. * @member {Array.<string>} [ServerFeature.prototype.fieldNames]
  45295. * @description 矢量要素的属性字段名集合。
  45296. */
  45297. this.fieldNames = null;
  45298. /**
  45299. * @member {Array.<string>} [ServerFeature.prototype.fieldValues]
  45300. * @description 矢量要素的属性字段值集合。
  45301. */
  45302. this.fieldValues = null;
  45303. /**
  45304. * @member {ServerGeometry} ServerFeature.prototype.geometry
  45305. * @description 矢量要素的几何信息。
  45306. */
  45307. this.geometry = null;
  45308. if (options) {
  45309. Util_Util.extend(this, options);
  45310. }
  45311. this.CLASS_NAME = "SuperMap.ServerFeature";
  45312. }
  45313. /**
  45314. * @function ServerFeature.prototype.destroy
  45315. * @description 释放资源,将引用资源的属性置空。
  45316. */
  45317. destroy() {
  45318. var me = this;
  45319. me.fieldNames = null;
  45320. me.fieldValues = null;
  45321. if (me.geometry) {
  45322. me.geometry.destroy();
  45323. me.geometry = null;
  45324. }
  45325. }
  45326. /**
  45327. * @function ServerFeature.prototype.toFeature
  45328. * @description 将服务端矢量要素 ServerFeature 转换为客户端矢量要素 Feature。
  45329. * @returns {Vector} 转换后的客户端矢量要素。
  45330. */
  45331. toFeature() {
  45332. var names, values, geo,
  45333. attr = {},
  45334. me = this,
  45335. feature;
  45336. names = me.fieldNames;
  45337. values = me.fieldValues;
  45338. for (var i in names) {
  45339. attr[names[i]] = values[i];
  45340. }
  45341. if (me.geometry) {
  45342. geo = me.geometry.toGeometry();
  45343. }
  45344. feature = new Vector(geo, attr);
  45345. if (me.geometry && me.geometry.id) {
  45346. feature.fid = me.geometry.id;
  45347. }
  45348. return feature;
  45349. }
  45350. /**
  45351. * @function ServerFeature.prototype.fromJson
  45352. * @description 将 JSON 对象表示服务端矢量要素转换为 ServerFeature。
  45353. * @param {Object} jsonObject - 要转换的 JSON 对象。
  45354. * @returns {ServerFeature} 转化后的 ServerFeature 对象。
  45355. */
  45356. static fromJson(jsonObject) {
  45357. var geo = null;
  45358. if (!jsonObject) {
  45359. return;
  45360. }
  45361. geo = jsonObject.geometry;
  45362. if (geo) {
  45363. geo = ServerGeometry.fromJson(geo);
  45364. }
  45365. return new ServerFeature({
  45366. fieldNames: jsonObject.fieldNames,
  45367. fieldValues: jsonObject.fieldValues,
  45368. geometry: geo
  45369. });
  45370. }
  45371. }
  45372. ;// CONCATENATED MODULE: ./src/common/iServer/SetDatasourceParameters.js
  45373. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45374. * This program are made available under the terms of the Apache License, Version 2.0
  45375. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45376. /**
  45377. * @class SetDatasourceParameters
  45378. * @deprecatedclass SuperMap.SetDatasourceParameters
  45379. * @category iServer Data Datasource
  45380. * @classdesc 设置数据源信息参数类。
  45381. * @param {Object} options - 参数。
  45382. * @param {string} options.datasourceName - 数据源名称。
  45383. * @param {string} options.description - 数据源描述信息。
  45384. * @param {string} options.coordUnit - 坐标单位。
  45385. * @param {string} options.distanceUnit - 距离单位。
  45386. * @usage
  45387. */
  45388. class SetDatasourceParameters {
  45389. constructor(options) {
  45390. if (!options) {
  45391. return;
  45392. }
  45393. /**
  45394. * @member {string} SetDatasourceParameters.prototype.datasourceName
  45395. * @description 数据源名称。
  45396. */
  45397. this.datasourceName = null;
  45398. /**
  45399. * @member {string} SetDatasourceParameters.prototype.description
  45400. * @description 数据源描述信息。
  45401. */
  45402. this.description = null;
  45403. /**
  45404. * @member {string} SetDatasourceParameters.prototype.coordUnit
  45405. * @description 坐标单位。
  45406. */
  45407. this.coordUnit = null;
  45408. /**
  45409. * @member {string} SetDatasourceParameters.prototype.distanceUnit
  45410. * @description 距离单位。
  45411. */
  45412. this.distanceUnit = null;
  45413. if (options) {
  45414. Util_Util.extend(this, options);
  45415. }
  45416. this.CLASS_NAME = "SuperMap.SetDatasourceParameters";
  45417. }
  45418. /**
  45419. * @function SetDatasourceParameters.prototype.destroy
  45420. * @description 释放资源,将引用资源的属性置空。
  45421. */
  45422. destroy() {
  45423. var me = this;
  45424. me.datasourceName = null;
  45425. me.description = null;
  45426. me.coordUnit = null;
  45427. me.distanceUnit = null;
  45428. }
  45429. }
  45430. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoParameters.js
  45431. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45432. * This program are made available under the terms of the Apache License, Version 2.0
  45433. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45434. /**
  45435. * @class SetLayerInfoParameters
  45436. * @deprecatedclass SuperMap.SetLayerInfoParameters
  45437. * @category iServer Map TempLayersSet
  45438. * @classdesc 设置图层信息参数类。
  45439. * @param {Object} options - 参数。
  45440. * @param {string} options.resourceID - 临时图层的资源 ID。
  45441. * @param {string} options.tempLayerName - 临时图层下的子图层名。
  45442. * @param {string} options.layerInfo - 要更新的图层信息。
  45443. * @usage
  45444. */
  45445. class SetLayerInfoParameters {
  45446. constructor(options) {
  45447. options = options || {};
  45448. /**
  45449. * @member {string} SetLayerInfoParameters.prototype.resourceID
  45450. * @description 临时图层的资源 ID。
  45451. */
  45452. this.resourceID = null;
  45453. /**
  45454. * @member {string} SetLayerInfoParameters.prototype.tempLayerName
  45455. * @description 临时图层下子图层(或者其子图层)名,如:Countries@World.3@@World。
  45456. */
  45457. this.tempLayerName = null;
  45458. /**
  45459. * @member {Object} SetLayerInfoParameters.prototype.layerInfo
  45460. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  45461. */
  45462. this.layerInfo = null;
  45463. Util_Util.extend(this, options);
  45464. this.CLASS_NAME = "SuperMap.SetLayerInfoParameters";
  45465. }
  45466. /**
  45467. * @function SetLayerInfoParameters.prototype.destroy
  45468. * @description 释放资源,将引用资源的属性置空。
  45469. */
  45470. destroy() {
  45471. var me = this;
  45472. me.resourceID = null;
  45473. me.tempLayerName = null;
  45474. me.layerInfo = null;
  45475. }
  45476. }
  45477. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoService.js
  45478. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45479. * This program are made available under the terms of the Apache License, Version 2.0
  45480. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45481. /**
  45482. * @class SetLayerInfoService
  45483. * @deprecatedclass SuperMap.SetLayerInfoService
  45484. * @category iServer Map TempLayersSet
  45485. * @classdesc 设置图层信息服务类。可以实现临时图层中子图层的修改
  45486. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  45487. * @extends {CommonServiceBase}
  45488. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  45489. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World";
  45490. * @param {Object} options - 参数。
  45491. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  45492. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  45493. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45494. * @param {Object} [options.headers] - 请求头。
  45495. * @usage
  45496. */
  45497. class SetLayerInfoService extends CommonServiceBase {
  45498. constructor(url, options) {
  45499. super(url, options);
  45500. if (options) {
  45501. Util_Util.extend(this, options);
  45502. }
  45503. this.CLASS_NAME = "SuperMap.SetLayerInfoService";
  45504. }
  45505. /**
  45506. * @override
  45507. */
  45508. destroy() {
  45509. super.destroy();
  45510. Util_Util.reset(this);
  45511. }
  45512. /**
  45513. * @function SetLayerInfoService.prototype.processAsync
  45514. * @description 负责将客户端的更新参数传递到服务端。
  45515. * @param {Object} params - 修改后的图层资源信息。
  45516. * 该参数可以使用获取图层信息服务<{@link GetLayersInfoService}>返回图层信息,解析结果result.subLayers.layers[i],然后对其属性进行修改来获取。
  45517. */
  45518. processAsync(params) {
  45519. if (!params) {
  45520. return;
  45521. }
  45522. var me = this;
  45523. var jsonParamsStr = Util_Util.toJSON(params);
  45524. me.request({
  45525. method: "PUT",
  45526. data: jsonParamsStr,
  45527. scope: me,
  45528. success: me.serviceProcessCompleted,
  45529. failure: me.serviceProcessFailed
  45530. });
  45531. }
  45532. }
  45533. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoParameters.js
  45534. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45535. * This program are made available under the terms of the Apache License, Version 2.0
  45536. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45537. /**
  45538. * @class SetLayersInfoParameters
  45539. * @deprecatedclass SuperMap.SetLayersInfoParameters
  45540. * @category iServer Map TempLayersSet
  45541. * @classdesc 设置图层信息参数类。
  45542. * @param {Object} options - 参数。
  45543. * @param {boolean} [options.isTempLayers=false] - 是否是临时图层。
  45544. * @param {string} options.resourceID - 临时图层资源 ID。
  45545. * @param {Object} options.layersInfo - 要更新的图层信息。
  45546. * @usage
  45547. */
  45548. class SetLayersInfoParameters {
  45549. constructor(options) {
  45550. options = options || {};
  45551. /**
  45552. * @member {boolean} [SetLayersInfoParameters.prototype.isTempLayers=false]
  45553. * @description 是否是临时图层。
  45554. */
  45555. this.isTempLayers = null;
  45556. /**
  45557. * @member {string} SetLayersInfoParameters.prototype.resourceID
  45558. * @description 临时图层资源 ID。
  45559. */
  45560. this.resourceID = null;
  45561. /**
  45562. * @member {Object} SetLayersInfoParameters.prototype.layersInfo
  45563. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  45564. */
  45565. this.layersInfo = null;
  45566. Util_Util.extend(this, options);
  45567. this.CLASS_NAME = "SuperMap.SetLayersInfoParameters";
  45568. }
  45569. /**
  45570. * @function SetLayersInfoParameters.prototype.destroy
  45571. * @description 释放资源,将引用资源的属性置空。
  45572. */
  45573. destroy() {
  45574. var me = this;
  45575. me.isTempLayers = null;
  45576. me.resourceID = null;
  45577. me.layersInfo = null;
  45578. }
  45579. }
  45580. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoService.js
  45581. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45582. * This program are made available under the terms of the Apache License, Version 2.0
  45583. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45584. /**
  45585. * @class SetLayersInfoService
  45586. * @deprecatedclass SuperMap.SetLayersInfoService
  45587. * @category iServer Map TempLayersSet
  45588. * @classdesc 设置图层信息服务类。可以实现创建新的临时图层和对现有临时图层的修改,
  45589. * 当 isTempLayers 为 false的时候执行创建临时图层。当 isTempLayers 为 ture 并且临时图层资源 resourceID 被设置有效时执行对临时图层的编辑。
  45590. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  45591. * @extends {CommonServiceBase}
  45592. * @param url - {string} 服务地址。请求地图服务,URL 应为:
  45593. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  45594. * @param {Object} options - 参数。
  45595. * @param {string} options.resourceID - 图层资源ID,临时图层的资源ID标记。
  45596. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  45597. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  45598. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  45599. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45600. * @param {Object} [options.headers] - 请求头。
  45601. * @usage
  45602. */
  45603. class SetLayersInfoService extends CommonServiceBase {
  45604. constructor(url, options) {
  45605. super(url, options);
  45606. /**
  45607. * @member {string} SetLayersInfoService.prototype.resourceID
  45608. * @description 图层资源ID,临时图层的资源ID标记。
  45609. */
  45610. this.resourceID = null;
  45611. /**
  45612. * @function {boolean} SetLayersInfoService.prototype.isTempLayers
  45613. * @description 当前url对应的图层是否是临时图层。
  45614. */
  45615. this.isTempLayers = false;
  45616. if (options) {
  45617. Util_Util.extend(this, options);
  45618. }
  45619. this.CLASS_NAME = "SuperMap.SetLayersInfoService";
  45620. }
  45621. /**
  45622. * @override
  45623. */
  45624. destroy() {
  45625. super.destroy();
  45626. Util_Util.reset(this);
  45627. }
  45628. /**
  45629. * @function SetLayersInfoService.prototype.processAsync
  45630. * @description 负责将客户端的更新参数传递到服务端。
  45631. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务 <{@link GetLayersInfoService}>返回图层信息,然后对其属性进行修改来获取。
  45632. */
  45633. processAsync(params) {
  45634. if (!params) {
  45635. return;
  45636. }
  45637. var jsonParams,
  45638. subLayers = [],
  45639. me = this,
  45640. method = "";
  45641. //创建临时图层和设置修改临时图层信息对应不同的资源URL
  45642. if (me.isTempLayers) {
  45643. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + me.resourceID);
  45644. method = "PUT";
  45645. } else {
  45646. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet");
  45647. method = "POST";
  45648. }
  45649. if (!params.subLayers) {
  45650. params.subLayers = {layers: []}
  45651. }
  45652. if (!params.subLayers.layers) {
  45653. params.subLayers.layers = [];
  45654. }
  45655. var layers = params.subLayers.layers,
  45656. len = layers.length;
  45657. for (let i in layers) {
  45658. if (layers[i].ugcLayerType === "GRID") {
  45659. var colorDictionary = {};
  45660. var colorDics = layers[i].colorDictionarys;
  45661. for (var j in colorDics) {
  45662. var key = colorDics[j].elevation;
  45663. colorDictionary[key] = colorDics[j].color;
  45664. }
  45665. }
  45666. layers[i].colorDictionary = colorDictionary;
  45667. delete layers[i].colorDictionarys;
  45668. }
  45669. for (let i = 0; i < len; i++) {
  45670. if (layers[i].toJsonObject) {
  45671. //将图层信息转换成服务端能识别的简单json对象
  45672. subLayers.push(layers[i].toJsonObject());
  45673. } else {
  45674. subLayers.push(layers[i]);
  45675. }
  45676. }
  45677. jsonParams = Util_Util.extend(jsonParams, params);
  45678. jsonParams.subLayers = {"layers": subLayers};
  45679. jsonParams.object = null;
  45680. var jsonParamsStr = Util_Util.toJSON([jsonParams]);
  45681. me.request({
  45682. method: method,
  45683. data: jsonParamsStr,
  45684. scope: me,
  45685. success: me.serviceProcessCompleted,
  45686. failure: me.serviceProcessFailed
  45687. });
  45688. }
  45689. }
  45690. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusParameters.js
  45691. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45692. * This program are made available under the terms of the Apache License, Version 2.0
  45693. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45694. /**
  45695. * @class SetLayerStatusParameters
  45696. * @deprecatedclass SuperMap.SetLayerStatusParameters
  45697. * @category iServer Map TempLayersSet
  45698. * @classdesc 子图层显示控制参数类,该类存储了各子图层是否可见的状态。
  45699. * 注意在 SuperMap iClient 系列产品中所说的图层与 SuperMap Deskpro 的地图对应,子图层与 SuperMap Deskpro 的图层对应。
  45700. * @param {Object} options - 参数。
  45701. * @param {Array.<LayerStatus>} options.layerStatusList - 获取或设置图层可见状态({@link LayerStatus})集合,
  45702. * 集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
  45703. * @param {number} [options.holdTime=15] - 获取或设置资源在服务端保存的时间。
  45704. * @param {string} [options.resourceID] - 获取或设置资源服务 ID。
  45705. * @usage
  45706. */
  45707. class SetLayerStatusParameters {
  45708. constructor(options) {
  45709. /**
  45710. * @member {Array.<LayerStatus>} SetLayerStatusParameters.prototype.layerStatusList
  45711. * @description 获取或设置图层可见状态({@link LayerStatus})集合,集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
  45712. */
  45713. this.layerStatusList = [];
  45714. /**
  45715. * @member {number} [SetLayerStatusParameters.prototype.holdTime=15]
  45716. * @description 获取或设置资源在服务端保存的时间。单位为分钟。
  45717. */
  45718. this.holdTime = 15;
  45719. /**
  45720. * @member {string} SetLayerStatusParameters.prototype.resourceID
  45721. * @description 获取或设置资源服务ID。如果设置该参数则会在指定的 TempLayer 中进行图层的显示控制;
  45722. * 如果不设置该参数,则会首先创建一个 TempLayer ,然后在新创建的 TempLayer 中进行图层的显示控制。
  45723. */
  45724. this.resourceID = null;
  45725. if (options) {
  45726. Util_Util.extend(this, options);
  45727. }
  45728. }
  45729. /**
  45730. * @function SetLayerStatusParameters.prototype.destroy
  45731. * @description 释放资源,将引用资源的属性置空。
  45732. */
  45733. destroy() {
  45734. var me = this;
  45735. me.layerStatusList = null;
  45736. me.holdTime = null;
  45737. me.resourceID = null;
  45738. }
  45739. /**
  45740. * @function SetLayerStatusParameters.prototype.toJSON
  45741. * @description 生成 JSON。
  45742. * @returns {Object} 对应的 JSON 对象。
  45743. */
  45744. toJSON() {
  45745. var json = '{';
  45746. json += '"layers":[';
  45747. var v = [];
  45748. for (var i = 0, len = this.layerStatusList.length; i < len; i++) {
  45749. v.push(this.layerStatusList[i].toJSON());
  45750. }
  45751. json += v;
  45752. json += ']';
  45753. json += '}';
  45754. return json;
  45755. }
  45756. }
  45757. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusService.js
  45758. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45759. * This program are made available under the terms of the Apache License, Version 2.0
  45760. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45761. /**
  45762. * @class SetLayerStatusService
  45763. * @deprecatedclass SuperMap.SetLayerStatusService
  45764. * @category iServer Map TempLayersSet
  45765. * @classdesc 子图层显示控制服务类。该类负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  45766. * 用户获取服务端返回的各子图层显示状态有两种方式:
  45767. * 一种是通过监听 SetLayerEvent.PROCESS_COMPLETE 事件;
  45768. * 一种是使用 AsyncResponder 类实现异步处理。
  45769. * @extends {CommonServiceBase}
  45770. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  45771. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  45772. * @param {Object} options - 参数。
  45773. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  45774. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  45775. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45776. * @param {Object} [options.headers] - 请求头。
  45777. * @usage
  45778. */
  45779. class SetLayerStatusService extends CommonServiceBase {
  45780. constructor(url, options) {
  45781. super(url, options);
  45782. this.lastparams = null;
  45783. this.mapUrl = url;
  45784. if (options) {
  45785. Util_Util.extend(this, options);
  45786. }
  45787. this.CLASS_NAME = "SuperMap.SetLayerStatusService";
  45788. }
  45789. /**
  45790. * @override
  45791. */
  45792. destroy() {
  45793. super.destroy();
  45794. Util_Util.reset(this);
  45795. }
  45796. /**
  45797. * @function SetLayerStatusService.prototype.processAsync
  45798. * @description 负责将客户端的更新参数传递到服务端。
  45799. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务{@link SetLayerStatusParameters}
  45800. * 返回图层信息,然后对其属性进行修改来获取。
  45801. */
  45802. processAsync(params) {
  45803. if (!(params instanceof SetLayerStatusParameters)) {
  45804. return;
  45805. }
  45806. var me = this,
  45807. method = "POST";
  45808. me.url = me.mapUrl;
  45809. if (params.resourceID == null) {
  45810. me.url = Util_Util.urlPathAppend(me.url, 'tempLayersSet');
  45811. me.lastparams = params;
  45812. me.request({
  45813. method: method,
  45814. scope: me,
  45815. success: me.createTempLayerComplete,
  45816. failure: me.serviceProcessFailed
  45817. });
  45818. } else {
  45819. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + params.resourceID);
  45820. me.url = Util_Util.urlAppend(me.url, "elementRemain=true&reference=" + params.resourceID + "&holdTime=" + params.holdTime.toString());
  45821. var jsonParameters = '[{';
  45822. jsonParameters += '"type":"UGC",';
  45823. if (params.layerStatusList != null && params.layerStatusList.length > 0) {
  45824. jsonParameters += '"subLayers":' + params.toJSON();
  45825. }
  45826. jsonParameters += ',"visible":' + true + ',';
  45827. jsonParameters += '"name":"' + this.getMapName(this.mapUrl) + '"';
  45828. jsonParameters += '}]';
  45829. me.request({
  45830. method: "PUT",
  45831. data: jsonParameters,
  45832. scope: me,
  45833. success: me.serviceProcessCompleted,
  45834. failure: me.serviceProcessFailed
  45835. });
  45836. }
  45837. }
  45838. /**
  45839. * @function SetLayerStatusService.prototype.createTempLayerComplete
  45840. * @description 设置完成,执行此方法。
  45841. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  45842. */
  45843. createTempLayerComplete(result) {
  45844. var me = this;
  45845. result = Util_Util.transformResult(result);
  45846. if (result.succeed) {
  45847. me.lastparams.resourceID = result.newResourceID;
  45848. }
  45849. me.processAsync(me.lastparams);
  45850. }
  45851. /**
  45852. * @function SetLayerStatusService.prototype.getMapName
  45853. * @description 获取地图名称。
  45854. * @param {Object} url - 服务地址。
  45855. */
  45856. getMapName(url) {
  45857. var mapUrl = url;
  45858. if (mapUrl.charAt(mapUrl.length - 1) === "/") {
  45859. mapUrl = mapUrl.substr(0, mapUrl.length - 1);
  45860. }
  45861. var index = mapUrl.lastIndexOf("/");
  45862. var mapName = mapUrl.substring(index + 1, mapUrl.length);
  45863. return mapName;
  45864. }
  45865. /**
  45866. * @function SetLayerStatusService.prototype.setLayerCompleted
  45867. * @description 设置完成,执行此方法。
  45868. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  45869. */
  45870. serviceProcessCompleted(result, options) {
  45871. var me = this;
  45872. result = Util_Util.transformResult(result);
  45873. if (result != null && me.lastparams != null) {
  45874. result.newResourceID = me.lastparams.resourceID;
  45875. }
  45876. me.events.triggerEvent("processCompleted", {result: result, options});
  45877. }
  45878. }
  45879. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  45880. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45881. * This program are made available under the terms of the Apache License, Version 2.0
  45882. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45883. /**
  45884. * @class SingleObjectQueryJobsParameter
  45885. * @deprecatedclass SuperMap.SingleObjectQueryJobsParameter
  45886. * @category iServer ProcessingService Query
  45887. * @classdesc 单对象空间查询分析任务参数类。
  45888. * @param {Object} options - 参数。
  45889. * @param {string} options.datasetName - 数据集名。
  45890. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  45891. * @param {SpatialQueryMode} [options.mode=SpatialQueryMode.CONTAIN] - 空间查询模式。
  45892. * @param {OutputSetting} [options.output] - 输出参数设置。
  45893. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  45894. * @usage
  45895. */
  45896. class SingleObjectQueryJobsParameter {
  45897. constructor(options) {
  45898. if (!options) {
  45899. return;
  45900. }
  45901. /**
  45902. * @member {string} SingleObjectQueryJobsParameter.prototype.datasetName
  45903. * @description 数据集名。
  45904. */
  45905. this.datasetName = "";
  45906. /**
  45907. * @member {string} SingleObjectQueryJobsParameter.prototype.datasetQuery
  45908. * @description 查询对象所在的数据集名称。
  45909. */
  45910. this.datasetQuery = "";
  45911. /**
  45912. * @member {string} SingleObjectQueryJobsParameter.prototype.geometryQuery
  45913. * @description 查询对象所在的几何对象。
  45914. */
  45915. this.geometryQuery = "";
  45916. /**
  45917. * @member {SpatialQueryMode} [SingleObjectQueryJobsParameter.prototype.mode=SpatialQueryMode.CONTAIN]
  45918. * @description 空间查询模式 。
  45919. */
  45920. this.mode = SpatialQueryMode.CONTAIN;
  45921. /**
  45922. * @member {OutputSetting} [SingleObjectQueryJobsParameter.prototype.output]
  45923. * @description 输出参数设置类。
  45924. */
  45925. this.output = null;
  45926. /**
  45927. * @member {MappingParameters} [SingleObjectQueryJobsParameter.prototype.mappingParameters]
  45928. * @description 分析后结果可视化的参数类。
  45929. */
  45930. this.mappingParameters = null;
  45931. Util_Util.extend(this, options);
  45932. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  45933. }
  45934. /**
  45935. * @function SingleObjectQueryJobsParameter.prototype.destroy
  45936. * @description 释放资源,将引用资源的属性置空。
  45937. */
  45938. destroy() {
  45939. this.datasetName = null;
  45940. this.datasetQuery = null;
  45941. this.geometryQuery = null;
  45942. this.mode = null;
  45943. if (this.output instanceof OutputSetting) {
  45944. this.output.destroy();
  45945. this.output = null;
  45946. }
  45947. if (this.mappingParameters instanceof MappingParameters){
  45948. this.mappingParameters.destroy();
  45949. this.mappingParameters = null;
  45950. }
  45951. }
  45952. /**
  45953. * @function SingleObjectQueryJobsParameter.toObject
  45954. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  45955. * @param {Object} tempObj - 目标对象。
  45956. * @description 生成单对象空间查询分析任务对象。
  45957. */
  45958. static toObject(singleObjectQueryJobsParameter, tempObj) {
  45959. for (var name in singleObjectQueryJobsParameter) {
  45960. if (name === "datasetName") {
  45961. tempObj['input'] = tempObj['input'] || {};
  45962. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  45963. continue;
  45964. }
  45965. if (name === "output"){
  45966. tempObj['output'] = tempObj['output'] || {};
  45967. tempObj['output'] = singleObjectQueryJobsParameter[name];
  45968. continue;
  45969. }
  45970. tempObj['analyst'] = tempObj['analyst'] || {};
  45971. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  45972. if(name === 'mappingParameters'){
  45973. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  45974. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  45975. }
  45976. }
  45977. }
  45978. }
  45979. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  45980. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45981. * This program are made available under the terms of the Apache License, Version 2.0
  45982. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45983. /**
  45984. * @class SingleObjectQueryJobsService
  45985. * @deprecatedclass SuperMap.SingleObjectQueryJobsService
  45986. * @category iServer ProcessingService Query
  45987. * @classdesc 单对象查询分析服务类
  45988. * @extends {ProcessingServiceBase}
  45989. * @param {string} url - 服务地址。
  45990. * @param {Object} options - 可选参数。
  45991. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  45992. * @param {Object} [options.headers] - 请求头。
  45993. * @usage
  45994. */
  45995. class SingleObjectQueryJobsService extends ProcessingServiceBase {
  45996. constructor(url, options) {
  45997. super(url, options);
  45998. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/query');
  45999. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  46000. }
  46001. /**
  46002. *@override
  46003. */
  46004. destroy() {
  46005. super.destroy();
  46006. }
  46007. /**
  46008. * @function SingleObjectQueryJobsService.protitype.getQueryJobs
  46009. * @description 获取单对象空间查询分析所有任务
  46010. */
  46011. getQueryJobs() {
  46012. super.getJobs(this.url);
  46013. }
  46014. /**
  46015. * @function KernelDensityJobsService.protitype.getQueryJob
  46016. * @description 获取指定id的单对象空间查询分析服务
  46017. * @param {string} id - 指定要获取数据的id
  46018. */
  46019. getQueryJob(id) {
  46020. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  46021. }
  46022. /**
  46023. * @function SingleObjectQueryJobsService.protitype.addQueryJob
  46024. * @description 新建单对象空间查询分析服务
  46025. * @param {SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  46026. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  46027. */
  46028. addQueryJob(params, seconds) {
  46029. super.addJob(this.url, params, SingleObjectQueryJobsParameter, seconds);
  46030. }
  46031. }
  46032. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryParameters.js
  46033. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46034. * This program are made available under the terms of the Apache License, Version 2.0
  46035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46036. /**
  46037. * @class StopQueryParameters
  46038. * @deprecatedclass SuperMap.StopQueryParameters
  46039. * @category iServer TrafficTransferAnalyst TransferStops
  46040. * @classdesc 站点查询参数类。
  46041. * @param {Object} options - 参数。
  46042. * @param {string} options.keyWord - 站点名称关键字。
  46043. * @param {boolean} [options.returnPosition=false] - 是否返回站点坐标信息。
  46044. * @usage
  46045. */
  46046. class StopQueryParameters {
  46047. constructor(options) {
  46048. options = options || {};
  46049. /**
  46050. * @member {string} StopQueryParameters.prototype.keyWord
  46051. * @description 站点名称关键字。
  46052. */
  46053. this.keyWord = null;
  46054. /**
  46055. * @member {boolean} [StopQueryParameters.prototype.returnPosition=false]
  46056. * @description 是否返回站点坐标信息。
  46057. */
  46058. this.returnPosition = false;
  46059. Util_Util.extend(this, options);
  46060. this.CLASS_NAME = "SuperMap.StopQueryParameters";
  46061. }
  46062. /**
  46063. * @function StopQueryParameters.prototype.destroy
  46064. * @description 释放资源,将引用资源的属性置空。
  46065. */
  46066. destroy() {
  46067. Util_Util.reset(this);
  46068. }
  46069. }
  46070. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryService.js
  46071. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46072. * This program are made available under the terms of the Apache License, Version 2.0
  46073. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46074. /**
  46075. * @class StopQueryService
  46076. * @deprecatedclass SuperMap.StopQueryService
  46077. * @category iServer TrafficTransferAnalyst TransferStops
  46078. * @classdesc 站点查询服务类。
  46079. * 返回结果通过该类支持的事件的监听函数参数获取
  46080. * @extends {CommonServiceBase}
  46081. * @param {string} url - 服务地址。
  46082. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  46083. * @param {Object} options - 参数。
  46084. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  46085. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46086. * @param {Object} [options.headers] - 请求头。
  46087. * @example 例如:
  46088. * (start code)
  46089. * var myService = new StopQueryService(url, {eventListeners: {
  46090. * "processCompleted": StopQueryCompleted,
  46091. * "processFailed": StopQueryError
  46092. * }
  46093. * };
  46094. * (end)
  46095. * @usage
  46096. *
  46097. */
  46098. class StopQueryService extends CommonServiceBase {
  46099. constructor(url, options) {
  46100. super(url, options);
  46101. options = options || {};
  46102. Util_Util.extend(this, options);
  46103. this.CLASS_NAME = "SuperMap.StopQueryService";
  46104. }
  46105. /**
  46106. *@override
  46107. */
  46108. destroy() {
  46109. super.destroy();
  46110. Util_Util.reset(this);
  46111. }
  46112. /**
  46113. * @function StopQueryService.prototype.processAsync
  46114. * @description 负责将客户端的更新参数传递到服务端。
  46115. * @param {StopQueryParameters} params - 交通换乘参数。
  46116. */
  46117. processAsync(params) {
  46118. if (!(params instanceof StopQueryParameters)) {
  46119. return;
  46120. }
  46121. var me = this;
  46122. me.url = Util_Util.urlPathAppend(me.url, 'stops/keyword/' + params.keyWord);
  46123. me.request({
  46124. method: "GET",
  46125. params: {returnPosition: params.returnPosition},
  46126. scope: me,
  46127. success: me.serviceProcessCompleted,
  46128. failure: me.serviceProcessFailed
  46129. });
  46130. }
  46131. }
  46132. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  46133. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46134. * This program are made available under the terms of the Apache License, Version 2.0
  46135. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46136. /**
  46137. * @class SummaryAttributesJobsParameter
  46138. * @deprecatedclass SuperMap.SummaryAttributesJobsParameter
  46139. * @category iServer ProcessingService SummaryAttributes
  46140. * @classdesc 属性汇总分析任务参数类。
  46141. * @param {Object} options - 参数。
  46142. * @param {string} options.datasetName - 数据集名。
  46143. * @param {string} options.groupField - 分组字段。
  46144. * @param {string} options.attributeField - 属性字段。
  46145. * @param {string} options.statisticModes - 统计模式。
  46146. * @param {OutputSetting} [options.output] -输出参数设置。
  46147. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  46148. * @usage
  46149. */
  46150. class SummaryAttributesJobsParameter {
  46151. constructor(options) {
  46152. if (!options) {
  46153. return;
  46154. }
  46155. /**
  46156. * @member {string} SummaryAttributesJobsParameter.prototype.datasetName
  46157. * @description 汇总数据集名称。
  46158. */
  46159. this.datasetName = "";
  46160. /**
  46161. * @member {string} SummaryAttributesJobsParameter.prototype.groupField
  46162. * @description 分组字段。
  46163. */
  46164. this.groupField = "";
  46165. /**
  46166. * @member {string} SummaryAttributesJobsParameter.prototype.attributeField
  46167. * @description 属性字段。
  46168. */
  46169. this.attributeField = "";
  46170. /**
  46171. * @member {string} SummaryAttributesJobsParameter.prototype.statisticModes
  46172. * @description 属性汇总统计模式。
  46173. */
  46174. this.statisticModes = "";
  46175. /**
  46176. * @member {OutputSetting} SummaryAttributesJobsParameter.prototype.output
  46177. * @description 输出参数设置类。
  46178. */
  46179. this.output = null;
  46180. /**
  46181. * @member {MappingParameters} [SummaryAttributesJobsParameter.prototype.mappingParameters]
  46182. * @description 分析后结果可视化的参数类。
  46183. */
  46184. this.mappingParameters = null;
  46185. Util_Util.extend(this, options);
  46186. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  46187. }
  46188. /**
  46189. * @function SummaryAttributesJobsParameter.prototype.destroy
  46190. * @description 释放资源,将资源的属性置空。
  46191. */
  46192. destroy() {
  46193. this.datasetName = null;
  46194. this.groupField = null;
  46195. this.attributeField = null;
  46196. this.statisticModes = null;
  46197. if (this.output instanceof OutputSetting) {
  46198. this.output.destroy();
  46199. this.output = null;
  46200. }
  46201. if (this.mappingParameters instanceof MappingParameters){
  46202. this.mappingParameters.destroy();
  46203. this.mappingParameters = null;
  46204. }
  46205. }
  46206. /**
  46207. * @function SummaryAttributesJobsParameter.toObject
  46208. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  46209. * @param {Object} tempObj - 目标对象。
  46210. * @description 生成属性汇总分析任务对象。
  46211. */
  46212. static toObject(SummaryAttributesJobsParameter, tempObj) {
  46213. for (var name in SummaryAttributesJobsParameter) {
  46214. if (name === "datasetName") {
  46215. tempObj['input'] = tempObj['input'] || {};
  46216. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  46217. continue;
  46218. }
  46219. if (name === "output") {
  46220. tempObj['output'] = tempObj['output'] || {};
  46221. tempObj['output'] = SummaryAttributesJobsParameter[name];
  46222. continue;
  46223. }
  46224. tempObj['analyst'] = tempObj['analyst'] || {};
  46225. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  46226. if(name === 'mappingParameters'){
  46227. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  46228. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  46229. }
  46230. }
  46231. }
  46232. }
  46233. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  46234. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46235. * This program are made available under the terms of the Apache License, Version 2.0
  46236. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46237. /**
  46238. * @class SummaryAttributesJobsService
  46239. * @deprecatedclass SuperMap.SummaryAttributesJobsService
  46240. * @category iServer ProcessingService SummaryAttributes
  46241. * @classdesc 属性汇总分析服务类
  46242. * @extends {ProcessingServiceBase}
  46243. * @param {string} url - 服务地址。
  46244. * @param {Object} options - 可选参数。
  46245. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46246. * @param {Object} [options.headers] - 请求头。
  46247. * @usage
  46248. */
  46249. class SummaryAttributesJobsService extends ProcessingServiceBase {
  46250. constructor(url, options) {
  46251. super(url, options);
  46252. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  46253. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  46254. }
  46255. /**
  46256. *@override
  46257. */
  46258. destroy() {
  46259. super.destroy();
  46260. }
  46261. /**
  46262. * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  46263. * @description 获取属性汇总分析所有任务
  46264. */
  46265. getSummaryAttributesJobs (){
  46266. super.getJobs(this.url);
  46267. }
  46268. /**
  46269. * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  46270. * @description 获取指定id的属性汇总分析服务
  46271. * @param {string} id - 指定要获取数据的id
  46272. */
  46273. getSummaryAttributesJob(id) {
  46274. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  46275. }
  46276. /**
  46277. * @function SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  46278. * @description 新建属性汇总分析服务
  46279. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析任务参数类。
  46280. * @param {number} seconds - 创建成功结果的时间间隔。
  46281. */
  46282. addSummaryAttributesJob(params, seconds) {
  46283. super.addJob(this.url, params, SummaryAttributesJobsParameter, seconds);
  46284. }
  46285. }
  46286. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  46287. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46288. * This program are made available under the terms of the Apache License, Version 2.0
  46289. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46290. /**
  46291. * @class SummaryMeshJobParameter
  46292. * @deprecatedclass SuperMap.SummaryMeshJobParameter
  46293. * @category iServer ProcessingService AggregatePoints
  46294. * @classdesc 点聚合分析任务参数类。
  46295. * @param {Object} options - 参数。
  46296. * @param {string} options.datasetName - 数据集名。
  46297. * @param {string} [options.regionDataset ] - 聚合面数据集(聚合类型为多边形聚合时使用的参数)
  46298. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  46299. * @param {number} options.fields - 权重索引。
  46300. * @param {number} [options.resolution=100] - 分辨率。
  46301. * @param {StatisticAnalystMode} [options.statisticModes=StatisticAnalystMode.AVERAGE] - 分析模式。
  46302. * @param {number} [options.meshType=0] - 分析类型。
  46303. * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 聚合类型。
  46304. * @param {OutputSetting} [options.output] - 输出参数设置。
  46305. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  46306. * @usage
  46307. */
  46308. class SummaryMeshJobParameter {
  46309. constructor(options) {
  46310. if (!options) {
  46311. return;
  46312. }
  46313. /**
  46314. * @member {string} SummaryMeshJobParameter.prototype.datasetName
  46315. * @description 数据集名。
  46316. */
  46317. this.datasetName = "";
  46318. /**
  46319. * @member {string} SummaryMeshJobParameter.prototype.regionDataset
  46320. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  46321. */
  46322. this.regionDataset = "";
  46323. /**
  46324. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryMeshJobParameter.prototype.query
  46325. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  46326. */
  46327. this.query = "";
  46328. /**
  46329. * @member {number} [SummaryMeshJobParameter.prototype.resolution=100]
  46330. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  46331. */
  46332. this.resolution = 100;
  46333. /**
  46334. * @member {number} [SummaryMeshJobParameter.prototype.meshType=0]
  46335. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  46336. */
  46337. this.meshType = 0;
  46338. /**
  46339. * @member {StatisticAnalystMode} [SummaryMeshJobParameter.prototype.statisticModes=StatisticAnalystMode.AVERAGE]
  46340. * @description 统计模式。
  46341. */
  46342. this.statisticModes = StatisticAnalystMode.AVERAGE;
  46343. /**
  46344. * @member {number} SummaryMeshJobParameter.prototype.fields
  46345. * @description 权重字段。
  46346. */
  46347. this.fields = "";
  46348. /**
  46349. * @member {SummaryType} [SummaryMeshJobParameter.prototype.type=SummaryType.SUMMARYMESH]
  46350. * @description 聚合类型。
  46351. */
  46352. this.type = SummaryType.SUMMARYMESH;
  46353. /**
  46354. * @member {OutputSetting} [SummaryMeshJobParameter.prototype.output]
  46355. * @description 输出参数设置类。
  46356. */
  46357. this.output = null;
  46358. /**
  46359. * @member {MappingParameters} [SummaryMeshJobParameter.prototype.mappingParameters]
  46360. * @description 分析后结果可视化的参数类。
  46361. */
  46362. this.mappingParameters = null;
  46363. Util_Util.extend(this, options);
  46364. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  46365. }
  46366. /**
  46367. * @function SummaryMeshJobParameter.prototype.destroy
  46368. * @description 释放资源,将资源的属性置空。
  46369. */
  46370. destroy() {
  46371. this.datasetName = null;
  46372. this.query = null;
  46373. this.resolution = null;
  46374. this.statisticModes = null;
  46375. this.meshType = null;
  46376. this.fields = null;
  46377. this.regionDataset = null;
  46378. this.type = null;
  46379. if (this.output instanceof OutputSetting) {
  46380. this.output.destroy();
  46381. this.output = null;
  46382. }
  46383. if (this.mappingParameters instanceof MappingParameters){
  46384. this.mappingParameters.destroy();
  46385. this.mappingParameters = null;
  46386. }
  46387. }
  46388. /**
  46389. * @function SummaryMeshJobParameter.toObject
  46390. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  46391. * @param {Object} tempObj - 目标对象。
  46392. * @description 生成点聚合分析任务对象。
  46393. */
  46394. static toObject(summaryMeshJobParameter, tempObj) {
  46395. for (var name in summaryMeshJobParameter) {
  46396. if (name === "datasetName") {
  46397. tempObj['input'] = tempObj['input'] || {};
  46398. tempObj['input'][name] = summaryMeshJobParameter[name];
  46399. continue;
  46400. }
  46401. if (name === "type") {
  46402. tempObj['type'] = summaryMeshJobParameter[name];
  46403. continue;
  46404. }
  46405. if (name === "output") {
  46406. tempObj['output'] = tempObj['output'] || {};
  46407. tempObj['output'] = summaryMeshJobParameter[name];
  46408. continue;
  46409. }
  46410. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  46411. tempObj['analyst'] = tempObj['analyst'] || {};
  46412. if (name === 'query' && summaryMeshJobParameter[name]) {
  46413. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  46414. } else {
  46415. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  46416. }
  46417. if(name === 'mappingParameters'){
  46418. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  46419. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  46420. }
  46421. }
  46422. }
  46423. function contains(arr, obj) {
  46424. var i = arr.length;
  46425. while (i--) {
  46426. if (arr[i] === obj) {
  46427. return true;
  46428. }
  46429. }
  46430. return false;
  46431. }
  46432. }
  46433. }
  46434. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  46435. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46436. * This program are made available under the terms of the Apache License, Version 2.0
  46437. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46438. /**
  46439. * @class SummaryMeshJobsService
  46440. * @deprecatedclass SuperMap.SummaryMeshJobsService
  46441. * @category iServer ProcessingService AggregatePoints
  46442. * @classdesc 点聚合分析任务类。
  46443. * @param {string} url - 服务地址。
  46444. * @param {Object} options - 参数。
  46445. * @param {Events} options.events - 处理所有事件的对象。
  46446. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  46447. * @param {number} options.index - 服务地址在数组中的位置。
  46448. * @param {number} options.length - 服务地址数组长度。
  46449. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46450. * @param {Object} [options.headers] - 请求头。
  46451. * @usage
  46452. */
  46453. class SummaryMeshJobsService extends ProcessingServiceBase {
  46454. constructor(url, options) {
  46455. super(url, options);
  46456. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  46457. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  46458. }
  46459. /**
  46460. * @override
  46461. */
  46462. destroy() {
  46463. super.destroy();
  46464. }
  46465. /**
  46466. * @function SummaryMeshJobsService.prototype.getSummaryMeshJobs
  46467. * @description 获取点聚合分析任务
  46468. */
  46469. getSummaryMeshJobs() {
  46470. super.getJobs(this.url);
  46471. }
  46472. /**
  46473. * @function SummaryMeshJobsService.prototype.getSummaryMeshJob
  46474. * @description 获取指定ip的点聚合分析任务
  46475. * @param {string} id - 指定要获取数据的id
  46476. */
  46477. getSummaryMeshJob(id) {
  46478. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  46479. }
  46480. /**
  46481. * @function SummaryMeshJobsService.prototype.addSummaryMeshJob
  46482. * @description 新建点聚合分析服务
  46483. * @param {SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  46484. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  46485. */
  46486. addSummaryMeshJob(params, seconds) {
  46487. super.addJob(this.url, params, SummaryMeshJobParameter, seconds);
  46488. }
  46489. }
  46490. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  46491. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46492. * This program are made available under the terms of the Apache License, Version 2.0
  46493. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46494. /**
  46495. * @class SummaryRegionJobParameter
  46496. * @deprecatedclass SuperMap.SummaryRegionJobParameter
  46497. * @category iServer ProcessingService SummaryRegion
  46498. * @classdesc 区域汇总分析任务参数类。
  46499. * @param {Object} options - 参数。
  46500. * @param {string} options.datasetName - 数据集名。
  46501. * @param {string} [options.regionDataset] - 汇总数据源(多边形汇总时用到的参数)。
  46502. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  46503. * @param {string} [options.standardFields] - 标准属性字段名称。
  46504. * @param {string} [options.weightedFields] - 权重字段名称。
  46505. * @param {StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  46506. * @param {StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  46507. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  46508. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属性字段统计。
  46509. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  46510. * @param {number} [options.resolution=100] - 网格大小。
  46511. * @param {number} [options.meshType=0] - 网格面汇总类型。
  46512. * @param {AnalystSizeUnit} [options.meshSizeUnit=AnalystSizeUnit.METER] - 网格大小单位。
  46513. * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 汇总类型。
  46514. * @param {OutputSetting} [options.output] - 输出参数设置。
  46515. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  46516. * @usage
  46517. */
  46518. class SummaryRegionJobParameter {
  46519. constructor(options) {
  46520. if (!options) {
  46521. return;
  46522. }
  46523. /**
  46524. * @member {string} SummaryRegionJobParameter.prototype.datasetName
  46525. * @description 数据集名。
  46526. */
  46527. this.datasetName = "";
  46528. /**
  46529. * @member {string} SummaryRegionJobParameter.prototype.regionDataset
  46530. * @description 汇总数据源(多边形汇总时用到的参数)。
  46531. */
  46532. this.regionDataset = "";
  46533. /**
  46534. * @member {boolean} [SummaryRegionJobParameter.prototype.sumShape=true]
  46535. * @description 是否统计长度或面积。
  46536. */
  46537. this.sumShape = true;
  46538. /**
  46539. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryRegionJobParameter.prototype.query
  46540. * @description 分析范围。
  46541. */
  46542. this.query = "";
  46543. /**
  46544. * @member {boolean} [SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  46545. * @description 是否以标准属字段统计。
  46546. */
  46547. this.standardSummaryFields = false;
  46548. /**
  46549. * @member {string} SummaryRegionJobParameter.prototype.standardFields
  46550. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  46551. */
  46552. this.standardFields = "";
  46553. /**
  46554. * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.standardStatisticModes
  46555. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  46556. */
  46557. this.standardStatisticModes = "";
  46558. /**
  46559. * @member {boolean} [SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  46560. * @description 是否以权重字段统计。
  46561. */
  46562. this.weightedSummaryFields = false;
  46563. /**
  46564. * @member {string} SummaryRegionJobParameter.prototype.weightedFields
  46565. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  46566. */
  46567. this.weightedFields = "";
  46568. /**
  46569. * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.weightedStatisticModes
  46570. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  46571. */
  46572. this.weightedStatisticModes = "";
  46573. /**
  46574. * @member {number} [SummaryRegionJobParameter.prototype.meshType=0]
  46575. * @description 网格面汇总类型。
  46576. */
  46577. this.meshType = 0;
  46578. /**
  46579. * @member {number} [SummaryRegionJobParameter.prototype.resolution=100]
  46580. * @description 网格大小。
  46581. */
  46582. this.resolution = 100;
  46583. /**
  46584. * @member {AnalystSizeUnit} [SummaryRegionJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
  46585. * @description 网格大小单位。
  46586. */
  46587. this.meshSizeUnit = AnalystSizeUnit.METER;
  46588. /**
  46589. * @member {SummaryType} [SummaryRegionJobParameter.prototype.type=SummaryType.SUMMARYMESH]
  46590. * @description 汇总类型。
  46591. */
  46592. this.type = SummaryType.SUMMARYMESH;
  46593. /**
  46594. * @member {OutputSetting} SummaryRegionJobParameter.prototype.output
  46595. * @description 输出参数设置类。
  46596. */
  46597. this.output = null;
  46598. /**
  46599. * @member {MappingParameters} [SummaryRegionJobParameter.prototype.mappingParameters]
  46600. * @description 分析后结果可视化的参数类。
  46601. */
  46602. this.mappingParameters = null;
  46603. Util_Util.extend(this, options);
  46604. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  46605. }
  46606. /**
  46607. * @function SummaryRegionJobParameter.prototype.destroy
  46608. * @description 释放资源,将引用资源的属性置空。
  46609. */
  46610. destroy() {
  46611. this.datasetName = null;
  46612. this.sumShape = null;
  46613. this.regionDataset = null;
  46614. this.query = null;
  46615. this.standardSummaryFields = null;
  46616. this.standardFields = null;
  46617. this.standardStatisticModes = null;
  46618. this.weightedSummaryFields = null;
  46619. this.weightedFields = null;
  46620. this.weightedStatisticModes = null;
  46621. this.meshType = null;
  46622. this.resolution = null;
  46623. this.meshSizeUnit = null;
  46624. this.type = null;
  46625. if (this.output instanceof OutputSetting) {
  46626. this.output.destroy();
  46627. this.output = null;
  46628. }
  46629. if (this.mappingParameters instanceof MappingParameters){
  46630. this.mappingParameters.destroy();
  46631. this.mappingParameters = null;
  46632. }
  46633. }
  46634. /**
  46635. * @function SummaryRegionJobParameter.toObject
  46636. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  46637. * @param {Object} tempObj - 目标对象。
  46638. * @description 生成区域汇总分析服务对象。
  46639. */
  46640. static toObject(summaryRegionJobParameter, tempObj) {
  46641. for (var name in summaryRegionJobParameter) {
  46642. if (name === "datasetName") {
  46643. tempObj['input'] = tempObj['input'] || {};
  46644. tempObj['input'][name] = summaryRegionJobParameter[name];
  46645. continue;
  46646. }
  46647. if (name === "type") {
  46648. tempObj['type'] = summaryRegionJobParameter[name];
  46649. continue;
  46650. }
  46651. if (name === "type") {
  46652. tempObj['type'] = summaryRegionJobParameter[name];
  46653. continue;
  46654. }
  46655. if (name === "output") {
  46656. tempObj['output'] = tempObj['output'] || {};
  46657. tempObj['output'] = summaryRegionJobParameter[name];
  46658. continue;
  46659. }
  46660. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  46661. tempObj['analyst'] = tempObj['analyst'] || {};
  46662. if (name === 'query' && summaryRegionJobParameter[name]) {
  46663. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  46664. } else {
  46665. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  46666. }
  46667. if(name === 'mappingParameters'){
  46668. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  46669. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  46670. }
  46671. }
  46672. }
  46673. }
  46674. }
  46675. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  46676. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46677. * This program are made available under the terms of the Apache License, Version 2.0
  46678. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46679. /**
  46680. * @class SummaryRegionJobsService
  46681. * @deprecatedclass SuperMap.SummaryRegionJobsService
  46682. * @category iServer ProcessingService SummaryRegion
  46683. * @classdesc 区域汇总分析服务类
  46684. * @extends {ProcessingServiceBase}
  46685. * @param {string} url - 服务地址。
  46686. * @param {Object} options - 可选参数。
  46687. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46688. * @param {Object} [options.headers] - 请求头。
  46689. * @usage
  46690. */
  46691. class SummaryRegionJobsService extends ProcessingServiceBase {
  46692. constructor(url, options) {
  46693. super(url, options);
  46694. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  46695. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  46696. }
  46697. /**
  46698. *@override
  46699. */
  46700. destroy() {
  46701. super.destroy();
  46702. }
  46703. /**
  46704. * @function SummaryRegionJobsService.prototype.getSummaryRegionJobs
  46705. * @description 获取区域汇总分析任务集合。
  46706. */
  46707. getSummaryRegionJobs() {
  46708. super.getJobs(this.url);
  46709. }
  46710. /**
  46711. * @function SummaryRegionJobsService.prototype.getSummaryRegionJob
  46712. * @description 获取指定id的区域汇总分析任务。
  46713. * @param {string} id -要获取区域汇总分析任务的id
  46714. */
  46715. getSummaryRegionJob(id) {
  46716. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  46717. }
  46718. /**
  46719. * @function SummaryRegionJobsService.prototype.addSummaryRegionJob
  46720. * @description 新建区域汇总任务。
  46721. * @param {SummaryRegionJobParameter} params - 区域汇总分析任务参数类。
  46722. * @param {number} seconds - 创建成功结果的时间间隔。
  46723. */
  46724. addSummaryRegionJob(params, seconds) {
  46725. super.addJob(this.url, params, SummaryRegionJobParameter, seconds);
  46726. }
  46727. }
  46728. ;// CONCATENATED MODULE: ./src/common/iServer/SupplyCenter.js
  46729. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46730. * This program are made available under the terms of the Apache License, Version 2.0
  46731. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46732. /**
  46733. * @class SupplyCenter
  46734. * @deprecatedclass SuperMap.SupplyCenter
  46735. * @category iServer NetworkAnalyst Location
  46736. * @classdesc 资源供给中心类。在资源分配和选址分区分析两个功能中使用。
  46737. * @param {Object} options - 参数。
  46738. * @param {number} options.maxWeight - 最大耗费值。
  46739. * @param {number} options.nodeID - 结点 ID 号。资源供给中心必须是结点。
  46740. * @param {number} options.resourceValue - 能提供的最大服务量或商品数量。
  46741. * @param {SupplyCenterType} [options.type] - 资源供给中心点的类型常量。
  46742. * @usage
  46743. */
  46744. class SupplyCenter {
  46745. constructor(options) {
  46746. /**
  46747. * @member {number} SupplyCenter.prototype.maxWeight
  46748. * @description 资源供给中心的最大耗费值。中心点最大阻值设置越小,表示中心点所提供的资源可影响范围越大。
  46749. * 最大阻力值是用来限制需求点到中心点的花费。
  46750. * 如果需求点(弧段或结点)到此中心的花费大于最大阻力值,则该需求点不属于该资源供给中心提供资源的范围。
  46751. */
  46752. this.maxWeight = null;
  46753. /**
  46754. * @member {number} SupplyCenter.prototype.nodeID
  46755. * @description 资源供给中心点的结点 ID 号,资源供给中心必须是结点。
  46756. */
  46757. this.nodeID = null;
  46758. /**
  46759. * @member {number} SupplyCenter.prototype.resourceValue
  46760. * @description 资源供给中心能提供的最大服务量或商品数量。例如资源中心为学校,资源中心资源量表示该学校能够接纳多少学生。
  46761. */
  46762. this.resourceValue = null;
  46763. /**
  46764. * @member {SupplyCenterType} [SupplyCenter.prototype.type]
  46765. * @description 资源供给中心点的类型常量。资源供给中心点的类型包括非中心,固定中心和可选中心。
  46766. * 固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  46767. */
  46768. this.type = null;
  46769. if (options) {
  46770. Util_Util.extend(this, options);
  46771. }
  46772. this.CLASS_NAME = "SuperMap.SupplyCenter";
  46773. }
  46774. /**
  46775. * @function SupplyCenter.prototype.destroy
  46776. * @description 释放资源,将引用资源的属性置空。
  46777. */
  46778. destroy() {
  46779. var me = this;
  46780. me.maxWeight = null;
  46781. me.nodeID = null;
  46782. me.resourceValue = null;
  46783. me.type = null;
  46784. }
  46785. /**
  46786. * @function SupplyCenter.fromJson
  46787. * @description 将服务端 JSON 对象转换成当前客户端对象。
  46788. * @param {Object} jsonObject - 要转换的 JSON 对象。
  46789. * @returns {SupplyCenter} SupplyCenter 对象。
  46790. */
  46791. static fromJson(jsonObject) {
  46792. if (!jsonObject) {
  46793. return;
  46794. }
  46795. return new SupplyCenter({
  46796. maxWeight: jsonObject.maxWeight,
  46797. nodeID: jsonObject.nodeID,
  46798. resourceValue: jsonObject.resourceValue,
  46799. type: jsonObject.type
  46800. });
  46801. }
  46802. }
  46803. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystService.js
  46804. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46805. * This program are made available under the terms of the Apache License, Version 2.0
  46806. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46807. /**
  46808. * @class SurfaceAnalystService
  46809. * @deprecatedclass SuperMap.SurfaceAnalystService
  46810. * @category iServer SpatialAnalyst SurfaceAnalyst
  46811. * @classdesc 表面分析服务类。
  46812. * 该类负责将客户设置的表面分析服务参数传递给服务端,并接收服务端返回的表面分析服务分析结果数据。
  46813. * 表面分析结果通过该类支持的事件的监听函数参数获取
  46814. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  46815. * @param {Object} options - 参数。
  46816. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  46817. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46818. * @param {Object} [options.headers] - 请求头。
  46819. * @extends {SpatialAnalystBase}
  46820. * @example 例如:
  46821. * (start code)
  46822. * var mySurfaceAnalystService = new SurfaceAnalystService(url, {
  46823. * eventListeners: {
  46824. * "processCompleted": surfaceAnalysCompleted,
  46825. * "processFailed": surfaceAnalysFailed
  46826. * }
  46827. * });
  46828. * (end)
  46829. * @usage
  46830. */
  46831. class SurfaceAnalystService extends SpatialAnalystBase {
  46832. constructor(url, options) {
  46833. super(url, options);
  46834. this.CLASS_NAME = "SuperMap.SurfaceAnalystService";
  46835. }
  46836. /**
  46837. * @function SurfaceAnalystService.prototype.destroy
  46838. * @description 释放资源,将引用的资源属性置空。
  46839. */
  46840. destroy() {
  46841. super.destroy();
  46842. }
  46843. /**
  46844. * @function SurfaceAnalystService.prototype.processAsync
  46845. * @description 负责将客户端的表面分析服务参数传递到服务端。
  46846. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  46847. */
  46848. processAsync(params) {
  46849. if (!(params instanceof SurfaceAnalystParameters)) {
  46850. return;
  46851. }
  46852. var me = this, jsonParameters;
  46853. jsonParameters = me.getJsonParameters(params);
  46854. me.request({
  46855. method: "POST",
  46856. data: jsonParameters,
  46857. scope: me,
  46858. success: me.serviceProcessCompleted,
  46859. failure: me.serviceProcessFailed
  46860. });
  46861. }
  46862. /**
  46863. * @function SurfaceAnalystService.prototype.getJsonParameters
  46864. * @description 将参数转化为 JSON 字符串。
  46865. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  46866. * @returns {Object} 转化后的JSON字符串。
  46867. */
  46868. getJsonParameters(params) {
  46869. var jsonParameters = '';
  46870. var parameterObject = {};
  46871. var me = this;
  46872. if (params instanceof DatasetSurfaceAnalystParameters) {
  46873. me.url = Util_Util.urlPathAppend(
  46874. me.url,
  46875. 'datasets/' + params.dataset + '/' + params.surfaceAnalystMethod.toLowerCase()
  46876. );
  46877. DatasetSurfaceAnalystParameters.toObject(params, parameterObject);
  46878. jsonParameters = Util_Util.toJSON(parameterObject);
  46879. } else if (params instanceof GeometrySurfaceAnalystParameters) {
  46880. me.url = Util_Util.urlPathAppend(me.url, 'geometry/' + params.surfaceAnalystMethod.toLowerCase());
  46881. jsonParameters = Util_Util.toJSON(params);
  46882. } else {
  46883. return;
  46884. }
  46885. this.returnContent = true;
  46886. return jsonParameters;
  46887. }
  46888. dataFormat() {
  46889. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  46890. }
  46891. }
  46892. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationParameters.js
  46893. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46894. * This program are made available under the terms of the Apache License, Version 2.0
  46895. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46896. /**
  46897. * @class TerrainCurvatureCalculationParameters
  46898. * @deprecatedclass SuperMap.TerrainCurvatureCalculationParameters
  46899. * @category iServer SpatialAnalyst TerrainCalculation
  46900. * @classdesc 地形曲率计算参数类。
  46901. * @param {Object} options - 参数。
  46902. * @param {string} options.dataset - 地形曲率计算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  46903. * @param {string} options.averageCurvatureName - 结果数据集:平均曲率数据集的名称。
  46904. * @param {string} options.profileCurvatureName - 结果数据集:剖面曲率数据集的名称。
  46905. * @param {string} options.planCurvatureName - 结果数据集:平面曲率数据集的名称。
  46906. * @param {number} [options.zFactor=1.0] - 指定的高程缩放系数。1.0 表示不缩放。
  46907. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  46908. * @usage
  46909. */
  46910. class TerrainCurvatureCalculationParameters {
  46911. constructor(options) {
  46912. if (!options) {
  46913. return;
  46914. }
  46915. /**
  46916. * @member {string} TerrainCurvatureCalculationParameters.prototype.dataset
  46917. * @description 要用来做地形曲率计算数据源中数据集的名称。
  46918. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  46919. * 注:地形曲率计算必须为栅格数据集。
  46920. */
  46921. this.dataset = null;
  46922. /**
  46923. * @member {number} [TerrainCurvatureCalculationParameters.prototype.zFactor=1.0]
  46924. * @description 指定的高程缩放系数。1.0 表示不缩放。
  46925. * 该值是指在 DEM 栅格数据中,栅格值( Z 坐标,即高程值)相对于 X 和 Y 坐标的单位变换系数。
  46926. * 通常有 X,Y,Z 都参加的计算中,需要将高程值乘以一个高程缩放系数,使得三者单位一致。
  46927. * 例如,X、Y 方向上的单位是米,而 Z 方向的单位是英尺,由于 1 英尺等于 0.3048 米,则需要指定缩放系数为 0.3048。
  46928. */
  46929. this.zFactor = 1.0;
  46930. /**
  46931. * @member {string} TerrainCurvatureCalculationParameters.prototype.averageCurvatureName
  46932. * @description 结果数据集:平均曲率数据集的名称。
  46933. */
  46934. this.averageCurvatureName = null;
  46935. /**
  46936. * @member {string} TerrainCurvatureCalculationParameters.prototype.profileCurvatureName
  46937. * @description 结果数据集:剖面曲率数据集的名称。
  46938. */
  46939. this.profileCurvatureName = "";
  46940. /**
  46941. * @member {string} TerrainCurvatureCalculationParameters.prototype.planCurvatureName
  46942. * @description 结果数据集:平面曲率数据集的名称。
  46943. */
  46944. this.planCurvatureName = "";
  46945. /**
  46946. * @member {boolean} [TerrainCurvatureCalculationParameters.prototype.deleteExistResultDataset=false]
  46947. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  46948. */
  46949. this.deleteExistResultDataset = false;
  46950. Util_Util.extend(this, options);
  46951. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationParameters";
  46952. }
  46953. /**
  46954. * @function TerrainCurvatureCalculationParameters.prototype.destroy
  46955. * @description 释放资源,将引用资源的属性置空。
  46956. */
  46957. destroy() {
  46958. var me = this;
  46959. me.dataset = null;
  46960. me.zFactor = 1.0;
  46961. me.averageCurvatureName = null;
  46962. me.profileCurvatureName = null;
  46963. me.planCurvatureName = null;
  46964. me.deleteExistResultDataset = true;
  46965. }
  46966. /**
  46967. * @function TerrainCurvatureCalculationParameters.toObject
  46968. * @param {Object} derrainCurvatureCalculationParameters - 地形曲率计算参数。
  46969. * @param {Object} tempObj - 目标对象。
  46970. * @description 生成地形曲率计算对象。
  46971. */
  46972. static toObject(derrainCurvatureCalculationParameters, tempObj) {
  46973. for (var name in derrainCurvatureCalculationParameters) {
  46974. if (name !== "dataset") {
  46975. tempObj[name] = derrainCurvatureCalculationParameters[name];
  46976. }
  46977. }
  46978. }
  46979. }
  46980. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationService.js
  46981. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46982. * This program are made available under the terms of the Apache License, Version 2.0
  46983. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46984. /**
  46985. * @class TerrainCurvatureCalculationService
  46986. * @deprecatedclass SuperMap.TerrainCurvatureCalculationService
  46987. * @category iServer SpatialAnalyst TerrainCalculation
  46988. * @classdesc 地形曲率计算服务类。
  46989. * @extends {SpatialAnalystBase}
  46990. * @param {Object} options - 参数。
  46991. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  46992. * @param {string} options.url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  46993. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  46994. * @param {Object} [options.headers] - 请求头。
  46995. * @example 例如:
  46996. * (start code)
  46997. * var myTerrainCurvatureCalculationService = new TerrainCurvatureCalculationService(url);
  46998. * myTerrainCurvatureCalculationService.on({
  46999. * "processCompleted": processCompleted,
  47000. * "processFailed": processFailed
  47001. * }
  47002. * );
  47003. * (end)
  47004. * @usage
  47005. */
  47006. class TerrainCurvatureCalculationService extends SpatialAnalystBase {
  47007. constructor(url, options) {
  47008. super(url, options);
  47009. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationService";
  47010. }
  47011. /**
  47012. *@override
  47013. */
  47014. destroy() {
  47015. super.destroy();
  47016. }
  47017. /**
  47018. * @function TerrainCurvatureCalculationService.prototype.processAsync
  47019. * @description 负责将客户端的查询参数传递到服务端。
  47020. * @param {TerrainCurvatureCalculationParameters} parameter - 地形曲率计算参数类。
  47021. */
  47022. processAsync(parameter) {
  47023. var me = this;
  47024. var parameterObject = {};
  47025. if (parameter instanceof TerrainCurvatureCalculationParameters) {
  47026. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/terraincalculation/curvature');
  47027. }
  47028. TerrainCurvatureCalculationParameters.toObject(parameter, parameterObject);
  47029. var jsonParameters = Util_Util.toJSON(parameterObject);
  47030. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  47031. me.request({
  47032. method: "POST",
  47033. data: jsonParameters,
  47034. scope: me,
  47035. success: me.serviceProcessCompleted,
  47036. failure: me.serviceProcessFailed
  47037. });
  47038. }
  47039. }
  47040. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeFlow.js
  47041. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47042. * This program are made available under the terms of the Apache License, Version 2.0
  47043. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47044. /**
  47045. * @class ThemeFlow
  47046. * @deprecatedclass SuperMap.ThemeFlow
  47047. * @private
  47048. * @category iServer Map Theme
  47049. * @classdesc 标签或符号流动显示和牵引线风格设置类。
  47050. * 通过该类可以设置专题图中符号是否流动显示、是否使用牵引线以及牵引线风格。
  47051. * @param {Object} options - 可选参数。
  47052. * @param {boolean} [options.flowEnabled=false] - 是否流动显示标签或符号。
  47053. * @param {boolean} [options.leaderLineDisplayed=false] - 是否显示标签或符号和它标注的对象之间的牵引线。
  47054. * @param {ServerStyle} [options.leaderLineStyle] - 标签或符号与其标注对象之间牵引线的风格。
  47055. * @usage
  47056. */
  47057. class ThemeFlow {
  47058. constructor(options) {
  47059. /**
  47060. * @member {boolean} [ThemeFlow.prototype.flowEnabled=false]
  47061. * @description 是否流动显示标签或符号。<br>
  47062. * 对于标签专题图而言,对于跨越比较大的区域和线条状的几何对象,在一个地图窗口中不能完全显示的情况下,如果其标签位置比较固定,
  47063. * 在当前地图窗口中该对象的标签不可见,则需要通过平移地图来查看对象的标签信息。如果采用了流动显示的效果,在当前地图窗口中,对象即使是部分显示,
  47064. * 其标签也会显示在当前地图窗口中。当平移地图时,对象的标签会随之移动,以保证在当前地图窗口中部分或全部显示的对象其标签都可见,从而可以方便地查看各要素的标签信息。
  47065. */
  47066. this.flowEnabled = false;
  47067. /**
  47068. * @member {boolean} [ThemeFlow.prototype.leaderLineDisplayed=false]
  47069. * @description 是否显示标签或符号和它标注的对象之间的牵引线。false表示不显示标签或符号和它标注的对象之间的牵引线。<br>
  47070. * 只有当 flowEnabled 为 true 时,牵引线才起作用。在当标签流动显示时,其位置不固定,由于牵引线始终指向要素的内点,
  47071. * 因而通过牵引线显示功能可以找到流动的标签或符号实际对应的要素。或者渲染符号偏移它所指向的对象时,图与对象之间可以采用牵引线进行连接。
  47072. */
  47073. this.leaderLineDisplayed = false;
  47074. /**
  47075. * @member {ServerStyle} ThemeFlow.prototype.leaderLineStyle
  47076. * @description 标签或符号与其标注对象之间牵引线的风格。
  47077. */
  47078. this.leaderLineStyle = new ServerStyle();
  47079. if (options) {
  47080. Util_Util.extend(this, options);
  47081. }
  47082. this.CLASS_NAME = "SuperMap.ThemeFlow";
  47083. }
  47084. /**
  47085. * @function ThemeFlow.prototype.destroy
  47086. * @description 释放资源,将引用资源的属性置空。
  47087. */
  47088. destroy() {
  47089. var me = this;
  47090. me.flowEnabled = null;
  47091. me.leaderLineDisplayed = null;
  47092. if (me.leaderLineStyle) {
  47093. me.leaderLineStyle.destroy();
  47094. me.leaderLineStyle = null;
  47095. }
  47096. }
  47097. /**
  47098. * @function ThemeFlow.fromObj
  47099. * @description 从传入对象获取标签或符号流动显示和牵引线风格设置类。
  47100. * @param {Object} obj - 传入对象。
  47101. * @returns {ThemeFlow} ThemeFlow 对象。
  47102. */
  47103. static fromObj(obj) {
  47104. if (!obj) {
  47105. return;
  47106. }
  47107. var res = new ThemeFlow();
  47108. Util_Util.copy(res, obj);
  47109. res.leaderLineStyle = ServerStyle.fromJson(obj.leaderLineStyle);
  47110. return res;
  47111. }
  47112. }
  47113. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRangeItem.js
  47114. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47115. * This program are made available under the terms of the Apache License, Version 2.0
  47116. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47117. /**
  47118. * @class ThemeGridRangeItem
  47119. * @deprecatedclass SuperMap.ThemeGridRangeItem
  47120. * @category iServer Map Theme
  47121. * @classdesc 栅格分段专题图子项类。在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  47122. * 本类用来设置每个范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  47123. * @param {Object} options - 参数。
  47124. * @param {ServerColor} options.color - 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  47125. * @param {string} [options.caption] - 栅格分段专题图子项的标题。
  47126. * @param {number} [options.end=0] - 栅格分段专题图子项的终止值。
  47127. * @param {number} [options.start=0] - 栅格分段专题图子项的起始值。
  47128. * @param {boolean} [options.visible=true] - 栅格分段专题图子项是否可见。
  47129. * @usage
  47130. */
  47131. class ThemeGridRangeItem {
  47132. constructor(options) {
  47133. /**
  47134. * @member {string} [ThemeGridRangeItem.prototype.caption]
  47135. * @description 栅格分段专题图子项的标题。
  47136. */
  47137. this.caption = null;
  47138. /**
  47139. * @member {ServerColor} ThemeGridRangeItem.prototype.color
  47140. * @description 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  47141. */
  47142. this.color = new ServerColor();
  47143. /**
  47144. * @member {number} [ThemeGridRangeItem.prototype.end=0]
  47145. * @description 栅格分段专题图子项的终止值,即该段专题值范围的最大值。
  47146. */
  47147. this.end = 0;
  47148. /**
  47149. * @member {number} [ThemeGridRangeItem.prototype.start=0]
  47150. * @description 栅格分段专题图子项的起始值,即该段专题值范围的最小值。
  47151. */
  47152. this.start = 0;
  47153. /**
  47154. * @member {boolean} [ThemeGridRangeItem.prototype.visible=true]
  47155. * @description 栅格分段专题图子项是否可见。
  47156. */
  47157. this.visible = true;
  47158. if (options) {
  47159. Util_Util.extend(this, options);
  47160. }
  47161. this.CLASS_NAME = "SuperMap.ThemeGridRangeItem";
  47162. }
  47163. /**
  47164. * @function ThemeGridRangeItem.prototype.destroy
  47165. * @description 释放资源,将引用资源的属性置空。
  47166. */
  47167. destroy() {
  47168. var me = this;
  47169. me.caption = null;
  47170. me.end = null;
  47171. me.start = null;
  47172. //需要验证是够存在destroy方法
  47173. if (me.color) {
  47174. me.color.destroy();
  47175. me.color = null;
  47176. }
  47177. me.visible = null;
  47178. }
  47179. /**
  47180. * @function ThemeGridRangeItem.prototype.toServerJSONObject
  47181. * @description 转换成对应的 JSON 格式对象。
  47182. * @returns {Object} 对应的 JSON 格式对象。
  47183. */
  47184. toServerJSONObject() {
  47185. var obj = {};
  47186. obj = Util_Util.copyAttributes(obj, this);
  47187. if (obj.color) {
  47188. if (obj.color.toServerJSONObject) {
  47189. obj.color = obj.color.toServerJSONObject();
  47190. }
  47191. }
  47192. return obj;
  47193. }
  47194. /**
  47195. * @function ThemeGridRangeItem.fromObj
  47196. * @description 从传入对象获取栅格分段专题图子项类。
  47197. * @param {Object} obj - 传入对象。
  47198. * @returns {ThemeGridRangeItem} ThemeGridRangeItem 对象。
  47199. */
  47200. static fromObj(obj) {
  47201. if (!obj) {
  47202. return;
  47203. }
  47204. var res = new ThemeGridRangeItem();
  47205. Util_Util.copy(res, obj);
  47206. res.color = ServerColor.fromJson(obj.color);
  47207. return res;
  47208. }
  47209. }
  47210. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRange.js
  47211. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47212. * This program are made available under the terms of the Apache License, Version 2.0
  47213. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47214. /**
  47215. * @class ThemeGridRange
  47216. * @deprecatedclass SuperMap.ThemeGridRange
  47217. * @category iServer Map Theme
  47218. * @classdesc 栅格分段专题图。栅格分段专题图,是将所有单元格的值按照某种分段方式分成多个范围段,值在同一个范围段中的单元格使用相同的颜色进行显示。一般用来反映连续分布现象的数量或程度特征。
  47219. * 比如某年的全国降水量分布图,将各气象站点的观测值经过内插之后生成的栅格数据进行分段显示。
  47220. * 该类类似于分段专题图类,不同点在于分段专题图的操作对象是矢量数据,而栅格分段专题图的操作对象是栅格数据。
  47221. * @extends {CommonTheme}
  47222. * @param {Object} options - 参数。
  47223. * @param {Array.<ThemeGridRangeItem>} options.items - 栅格分段专题图子项数组。
  47224. * @param {boolean} [options.reverseColor=false] - 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  47225. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  47226. * @param {number} [options.rangeParameter=0] - 分段参数。
  47227. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  47228. * @usage
  47229. */
  47230. class ThemeGridRange extends Theme {
  47231. constructor(options) {
  47232. super("GRIDRANGE", options);
  47233. /**
  47234. * @member {Array.<ThemeGridRangeItem>} ThemeGridRange.prototype.items
  47235. * @description 栅格分段专题图子项数组。<br>
  47236. * 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  47237. * 本类用来设置每个栅格范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  47238. */
  47239. this.items = null;
  47240. /**
  47241. * @member {RangeMode} [ThemeGridRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
  47242. * @description 分段专题图的分段模式。<br>
  47243. * 在栅格分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  47244. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  47245. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  47246. */
  47247. this.rangeMode = RangeMode.EQUALINTERVAL;
  47248. /**
  47249. * @member {number} [ThemeGridRange.prototype.rangeParameter=0]
  47250. * @description 分段参数。<br>
  47251. * 当分段模式为等距离分段法,平方根分段,对数分段法,等计数分段法其中一种模式时,该参数用于设置分段个数,必设;当分段模式为标准差分段法时,
  47252. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  47253. */
  47254. this.rangeParameter = 0;
  47255. /**
  47256. * @member {ColorGradientType} [ThemeGridRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  47257. * @description 渐变颜色枚举类。
  47258. *
  47259. */
  47260. this.colorGradientType = ColorGradientType.YELLOW_RED;
  47261. /**
  47262. * @member {boolean} ThemeGridRange.prototype.reverseColor
  47263. * @description 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  47264. */
  47265. this.reverseColor = false;
  47266. if (options) {
  47267. Util_Util.extend(this, options);
  47268. }
  47269. this.CLASS_NAME = "SuperMap.ThemeGridRange";
  47270. }
  47271. /**
  47272. * @function ThemeGridRange.prototype.destroy
  47273. * @override
  47274. */
  47275. destroy() {
  47276. super.destroy();
  47277. var me = this;
  47278. if (me.items) {
  47279. if (me.items.length > 0) {
  47280. for (var item in me.items) {
  47281. me.items[item].destroy();
  47282. me.items[item] = null;
  47283. }
  47284. }
  47285. me.items = null;
  47286. }
  47287. me.reverseColor = null;
  47288. me.rangeMode = null;
  47289. me.rangeParameter = null;
  47290. me.colorGradientType = null;
  47291. }
  47292. /**
  47293. * @function ThemeGridRange.fromObj
  47294. * @description 从传入对象获取栅格分段专题图。
  47295. * @param {Object} obj - 传入对象。
  47296. * @returns {ThemeGridRange} ThemeGridRange 对象。
  47297. */
  47298. static fromObj(obj) {
  47299. if (!obj) {
  47300. return;
  47301. }
  47302. var res = new ThemeGridRange();
  47303. Util_Util.copy(res, obj);
  47304. var itemsR = obj.items;
  47305. var len = itemsR ? itemsR.length : 0;
  47306. res.items = [];
  47307. for (var i = 0; i < len; i++) {
  47308. res.items.push(ThemeGridRangeItem.fromObj(itemsR[i]));
  47309. }
  47310. return res;
  47311. }
  47312. }
  47313. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUniqueItem.js
  47314. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47315. * This program are made available under the terms of the Apache License, Version 2.0
  47316. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47317. /**
  47318. * @class ThemeGridUniqueItem
  47319. * @deprecatedclass SuperMap.ThemeGridUniqueItem
  47320. * @category iServer Map Theme
  47321. * @classdesc 栅格单值专题图子项类。
  47322. * 栅格单值专题图是将值相同的单元格归为一类,每一类是一个专题图子项。
  47323. * @param {Object} options - 可选参数。
  47324. * @param {string} [options.caption] - 子项的名称。
  47325. * @param {ServerColor} [options.color] - 子项的显示颜色。
  47326. * @param {number} options.unique - 子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  47327. * @param {boolean} [options.visible=true] - 子项是否可见。
  47328. * @usage
  47329. */
  47330. class ThemeGridUniqueItem {
  47331. constructor(options) {
  47332. /**
  47333. * @member {string} [ThemeGridUniqueItem.prototype.caption]
  47334. * @description 栅格单值专题图子项的名称。
  47335. */
  47336. this.caption = null;
  47337. /**
  47338. * @member {ServerColor} [ThemeGridUniqueItem.prototype.color]
  47339. * @description 栅格单值专题图子项的显示颜色。
  47340. */
  47341. this.color = new ServerColor();
  47342. /**
  47343. * @member {number} ThemeGridUniqueItem.prototype.unique
  47344. * @description 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  47345. */
  47346. this.unique = null;
  47347. /**
  47348. * @member {boolean} [ThemeGridUniqueItem.prototype.visible=true]
  47349. * @description 栅格单值专题图子项是否可见。
  47350. */
  47351. this.visible = true;
  47352. if (options) {
  47353. Util_Util.extend(this, options);
  47354. }
  47355. this.CLASS_NAME = "SuperMap.ThemeGridUniqueItem";
  47356. }
  47357. /**
  47358. * @function ThemeGridUniqueItem.prototype.destroy
  47359. * @description 释放资源,将引用资源的属性置空。
  47360. */
  47361. destroy() {
  47362. var me = this;
  47363. me.caption = null;
  47364. me.unique = null;
  47365. if (me.color) {
  47366. me.color.destroy();
  47367. me.color = null;
  47368. }
  47369. me.visible = null;
  47370. }
  47371. /**
  47372. * @function ThemeGridUniqueItem.prototype.toServerJSONObject
  47373. * @description 转换成对应的 JSON 格式对象。
  47374. * @returns {Object} 对应的 JSON 格式对象。
  47375. */
  47376. toServerJSONObject() {
  47377. var obj = {};
  47378. obj = Util_Util.copyAttributes(obj, this);
  47379. if (obj.color) {
  47380. if (obj.color.toServerJSONObject) {
  47381. obj.color = obj.color.toServerJSONObject();
  47382. }
  47383. }
  47384. return obj;
  47385. }
  47386. /**
  47387. * @function ThemeGridUniqueItem.fromObj
  47388. * @description 从传入对象获取栅格单值专题图子项类。
  47389. * @param {Object} obj - 传入对象。
  47390. * @returns {ThemeGridUniqueItem} ThemeGridUniqueItem 对象。
  47391. */
  47392. static fromObj(obj) {
  47393. var res = new ThemeGridUniqueItem();
  47394. Util_Util.copy(res, obj);
  47395. res.color = ServerColor.fromJson(obj.color);
  47396. return res;
  47397. }
  47398. }
  47399. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUnique.js
  47400. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47401. * This program are made available under the terms of the Apache License, Version 2.0
  47402. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47403. /**
  47404. * @class ThemeGridUnique
  47405. * @deprecatedclass SuperMap.ThemeGridUnique
  47406. * @category iServer Map Theme
  47407. * @classdesc 栅格单值专题图类。栅格单值专题图是将单元格值相同的归为一类,为每一类设定一种颜色,从而用来区分不同的类别。
  47408. * 适用于离散栅格数据和部分连续栅格数据,对于单元格值各不相同的那些连续栅格数据,使用栅格单值专题图不具有任何意义。
  47409. * @extends {CommonTheme}
  47410. * @param {Object} options - 参数。
  47411. * @param {Array.<ThemeGridUniqueItem>} options.items - 栅格单值专题图子项数组。
  47412. * @param {ServerColor} [options.defaultcolor] - 栅格单值专题图的默认颜色。
  47413. * @usage
  47414. */
  47415. class ThemeGridUnique extends Theme {
  47416. constructor(options) {
  47417. super("GRIDUNIQUE", options);
  47418. /**
  47419. * @member {ServerColor} ThemeGridUnique.prototype.defaultcolor
  47420. * @description 栅格单值专题图的默认颜色。
  47421. * 对于那些未在格网单值专题图子项之列的要素使用该颜色显示。
  47422. */
  47423. this.defaultcolor = new ServerColor();
  47424. /**
  47425. * @member {Array.<ThemeGridUniqueItem>} ThemeGridUnique.prototype.items
  47426. * @description 栅格单值专题图子项数组。
  47427. * 栅格单值专题图将值相同的单元格归为一类,每一类是一个专题图子项。
  47428. */
  47429. this.items = null;
  47430. if (options) {
  47431. Util_Util.extend(this, options);
  47432. }
  47433. this.CLASS_NAME = "SuperMap.ThemeGridUnique";
  47434. }
  47435. /**
  47436. * @function ThemeGridUnique.prototype.destroy
  47437. * @override
  47438. */
  47439. destroy() {
  47440. super.destroy();
  47441. var me = this;
  47442. if (me.items) {
  47443. if (me.items.length > 0) {
  47444. for (var item in me.items) {
  47445. me.items[item].destroy();
  47446. me.items[item] = null;
  47447. }
  47448. }
  47449. me.items = null;
  47450. }
  47451. if (me.defaultcolor) {
  47452. me.defaultcolor.destroy();
  47453. me.defaultcolor = null;
  47454. }
  47455. }
  47456. /**
  47457. * @function ThemeGridUnique.prototype.toServerJSONObject
  47458. * @description 转换成对应的 JSON 格式对象。
  47459. * @returns {Object} 对应的 JSON 格式对象
  47460. */
  47461. toServerJSONObject() {
  47462. var obj = {};
  47463. obj = Util_Util.copyAttributes(obj, this);
  47464. if (obj.defaultcolor) {
  47465. if (obj.defaultcolor.toServerJSONObject) {
  47466. obj.defaultcolor = obj.defaultcolor.toServerJSONObject();
  47467. }
  47468. }
  47469. if (obj.items) {
  47470. var items = [],
  47471. len = obj.items.length;
  47472. for (var i = 0; i < len; i++) {
  47473. items.push(obj.items[i].toServerJSONObject());
  47474. }
  47475. obj.items = items;
  47476. }
  47477. return obj;
  47478. }
  47479. /**
  47480. * @function ThemeGridUnique.fromObj
  47481. * @description 从传入对象获取栅格单值专题图类。
  47482. * @param {Object} obj - 传入对象
  47483. * @returns {ThemeGridUnique} ThemeGridUnique 对象
  47484. */
  47485. static fromObj(obj) {
  47486. var res = new ThemeGridUnique();
  47487. var uItems = obj.items;
  47488. var len = uItems ? uItems.length : 0;
  47489. Util_Util.extend(res, obj);
  47490. res.items = [];
  47491. res.defaultcolor = ServerColor.fromJson(obj.defaultcolor);
  47492. for (var i = 0; i < len; i++) {
  47493. res.items.push(ThemeGridUniqueItem.fromObj(uItems[i]));
  47494. }
  47495. return res;
  47496. }
  47497. }
  47498. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelUniqueItem.js
  47499. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47500. * This program are made available under the terms of the Apache License, Version 2.0
  47501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47502. /**
  47503. * @class ThemeLabelUniqueItem
  47504. * @deprecatedclass SuperMap.ThemeLabelUniqueItem
  47505. * @category iServer Map Theme
  47506. * @classdesc 单值标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注,值得注意的是,单值标签专题图允许用户通过 uniqueExpression
  47507. * 字段指定用于单值的字段,同一值的标签具有相同的显示风格,其中每一个值就是一个专题图子项,
  47508. * 每一个子项都具有其名称、风格、指定的单值、X 方向偏移量和 Y 方向偏移量。
  47509. * @param {Object} options - 参数。
  47510. * @param {string} options.unique - 子项的值,可以为数字、字符串等。
  47511. * @param {string} [options.caption] - 子项的名称。
  47512. * @param {number} [options.offsetX=0] - 标签在 X 方向偏移量。
  47513. * @param {number} [options.offsetY=0] - 标签在 Y 方向偏移量。
  47514. * @param {boolean} [options.visible=true] - 子项是否可见。
  47515. * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
  47516. * @usage
  47517. */
  47518. class ThemeLabelUniqueItem {
  47519. constructor(options) {
  47520. /**
  47521. * @member {string} [ThemeLabelUniqueItem.prototype.caption]
  47522. * @description 标签专题子项的标题。
  47523. */
  47524. this.caption = null;
  47525. /**
  47526. * @member {string} ThemeLabelUniqueItem.prototype.unique
  47527. * @description 单值专题图子项的值,可以为数字、字符串等。
  47528. */
  47529. this.unique = null;
  47530. /**
  47531. * @member {number} [ThemeLabelUniqueItem.prototype.offsetX=0]
  47532. * @description 标签在 X 方向偏移量。
  47533. */
  47534. this.offsetX = 0;
  47535. /**
  47536. * @member {number} [ThemeLabelUniqueItem.prototype.offsetY=0]
  47537. * @description 标签在 Y 方向偏移量。
  47538. */
  47539. this.offsetY = 0;
  47540. /**
  47541. * @member {boolean} [ThemeLabelUniqueItem.prototype.visible=true]
  47542. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  47543. */
  47544. this.visible = true;
  47545. /**
  47546. * @member {ServerTextStyle} ThemeLabelUniqueItem.prototype.style
  47547. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  47548. * uniformMixedStyle(标签文本的复合风格),ThemeLabelUniqueItem.style(单值子项的文本风格),uniformStyle(统一文本风格)。
  47549. */
  47550. this.style = new ServerTextStyle();
  47551. if (options) {
  47552. Util_Util.extend(this, options);
  47553. }
  47554. this.CLASS_NAME = "SuperMap.ThemeLabelUniqueItem";
  47555. }
  47556. /**
  47557. * @function ThemeLabelUniqueItem.prototype.destroy
  47558. * @description 释放资源,将引用资源的属性置空。
  47559. */
  47560. destroy() {
  47561. var me = this;
  47562. me.unique = null;
  47563. me.caption = null;
  47564. me.offsetX = null;
  47565. me.offsetY = null;
  47566. if (me.style) {
  47567. me.style.destroy();
  47568. me.style = null;
  47569. }
  47570. me.visible = null;
  47571. }
  47572. /**
  47573. * @function ThemeLabelUniqueItem.fromObj
  47574. * @description 从传入对象获取单值标签专题图的子项类。
  47575. * @param {Object} obj - 传入对象。
  47576. * @returns {ThemeLabelUniqueItem} ThemeLabelUniqueItem 对象。
  47577. */
  47578. static fromObj(obj) {
  47579. if (!obj) {
  47580. return;
  47581. }
  47582. var t = new ThemeLabelUniqueItem();
  47583. Util_Util.copy(t, obj);
  47584. return t;
  47585. }
  47586. }
  47587. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeMemoryData.js
  47588. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47589. * This program are made available under the terms of the Apache License, Version 2.0
  47590. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47591. /**
  47592. * @class ThemeMemoryData
  47593. * @deprecatedclass SuperMap.ThemeMemoryData
  47594. * @category iServer Map Theme
  47595. * @classdesc 专题图内存数据类。
  47596. * @param {Array} srcData - 原始值数组。
  47597. * @param {Array} targetData - 外部值数组。
  47598. * @usage
  47599. */
  47600. class ThemeMemoryData {
  47601. constructor(srcData, targetData) {
  47602. /**
  47603. * @member {Array} ThemeMemoryData.prototype.srcData
  47604. * @description 原始值数组,该属性值将被 targetData 属性所指定的值替换掉,然后制作专题图,但数据库中的值并不会改变。
  47605. */
  47606. this.srcData = srcData;
  47607. /**
  47608. * @member {Array} ThemeMemoryData.prototype.targetData
  47609. * @description 外部值数组,即用于制作专题图的内存数据,设定该属性值后,会将 srcData 属性所指定的原始值替换掉制作专题图,但数据库中的值并不会改变。
  47610. */
  47611. this.targetData = targetData;
  47612. this.CLASS_NAME = "SuperMap.ThemeMemoryData";
  47613. }
  47614. /**
  47615. * @function ThemeMemoryData.prototype.destroy
  47616. * @description 释放资源,将引用资源的属性置空。
  47617. */
  47618. destroy() {
  47619. var me = this;
  47620. me.srcData = null;
  47621. me.targetData = null;
  47622. }
  47623. /**
  47624. * @function ThemeMemoryData.prototype.toJSON
  47625. * @description 将 ThemeMemoryData 对象转化为 JSON 字符串。
  47626. * @returns {string} 返回转换后的 JSON 字符串。
  47627. */
  47628. toJSON() {
  47629. if (this.srcData && this.targetData) {
  47630. var memoryDataStr = "";
  47631. var count = Math.min(this.srcData.length, this.targetData.length);
  47632. for (var i = 0; i < count; i++) {
  47633. memoryDataStr += "\'" + this.srcData[i] + "\':\'" + this.targetData[i] + "\',";
  47634. }
  47635. //去除多余的逗号
  47636. if (i > 0) {
  47637. memoryDataStr = memoryDataStr.substring(0, memoryDataStr.length - 1);
  47638. }
  47639. return "{" + memoryDataStr + "}";
  47640. } else {
  47641. return null;
  47642. }
  47643. }
  47644. }
  47645. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeParameters.js
  47646. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47647. * This program are made available under the terms of the Apache License, Version 2.0
  47648. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47649. /**
  47650. * @class ThemeParameters
  47651. * @deprecatedclass SuperMap.ThemeParameters
  47652. * @category iServer Map Theme
  47653. * @classdesc 专题图参数类。
  47654. * 该类存储了制作专题所需的参数,包括数据源、数据集名称和专题图对象。
  47655. * @param {Object} options - 参数。
  47656. * @param {Array.<string>} options.datasetNames - 数据集数组。
  47657. * @param {Array.<string>} options.dataSourceNames - 数据源数组。
  47658. * @param {Array.<JoinItem>} [options.joinItems] - 专题图外部表的连接信息 JoinItem 数组。
  47659. * @param {Array.<CommonTheme>} options.themes - 专题图对象列表。
  47660. * @param {Array.<string>} [options.displayFilters] - 专题图属性过滤条件。
  47661. * @param {Array.<string>} [options.displayOrderBys] - 专题图对象生成符号叠加次序排序字段。
  47662. * @param {Object} [options.fieldValuesDisplayFilter] - 图层要素的显示和隐藏的过滤属性,其带有三个属性,分别是:values、fieldName、fieldValuesDisplayMode。
  47663. * @usage
  47664. */
  47665. class ThemeParameters {
  47666. constructor(options) {
  47667. /**
  47668. * @member {Array.<string>} ThemeParameters.prototype.datasetNames
  47669. * @description 要制作专题图的数据集数组。
  47670. */
  47671. this.datasetNames = null;
  47672. /**
  47673. * @member {Array.<string>} ThemeParameters.prototype.dataSourceNames
  47674. * @description 要制作专题图的数据集所在的数据源数组。
  47675. */
  47676. this.dataSourceNames = null;
  47677. /**
  47678. * @member {Array.<JoinItem>} [ThemeParameters.prototype.joinItems]
  47679. * @description 设置与外部表的连接信息 JoinItem 数组。
  47680. * 使用此属性可以制作与外部表连接的专题图。
  47681. */
  47682. this.joinItems = null;
  47683. /**
  47684. * @member {Array.<CommonTheme>} ThemeParameters.prototype.themes
  47685. * @description 专题图对象列表。
  47686. * 该参数为实例化的各类专题图对象的集合。
  47687. */
  47688. this.themes = null;
  47689. /**
  47690. * @member {Array.<string>} [ThemeParameters.prototype.displayFilters]
  47691. * @description 专题图属性过滤条件。
  47692. */
  47693. this.displayFilters = null;
  47694. /**
  47695. * @member {Array.<string>} [ThemeParameters.prototype.displayOrderBys]
  47696. * @description 专题图对象生成符号叠加次序排序字段。
  47697. */
  47698. this.displayOrderBys = null;
  47699. /**
  47700. * @member {Object} [ThemeParameters.prototype.fieldValuesDisplayFilter]
  47701. * @property {Array.<number>} values - 待过滤的值。
  47702. * @property {string} fieldName - 待过滤的字段名称只支持数字类型的字段。
  47703. * @property {string} fieldValuesDisplayMode - 目前为 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  47704. */
  47705. this.fieldValuesDisplayFilter = null;
  47706. if (options) {
  47707. Util_Util.extend(this, options);
  47708. }
  47709. this.CLASS_NAME = "SuperMap.ThemeParameters";
  47710. }
  47711. /**
  47712. * @function ThemeParameters.prototype.destroy
  47713. * @description 释放资源,将引用资源的属性置空。
  47714. */
  47715. destroy() {
  47716. var me = this;
  47717. me.datasetNames = null;
  47718. me.dataSourceNames = null;
  47719. if (me.joinItems) {
  47720. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  47721. joinItems[i].destroy();
  47722. }
  47723. me.joinItems = null;
  47724. }
  47725. if (me.themes) {
  47726. for (let i = 0, themes = me.themes, len = themes.length; i < len; i++) {
  47727. themes[i].destroy();
  47728. }
  47729. me.themes = null;
  47730. }
  47731. }
  47732. }
  47733. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeService.js
  47734. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47735. * This program are made available under the terms of the Apache License, Version 2.0
  47736. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47737. /**
  47738. * @class ThemeService
  47739. * @deprecatedclass SuperMap.ThemeService
  47740. * @category iServer Map Theme
  47741. * @classdesc 专题图服务类。
  47742. * @extends {CommonServiceBase}
  47743. * @example
  47744. * var myThemeService = new ThemeService(url, {
  47745. * eventListeners: {
  47746. * "processCompleted": themeCompleted,
  47747. * "processFailed": themeFailed
  47748. * }
  47749. * });
  47750. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  47751. * @param {Object} options - 参数。
  47752. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  47753. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47754. * @param {Object} [options.headers] - 请求头。
  47755. * @usage
  47756. */
  47757. class ThemeService_ThemeService extends CommonServiceBase {
  47758. constructor(url, options) {
  47759. super(url, options);
  47760. if (options) {
  47761. Util_Util.extend(this, options);
  47762. }
  47763. this.eventCount = 0;
  47764. this.url = Util_Util.urlPathAppend(this.url, 'tempLayersSet');
  47765. this.CLASS_NAME = 'SuperMap.ThemeService';
  47766. }
  47767. /**
  47768. * @override
  47769. */
  47770. destroy() {
  47771. super.destroy();
  47772. }
  47773. /**
  47774. * @function ThemeService.prototype.processAsync
  47775. * @description 负责将客户端的专题图参数传递到服务端。
  47776. * @param {ThemeParameters} params - 专题图参数类。
  47777. */
  47778. processAsync(params, callback) {
  47779. if (!(params instanceof ThemeParameters)) {
  47780. return;
  47781. }
  47782. var me = this,
  47783. jsonParameters = null;
  47784. jsonParameters = me.getJsonParameters(params);
  47785. let eventId = ++this.eventCount;
  47786. let eventListeners = {
  47787. scope: this,
  47788. processCompleted: function(result) {
  47789. if (eventId === result.result.eventId && callback) {
  47790. delete result.result.eventId;
  47791. callback(result);
  47792. this.events && this.events.un(eventListeners);
  47793. return false;
  47794. }
  47795. },
  47796. processFailed: function(result) {
  47797. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  47798. callback(result);
  47799. this.events && this.events.un(eventListeners);
  47800. return false;
  47801. }
  47802. }
  47803. }
  47804. this.events.on(eventListeners);
  47805. me.request({
  47806. method: "POST",
  47807. data: jsonParameters,
  47808. scope: me,
  47809. success(result, options) {
  47810. result.eventId = eventId;
  47811. this.serviceProcessCompleted(result, options);
  47812. },
  47813. failure(result, options) {
  47814. if (result.error) {
  47815. result.error.eventId = eventId;
  47816. }
  47817. result.eventId = eventId;
  47818. this.serviceProcessFailed(result, options);
  47819. }
  47820. });
  47821. }
  47822. /**
  47823. * @function ThemeService.prototype.getJsonParameters
  47824. * @description 将专题图参数参数转化为 JSON 字符串。
  47825. * @param {ThemeParameters} parameter - 专题图参数类。
  47826. * @returns {Object} 转化后的JSON字符串。
  47827. */
  47828. getJsonParameters(parameter) {
  47829. var jsonParameters = "",
  47830. themeObj = null,
  47831. filters = null,
  47832. orderBys = null,
  47833. fieldValuesDisplayFilter;
  47834. jsonParameters += "[{'type': 'UGC','subLayers': {'layers': [";
  47835. for (var i = 0; i < parameter.themes.length; i++) {
  47836. themeObj = parameter.themes[i];
  47837. var jsonTheme = Util_Util.toJSON(themeObj);
  47838. jsonTheme = jsonTheme.slice(0, -1);
  47839. jsonParameters += "{'theme': " + jsonTheme + "},'type': 'UGC','ugcLayerType': 'THEME',";
  47840. filters = parameter.displayFilters;
  47841. if (filters && filters.length > 0) {
  47842. if (filters.length === 1) {
  47843. jsonParameters += "'displayFilter':\"" + filters[0] + "\",";
  47844. } else {
  47845. jsonParameters += "'displayFilter':\"" + filters[i] + "\",";
  47846. }
  47847. }
  47848. orderBys = parameter.displayOrderBy;
  47849. if (orderBys && orderBys.length > 0) {
  47850. if (orderBys.length === 1) {
  47851. jsonParameters += "'displayOrderBy':'" + orderBys[0] + "',";
  47852. } else {
  47853. jsonParameters += "'displayOrderBy':'" + orderBys[i] + "',";
  47854. }
  47855. }
  47856. fieldValuesDisplayFilter = parameter.fieldValuesDisplayFilter;
  47857. if (fieldValuesDisplayFilter) {
  47858. jsonParameters += "'fieldValuesDisplayFilter':" + Util_Util.toJSON(fieldValuesDisplayFilter) + ",";
  47859. }
  47860. if (parameter.joinItems && parameter.joinItems.length > 0 && parameter.joinItems[i]) {
  47861. jsonParameters += "'joinItems':[" + Util_Util.toJSON(parameter.joinItems[i]) + "],";
  47862. }
  47863. if (parameter.datasetNames && parameter.dataSourceNames) {
  47864. var datasetID = parameter.datasetNames[i] ? i : (parameter.datasetNames.length - 1);
  47865. var dataSourceID = parameter.dataSourceNames[i] ? i : (parameter.dataSourceNames.length - 1);
  47866. jsonParameters += "'datasetInfo': {'name': '" + parameter.datasetNames[datasetID] +
  47867. "','dataSourceName': '" + parameter.dataSourceNames[dataSourceID] + "'}},";
  47868. } else {
  47869. jsonParameters += "},";
  47870. }
  47871. }
  47872. //去除多余的逗号
  47873. if (parameter.themes && parameter.themes.length > 0) {
  47874. jsonParameters = jsonParameters.substring(0, jsonParameters.length - 1);
  47875. }
  47876. jsonParameters += "]},";
  47877. var urlArray = this.url.split("/");
  47878. var jsonMapName = urlArray[urlArray.length - 2];
  47879. jsonParameters += "'name': '" + jsonMapName + "'}]";
  47880. return jsonParameters;
  47881. }
  47882. }
  47883. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystService.js
  47884. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47885. * This program are made available under the terms of the Apache License, Version 2.0
  47886. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47887. /**
  47888. * @class ThiessenAnalystService
  47889. * @deprecatedclass SuperMap.ThiessenAnalystService
  47890. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  47891. * @classdesc
  47892. * 泰森多边形分析服务类
  47893. * 该类负责将客户设置的泰森多边形分析参数传递给服务端,并接收服务端返回的分析结果数据。
  47894. * 泰森多边形分析结果通过该类支持的事件的监听函数参数获取
  47895. * 泰森多边形分析的参数支持两种,当参数为 {@link DatasetThiessenAnalystParameters} 类型
  47896. * 时,执行数据集泰森多边形分析,当参数为 {@link GeometryThiessenAnalystParameters} 类型时,
  47897. * 执行几何对象泰森多边形分析。
  47898. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  47899. * @param {Object} options - 参数。
  47900. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  47901. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47902. * @param {Object} [options.headers] - 请求头。
  47903. * @extends {SpatialAnalystBase}
  47904. * @example 例如:
  47905. * (start code)
  47906. * var myThiessenAnalystService = new ThiessenAnalystService(url, {
  47907. * eventListeners: {
  47908. * "processCompleted": bufferCompleted,
  47909. * "processFailed": bufferFailed
  47910. * }
  47911. * });
  47912. * (end)
  47913. * @usage
  47914. */
  47915. class ThiessenAnalystService extends SpatialAnalystBase {
  47916. constructor(url, options) {
  47917. super(url, options);
  47918. /**
  47919. * @member {string} ThiessenAnalystService.prototype.mode
  47920. * @description 缓冲区分析类型
  47921. */
  47922. this.mode = null;
  47923. if (options) {
  47924. Util_Util.extend(this, options);
  47925. }
  47926. this.CLASS_NAME = "SuperMap.ThiessenAnalystService";
  47927. }
  47928. /**
  47929. * @override
  47930. */
  47931. destroy() {
  47932. super.destroy();
  47933. this.mode = null;
  47934. }
  47935. /**
  47936. * @function ThiessenAnalystService.prototype.processAsync
  47937. * @description 负责将客户端的查询参数传递到服务端。
  47938. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} parameter - 泰森多边形分析参数基类。
  47939. */
  47940. processAsync(parameter) {
  47941. var parameterObject = {};
  47942. var me = this;
  47943. if (parameter instanceof DatasetThiessenAnalystParameters) {
  47944. me.mode = "datasets";
  47945. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/thiessenpolygon');
  47946. DatasetThiessenAnalystParameters.toObject(parameter, parameterObject);
  47947. } else if (parameter instanceof GeometryThiessenAnalystParameters) {
  47948. me.mode = "geometry";
  47949. me.url = Util_Util.urlPathAppend(me.url, 'geometry/thiessenpolygon');
  47950. GeometryThiessenAnalystParameters.toObject(parameter, parameterObject);
  47951. }
  47952. var jsonParameters = Util_Util.toJSON(parameterObject);
  47953. this.returnContent = true;
  47954. me.request({
  47955. method: "POST",
  47956. data: jsonParameters,
  47957. scope: me,
  47958. success: me.serviceProcessCompleted,
  47959. failure: me.serviceProcessFailed
  47960. });
  47961. }
  47962. dataFormat() {
  47963. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  47964. }
  47965. }
  47966. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBatchAnalystService.js
  47967. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47968. * This program are made available under the terms of the Apache License, Version 2.0
  47969. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47970. /**
  47971. * @class GeometryBatchAnalystService
  47972. * @deprecatedclass SuperMap.GeometryBatchAnalystService
  47973. * @category iServer SpatialAnalyst BatchAnalyst
  47974. * @classdesc 批量空间分析服务类
  47975. * @description 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  47976. * 获取的结果数据包括 originResult 、result 两种,
  47977. * 其中,originResult 为服务端返回的用 JSON 对象表示的量算结果数据,result 为服务端返回的量算结果数据。
  47978. * @extends {SpatialAnalystBase}
  47979. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  47980. * @param {Object} options - 参数。
  47981. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  47982. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  47983. * @param {Object} [options.headers] - 请求头。
  47984. * @example
  47985. * var myOverlayAnalystService = new GeometryBatchAnalystService(url, {
  47986. * eventListeners: {
  47987. * "processCompleted": OverlayCompleted,
  47988. * "processFailed": OverlayFailed
  47989. * }
  47990. * });
  47991. * @usage
  47992. */
  47993. class GeometryBatchAnalystService extends SpatialAnalystBase {
  47994. constructor(url, options) {
  47995. super(url, options);
  47996. if (options) {
  47997. Util_Util.extend(this, options);
  47998. }
  47999. this.CLASS_NAME = "SuperMap.GeometryBatchAnalystService";
  48000. }
  48001. /**
  48002. * @function GeometryBatchAnalystService.prototype.processAsync
  48003. * @description 负责将客户端的查询参数传递到服务端。
  48004. * @param {GeometryOverlayAnalystParameter} parameter - 批量几何对象叠加分析参数类
  48005. *
  48006. */
  48007. processAsync(parameters) {
  48008. var me = this;
  48009. me.url = Util_Util.urlPathAppend(me.url, 'geometry/batchanalyst');
  48010. me.url = Util_Util.urlAppend(me.url, 'returnContent=true&ignoreAnalystParam=true');
  48011. var parameterObjects = me._processParams(parameters);
  48012. var jsonParameters = Util_Util.toJSON(parameterObjects);
  48013. me.request({
  48014. method: "POST",
  48015. data: jsonParameters,
  48016. scope: me,
  48017. success: me.serviceProcessCompleted,
  48018. failure: me.serviceProcessFailed
  48019. });
  48020. }
  48021. _processParams(parameters) {
  48022. var me = this;
  48023. if (!Util_Util.isArray(parameters)) {
  48024. return;
  48025. }
  48026. var processParams = [];
  48027. parameters.map(function (item) {
  48028. processParams.push(me._toJSON(item));
  48029. return item;
  48030. });
  48031. return processParams;
  48032. }
  48033. _toJSON(parameter) {
  48034. var tempObj = {};
  48035. if(parameter.analystName ==="buffer"){
  48036. tempObj.analystName = "buffer";
  48037. tempObj.param = {};
  48038. //几何对象的批量空间分析,
  48039. GeometryBufferAnalystParameters.toObject(parameter.param, tempObj.param);
  48040. }else if(parameter.analystName ==="overlay"){
  48041. tempObj.analystName = "overlay";
  48042. tempObj.param = {};
  48043. GeometryOverlayAnalystParameters.toObject(parameter.param, tempObj.param);
  48044. }else if(parameter.analystName ==="interpolationDensity"){
  48045. tempObj.analystName = "interpolationDensity";
  48046. tempObj.param = {};
  48047. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  48048. }else if(parameter.analystName ==="interpolationidw"){
  48049. tempObj.analystName = "interpolationidw";
  48050. tempObj.param = {};
  48051. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  48052. }else if(parameter.analystName ==="interpolationRBF"){
  48053. tempObj.analystName = "interpolationRBF";
  48054. tempObj.param = {};
  48055. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  48056. }else if(parameter.analystName ==="interpolationKriging"){
  48057. tempObj.analystName = "interpolationKriging";
  48058. tempObj.param = {};
  48059. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  48060. }else if(parameter.analystName ==="thiessenpolygon"){
  48061. tempObj.analystName = "thiessenpolygon";
  48062. tempObj.param = {};
  48063. GeometryThiessenAnalystParameters.toObject(parameter.param, tempObj.param);
  48064. }else {
  48065. //isoline; isoregion; calculatemeasure; routelocator 四种分析不需要再处理参数
  48066. return parameter;
  48067. }
  48068. return tempObj;
  48069. }
  48070. /**
  48071. * @override
  48072. */
  48073. destroy() {
  48074. super.destroy();
  48075. }
  48076. }
  48077. ;// CONCATENATED MODULE: ./src/common/iServer/TilesetsService.js
  48078. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48079. * This program are made available under the terms of the Apache License, Version 2.0
  48080. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48081. /**
  48082. * @class TilesetsService
  48083. * @deprecatedclass SuperMap.TilesetsService
  48084. * @category iServer Map Tilesets
  48085. * @classdesc 切片列表信息查询服务类;即查询切片地图服务的切片列表,返回切片集名称、地图切片元数据信息、切片版本集信息。
  48086. * @extends {CommonServiceBase}
  48087. * @param {string} url - 服务地址。URL 应为:
  48088. * http://{服务器地址}:{服务端口号}/iserver/services/{服务名}/rest/maps/map;
  48089. * 例如: "http://localhost:8090/iserver/services/test/rest/maps/tianlocal"。
  48090. * @param {Object} options - 参数。
  48091. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  48092. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  48093. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48094. * @param {Object} [options.headers] - 请求头。
  48095. * @usage
  48096. */
  48097. class TilesetsService extends CommonServiceBase {
  48098. constructor(url, options) {
  48099. super(url, options);
  48100. this.CLASS_NAME = "SuperMap.TilesetsService";
  48101. }
  48102. /**
  48103. * @override
  48104. */
  48105. destroy() {
  48106. super.destroy();
  48107. }
  48108. /**
  48109. * @function TilesetsService.prototype.processAsync
  48110. * @description 负责将客户端的查询参数传递到服务端。
  48111. */
  48112. processAsync() {
  48113. if (!this.url) {
  48114. return;
  48115. }
  48116. var me = this;
  48117. me.url = Util_Util.urlPathAppend(me.url, 'tilesets');
  48118. me.request({
  48119. method: "GET",
  48120. scope: me,
  48121. success: me.serviceProcessCompleted,
  48122. failure: me.serviceProcessFailed
  48123. });
  48124. }
  48125. }
  48126. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  48127. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48128. * This program are made available under the terms of the Apache License, Version 2.0
  48129. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48130. /**
  48131. * @class TopologyValidatorJobsParameter
  48132. * @deprecatedclass SuperMap.TopologyValidatorJobsParameter
  48133. * @category iServer ProcessingService TopologyValidator
  48134. * @classdesc 拓扑检查分析任务参数类。
  48135. * @param {Object} options - 参数。
  48136. * @param {string} options.datasetName - 数据集名。
  48137. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  48138. * @param {TopologyValidatorRule} [options.rule=TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  48139. * @param {string} [options.tolerance] - 容限。
  48140. * @param {OutputSetting} [options.output] - 输出参数设置。
  48141. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  48142. * @usage
  48143. */
  48144. class TopologyValidatorJobsParameter {
  48145. constructor(options) {
  48146. if (!options) {
  48147. return;
  48148. }
  48149. /**
  48150. * @member {string} TopologyValidatorJobsParameter.prototype.datasetName
  48151. * @description 数据集名。
  48152. */
  48153. this.datasetName = "";
  48154. /**
  48155. * @member {string} TopologyValidatorJobsParameter.prototype.datasetTopology
  48156. * @description 拓扑检查对象所在的数据集名称。
  48157. */
  48158. this.datasetTopology = "";
  48159. /**
  48160. * @member {string} [TopologyValidatorJobsParameter.prototype.tolerance]
  48161. * @description 容限,指定的拓扑错误检查时使用的容限。
  48162. */
  48163. this.tolerance = "";
  48164. /**
  48165. * @member {TopologyValidatorRule} [TopologyValidatorJobsParameter.prototype.rule=TopologyValidatorRule.REGIONNOOVERLAP]
  48166. * @description 拓扑检查模式。
  48167. */
  48168. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  48169. /**
  48170. * @member {OutputSetting} [TopologyValidatorJobsParameter.prototype.output]
  48171. * @description 输出参数设置类。
  48172. */
  48173. this.output = null;
  48174. /**
  48175. * @member {MappingParameters} [TopologyValidatorJobsParameter.prototype.mappingParameters]
  48176. * @description 分析后结果可视化的参数类。
  48177. */
  48178. this.mappingParameters = null;
  48179. Util_Util.extend(this, options);
  48180. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  48181. }
  48182. /**
  48183. * @function TopologyValidatorJobsParameter.prototype.destroy
  48184. * @description 释放资源,将引用资源的属性置空。
  48185. */
  48186. destroy() {
  48187. this.datasetName = null;
  48188. this.datasetTopology = null;
  48189. this.tolerance = null;
  48190. this.rule = null;
  48191. if (this.output instanceof OutputSetting) {
  48192. this.output.destroy();
  48193. this.output = null;
  48194. }
  48195. if (this.mappingParameters instanceof MappingParameters) {
  48196. this.mappingParameters.destroy();
  48197. this.mappingParameters = null;
  48198. }
  48199. }
  48200. /**
  48201. * @function TopologyValidatorJobsParameter.toObject
  48202. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  48203. * @param {Object} tempObj - 目标对象。
  48204. * @description 生成拓扑检查分析任务对象。
  48205. */
  48206. static toObject(TopologyValidatorJobsParameter, tempObj) {
  48207. for (var name in TopologyValidatorJobsParameter) {
  48208. if (name === "datasetName") {
  48209. tempObj['input'] = tempObj['input'] || {};
  48210. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  48211. continue;
  48212. }
  48213. if (name === "output") {
  48214. tempObj['output'] = tempObj['output'] || {};
  48215. tempObj['output'] = TopologyValidatorJobsParameter[name];
  48216. continue;
  48217. }
  48218. tempObj['analyst'] = tempObj['analyst'] || {};
  48219. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  48220. if(name === 'mappingParameters'){
  48221. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  48222. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  48223. }
  48224. }
  48225. }
  48226. }
  48227. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  48228. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48229. * This program are made available under the terms of the Apache License, Version 2.0
  48230. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48231. /**
  48232. * @class TopologyValidatorJobsService
  48233. * @deprecatedclass SuperMap.TopologyValidatorJobsService
  48234. * @category iServer ProcessingService TopologyValidator
  48235. * @classdesc 拓扑检查分析服务类
  48236. * @extends {ProcessingServiceBase}
  48237. * @param {string} url - 服务地址。
  48238. * @param {Object} options - 可选参数。
  48239. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48240. * @param {Object} [options.headers] - 请求头。
  48241. * @usage
  48242. */
  48243. class TopologyValidatorJobsService extends ProcessingServiceBase {
  48244. constructor(url, options) {
  48245. super(url, options);
  48246. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  48247. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  48248. }
  48249. /**
  48250. *@override
  48251. */
  48252. destroy() {
  48253. super.destroy();
  48254. }
  48255. /**
  48256. * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  48257. * @description 获取拓扑检查分析所有任务
  48258. */
  48259. getTopologyValidatorJobs() {
  48260. super.getJobs(this.url);
  48261. }
  48262. /**
  48263. * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  48264. * @description 获取指定id的拓扑检查分析服务
  48265. * @param {string} id - 指定要获取数据的id
  48266. */
  48267. getTopologyValidatorJob(id) {
  48268. super.getJobs( Util_Util.urlPathAppend(this.url, id));
  48269. }
  48270. /**
  48271. * @function TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  48272. * @description 新建拓扑检查分析服务
  48273. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析任务参数类。
  48274. * @param {number} seconds -创建成功结果的时间间隔。
  48275. */
  48276. addTopologyValidatorJob(params, seconds) {
  48277. super.addJob(this.url, params, TopologyValidatorJobsParameter, seconds);
  48278. }
  48279. }
  48280. ;// CONCATENATED MODULE: ./src/common/iServer/TransferLine.js
  48281. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48282. * This program are made available under the terms of the Apache License, Version 2.0
  48283. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48284. /**
  48285. * @class TransferLine
  48286. * @deprecatedclass SuperMap.TransferLine
  48287. * @category iServer TrafficTransferAnalyst TransferPath
  48288. * @classdesc 换乘路线信息类。
  48289. * @param {Object} options - 参数。
  48290. * @param {number} options.lineID - 乘车路线 ID。
  48291. * @param {string} options.lineName - 乘车路线名称。
  48292. * @param {string} options.lineAliasName - 乘车路线别名。
  48293. * @param {number} options.startStopIndex - 上车站点在本公交路线中的索引。
  48294. * @param {string} options.startStopName - 上车站点名称。
  48295. * @param {string} options.startStopAliasName - 上车站点别名。
  48296. * @param {number} options.endStopIndex - 下车站点在本公交路线中的索引。
  48297. * @param {string} options.endStopName - 下车站点名称。
  48298. * @param {string} options.endStopAliasName - 下车站点别名。
  48299. * @usage
  48300. */
  48301. class TransferLine {
  48302. constructor(options) {
  48303. options = options || {};
  48304. /**
  48305. * @member {number} TransferLine.prototype.lineID
  48306. * @description 乘车路线 ID。
  48307. */
  48308. this.lineID = null;
  48309. /**
  48310. * @member {string} TransferLine.prototype.lineName
  48311. * @description 乘车路线名称。
  48312. */
  48313. this.lineName = null;
  48314. /**
  48315. * @member {string} TransferLine.prototype.lineAliasName
  48316. * @description 乘车路线别名。
  48317. */
  48318. this.lineAliasName = null;
  48319. /**
  48320. * @member {number} TransferLine.prototype.startStopIndex
  48321. * @description 上车站点在本公交路线中的索引。
  48322. */
  48323. this.startStopIndex = null;
  48324. /**
  48325. * @member {string} TransferLine.prototype.startStopName
  48326. * @description 上车站点名称。
  48327. */
  48328. this.startStopName = null;
  48329. /**
  48330. * @member {string} TransferLine.prototype.startStopAliasName
  48331. * @description 上车站点别名。
  48332. */
  48333. this.startStopAliasName = null;
  48334. /**
  48335. * @member {number} TransferLine.prototype.endStopIndex
  48336. * @description 下车站点在本公交路线中的索引。
  48337. */
  48338. this.endStopIndex = null;
  48339. /**
  48340. * @member {string} TransferLine.prototype.endStopName
  48341. * @description 下车站点名称。
  48342. */
  48343. this.endStopName = null;
  48344. /**
  48345. * @member {string} TransferLine.prototype.endStopAliasName
  48346. * @description 下车站点别名。
  48347. */
  48348. this.endStopAliasName = null;
  48349. Util_Util.extend(this, options);
  48350. this.CLASS_NAME = "SuperMap.TransferLine";
  48351. }
  48352. /**
  48353. * @function TransferLine.prototype.destroy
  48354. * @description 释放资源,将引用资源的属性置空。
  48355. */
  48356. destroy() {
  48357. Util_Util.reset(this);
  48358. }
  48359. /**
  48360. * @function TransferLine.fromJson
  48361. * @description 将返回结果转化为 {@link TransferLine} 对象。
  48362. * @param {Object} jsonObject - 新的返回结果。
  48363. * @returns {TransferLine} 转化后的 {@link TransferLine} 对象。
  48364. */
  48365. static fromJson(jsonObject) {
  48366. if (!jsonObject) {
  48367. return;
  48368. }
  48369. return new TransferLine({
  48370. lineID: jsonObject['lineID'],
  48371. lineName: jsonObject['lineName'],
  48372. lineAliasName: jsonObject['lineAliasName'],
  48373. startStopIndex: jsonObject['startStopIndex'],
  48374. startStopName: jsonObject['startStopName'],
  48375. startStopAliasName: jsonObject['startStopAliasName'],
  48376. endStopIndex: jsonObject['endStopIndex'],
  48377. endStopName: jsonObject['endStopName'],
  48378. endStopAliasName: jsonObject['endStopAliasName']
  48379. });
  48380. }
  48381. }
  48382. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathParameters.js
  48383. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48384. * This program are made available under the terms of the Apache License, Version 2.0
  48385. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48386. /**
  48387. * @class TransferPathParameters
  48388. * @deprecatedclass SuperMap.TransferPathParameters
  48389. * @category iServer TrafficTransferAnalyst TransferPath
  48390. * @classdesc 交通换乘线路查询参数类。
  48391. * @param {Object} options - 参数。
  48392. * @param {Array.<TransferLine>} options.transferLines - 本换乘分段内可乘车的路线集合。
  48393. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止 ID 进行查询和按照起止点的坐标进行查询。
  48394. * @usage
  48395. */
  48396. class TransferPathParameters {
  48397. constructor(options) {
  48398. options = options || {};
  48399. /**
  48400. * @member {Array.<TransferLine>} TransferPathParameters.prototype.transferLines
  48401. * @description 本换乘分段内可乘车的路线集合,通过交通换乘方案查询得到。
  48402. */
  48403. this.transferLines = null;
  48404. /**
  48405. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferPathParameters.prototype.points
  48406. * @description 两种查询方式:<br>
  48407. * 1. 按照公交站点的起止ID进行查询,则 points 参数的类型为 int[],形如:[起点ID、终点ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  48408. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  48409. */
  48410. this.points = null;
  48411. Util_Util.extend(this, options);
  48412. this.CLASS_NAME = "SuperMap.TransferPathParameters";
  48413. }
  48414. /**
  48415. * @function TransferPathParameters.prototype.destroy
  48416. * @description 释放资源,将引用资源的属性置空。
  48417. */
  48418. destroy() {
  48419. Util_Util.reset(this);
  48420. }
  48421. /**
  48422. * @function TransferPathParameters.toJson
  48423. * @description 将 {@link TransferPathParameters} 对象参数转换为 JSON 字符串。
  48424. * @param {TransferPathParameters} params - 交通换乘参数。
  48425. * @returns {string} 转化后的 JSON 字符串。
  48426. */
  48427. static toJson(params) {
  48428. if (params) {
  48429. return Util_Util.toJSON(params);
  48430. }
  48431. }
  48432. }
  48433. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathService.js
  48434. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48435. * This program are made available under the terms of the Apache License, Version 2.0
  48436. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48437. /**
  48438. * @class TransferPathService
  48439. * @deprecatedclass SuperMap.TransferPathService
  48440. * @category iServer TrafficTransferAnalyst TransferPath
  48441. * @classdesc 交通换乘线路查询服务类,根据交通换乘分析结果(TransferSolutionResult),获取某一条乘车路线的详细信息。
  48442. * 返回结果通过该类支持的事件的监听函数参数获取
  48443. * @extends {CommonServiceBase}
  48444. * @example 例如:
  48445. * var myService = new TransferPathService(url, {eventListeners: {
  48446. * "processCompleted": TrafficTransferCompleted,
  48447. * "processFailed": TrafficTransferError
  48448. * }
  48449. * };
  48450. * @param {string} url - 服务地址。
  48451. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  48452. * @param {Object} options - 参数。
  48453. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  48454. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48455. * @param {Object} [options.headers] - 请求头。
  48456. * @usage
  48457. */
  48458. class TransferPathService extends CommonServiceBase {
  48459. constructor(url, options) {
  48460. super(url, options);
  48461. this.CLASS_NAME = "SuperMap.TransferPathService";
  48462. }
  48463. /**
  48464. * @override
  48465. */
  48466. destroy() {
  48467. super.destroy();
  48468. }
  48469. /**
  48470. * @function TransferPathService.prototype.processAsync
  48471. * @description 负责将客户端的更新参数传递到服务端。
  48472. * @param {TransferPathParameters} params - 交通换乘参数。
  48473. */
  48474. processAsync(params) {
  48475. if (!(params instanceof TransferPathParameters)) {
  48476. return;
  48477. }
  48478. var me = this,
  48479. method = "GET",
  48480. jsonParameters;
  48481. me.url = Util_Util.urlPathAppend(me.url, 'path');
  48482. jsonParameters = {
  48483. points: Util_Util.toJSON(params.points),
  48484. transferLines: Util_Util.toJSON(params['transferLines'])
  48485. };
  48486. me.request({
  48487. method: method,
  48488. params: jsonParameters,
  48489. scope: me,
  48490. success: me.serviceProcessCompleted,
  48491. failure: me.serviceProcessFailed
  48492. });
  48493. }
  48494. }
  48495. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionParameters.js
  48496. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48497. * This program are made available under the terms of the Apache License, Version 2.0
  48498. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48499. /**
  48500. * @class TransferSolutionParameters
  48501. * @deprecatedclass SuperMap.TransferSolutionParameters
  48502. * @category iServer TrafficTransferAnalyst TransferSolutions
  48503. * @classdesc 交通换乘方案查询参数类。
  48504. * @param {Object} options - 参数。
  48505. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止ID进行查询和按照起止点的坐标进行查询。
  48506. * @param {number} [options.solutionCount=6] - 乘车方案的数量。
  48507. * @param {TransferTactic} [options.transferTactic=TransferTactic.LESS_TIME] - 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  48508. * @param {TransferPreference} [options.transferPreference=TransferPreference.NONE] - 乘车偏好枚举。
  48509. * @param {number} [options.walkingRatio=10] - 步行与公交的消耗权重比。
  48510. * @param {Array.<number>} [options.evadeLines] - 避让路线的 ID。
  48511. * @param {Array.<number>} [options.evadeStops] - 避让站点的 ID。
  48512. * @param {Array.<number>} [options.priorLines] - 优先路线的 ID。
  48513. * @param {Array.<number>} [options.priorStops] - 优先站点的 ID。
  48514. * @param {string} [options.travelTime] - 出行的时间。
  48515. * @usage
  48516. */
  48517. class TransferSolutionParameters {
  48518. constructor(options) {
  48519. options = options || {};
  48520. /**
  48521. * @member {number} [TransferSolutionParameters.prototype.solutionCount=6]
  48522. * @description 乘车方案的数量。
  48523. */
  48524. this.solutionCount = 6;
  48525. /**
  48526. * @member {TransferPreference} [TransferSolutionParameters.prototype.transferPreference=TransferPreference.NONE]
  48527. * @description 乘车偏好枚举。
  48528. */
  48529. this.transferPreference = TransferPreference.NONE;
  48530. /**
  48531. * @member {TransferTactic} [TransferSolutionParameters.prototype.transferTactic=TransferTactic|TransferTactic.LESS_TIME]
  48532. * @description 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  48533. */
  48534. this.transferTactic = TransferTactic.LESS_TIME;
  48535. /**
  48536. * @member {number} [TransferSolutionParameters.prototype.walkingRatio=10]
  48537. * @description 步行与公交的消耗权重比。此值越大,则步行因素对于方案选择的影响越大。例如:</br>
  48538. * 例如现在有两种换乘方案(在仅考虑消耗因素的情况下):</br>
  48539. * 方案1:坐车 10 公里,走路 1 公里;</br>
  48540. * 方案2:坐车 15 公里,走路 0.5 公里;</br>
  48541. * 1. 假设权重比为 15:</br>
  48542. * •方案 1 的总消耗为:10 + 1*15 = 25</br>
  48543. * •方案 2 的总消耗为:15 + 0.5*15 = 22.5</br>
  48544. * 此时方案 2 消耗更低。</br>
  48545. * 2. 假设权重比为2:</br>
  48546. * •方案 1 的总消耗为:10+1*2 = 12</br>
  48547. * •方案 2 的总消耗为:15+0.5*2 = 17</br>
  48548. * 此时方案 1 消耗更低。</br>
  48549. */
  48550. this.walkingRatio = null;
  48551. /**
  48552. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferSolutionParameters.prototype.points
  48553. * @description 两种查询方式:</br>
  48554. * 1. 按照公交站点的起止 ID 进行查询,则 points 参数的类型为 int[],形如:[起点 ID、终点 ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  48555. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  48556. */
  48557. this.points = false;
  48558. /**
  48559. * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeLinesnull]
  48560. * @description 避让路线 ID。
  48561. * */
  48562. this.evadeLines = null;
  48563. /**
  48564. * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeStops=TransferLine]
  48565. * @description 避让站点 ID。
  48566. * */
  48567. this.evadeStops = null;
  48568. /**
  48569. * @member {Array.<number>} [TransferSolutionParameters.prototype.priorLines]
  48570. * @description 优先路线 ID。
  48571. * */
  48572. this.priorLines = null;
  48573. /**
  48574. * @member {Array.<number>} [TransferSolutionParameters.prototype.priorStops]
  48575. * @description 优先站点 ID。
  48576. * */
  48577. this.priorStops = null;
  48578. /**
  48579. * @member {string} TransferSolutionParameters.prototype.travelTime
  48580. * @description 出行的时间;格式是:"小时:分钟",如:"08:30"。如果设置了该参数,在分析时,则会考虑线路的首末班车时间的限制,即在返回的结果中会提示公交的首末班发车时间。
  48581. */
  48582. this.travelTime = null;
  48583. Util_Util.extend(this, options);
  48584. this.CLASS_NAME = "SuperMap.TransferSolutionParameters";
  48585. }
  48586. /**
  48587. * @function TransferSolutionParameters.prototype.destroy
  48588. * @description 释放资源,将引用资源的属性置空。
  48589. */
  48590. destroy() {
  48591. Util_Util.reset(this);
  48592. }
  48593. /**
  48594. * @function TransferSolutionParameters.toJsonParameters
  48595. * @description 将 {@link TransferSolutionParameters} 对象参数转换为 JSON 字符串。
  48596. * @param {TransferSolutionParameters} params - 交通换乘参数。
  48597. * @returns {string} 转化后的 JSON 字符串。
  48598. */
  48599. static toJson(params) {
  48600. if (params) {
  48601. return Util_Util.toJSON(params);
  48602. }
  48603. }
  48604. }
  48605. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionService.js
  48606. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48607. * This program are made available under the terms of the Apache License, Version 2.0
  48608. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48609. /**
  48610. * @class TransferSolutionService
  48611. * @deprecatedclass SuperMap.TransferSolutionService
  48612. * @category iServer TrafficTransferAnalyst TransferSolutions
  48613. * @classdesc 交通换乘方案查询服务类。
  48614. * 返回结果通过该类支持的事件的监听函数参数获取。
  48615. * @param {string} url - 服务地址。
  48616. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  48617. * @param {Object} options - 参数。</br>
  48618. * @param {Object} options.eventListeners - 需要被注册的监听器对象。</br>
  48619. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48620. * @param {Object} [options.headers] - 请求头。
  48621. * @extends {CommonServiceBase}
  48622. * @example 例如:
  48623. * (start code)
  48624. * var myService = new TransferSolutionService(url, {eventListeners: {
  48625. * "processCompleted": trafficTransferCompleted,
  48626. * "processFailed": trafficTransferError
  48627. * }
  48628. * };
  48629. * (end)
  48630. * @usage
  48631. */
  48632. class TransferSolutionService extends CommonServiceBase {
  48633. constructor(url, options) {
  48634. super(url, options);
  48635. this.CLASS_NAME = "SuperMap.TransferSolutionService";
  48636. }
  48637. /**
  48638. * @override
  48639. */
  48640. destroy() {
  48641. super.destroy();
  48642. }
  48643. /**
  48644. * @function TransferSolutionService.prototype.processAsync
  48645. * @description 负责将客户端的更新参数传递到服务端。
  48646. * @param {TransferSolutionParameters} params - 交通换乘参数。
  48647. */
  48648. processAsync(params) {
  48649. if (!(params instanceof TransferSolutionParameters)) {
  48650. return;
  48651. }
  48652. var me = this,
  48653. method = "GET",
  48654. jsonParameters;
  48655. me.url = Util_Util.urlPathAppend(me.url, 'solutions');
  48656. jsonParameters = {
  48657. points: Util_Util.toJSON(params.points),
  48658. walkingRatio: params['walkingRatio'],
  48659. transferTactic: params['transferTactic'],
  48660. solutionCount: params['solutionCount'],
  48661. transferPreference: params["transferPreference"]
  48662. };
  48663. if (params.evadeLines) {
  48664. jsonParameters["evadeLines"] = Util_Util.toJSON(params.evadeLines);
  48665. }
  48666. if (params.evadeStops) {
  48667. jsonParameters["evadeStops"] = Util_Util.toJSON(params.evadeStops);
  48668. }
  48669. if (params.priorLines) {
  48670. jsonParameters["priorLines"] = Util_Util.toJSON(params.priorLines);
  48671. }
  48672. if (params.priorStops) {
  48673. jsonParameters["priorStops"] = Util_Util.toJSON(params.priorStops);
  48674. }
  48675. if (params.travelTime) {
  48676. jsonParameters["travelTime"] = params.travelTime;
  48677. }
  48678. me.request({
  48679. method: method,
  48680. params: jsonParameters,
  48681. scope: me,
  48682. success: me.serviceProcessCompleted,
  48683. failure: me.serviceProcessFailed
  48684. });
  48685. }
  48686. }
  48687. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightParameters.js
  48688. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48689. * This program are made available under the terms of the Apache License, Version 2.0
  48690. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48691. /**
  48692. * @class UpdateEdgeWeightParameters
  48693. * @deprecatedclass SuperMap.UpdateEdgeWeightParameters
  48694. * @category iServer NetworkAnalyst EdgeWeight
  48695. * @classdesc 边的耗费权重更新服务参数类。
  48696. * @param {Object} options - 参数。
  48697. * @param {string} options.edgeId - 所在边的 ID。
  48698. * @param {string} options.fromNodeId - 起始转向点的 ID。
  48699. * @param {string} options.toNodeId - 终止转向点的 ID。
  48700. * @param {string} options.weightField - 边的耗费字段。
  48701. * @param {string} options.edgeWeight - 耗费权重。
  48702. * @usage
  48703. */
  48704. class UpdateEdgeWeightParameters {
  48705. constructor(options) {
  48706. if (!options) {
  48707. return;
  48708. }
  48709. /**
  48710. * @member {string} UpdateEdgeWeightParameters.prototype.edgeId
  48711. * @description 所在边的 ID。
  48712. */
  48713. this.edgeId = "";
  48714. /**
  48715. * @member {string} UpdateEdgeWeightParameters.prototype.fromNodeId
  48716. * @description 起始转向点的 ID。
  48717. */
  48718. this.fromNodeId = "";
  48719. /**
  48720. * @member {string} UpdateEdgeWeightParameters.prototype.toNodeId
  48721. * @description 终止转向点的 ID。
  48722. */
  48723. this.toNodeId = "";
  48724. /**
  48725. * @member {string} UpdateEdgeWeightParameters.prototype.weightField
  48726. * @description 边的耗费字段。
  48727. */
  48728. this.weightField = "";
  48729. /**
  48730. * @member {string} UpdateEdgeWeightParameters.prototype.edgeWeight
  48731. * @description 耗费权重。
  48732. */
  48733. this.edgeWeight = "";
  48734. Util_Util.extend(this, options);
  48735. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightParameters";
  48736. }
  48737. /**
  48738. * @function UpdateEdgeWeightParameters.prototype.destroy
  48739. * @description 释放资源,将引用资源的属性置空。
  48740. */
  48741. destroy() {
  48742. this.edgeId = null;
  48743. this.fromNodeId = null;
  48744. this.toNodeId = null;
  48745. this.weightField = null;
  48746. this.edgeWeight = null;
  48747. }
  48748. }
  48749. ;// CONCATENATED MODULE: ./src/common/iServer/CreateDatasetParameters.js
  48750. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48751. * This program are made available under the terms of the Apache License, Version 2.0
  48752. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48753. /**
  48754. * @class CreateDatasetParameters
  48755. * @deprecatedclass SuperMap.CreateDatasetParameters
  48756. * @category iServer Data Dataset
  48757. * @classdesc 数据集创建参数类。
  48758. * @param {Object} options - 参数。
  48759. * @param {string} options.datasourceName - 数据源名称,此为必选参数。
  48760. * @param {string} options.datasetName - 数据集名称,此为必选参数。
  48761. * @param {string} options.datasetType - 数据集类型。目前支持创建的数据集类型有:点、线、面、文本、复合(CAD)和属性数据集。
  48762. * @usage
  48763. */
  48764. class CreateDatasetParameters {
  48765. constructor(options) {
  48766. if (!options) {
  48767. return;
  48768. }
  48769. /**
  48770. * @member {string} CreateDatasetParameters.prototype.datasourceName
  48771. * @description 数据源名称,此为必选参数。
  48772. */
  48773. this.datasourceName = null;
  48774. /**
  48775. * @member {string} CreateDatasetParameters.prototype.datasetName
  48776. * @description 数据集名称,此为必选参数。
  48777. */
  48778. this.datasetName = null;
  48779. /**
  48780. * @member {string} CreateDatasetParameters.prototype.datasetType
  48781. * @description 数据集类型。目前支持创建的数据集类型有:点、线、面、文本、复合(CAD)和属性数据集。
  48782. */
  48783. this.datasetType = null;
  48784. if (options) {
  48785. Util_Util.extend(this, options);
  48786. }
  48787. this.CLASS_NAME = "SuperMap.CreateDatasetParameters";
  48788. }
  48789. /**
  48790. * @function CreateDatasetParameters.prototype.destroy
  48791. * @description 释放资源,将引用资源的属性置空。
  48792. */
  48793. destroy() {
  48794. var me = this;
  48795. me.datasourceName = null;
  48796. me.datasetName = null;
  48797. me.datasetType = null;
  48798. }
  48799. }
  48800. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightService.js
  48801. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48802. * This program are made available under the terms of the Apache License, Version 2.0
  48803. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48804. /**
  48805. * @class UpdateEdgeWeightService
  48806. * @deprecatedclass SuperMap.UpdateEdgeWeightService
  48807. * @category iServer NetworkAnalyst EdgeWeight
  48808. * @classdesc 更新边的边的耗费权重服务
  48809. * @extends {NetworkAnalystServiceBase}
  48810. * @example
  48811. *(start code)
  48812. * var updateEdgeWeightService = new UpdateEdgeWeightService(url, {
  48813. * eventListeners: {
  48814. * "processCompleted": UpdateEdgeWeightCompleted,
  48815. * "processFailed": UpdateEdgeWeightError
  48816. * }
  48817. * });
  48818. * (end)
  48819. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  48820. * @param {Object} options - 参数。
  48821. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  48822. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48823. * @param {Object} [options.headers] - 请求头。
  48824. * @usage
  48825. */
  48826. class UpdateEdgeWeightService extends NetworkAnalystServiceBase {
  48827. constructor(url, options) {
  48828. super(url, options);
  48829. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightService";
  48830. }
  48831. /**
  48832. * @override
  48833. */
  48834. destroy() {
  48835. super.destroy();
  48836. }
  48837. /**
  48838. * @function UpdateEdgeWeightService.prototype.processAsync
  48839. * @description 开始异步执行边的边的耗费权重的更新
  48840. * @param {UpdateEdgeWeightParameters} params - 边的耗费权重更新服务参数类
  48841. * @example
  48842. * (code)
  48843. * var updateEdgeWeightParam=new SuperMapUpdateEdgeWeightParameters({
  48844. * edgeId:"20",
  48845. * fromNodeId:"26",
  48846. * toNodeId:"109",
  48847. * weightField:"time",
  48848. * edgeWeight:"25"
  48849. * });
  48850. * updateEdgeWeightService.processAsync(updateEdgeWeightParam);
  48851. * (end)
  48852. */
  48853. processAsync(params) {
  48854. if (!(params instanceof UpdateEdgeWeightParameters)) {
  48855. return;
  48856. }
  48857. var me = this;
  48858. var paramStr = me.parse(params);
  48859. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  48860. var data = params.edgeWeight ? params.edgeWeight : null;
  48861. me.request({
  48862. method: "PUT",
  48863. scope: me,
  48864. data: data,
  48865. success: me.serviceProcessCompleted,
  48866. failure: me.serviceProcessFailed
  48867. });
  48868. }
  48869. /**
  48870. * @function UpdateEdgeWeightService.prototype.parse
  48871. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  48872. */
  48873. parse(params) {
  48874. if (!params) {
  48875. return;
  48876. }
  48877. var paramStr = "";
  48878. for (var attr in params) {
  48879. if (params[attr] === "" || params[attr] === "edgeWeight") {
  48880. continue;
  48881. }
  48882. switch (attr) {
  48883. case "edgeId":
  48884. paramStr += "/edgeweight/" + params[attr];
  48885. break;
  48886. case "fromNodeId":
  48887. paramStr += "/fromnode/" + params[attr];
  48888. break;
  48889. case "toNodeId":
  48890. paramStr += "/tonode/" + params[attr];
  48891. break;
  48892. case "weightField":
  48893. paramStr += "/weightfield/" + params[attr];
  48894. break;
  48895. default :
  48896. break;
  48897. }
  48898. }
  48899. return paramStr;
  48900. }
  48901. }
  48902. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightParameters.js
  48903. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48904. * This program are made available under the terms of the Apache License, Version 2.0
  48905. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48906. /**
  48907. * @class UpdateTurnNodeWeightParameters
  48908. * @deprecatedclass SuperMap.UpdateTurnNodeWeightParameters
  48909. * @category iServer NetworkAnalyst TurnNodeWeight
  48910. * @classdesc 转向耗费权重更新服务参数类。
  48911. * @param {Object} options - 参数。
  48912. * @param {string} options.nodeId - 转向结点的 ID。
  48913. * @param {string} options.fromEdgeId - 起始边的 ID。
  48914. * @param {string} options.toEdgeId - 终止边的 ID。
  48915. * @param {string} options.weightField - 转向结点的耗费字段。
  48916. * @param {string} options.turnNodeWeight - 耗费权重。
  48917. * @usage
  48918. */
  48919. class UpdateTurnNodeWeightParameters {
  48920. constructor(options) {
  48921. if (!options) {
  48922. return;
  48923. }
  48924. /**
  48925. * @member {string} UpdateTurnNodeWeightParameters.prototype.nodeId
  48926. * @description 转向结点的 ID。
  48927. */
  48928. this.nodeId = "";
  48929. /**
  48930. * @member {string} UpdateTurnNodeWeightParameters.prototype.fromEdgeId
  48931. * @description 起始边的 ID。
  48932. */
  48933. this.fromEdgeId = "";
  48934. /**
  48935. * @member {string} UpdateTurnNodeWeightParameters.prototype.toEdgeId
  48936. * @description 终止边的 ID。
  48937. */
  48938. this.toEdgeId = "";
  48939. /**
  48940. * @member {string} UpdateTurnNodeWeightParameters.prototype.weightField
  48941. * @description 转向结点的耗费字段。
  48942. */
  48943. this.weightField = "";
  48944. /**
  48945. * @member {string} UpdateTurnNodeWeightParameters.prototype.turnNodeWeight
  48946. * @description 耗费权重。
  48947. */
  48948. this.turnNodeWeight = "";
  48949. Util_Util.extend(this, options);
  48950. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightParameters";
  48951. }
  48952. /**
  48953. * @function UpdateTurnNodeWeightParameters.prototype.destroy
  48954. * @description 释放资源,将引用资源的属性置空。
  48955. */
  48956. destroy() {
  48957. this.nodeId = null;
  48958. this.fromEdgeId = null;
  48959. this.toEdgeId = null;
  48960. this.weightField = null;
  48961. this.turnNodeWeight = null;
  48962. }
  48963. }
  48964. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightService.js
  48965. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48966. * This program are made available under the terms of the Apache License, Version 2.0
  48967. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48968. /**
  48969. * @class UpdateTurnNodeWeightService
  48970. * @deprecatedclass SuperMap.UpdateTurnNodeWeightService
  48971. * @category iServer NetworkAnalyst TurnNodeWeight
  48972. * @classdesc 转向耗费权重更新服务类
  48973. * @extends {NetworkAnalystServiceBase}
  48974. * @example
  48975. * var UpdateTurnNodeWeightService = new UpdateTurnNodeWeightService(url, {
  48976. * eventListeners: {
  48977. * "processCompleted": UpdateTurnNodeWeightCompleted,
  48978. * "processFailed": UpdateTurnNodeWeightError
  48979. * }
  48980. * });
  48981. * @param {string} url - 服务地址。如:
  48982. * http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  48983. * @param {Object} options - 参数。
  48984. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  48985. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  48986. * @param {Object} [options.headers] - 请求头。
  48987. * @usage
  48988. */
  48989. class UpdateTurnNodeWeightService extends NetworkAnalystServiceBase {
  48990. constructor(url, options) {
  48991. super(url, options);
  48992. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightService";
  48993. }
  48994. /**
  48995. * @override
  48996. */
  48997. destroy() {
  48998. super.destroy();
  48999. }
  49000. /**
  49001. * @function UpdateTurnNodeWeightService.prototype.processAsync
  49002. * @description 开始异步执行转向耗费权重的更新
  49003. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类
  49004. * @example
  49005. * (code)
  49006. * var updateTurnNodeWeightParam=new UpdateTurnNodeWeightParameters({
  49007. * nodeId:"106",
  49008. * fromEdgeId:"6508",
  49009. * toEdgeId:"6504",
  49010. * weightField:"TurnCost",
  49011. * turnNodeWeight:"50"
  49012. * });
  49013. * updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParam);
  49014. * (end)
  49015. **/
  49016. processAsync(params) {
  49017. if (!(params instanceof UpdateTurnNodeWeightParameters)) {
  49018. return;
  49019. }
  49020. var me = this;
  49021. var paramStr = me.parse(params);
  49022. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  49023. var data = params.turnNodeWeight ? params.turnNodeWeight : null;
  49024. me.request({
  49025. method: "PUT",
  49026. scope: me,
  49027. data: data,
  49028. success: me.serviceProcessCompleted,
  49029. failure: me.serviceProcessFailed
  49030. });
  49031. }
  49032. /**
  49033. * @function UpdateTurnNodeWeightService.prototype.parse
  49034. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  49035. */
  49036. parse(params) {
  49037. if (!params) {
  49038. return;
  49039. }
  49040. var paramStr = "";
  49041. for (var attr in params) {
  49042. if (params[attr] === "" || params[attr] === "turnNodeWeight") {
  49043. continue;
  49044. }
  49045. switch (attr) {
  49046. case "nodeId":
  49047. paramStr += "/turnnodeweight/" + params[attr];
  49048. break;
  49049. case "fromEdgeId":
  49050. paramStr += "/fromedge/" + params[attr];
  49051. break;
  49052. case "toEdgeId":
  49053. paramStr += "/toedge/" + params[attr];
  49054. break;
  49055. case "weightField":
  49056. paramStr += "/weightfield/" + params[attr];
  49057. break;
  49058. default :
  49059. break;
  49060. }
  49061. }
  49062. return paramStr;
  49063. }
  49064. }
  49065. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateDatasetParameters.js
  49066. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49067. * This program are made available under the terms of the Apache License, Version 2.0
  49068. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49069. /**
  49070. * @class UpdateDatasetParameters
  49071. * @deprecatedclass SuperMap.UpdateDatasetParameters
  49072. * @category iServer Data Dataset
  49073. * @classdesc 数据集信息更改参数类。
  49074. * @param {Object} options - 参数。
  49075. * @param {string} options.datasourceName - 数据源名称。
  49076. * @param {string} options.datasetName - 数据集名称。
  49077. * @param {boolean} options.isFileCache - 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
  49078. * @param {string} options.description - 数据集描述信息。
  49079. * @param {string} options.prjCoordSys - 投影坐标系。
  49080. * @param {Object} options.charset - 矢量数据集的字符集。当数据集类型为矢量数据集时,可以传递此参数。如果用户传递空值,则编码方式保持不变。
  49081. * @param {Array.<string>} options.palette - 影像数据的颜色调色板。当数据集类型为影像数据集时,可以传递此参数。
  49082. * @param {number} options.noValue - 栅格数据集中没有数据的像元的栅格值。当数据集类型为栅格数据集时,可以传递此参数。
  49083. * @usage
  49084. */
  49085. class UpdateDatasetParameters {
  49086. constructor(options) {
  49087. if (!options) {
  49088. return;
  49089. }
  49090. /**
  49091. * @member {string} UpdateDatasetParameters.prototype.datasourceName
  49092. * @description 数据源名称。
  49093. */
  49094. this.datasourceName = null;
  49095. /**
  49096. * @member {string} UpdateDatasetParameters.prototype.datasetName
  49097. * @description 数据集名称。
  49098. */
  49099. this.datasetName = null;
  49100. /**
  49101. * @member {boolean} UpdateDatasetParameters.prototype.isFileCache
  49102. * @description 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
  49103. */
  49104. this.isFileCache = null;
  49105. /**
  49106. * @member {string} UpdateDatasetParameters.prototype.description
  49107. * @description 数据集描述信息。
  49108. */
  49109. this.description = null;
  49110. /**
  49111. * @member {string} UpdateDatasetParameters.prototype.prjCoordSys
  49112. * @description 投影坐标系。
  49113. */
  49114. this.prjCoordSys = null;
  49115. /**
  49116. * @member {Object} UpdateDatasetParameters.prototype.charset
  49117. * @description 矢量数据集的字符集。
  49118. */
  49119. this.charset = null;
  49120. /**
  49121. * @member {Array.<string>} UpdateDatasetParameters.prototype.palette
  49122. * @description 影像数据的颜色调色板。
  49123. */
  49124. this.palette = null;
  49125. /**
  49126. * @member {number} UpdateDatasetParameters.prototype.noValue
  49127. * @description 栅格数据集中没有数据的像元的栅格值。
  49128. */
  49129. this.noValue = null;
  49130. if (options) {
  49131. Util_Util.extend(this, options);
  49132. }
  49133. this.CLASS_NAME = "SuperMap.UpdateDatasetParameters";
  49134. }
  49135. /**
  49136. * @function UpdateDatasetParameters.prototype.destroy
  49137. * @description 释放资源,将引用资源的属性置空。
  49138. */
  49139. destroy() {
  49140. var me = this;
  49141. me.datasourceName = null;
  49142. me.datasetName = null;
  49143. me.isFileCache = null;
  49144. me.prjCoordSys = null;
  49145. me.charset = null;
  49146. me.palette = null;
  49147. me.noValue = null;
  49148. }
  49149. }
  49150. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
  49151. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49152. * This program are made available under the terms of the Apache License, Version 2.0
  49153. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49154. /**
  49155. * @class VectorClipJobsParameter
  49156. * @deprecatedclass SuperMap.VectorClipJobsParameter
  49157. * @category iServer ProcessingService VectorClip
  49158. * @classdesc 矢量裁剪分析任务参数类。
  49159. * @param {Object} options - 参数。
  49160. * @param {string} options.datasetName - 数据集名。
  49161. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  49162. * @param {ClipAnalystMode} [options.mode=ClipAnalystMode.CLIP] - 裁剪分析模式。
  49163. * @param {string} [options.geometryClip] - 裁剪几何对象。
  49164. * @param {OutputSetting} [options.output] - 输出参数设置。
  49165. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  49166. * @usage
  49167. */
  49168. class VectorClipJobsParameter {
  49169. constructor(options) {
  49170. options = options || {};
  49171. /**
  49172. * @member {string} VectorClipJobsParameter.prototype.datasetName
  49173. * @description 数据集名。
  49174. */
  49175. this.datasetName = "";
  49176. /**
  49177. * @member {string} VectorClipJobsParameter.prototype.datasetOverlay
  49178. * @description 裁剪对象数据集。
  49179. */
  49180. this.datasetVectorClip = "";
  49181. /**
  49182. * @member {string} VectorClipJobsParameter.prototype.geometryClip
  49183. * @description 裁剪几何对象。
  49184. */
  49185. this.geometryClip = "";
  49186. /**
  49187. * @member {ClipAnalystMode} [VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  49188. * @description 裁剪分析模式 。
  49189. */
  49190. this.mode = ClipAnalystMode.CLIP;
  49191. /**
  49192. * @member {OutputSetting} VectorClipJobsParameter.prototype.output
  49193. * @description 输出参数设置类。
  49194. */
  49195. this.output = null;
  49196. /**
  49197. * @member {MappingParameters} [VectorClipJobsParameter.prototype.mappingParameters]
  49198. * @description 分析后结果可视化的参数类。
  49199. */
  49200. this.mappingParameters = null;
  49201. Util_Util.extend(this, options);
  49202. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  49203. }
  49204. /**
  49205. * @function VectorClipJobsParameter.prototype.destroy
  49206. * @description 释放资源,将引用资源的属性置空。
  49207. */
  49208. destroy() {
  49209. this.datasetName = null;
  49210. this.datasetVectorClip = null;
  49211. this.geometryClip = null;
  49212. this.mode = null;
  49213. if (this.output instanceof OutputSetting) {
  49214. this.output.destroy();
  49215. this.output = null;
  49216. }
  49217. if (this.mappingParameters instanceof MappingParameters) {
  49218. this.mappingParameters.destroy();
  49219. this.mappingParameters = null;
  49220. }
  49221. }
  49222. /**
  49223. * @function VectorClipJobsParameter.toObject
  49224. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  49225. * @param {Object} tempObj - 目标对象。
  49226. * @description 矢量裁剪分析任务对象。
  49227. */
  49228. static toObject(vectorClipJobsParameter, tempObj) {
  49229. for (var name in vectorClipJobsParameter) {
  49230. if (name === "datasetName") {
  49231. tempObj['input'] = tempObj['input'] || {};
  49232. tempObj['input'][name] = vectorClipJobsParameter[name];
  49233. continue;
  49234. }
  49235. if (name === "output"){
  49236. tempObj['output'] = tempObj['output'] || {};
  49237. tempObj['output'] = vectorClipJobsParameter[name];
  49238. continue;
  49239. }
  49240. tempObj['analyst'] = tempObj['analyst'] || {};
  49241. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  49242. if(name === 'mappingParameters'){
  49243. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  49244. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  49245. }
  49246. }
  49247. }
  49248. }
  49249. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  49250. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49251. * This program are made available under the terms of the Apache License, Version 2.0
  49252. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49253. /**
  49254. * @class VectorClipJobsService
  49255. * @deprecatedclass SuperMap.VectorClipJobsService
  49256. * @category iServer ProcessingService VectorClip
  49257. * @classdesc 矢量裁剪分析服务类
  49258. * @extends {ProcessingServiceBase}
  49259. * @param {string} url -服务地址。
  49260. * @param {Object} options - 可选参数。
  49261. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  49262. * @param {Object} [options.headers] - 请求头。
  49263. * @usage
  49264. */
  49265. class VectorClipJobsService extends ProcessingServiceBase {
  49266. constructor(url, options) {
  49267. super(url, options);
  49268. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  49269. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  49270. }
  49271. /**
  49272. *@override
  49273. */
  49274. destroy() {
  49275. super.destroy();
  49276. }
  49277. /**
  49278. * @function VectorClipJobsService.protitype.getVectorClipJobs
  49279. * @description 获取矢量裁剪分析所有任务
  49280. */
  49281. getVectorClipJobs() {
  49282. super.getJobs(this.url);
  49283. }
  49284. /**
  49285. * @function KernelDensityJobsService.protitype.getVectorClipJob
  49286. * @description 获取指定id的矢量裁剪分析服务
  49287. * @param {string} id - 指定要获取数据的id
  49288. */
  49289. getVectorClipJob(id) {
  49290. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  49291. }
  49292. /**
  49293. * @function VectorClipJobsService.protitype.addVectorClipJob
  49294. * @description 新建矢量裁剪分析服务
  49295. * @param {VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  49296. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  49297. */
  49298. addVectorClipJob(params, seconds) {
  49299. super.addJob(this.url, params, VectorClipJobsParameter, seconds);
  49300. }
  49301. }
  49302. ;// CONCATENATED MODULE: ./src/common/iServer/RasterFunctionParameter.js
  49303. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49304. * This program are made available under the terms of the Apache License, Version 2.0
  49305. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49306. /**
  49307. * @class RasterFunctionParameter
  49308. * @deprecatedclass SuperMap.RasterFunctionParameter
  49309. * @category iServer Map Tile
  49310. * @classdesc iServer 地图服务栅格分析参数基类。
  49311. * @param {Object} options - 参数。
  49312. * @param {RasterFunctionType} options.type - 栅格分析方法。
  49313. * @usage
  49314. */
  49315. class RasterFunctionParameter {
  49316. constructor(options) {
  49317. options = options || {};
  49318. /**
  49319. * @member {RasterFunctionType} [RasterFunctionParameter.prototype.type]
  49320. * @description 栅格分析方法。
  49321. */
  49322. this.type = null;
  49323. Util_Util.extend(this, options);
  49324. this.CLASS_NAME = 'SuperMap.RasterFunctionParameter';
  49325. }
  49326. /**
  49327. * @function RasterFunctionParameter.prototype.destroy
  49328. * @description 释放资源,将资源的属性置空。
  49329. */
  49330. destroy() {
  49331. this.type = null;
  49332. }
  49333. }
  49334. ;// CONCATENATED MODULE: ./src/common/iServer/NDVIParameter.js
  49335. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49336. * This program are made available under the terms of the Apache License, Version 2.0
  49337. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49338. /**
  49339. * @class NDVIParameter
  49340. * @deprecatedclass SuperMap.NDVIParameter
  49341. * @category iServer Map Tile
  49342. * @classdesc 归一化植被指数参数类。
  49343. * @param {Object} options - 参数。
  49344. * @param {number} [options.redIndex=0] - 红光谱波段索引。
  49345. * @param {number} [options.nirIndex=1] - 近红外光谱波段索引。
  49346. * @param {string} [options.colorMap="0:ffffe5ff;0.1:f7fcb9ff;0.2:d9f0a3ff;0.3:addd8eff;0.4:78c679ff;0.5:41ab5dff;0.6:238443ff;0.7:006837ff;1:004529ff"] - 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  49347. * @extends {RasterFunctionParameter}
  49348. * @usage
  49349. */
  49350. class NDVIParameter extends RasterFunctionParameter {
  49351. constructor(options) {
  49352. super(options);
  49353. /**
  49354. * @member {number} [NDVIParameter.prototype.redIndex=0]
  49355. * @description 红光谱波段索引。
  49356. */
  49357. this.redIndex = 0;
  49358. /**
  49359. * @member {number} [NDVIParameter.prototype.nirIndex=1]
  49360. * @description 近红外光谱波段索引。
  49361. */
  49362. this.nirIndex = 1;
  49363. /**
  49364. * @member {string} [NDVIParameter.prototype.colorMap="0:ffffe5ff;0.1:f7fcb9ff;0.2:d9f0a3ff;0.3:addd8eff;0.4:78c679ff;0.5:41ab5dff;0.6:238443ff;0.7:006837ff;1:004529ff"]
  49365. * @description 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  49366. */
  49367. this.colorMap =
  49368. '0:ffffe5ff;0.1:f7fcb9ff;0.2:d9f0a3ff;0.3:addd8eff;0.4:78c679ff;0.5:41ab5dff;0.6:238443ff;0.7:006837ff;1:004529ff';
  49369. /**
  49370. * @member {RasterFunctionType} [NDVIParameter.prototype.type]
  49371. * @description 栅格分析方法。
  49372. */
  49373. this.type = RasterFunctionType.NDVI;
  49374. Util_Util.extend(this, options);
  49375. this.CLASS_NAME = 'SuperMap.NDVIParameter';
  49376. }
  49377. /**
  49378. * @function NDVIParameter.prototype.destroy
  49379. * @override
  49380. */
  49381. destroy() {
  49382. super.destroy();
  49383. this.redIndex = null;
  49384. this.nirIndex = null;
  49385. this.colorMap = null;
  49386. }
  49387. /**
  49388. * @function NDVIParameter.prototype.toJSON
  49389. * @description 将 NDVIParameter 对象转化为 JSON 字符串。
  49390. * @returns {string} 返回转换后的 JSON 字符串。
  49391. */
  49392. toJSON() {
  49393. return {
  49394. redIndex: this.redIndex,
  49395. nirIndex: this.nirIndex,
  49396. colorMap: this.colorMap,
  49397. type: this.type
  49398. };
  49399. }
  49400. }
  49401. ;// CONCATENATED MODULE: ./src/common/iServer/HillshadeParameter.js
  49402. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49403. * This program are made available under the terms of the Apache License, Version 2.0
  49404. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49405. /**
  49406. * @class HillshadeParameter
  49407. * @deprecatedclass SuperMap.HillshadeParameter
  49408. * @category iServer Map Tile
  49409. * @classdesc 阴影面分析参数类。
  49410. * @param {Object} options - 可选参数。
  49411. * @param {number} [options.altitude=45] - 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  49412. * @param {number} [options.azimuth=315] - 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  49413. * @param {number} [options.zFactor=1] - 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  49414. * z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  49415. * 如果 x,y 单位和 z 单位采用相同的测量单位,则 z 因子为 1。这是默认设置。
  49416. * 如果 x,y 单位和 z 单位采用不同的测量单位,则必须将 z 因子设置为适当的因子,否则会得到错误的结果。例如,如果 z 单位是英尺而 x,y 单位是米,则应使用 z 因子 0.3048 将 z 单位从英尺转换为米(1 英尺 = 0.3048 米)。
  49417. * 如果输入栅格位于球面坐标系中(如十进制度球面坐标系),则生成的山体阴影可能看起来很独特。这是因为水平地面单位与高程 z 单位之间的测量值存在差异。由于经度的长度随着纬度而变化,因此需要为该纬度指定一个适当的 z 因子。如果 x,y 单位是十进制度而 Z 单位是米,特定纬度的一些合适的 Z 因子为:
  49418. * Latitude Z-factor
  49419. * 0 0.00000898
  49420. * 10 0.00000912
  49421. * 20 0.00000956
  49422. * 30 0.00001036
  49423. * 40 0.00001171
  49424. * 50 0.00001395
  49425. * 60 0.00001792
  49426. * 70 0.00002619
  49427. * 80 0.00005156
  49428. * @extends {RasterFunctionParameter}
  49429. * @usage
  49430. */
  49431. class HillshadeParameter extends RasterFunctionParameter {
  49432. constructor(options) {
  49433. super(options);
  49434. /**
  49435. * @member {number} [HillshadeParameter.prototype.altitude = 45]
  49436. * @description 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  49437. */
  49438. this.altitude = 45;
  49439. /**
  49440. * @member {number} [HillshadeParameter.prototype.azimuth = 315]
  49441. * @description 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  49442. */
  49443. this.azimuth = 315;
  49444. /**
  49445. * @member {number} [HillshadeParameter.prototype.zFactor = 1]
  49446. * @description 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  49447. */
  49448. this.zFactor = 1;
  49449. /**
  49450. * @member {RasterFunctionType} HillshadeParameter.prototype.type
  49451. * @description 栅格分析方法。
  49452. */
  49453. this.type = RasterFunctionType.HILLSHADE;
  49454. Util_Util.extend(this, options);
  49455. this.CLASS_NAME = 'SuperMap.HillshadeParameter';
  49456. }
  49457. /**
  49458. * @function HillshadeParameter.prototype.destroy
  49459. * @override
  49460. */
  49461. destroy() {
  49462. super.destroy();
  49463. this.altitude = null;
  49464. this.azimuth = null;
  49465. this.zFactor = null;
  49466. }
  49467. /**
  49468. * @function HillshadeParameter.prototype.toJSON
  49469. * @description 将 HillshadeParameter 对象转化为 JSON 字符串。
  49470. * @returns {string} 返回转换后的 JSON 字符串。
  49471. */
  49472. toJSON() {
  49473. return {
  49474. altitude: this.altitude,
  49475. azimuth: this.azimuth,
  49476. zFactor: this.zFactor,
  49477. type: this.type
  49478. };
  49479. }
  49480. }
  49481. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobCustomItems.js
  49482. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49483. * This program are made available under the terms of the Apache License, Version 2.0
  49484. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49485. /**
  49486. * @class WebPrintingJobCustomItems
  49487. * @deprecatedclass SuperMap.WebPrintingJobCustomItems
  49488. * @classdesc Web 打印图例元素参数类。
  49489. * @version 10.1.0
  49490. * @category iServer WebPrintingJob
  49491. * @param {Object} option - 参数。
  49492. * @param {string} option.name - 图例元素的名称。
  49493. * @param {string} option.picAsUrl - 图例元素 Base64 格式图片。
  49494. * @param {string} [option.picAsBase64] - 图例元素图片的获取地址。如果已填了 URL 参数,此参数可不传。
  49495. * @usage
  49496. */
  49497. class WebPrintingJobCustomItems {
  49498. constructor(option) {
  49499. /**
  49500. * @member {string} WebPrintingJobCustomItems.prototype.name
  49501. * @description 图例元素的名称。
  49502. */
  49503. this.name = null;
  49504. /**
  49505. * @member {string} [WebPrintingJobCustomItems.prototype.picAsUrl]
  49506. * @description 图例元素 Base64 格式图片。
  49507. */
  49508. this.picAsUrl = null;
  49509. /**
  49510. * @member {string} [WebPrintingJobCustomItems.prototype.picAsBase64]
  49511. * @description 图例元素图片的获取地址。
  49512. */
  49513. this.picAsBase64 = null;
  49514. this.CLASS_NAME = 'SuperMap.WebPrintingJobCustomItems';
  49515. Util_Util.extend(this, option);
  49516. }
  49517. /**
  49518. * @function WebPrintingJobCustomItems.prototype.destroy
  49519. * @description 释放资源,将引用资源的属性置空。
  49520. */
  49521. destroy() {
  49522. var me = this;
  49523. me.name = null;
  49524. me.picAsUrl = null;
  49525. me.picAsBase64 = null;
  49526. }
  49527. /**
  49528. * @function WebPrintingJobCustomItems.prototype.toJSON
  49529. * @description 将 WebPrintingJobCustomItems 对象转化为 JSON 字符串。
  49530. * @returns {string} 转换后的 JSON 字符串。
  49531. */
  49532. toJSON() {
  49533. var params = {
  49534. name: this.name
  49535. };
  49536. if (this.title) {
  49537. params.title = this.title;
  49538. }
  49539. if (this.picAsUrl) {
  49540. params.picAsUrl = this.picAsUrl;
  49541. } else if (this.picAsBase64) {
  49542. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  49543. }
  49544. return Util_Util.toJSON(params);
  49545. }
  49546. }
  49547. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobImage.js
  49548. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49549. * This program are made available under the terms of the Apache License, Version 2.0
  49550. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49551. /**
  49552. * @class WebPrintingJobImage
  49553. * @deprecatedclass SuperMap.WebPrintingJobImage
  49554. * @classdesc 表达小地图的静态图片参数类。
  49555. * @version 10.1.0
  49556. * @category iServer WebPrintingJob
  49557. * @param {Object} option - 参数。
  49558. * @param {string} option.picAsUrl - 小地图的图片 URL 地址。
  49559. * @param {string} [option.picAsBase64] - 小地图的base64位图片信息。如果已填了 URL 参数,此参数可不传。
  49560. * @usage
  49561. */
  49562. class WebPrintingJobImage {
  49563. constructor(option) {
  49564. /**
  49565. * @member {string} [WebPrintingJobImage.prototype.picAsUrl]
  49566. * @description 小地图的图片 URL 地址。
  49567. */
  49568. this.picAsUrl = null;
  49569. /**
  49570. * @member {string} [WebPrintingJobImage.prototype.picAsBase64]
  49571. * @description 小地图的base64位图片信息。
  49572. */
  49573. this.picAsBase64 = null;
  49574. this.CLASS_NAME = 'SuperMap.WebPrintingJobImage';
  49575. Util_Util.extend(this, option);
  49576. }
  49577. /**
  49578. * @function WebPrintingJobImage.prototype.destroy
  49579. * @description 释放资源,将引用资源的属性置空。
  49580. */
  49581. destroy() {
  49582. this.picAsUrl = null;
  49583. this.picAsBase64 = null;
  49584. }
  49585. /**
  49586. * @function WebPrintingJobImage.prototype.toJSON
  49587. * @description 将 WebPrintingJobImage 对象转化为 JSON 字符串。
  49588. * @returns {string} 转换后的 JSON 字符串。
  49589. */
  49590. toJSON() {
  49591. var params = {};
  49592. if (this.picAsUrl) {
  49593. params.picAsUrl = this.picAsUrl;
  49594. }
  49595. if (this.picAsBase64) {
  49596. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  49597. }
  49598. return Util_Util.toJSON(params);
  49599. }
  49600. }
  49601. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayers.js
  49602. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49603. * This program are made available under the terms of the Apache License, Version 2.0
  49604. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49605. /**
  49606. * @class WebPrintingJobLayers
  49607. * @deprecatedclass SuperMap.WebPrintingJobLayers
  49608. * @classdesc 将图例添加到布局的业务图层参数类。
  49609. * @version 10.1.0
  49610. * @category iServer WebPrintingJob
  49611. * @param {Object} option - 参数。
  49612. * @param {string} option.name - 图层 name 的字符串。此 name 必须唯一,并且必须与定义业务图层的 LegendOptions_layers 元素中的图层 name 匹配。
  49613. * @usage
  49614. */
  49615. class WebPrintingJobLayers {
  49616. constructor(option) {
  49617. /**
  49618. * @member {string} WebPrintingJobLayers.prototype.name
  49619. * @description 图层 name。
  49620. */
  49621. this.name = null;
  49622. /**
  49623. * @member {string} WebPrintingJobLayers.prototype.layerType
  49624. * @description 图层 type。
  49625. */
  49626. this.layerType = null;
  49627. /**
  49628. * @member {string} WebPrintingJobLayers.prototype.url
  49629. * @description 图层 URL。
  49630. */
  49631. this.url = null;
  49632. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayers';
  49633. Util_Util.extend(this, option);
  49634. }
  49635. /**
  49636. * @function WebPrintingJobLayers.prototype.destroy
  49637. * @description 释放资源,将引用资源的属性置空。
  49638. */
  49639. destroy() {
  49640. this.name = null;
  49641. this.layerType = null;
  49642. this.url = null;
  49643. }
  49644. }
  49645. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLegendOptions.js
  49646. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49647. * This program are made available under the terms of the Apache License, Version 2.0
  49648. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49649. /**
  49650. * @class WebPrintingJobLegendOptions
  49651. * @deprecatedclass SuperMap.WebPrintingJobLegendOptions
  49652. * @classdesc Web 打印图例参数类。
  49653. * @version 10.1.0
  49654. * @category iServer WebPrintingJob
  49655. * @param {Object} option - 参数。
  49656. * @param {string} [option.title] - 图例名称。
  49657. * @param {string} [option.picAsUrl] - 图例的图片 URL 地址。
  49658. * @param {string} [option.picAsBase64] - 图例的 base64 位图片信息。
  49659. * @param {WebPrintingJobLayers} [option.layers] - 图例的布局业务图层参数类。
  49660. * @param {WebPrintingJobCustomItems} [option.customItems] - 自定义图例元素参数类。
  49661. * @usage
  49662. */
  49663. class WebPrintingJobLegendOptions {
  49664. constructor(option) {
  49665. /**
  49666. * @member {string} WebPrintingJobLegendOptions.prototype.title
  49667. * @description 图例名称。
  49668. */
  49669. this.title = null;
  49670. /**
  49671. * @member {string} [WebPrintingJobLegendOptions.prototype.picAsUrl]
  49672. * @description 图例的图片 URL 地址。
  49673. */
  49674. this.picAsUrl = null;
  49675. /**
  49676. * @member {string} [WebPrintingJobLegendOptions.prototype.picAsBase64]
  49677. * @description 图例的 base64 位图片信息。
  49678. */
  49679. this.picAsBase64 = null;
  49680. /**
  49681. * @member {WebPrintingJobLayers} [WebPrintingJobLegendOptions.prototype.layers]
  49682. * @description 图例的布局业务图层参数类。
  49683. */
  49684. this.layers = null;
  49685. /**
  49686. * @member {WebPrintingJobCustomItems} [WebPrintingJobLegendOptions.prototype.customItems]
  49687. * @description 自定义图例元素参数类。
  49688. */
  49689. this.customItems = null;
  49690. this.CLASS_NAME = 'SuperMap.WebPrintingJobLegendOptions';
  49691. Util_Util.extend(this, option);
  49692. }
  49693. /**
  49694. * @function WebPrintingJobLegendOptions.prototype.destroy
  49695. * @description 释放资源,将引用资源的属性置空。
  49696. */
  49697. destroy() {
  49698. this.title = null;
  49699. this.picAsUrl = null;
  49700. this.picAsBase64 = null;
  49701. if (this.layers instanceof WebPrintingJobLayers) {
  49702. this.layers.destroy();
  49703. this.layers = null;
  49704. }
  49705. if (this.customItems instanceof WebPrintingJobCustomItems) {
  49706. this.customItems.destroy();
  49707. this.customItems = null;
  49708. }
  49709. }
  49710. /**
  49711. * @function WebPrintingJobLegendOptions.prototype.toJSON
  49712. * @description 将 WebPrintingJobLegendOptions 对象转化为 JSON 字符串。
  49713. * @returns {string} 转换后的 JSON 字符串。
  49714. */
  49715. toJSON() {
  49716. var params = {
  49717. title: this.title || ""
  49718. };
  49719. if (this.picAsUrl) {
  49720. params.picAsUrl = this.picAsUrl;
  49721. } else if (this.picAsBase64) {
  49722. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  49723. } else if (this.customItems) {
  49724. params.customItems = this.customItems;
  49725. }
  49726. return Util_Util.toJSON(params);
  49727. }
  49728. }
  49729. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLittleMapOptions.js
  49730. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49731. * This program are made available under the terms of the Apache License, Version 2.0
  49732. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49733. /**
  49734. * @class WebPrintingJobLittleMapOptions
  49735. * @deprecatedclass SuperMap.WebPrintingJobLittleMapOptions
  49736. * @classdesc Web 打印小地图参数类。
  49737. * @version 10.1.0
  49738. * @category iServer WebPrintingJob
  49739. * @param {Object} option - 参数。
  49740. * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} option.center - 小地图的中心点。
  49741. * @param {number} [option.scale] - 小地图的比例尺。
  49742. * @param {Array.<string>} [option.layerNames] - 指定 WebMap中图层名称的列表,用于渲染小地图。
  49743. * @param {WebPrintingJobImage} [option.image] - 表达小地图的静态图类。
  49744. * @param {WebPrintingJobLayers} [option.layers] - 指定 WebMap 中的 layers 图层类。
  49745. * @usage
  49746. */
  49747. class WebPrintingJobLittleMapOptions {
  49748. constructor(option) {
  49749. /**
  49750. * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} WebPrintingJobLittleMapOptions.prototype.center
  49751. * @description 小地图的中心点。
  49752. */
  49753. this.center = null;
  49754. /**
  49755. * @member {number} [WebPrintingJobLittleMapOptions.prototype.scale]
  49756. * @description 小地图的比例尺。
  49757. */
  49758. this.scale = null;
  49759. /**
  49760. * @member {Array.<string>} WebPrintingJobLittleMapOptions.prototype.layerNames
  49761. * @description 指定 WebMap中图层名称的列表,用于渲染小地图。
  49762. */
  49763. this.layerNames = null;
  49764. /**
  49765. * @member {WebPrintingJobImage} [WebPrintingJobLittleMapOptions.prototype.image]
  49766. * @description 表达小地图的静态图类。暂不支持。
  49767. */
  49768. this.image = null;
  49769. /**
  49770. * @member {WebPrintingJobLayers} [WebPrintingJobLittleMapOptions.prototype.layers]
  49771. * @description 指定 WebMap 中的 layers 图层类。
  49772. */
  49773. this.layers = null;
  49774. this.CLASS_NAME = 'SuperMap.WebPrintingJobLittleMapOptions';
  49775. Util_Util.extend(this, option);
  49776. }
  49777. /**
  49778. * @function WebPrintingJobLittleMapOptions.prototype.destroy
  49779. * @description 释放资源,将引用资源的属性置空。
  49780. */
  49781. destroy() {
  49782. this.center = null;
  49783. this.scale = null;
  49784. this.layerNames = null;
  49785. if (this.image instanceof WebPrintingJobImage) {
  49786. this.image.destroy();
  49787. this.image = null;
  49788. }
  49789. if (this.layers instanceof WebPrintingJobLayers) {
  49790. this.layers.destroy();
  49791. this.layers = null;
  49792. }
  49793. }
  49794. /**
  49795. * @function WebPrintingJobLittleMapOptions.prototype.toJSON
  49796. * @description 将 WebPrintingJobLittleMapOptions 对象转化为 JSON 字符串。
  49797. * @returns {string} 转换后的 JSON 字符串。
  49798. */
  49799. toJSON() {
  49800. var params = {
  49801. scale: this.scale,
  49802. center: this.center
  49803. };
  49804. if (this.layerNames) {
  49805. params.layerNames = this.layerNames;
  49806. } else if (this.layers) {
  49807. params.layers = this.layers;
  49808. }
  49809. if (this.image) {
  49810. params.image = this.image;
  49811. }
  49812. return Util_Util.toJSON(params);
  49813. }
  49814. }
  49815. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobNorthArrowOptions.js
  49816. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49817. * This program are made available under the terms of the Apache License, Version 2.0
  49818. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49819. /**
  49820. * @class WebPrintingJobNorthArrowOptions
  49821. * @deprecatedclass SuperMap.WebPrintingJobNorthArrowOptions
  49822. * @classdesc Web 打印地图指北针参数类。
  49823. * @version 10.1.0
  49824. * @category iServer WebPrintingJob
  49825. * @param {Object} option - 参数。
  49826. * @param {string} option.picAsUrl - 指北针的图片 URL 地址。
  49827. * @param {string} [option.picAsBase64] - 指北针的base64位图片信息。
  49828. * @usage
  49829. */
  49830. class WebPrintingJobNorthArrowOptions {
  49831. constructor(option) {
  49832. /**
  49833. * @member {string} WebPrintingJobNorthArrowOptions.prototype.picAsUrl
  49834. * @description 指北针的图片 URL 地址。
  49835. */
  49836. this.picAsUrl = null;
  49837. /**
  49838. * @member {string} [WebPrintingJobNorthArrowOptions.prototype.picAsBase64]
  49839. * @description 指北针的base64位图片信息。
  49840. */
  49841. this.picAsBase64 = null;
  49842. this.CLASS_NAME = 'SuperMap.WebPrintingJobNorthArrowOptions';
  49843. Util_Util.extend(this, option);
  49844. }
  49845. /**
  49846. * @function WebPrintingJobNorthArrowOptions.prototype.destroy
  49847. * @description 释放资源,将引用资源的属性置空。
  49848. */
  49849. destroy() {
  49850. this.picAsUrl = null;
  49851. this.picAsBase64 = null;
  49852. }
  49853. /**
  49854. * @function WebPrintingJobNorthArrowOptions.prototype.toJSON
  49855. * @description 将 WebPrintingJobNorthArrowOptions 对象转化为 JSON 字符串。
  49856. * @returns {string} 转换后的 JSON 字符串。
  49857. */
  49858. toJSON() {
  49859. var params = {};
  49860. if (this.picAsUrl) {
  49861. params.picAsUrl = this.picAsUrl;
  49862. } else if (this.picAsBase64) {
  49863. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  49864. }
  49865. return Util_Util.toJSON(params);
  49866. }
  49867. }
  49868. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobScaleBarOptions.js
  49869. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49870. * This program are made available under the terms of the Apache License, Version 2.0
  49871. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49872. /**
  49873. * @class WebPrintingJobScaleBarOptions
  49874. * @deprecatedclass SuperMap.WebPrintingJobScaleBarOptions
  49875. * @classdesc Web 打印比例尺参数类。
  49876. * @category iServer WebPrintingJob
  49877. * @version 10.1.0
  49878. * @param {Object} option - 参数。
  49879. * @param {string} [option.scaleText] - 比例尺文本信息。例如:1:1000000。
  49880. * @param {WebScaleOrientationType} [option.orientation] - 比例尺的方位样式。
  49881. * @param {WebScaleType} [option.type] - 比例尺的样式。
  49882. * @param {number} [option.intervals] - 比例尺条的段数。
  49883. * @param {WebScaleUnit} [option.unit] - 比例尺的单位制。
  49884. * @usage
  49885. */
  49886. class WebPrintingJobScaleBarOptions {
  49887. constructor(option) {
  49888. /**
  49889. * @member {string} WebPrintingJobScaleBarOptions.prototype.scaleText
  49890. * @description 比例尺文本信息。
  49891. */
  49892. this.scaleText = null;
  49893. /**
  49894. * @member {WebScaleOrientationType} [WebPrintingJobScaleBarOptions.prototype.orientation]
  49895. * @description 比例尺的方位样式。
  49896. */
  49897. this.orientation = null;
  49898. /**
  49899. * @member {WebScaleType} [WebPrintingJobScaleBarOptions.prototype.type]
  49900. * @description 比例尺的样式。
  49901. */
  49902. this.type = null;
  49903. /**
  49904. * @member {Object} [WebPrintingJobScaleBarOptions.prototype.intervals]
  49905. * @description 比例尺条的段数。
  49906. */
  49907. this.intervals = null;
  49908. /**
  49909. * @member {WebScaleUnit} [WebPrintingJobScaleBarOptions.prototype.unit]
  49910. * @description 比例尺的单位制。
  49911. */
  49912. this.unit = null;
  49913. this.CLASS_NAME = 'SuperMap.WebPrintingJobScaleBarOptions';
  49914. Util_Util.extend(this, option);
  49915. }
  49916. /**
  49917. * @function WebPrintingJobScaleBarOptions.prototype.destroy
  49918. * @description 释放资源,将引用资源的属性置空。
  49919. */
  49920. destroy() {
  49921. this.scaleText = null;
  49922. this.orientation = null;
  49923. this.type = null;
  49924. this.intervals = null;
  49925. this.unit = null;
  49926. }
  49927. /**
  49928. * @function WebPrintingJobScaleBarOptions.prototype.toJSON
  49929. * @description 将 WebPrintingJobScaleBarOptions 对象转化为 JSON 字符串。
  49930. * @returns {string} 转换后的 JSON 字符串。
  49931. */
  49932. toJSON() {
  49933. var params = {
  49934. scaleText: this.scaleText || "",
  49935. type: this.type || "BAR",
  49936. intervals: this.intervals || "",
  49937. unit: this.unit || "METER"
  49938. };
  49939. if (this.orientation) {
  49940. params.orientation = this.orientation;
  49941. }
  49942. return Util_Util.toJSON(params);
  49943. }
  49944. }
  49945. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobContent.js
  49946. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  49947. * This program are made available under the terms of the Apache License, Version 2.0
  49948. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49949. /**
  49950. * @class WebPrintingJobContent
  49951. * @deprecatedclass SuperMap.WebPrintingJobContent
  49952. * @classdesc Web 打印内容参数类。
  49953. * @version 10.1.0
  49954. * @category iServer WebPrintingJob
  49955. * @param {Object} option - 参数。
  49956. * @param {string} option.type - Web 打印内容支持的类型。目前支持的类型:WEBMAP。
  49957. * @param {string} [option.url] - 待打印的 SuperMap iPortal WebMap 的 URL 地址。例如:http://supermapiportal:8190/iportal/web/maps/{mapid}/map.rjson 。
  49958. * @param {string} [option.token] - 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  49959. * @param {WebMapSummaryObject} [option.value] - 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 JSON 表达。如果已填了 URL 参数,此参数可不传。
  49960. * @usage
  49961. */
  49962. class WebPrintingJobContent {
  49963. constructor(option) {
  49964. /**
  49965. * @member {string} WebPrintingJobContent.prototype.type
  49966. * @description Web 打印内容支持的类型。
  49967. */
  49968. this.type = null;
  49969. /**
  49970. * @member {string} [WebPrintingJobContent.prototype.url]
  49971. * @description 待打印的 SuperMap iPortal WebMap 的 URL 地址。
  49972. */
  49973. this.url = null;
  49974. /**
  49975. * @member {string} [WebPrintingJobContent.prototype.token]
  49976. * @description 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  49977. */
  49978. this.token = null;
  49979. /**
  49980. * @member {WebMapSummaryObject} [WebPrintingJobContent.prototype.value]
  49981. * @description 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 JSON 表达。
  49982. */
  49983. this.value = null;
  49984. this.CLASS_NAME = 'SuperMap.WebPrintingJobContent';
  49985. Util_Util.extend(this, option);
  49986. }
  49987. /**
  49988. * @function WebPrintingJobContent.prototype.destroy
  49989. * @description 释放资源,将引用资源的属性置空。
  49990. */
  49991. destroy() {
  49992. this.type = false || "WEBMAP";
  49993. this.url = null;
  49994. this.token = null;
  49995. this.value = null;
  49996. }
  49997. /**
  49998. * @function WebPrintingJobContent.prototype.toJSON
  49999. * @description 将 WebPrintingJobContent 对象转化为 JSON 字符串。
  50000. * @returns {string} 转换后的 JSON 字符串。
  50001. */
  50002. toJSON() {
  50003. var params = {
  50004. type: this.type
  50005. };
  50006. if (this.token) {
  50007. params.token = this.token;
  50008. }
  50009. if (this.url) {
  50010. params.url = this.url;
  50011. } else if (this.value) {
  50012. params.value = this.value;
  50013. }
  50014. return Util_Util.toJSON(params);
  50015. }
  50016. }
  50017. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayoutOptions.js
  50018. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50019. * This program are made available under the terms of the Apache License, Version 2.0
  50020. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50021. /**
  50022. * @class WebPrintingJobLayoutOptions
  50023. * @deprecatedclass SuperMap.WebPrintingJobLayoutOptions
  50024. * @classdesc Web 打印的布局参数类。
  50025. * @version 10.1.0
  50026. * @category iServer WebPrintingJob
  50027. * @param {Object} option - 参数。
  50028. * @param {string} option.templateName - 布局模板的名称。
  50029. * @param {string} option.title - 地图主标题名称。
  50030. * @param {string} option.subTitle - 地图副标题名称。
  50031. * @param {string} option.author - 作者名称。
  50032. * @param {string} option.copyright - 版权信息。
  50033. * @param {WebPrintingJobLittleMapOptions} option.littleMapOptions - 小地图参数类。
  50034. * @param {WebPrintingJobLegendOptions} option.legendOptions - 图例参数类。
  50035. * @param {WebPrintingJobScaleBarOptions} [option.scaleBarOptions] - 地图比例尺参数类。
  50036. * @param {WebPrintingJobNorthArrowOptions} [option.northArrowOptions] - 地图指北针参数类。
  50037. * @usage
  50038. */
  50039. class WebPrintingJobLayoutOptions {
  50040. constructor(option) {
  50041. /**
  50042. * @member {string} WebPrintingJobLayoutOptions.prototype.templateName
  50043. * @description 布局模板的名称。
  50044. */
  50045. this.templateName = null;
  50046. /**
  50047. * @member {string} WebPrintingJobLayoutOptions.prototype.title
  50048. * @description 地图主标题名称。
  50049. */
  50050. this.title = null;
  50051. /**
  50052. * @member {string} WebPrintingJobLayoutOptions.prototype.subTitle
  50053. * @description 地图副标题名称。
  50054. */
  50055. this.subTitle = null;
  50056. /**
  50057. * @member {string} WebPrintingJobLayoutOptions.prototype.author
  50058. * @description 地图作者名称。
  50059. */
  50060. this.author = null;
  50061. /**
  50062. * @member {string} WebPrintingJobLayoutOptions.prototype.copyright
  50063. * @description 地图版权信息。
  50064. */
  50065. this.copyright = null;
  50066. /**
  50067. * @member {WebPrintingJobScaleBarOptions} [WebPrintingJobLayoutOptions.prototype.scaleBarOptions]
  50068. * @description 地图比例尺参数类。
  50069. */
  50070. this.scaleBarOptions = null;
  50071. /**
  50072. * @member {WebPrintingJobNorthArrowOptions} [WebPrintingJobLayoutOptions.prototype.northArrowOptions]
  50073. * @description 地图指北针参数类。
  50074. */
  50075. this.northArrowOptions = null;
  50076. /**
  50077. * @member {WebPrintingJobLittleMapOptions} WebPrintingJobLayoutOptions.prototype.littleMapOptions
  50078. * @description 小地图参数类。
  50079. */
  50080. this.littleMapOptions = null;
  50081. /**
  50082. * @member {WebPrintingJobLegendOptions} WebPrintingJobLayoutOptions.prototype.legendOptions
  50083. * @description 图例参数类。
  50084. */
  50085. this.legendOptions = null;
  50086. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayoutOptions';
  50087. Util_Util.extend(this, option);
  50088. }
  50089. /**
  50090. * @function WebPrintingJobLayoutOptions.prototype.destroy
  50091. * @description 释放资源,将引用资源的属性置空。
  50092. */
  50093. destroy() {
  50094. this.templateName = null;
  50095. this.title = null;
  50096. this.subTitle = null;
  50097. this.author = null;
  50098. this.copyright = null;
  50099. if (this.scaleBarOptions instanceof WebPrintingJobScaleBarOptions) {
  50100. this.scaleBarOptions.destroy();
  50101. this.scaleBarOptions = null;
  50102. }
  50103. if (this.northArrowOptions instanceof WebPrintingJobNorthArrowOptions) {
  50104. this.northArrowOptions.destroy();
  50105. this.northArrowOptions = null;
  50106. }
  50107. if (this.littleMapOptions instanceof WebPrintingJobLittleMapOptions) {
  50108. this.littleMapOptions.destroy();
  50109. this.littleMapOptions = null;
  50110. }
  50111. if (this.legendOptions instanceof WebPrintingJobLegendOptions) {
  50112. this.legendOptions.destroy();
  50113. this.legendOptions = null;
  50114. }
  50115. }
  50116. /**
  50117. * @function WebPrintingJobLayoutOptions.prototype.toJSON
  50118. * @description 将 WebPrintingJobLayoutOptions 对象转化为 JSON 字符串。
  50119. * @returns {string} 转换后的 JSON 字符串。
  50120. */
  50121. toJSON() {
  50122. var params = {
  50123. templateName: this.templateName,
  50124. title: this.title,
  50125. subTitle: this.subTitle,
  50126. author: this.author,
  50127. copyright: this.copyright
  50128. };
  50129. if (this.scaleBarOptions) {
  50130. params.scaleBarOptions = this.scaleBarOptions;
  50131. }
  50132. if (this.northArrowOptions) {
  50133. params.northArrowOptions = this.northArrowOptions;
  50134. }
  50135. if (this.littleMapOptions) {
  50136. params.littleMapOptions = this.littleMapOptions;
  50137. }
  50138. if (this.legendOptions) {
  50139. params.legendOptions = this.legendOptions;
  50140. }
  50141. return Util_Util.toJSON(params);
  50142. }
  50143. }
  50144. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobExportOptions.js
  50145. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50146. * This program are made available under the terms of the Apache License, Version 2.0
  50147. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50148. /**
  50149. * @class WebPrintingJobExportOptions
  50150. * @deprecatedclass SuperMap.WebPrintingJobExportOptions
  50151. * @classdesc Web 打印的输出参数类。
  50152. * @version 10.1.0
  50153. * @category iServer WebPrintingJob
  50154. * @param {Object} option - 参数。
  50155. * @param {WebExportFormatType} option.format - Web 打印输出的格式,目前支持:PNG、PDF。
  50156. * @param {number} [option.dpi=96] - Web 打印输出的分辨率,单位为每英寸点数。默认值为 96 DPI。
  50157. * @param {number} [option.scale] - Web 打印输出的地图比例尺。
  50158. * @param {number} [option.rotation] - Web 打印输出的地图角度。
  50159. * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [option.center] - Web 打印输出的地图中心点。
  50160. * @usage
  50161. */
  50162. class WebPrintingJobExportOptions {
  50163. constructor(option) {
  50164. /**
  50165. * @member {WebExportFormatType} WebPrintingJobExportOptions.prototype.format
  50166. * @description Web 打印输出的格式。
  50167. */
  50168. this.format = null;
  50169. /**
  50170. * @member {number} [WebPrintingJobExportOptions.prototype.dpi=96]
  50171. * @description Web 打印输出的分辨率,单位为每英寸点数。
  50172. */
  50173. this.dpi = 96;
  50174. /**
  50175. * @member {number} [WebPrintingJobExportOptions.prototype.scale]
  50176. * @description Web 打印输出的地图比例尺。
  50177. */
  50178. this.scale = null;
  50179. /**
  50180. * @member {number} [WebPrintingJobExportOptions.prototype.rotation]
  50181. * @description Web 打印输出的地图角度。
  50182. */
  50183. this.rotation = null;
  50184. /**
  50185. * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [WebPrintingJobExportOptions.prototype.center]
  50186. * @description Web 打印输出的地图中心点。
  50187. */
  50188. this.center = null;
  50189. this.CLASS_NAME = 'SuperMap.WebPrintingJobExportOptions';
  50190. Util_Util.extend(this, option);
  50191. }
  50192. /**
  50193. * @function WebPrintingJobExportOptions.prototype.destroy
  50194. * @description 释放资源,将引用资源的属性置空。
  50195. */
  50196. destroy() {
  50197. this.format = null;
  50198. this.dpi = null;
  50199. this.scale = null;
  50200. this.rotation = null;
  50201. this.center = null;
  50202. this.outputSize = null;
  50203. }
  50204. /**
  50205. * @function WebPrintingJobExportOptions.prototype.toJSON
  50206. * @description 将 WebPrintingJobExportOptions 对象转化为 JSON 字符串。
  50207. * @returns {string} 转换后的 JSON 字符串。
  50208. */
  50209. toJSON() {
  50210. var params = {
  50211. format: this.format || "PDF",
  50212. dpi: this.dpi,
  50213. scale: this.scale,
  50214. center: this.center
  50215. };
  50216. if (this.rotation) {
  50217. params.rotation = this.rotation;
  50218. }
  50219. if (this.outputSize) {
  50220. params.outputSize = this.outputSize;
  50221. }
  50222. return Util_Util.toJSON(params);
  50223. }
  50224. }
  50225. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobParameters.js
  50226. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50227. * This program are made available under the terms of the Apache License, Version 2.0
  50228. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50229. /**
  50230. * @class WebPrintingJobParameters
  50231. * @deprecatedclass SuperMap.WebPrintingJobParameters
  50232. * @category iServer WebPrintingJob
  50233. * @version 10.1.0
  50234. * @classdesc Web 打印参数类。
  50235. * @param {Object} options - 参数。
  50236. * @param {WebPrintingJobContent} options.content - Web 打印的内容类。
  50237. * @param {WebPrintingJobLayoutOptions} options.layoutOptions - Web 打印的布局类,包含各种布局元素的设置。
  50238. * @param {WebPrintingJobExportOptions} options.exportOptions - Web 打印的输出类,包含 DPI、页面大小等。
  50239. * @usage
  50240. */
  50241. class WebPrintingJobParameters {
  50242. constructor(options) {
  50243. if (!options) {
  50244. return;
  50245. }
  50246. /**
  50247. * @member {WebPrintingJobContent} WebPrintingJobParameters.prototype.content
  50248. * @description Web 打印的内容类。
  50249. */
  50250. this.content = null;
  50251. /**
  50252. * @member {WebPrintingJobLayoutOptions} WebPrintingJobParameters.prototype.layoutOptions
  50253. * @description Web 打印的布局类,包含各种布局元素的设置。
  50254. */
  50255. this.layoutOptions = null;
  50256. /**
  50257. * @member {WebPrintingJobExportOptions} WebPrintingJobParameters.prototype.exportOptions
  50258. * @description Web 打印的输出类,包含 DPI、页面大小等。
  50259. */
  50260. this.exportOptions = null;
  50261. Util_Util.extend(this, options);
  50262. this.CLASS_NAME = 'SuperMap.WebPrintingJobParameters';
  50263. }
  50264. /**
  50265. * @function WebPrintingJobParameters.prototype.destroy
  50266. * @description 释放资源,将引用资源的属性置空。
  50267. */
  50268. destroy() {
  50269. if (this.content instanceof WebPrintingJobContent) {
  50270. this.content.destroy();
  50271. this.content = null;
  50272. }
  50273. if (this.layoutOptions instanceof WebPrintingJobLayoutOptions) {
  50274. this.layoutOptions.destroy();
  50275. this.layoutOptions = null;
  50276. }
  50277. if (this.exportOptions instanceof WebPrintingJobExportOptions) {
  50278. this.exportOptions.destroy();
  50279. this.exportOptions = null;
  50280. }
  50281. }
  50282. }
  50283. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingService.js
  50284. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50285. * This program are made available under the terms of the Apache License, Version 2.0
  50286. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50287. /**
  50288. * @class WebPrintingService
  50289. * @deprecatedclass SuperMap.WebPrintingService
  50290. * @category iServer WebPrintingJob
  50291. * @version 10.1.0
  50292. * @classdesc 打印地图服务基类。
  50293. * @extends {CommonServiceBase}
  50294. * @param {string} url - 服务地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  50295. * @param {Object} options - 参数。
  50296. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  50297. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50298. * @param {Object} [options.headers] - 请求头。
  50299. * @usage
  50300. */
  50301. class WebPrintingService extends CommonServiceBase {
  50302. constructor(url, options) {
  50303. super(url, options);
  50304. if (options) {
  50305. Util_Util.extend(this, options);
  50306. }
  50307. this.eventCount = 0;
  50308. this.CLASS_NAME = 'SuperMap.WebPrintingService';
  50309. if (!this.url) {
  50310. return;
  50311. }
  50312. }
  50313. /**
  50314. * @function WebPrintingService.prototype.destroy
  50315. * @description 释放资源,将引用资源的属性置空。
  50316. */
  50317. destroy() {
  50318. super.destroy();
  50319. }
  50320. /**
  50321. * @function WebPrintingService.prototype.createWebPrintingJob
  50322. * @description 创建 Web 打印任务。
  50323. * @param {WebPrintingJobParameters} params - Web 打印的请求参数。
  50324. */
  50325. createWebPrintingJob(params, callback) {
  50326. if (!params) {
  50327. return;
  50328. }
  50329. if (params.layoutOptions) {
  50330. if (params.layoutOptions.legendOptions) {
  50331. !params.layoutOptions.legendOptions.title && (params.layoutOptions.legendOptions.title = '');
  50332. params.layoutOptions.legendOptions.picAsBase64 =
  50333. params.layoutOptions.legendOptions.picAsBase64 &&
  50334. params.layoutOptions.legendOptions.picAsBase64.replace(/^data:.+;base64,/, '');
  50335. if (
  50336. params.layoutOptions.legendOptions.customItems &&
  50337. params.layoutOptions.legendOptions.customItems.hasOwnProperty('picAsBase64')
  50338. ) {
  50339. params.layoutOptions.legendOptions.customItems.picAsBase64 = params.layoutOptions.legendOptions.customItems.picAsBase64.replace(
  50340. /^data:.+;base64,/,
  50341. ''
  50342. );
  50343. }
  50344. }
  50345. }
  50346. this.processAsync('jobs', 'POST', callback, params)
  50347. }
  50348. /**
  50349. * @function WebPrintingService.prototype.getPrintingJob
  50350. * @description 获取 Web 打印输出文档任务。
  50351. * @param {string} jobId - Web 打印任务 ID
  50352. */
  50353. getPrintingJob(jobId, callback) {
  50354. var me = this;
  50355. me.processAsync(`jobs/${jobId}`, 'GET', function(result) {
  50356. me.rollingProcess(result, me._processUrl(`jobs/${jobId}`), callback);
  50357. });
  50358. }
  50359. /**
  50360. * @function WebPrintingService.prototype.getPrintingJobResult
  50361. * @description 获取 Web 打印任务的输出文档。
  50362. * @param {string} jobId - Web 打印输入文档任务 ID。
  50363. */
  50364. getPrintingJobResult(jobId, callback) {
  50365. this.processAsync(`jobs/${jobId}/result`, 'GET', callback);
  50366. }
  50367. /**
  50368. * @function WebPrintingService.prototype.getLayoutTemplates
  50369. * @description 查询 Web 打印服务所有可用的模板信息。
  50370. */
  50371. getLayoutTemplates(callback) {
  50372. this.processAsync('layouts', 'GET', callback);
  50373. }
  50374. /**
  50375. * @function WebPrintingService.prototype.rollingProcess
  50376. * @description 轮询查询 Web 打印任务。
  50377. * @param {Object} result - 服务器返回的结果对象。
  50378. */
  50379. rollingProcess(result, url, callback) {
  50380. var me = this;
  50381. if (!result) {
  50382. return;
  50383. }
  50384. var id = setInterval(function () {
  50385. let eventId = ++me.eventCount;
  50386. let eventListeners = {
  50387. scope: this,
  50388. processCompleted: function(result) {
  50389. if (eventId === result.result.eventId && callback) {
  50390. delete result.result.eventId;
  50391. callback(result);
  50392. me.events.un(eventListeners);
  50393. return false;
  50394. }
  50395. },
  50396. processFailed: function(result) {
  50397. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  50398. callback(result);
  50399. me.events.un(eventListeners);
  50400. return false;
  50401. }
  50402. }
  50403. }
  50404. me.events.on(eventListeners);
  50405. me.request({
  50406. url,
  50407. method: 'GET',
  50408. scope: me,
  50409. success: function (result, options) {
  50410. result.eventId = eventId;
  50411. switch (result.status) {
  50412. case 'FINISHED':
  50413. clearInterval(id);
  50414. me.serviceProcessCompleted(result, options);
  50415. break;
  50416. case 'ERROR':
  50417. clearInterval(id);
  50418. me.serviceProcessFailed(result, options);
  50419. break;
  50420. case 'RUNNING':
  50421. me.events.triggerEvent('processRunning', result);
  50422. break;
  50423. }
  50424. },
  50425. failure: me.serviceProcessFailed
  50426. });
  50427. }, 1000);
  50428. }
  50429. processAsync(url, method, callback, params) {
  50430. let eventId = ++this.eventCount;
  50431. let eventListeners = {
  50432. scope: this,
  50433. processCompleted: function(result) {
  50434. if (eventId === result.result.eventId && callback) {
  50435. delete result.result.eventId;
  50436. callback(result);
  50437. this.events && this.events.un(eventListeners);
  50438. return false;
  50439. }
  50440. },
  50441. processFailed: function(result) {
  50442. if (eventId === result.error.eventId || eventId === result.eventId) {
  50443. callback(result);
  50444. this.events && this.events.un(eventListeners);
  50445. return false;
  50446. }
  50447. }
  50448. }
  50449. this.events.on(eventListeners);
  50450. var me = this;
  50451. let requestConfig = {
  50452. url: me._processUrl(url),
  50453. method,
  50454. scope: me,
  50455. success(result, options) {
  50456. result.eventId = eventId;
  50457. this.serviceProcessCompleted(result, options);
  50458. },
  50459. failure(result, options) {
  50460. if (result.error) {
  50461. result.error.eventId = eventId;
  50462. }
  50463. result.eventId = eventId;
  50464. this.serviceProcessFailed(result, options);
  50465. }
  50466. };
  50467. params && (requestConfig.data = Util_Util.toJSON(params));
  50468. me.request(requestConfig);
  50469. }
  50470. _processUrl(appendContent) {
  50471. if (appendContent) {
  50472. return Util_Util.urlPathAppend(this.url, appendContent);
  50473. }
  50474. return this.url;
  50475. }
  50476. }
  50477. ;// CONCATENATED MODULE: ./src/common/iServer/ImageCollectionService.js
  50478. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50479. * This program are made available under the terms of the Apache License, Version 2.0
  50480. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50481. /**
  50482. * @class ImageCollectionService
  50483. * @deprecatedclass SuperMap.ImageCollectionService
  50484. * @classdesc 影像集合服务类。
  50485. * @version 10.2.0
  50486. * @category iServer Image
  50487. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  50488. * @param {Object} options - 参数。
  50489. * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  50490. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50491. * @param {Object} [options.headers] - 请求头。
  50492. * @extends {CommonServiceBase}
  50493. * @usage
  50494. */
  50495. class ImageCollectionService_ImageCollectionService extends CommonServiceBase {
  50496. constructor(url, options) {
  50497. super(url, options);
  50498. this.options = options || {};
  50499. if (options) {
  50500. Util_Util.extend(this, options);
  50501. }
  50502. this.eventCount = 0;
  50503. this.CLASS_NAME = 'SuperMap.ImageCollectionService';
  50504. }
  50505. /**
  50506. * @function ImageCollectionService.prototype.destroy
  50507. * @override
  50508. */
  50509. destroy() {
  50510. super.destroy();
  50511. }
  50512. /**
  50513. * @function ImageCollectionService.prototype.getLegend
  50514. * @description 返回当前影像集合的图例信息。默认为服务发布所配置的风格,支持根据风格参数生成新的图例。
  50515. * @param {Object} queryParams query参数。
  50516. * @param {ImageRenderingRule} [queryParams.renderingRule] renderingRule 对象,用来指定影像的渲染风格,从而确定图例内容。影像的渲染风格包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。该参数未设置时,将使用发布服务时所配置的风格。
  50517. */
  50518. getLegend(queryParams, callback) {
  50519. var me = this;
  50520. var pathParams = {
  50521. collectionId: me.options.collectionId
  50522. };
  50523. var path = Util_Util.convertPath('/collections/{collectionId}/legend', pathParams);
  50524. var url = Util_Util.urlPathAppend(me.url, path);
  50525. this._processAsync({ url, method: 'GET', params: queryParams, callback });
  50526. }
  50527. /**
  50528. * @function ImageCollectionService.prototype.getStatistics
  50529. * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
  50530. */
  50531. getStatistics(callback) {
  50532. var me = this;
  50533. var pathParams = {
  50534. collectionId: me.options.collectionId
  50535. };
  50536. var path = Util_Util.convertPath('/collections/{collectionId}/statistics', pathParams);
  50537. var url = Util_Util.urlPathAppend(me.url, path);
  50538. this._processAsync({ url, method: 'GET', callback });
  50539. }
  50540. /**
  50541. * @function ImageCollectionService.prototype.getTileInfo
  50542. * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
  50543. */
  50544. getTileInfo(callback) {
  50545. var me = this;
  50546. var pathParams = {
  50547. collectionId: me.options.collectionId
  50548. };
  50549. var path = Util_Util.convertPath('/collections/{collectionId}/tileInfo', pathParams);
  50550. var url = Util_Util.urlPathAppend(me.url, path);
  50551. this._processAsync({ url, method: 'GET', callback });
  50552. }
  50553. /**
  50554. * @function ImageCollectionService.prototype.deleteItemByID
  50555. * @description 删除影像集合中指定 ID 的 Item,即从影像集合中删除指定的影像。
  50556. * @param {string} featureId Feature 的本地标识符。
  50557. */
  50558. deleteItemByID(featureId, callback) {
  50559. var me = this;
  50560. var pathParams = {
  50561. collectionId: me.options.collectionId,
  50562. featureId: featureId
  50563. };
  50564. var path = Util_Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
  50565. var url = Util_Util.urlPathAppend(me.url, path);
  50566. this._processAsync({ url, method: 'DELETE', callback });
  50567. }
  50568. /**
  50569. * @function ImageCollectionService.prototype.getItemByID
  50570. * @description 返回指定ID(`collectionId`)的影像集合中的指定ID(`featureId`)的Item对象,即返回影像集合中指定的影像。
  50571. * @param {string} featureId Feature 的本地标识符。
  50572. */
  50573. getItemByID(featureId, callback) {
  50574. var me = this;
  50575. var pathParams = {
  50576. collectionId: me.options.collectionId,
  50577. featureId: featureId
  50578. };
  50579. var path = Util_Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
  50580. var url = Util_Util.urlPathAppend(me.url, path);
  50581. this._processAsync({ url, method: 'GET', callback });
  50582. }
  50583. _processAsync({ url, method, callback, params}) {
  50584. let eventId = ++this.eventCount;
  50585. let eventListeners = {
  50586. scope: this,
  50587. processCompleted: function(result) {
  50588. if (eventId === result.result.eventId && callback) {
  50589. delete result.result.eventId;
  50590. callback(result);
  50591. this.events && this.events.un(eventListeners);
  50592. return false;
  50593. }
  50594. },
  50595. processFailed: function(result) {
  50596. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  50597. callback(result);
  50598. this.events && this.events.un(eventListeners);
  50599. return false;
  50600. }
  50601. }
  50602. }
  50603. this.events.on(eventListeners);
  50604. this.request({
  50605. method: method || 'GET',
  50606. url,
  50607. params,
  50608. scope: this,
  50609. success(result, options) {
  50610. result.eventId = eventId;
  50611. this.serviceProcessCompleted(result, options);
  50612. },
  50613. failure(result, options) {
  50614. if (result.error) {
  50615. result.error.eventId = eventId;
  50616. }
  50617. result.eventId = eventId;
  50618. this.serviceProcessFailed(result, options);
  50619. }
  50620. });
  50621. }
  50622. }
  50623. ;// CONCATENATED MODULE: ./src/common/iServer/ImageService.js
  50624. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50625. * This program are made available under the terms of the Apache License, Version 2.0
  50626. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50627. /**
  50628. * @class ImageService
  50629. * @deprecatedclass SuperMap.ImageService
  50630. * @classdesc 影像服务类。
  50631. * @version 10.2.0
  50632. * @category iServer Image
  50633. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  50634. * @param {Object} options - 可选参数。
  50635. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  50636. * @param {Object} [options.headers] - 请求头。
  50637. * @extends {CommonServiceBase}
  50638. * @usage
  50639. */
  50640. class ImageService_ImageService extends CommonServiceBase {
  50641. constructor(url, options) {
  50642. super(url, options);
  50643. this.options = options || {};
  50644. if (options) {
  50645. Util_Util.extend(this, options);
  50646. }
  50647. this.eventCount = 0;
  50648. this.CLASS_NAME = 'SuperMap.ImageService';
  50649. }
  50650. /**
  50651. * @function ImageService.prototype.destroy
  50652. * @override
  50653. */
  50654. destroy() {
  50655. super.destroy();
  50656. }
  50657. /**
  50658. * @function ImageService.prototype.getCollections
  50659. * @description 返回当前影像服务中的影像集合列表(Collections)。
  50660. */
  50661. getCollections(callback) {
  50662. var me = this;
  50663. var path = Util_Util.convertPath('/collections');
  50664. var url = Util_Util.urlPathAppend(me.url, path);
  50665. this._processAsync({ url, mehtod: 'GET', callback });
  50666. }
  50667. /**
  50668. * @function ImageService.prototype.getCollectionByID
  50669. * @description ID值等于`collectionId`参数值的影像集合(Collection)。ID值用于在服务中唯一标识该影像集合。
  50670. * @param {string} collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  50671. */
  50672. getCollectionByID(collectionId, callback) {
  50673. var pathParams = {
  50674. collectionId: collectionId
  50675. };
  50676. var me = this;
  50677. var path = Util_Util.convertPath('/collections/{collectionId}', pathParams);
  50678. var url = Util_Util.urlPathAppend(me.url, path);
  50679. this._processAsync({ url, mehtod: 'GET', callback });
  50680. }
  50681. /**
  50682. * @function ImageSearchService.prototype.search
  50683. * @description 查询与过滤条件匹配的影像数据。
  50684. * @param {ImageSearchParameter} [imageSearchParameter] 查询参数。
  50685. */
  50686. search(imageSearchParameter, callback) {
  50687. var postBody = { ...(imageSearchParameter || {}) };
  50688. var me = this;
  50689. var path = Util_Util.convertPath('/search');
  50690. var url = Util_Util.urlPathAppend(me.url, path);
  50691. this._processAsync({ url, method: 'POST', data: postBody, callback });
  50692. }
  50693. _processAsync({ url, method, callback, data }) {
  50694. let eventId = ++this.eventCount;
  50695. let me = this;
  50696. let eventListeners = {
  50697. scope: this,
  50698. processCompleted: function (result) {
  50699. if (eventId === result.result.eventId && callback) {
  50700. delete result.result.eventId;
  50701. callback(result);
  50702. this.events && this.events.un(eventListeners);
  50703. return false;
  50704. }
  50705. },
  50706. processFailed: function (result) {
  50707. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  50708. callback(result);
  50709. this.events && this.events.un(eventListeners);
  50710. return false;
  50711. }
  50712. }
  50713. };
  50714. this.events.on(eventListeners);
  50715. this.request({
  50716. method: method || 'GET',
  50717. url,
  50718. data,
  50719. scope: this,
  50720. success(result, options) {
  50721. result.eventId = eventId;
  50722. me.serviceProcessCompleted(result, options);
  50723. },
  50724. failure(result, options) {
  50725. if (result.error) {
  50726. result.error.eventId = eventId;
  50727. }
  50728. result.eventId = eventId;
  50729. me.serviceProcessFailed(result, options);
  50730. }
  50731. });
  50732. }
  50733. }
  50734. ;// CONCATENATED MODULE: ./src/common/iServer/FieldsFilter.js
  50735. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50736. * This program are made available under the terms of the Apache License, Version 2.0
  50737. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50738. /**
  50739. * @class FieldsFilter
  50740. * @deprecatedclass SuperMap.FieldsFilter
  50741. * @category iServer Data Field
  50742. * @classdesc 指定返回的用于描述 Feature 的字段。
  50743. * @param {Object} options - 可选参数。
  50744. * @param {Array.<string>} [options.include] 对返回的字段内容进行过滤,需保留的字段列表。
  50745. * @param {Array.<string>} [options.exclude] 对返回的字段内容进行过滤,需排除的字段列表。
  50746. * @usage
  50747. */
  50748. class FieldsFilter {
  50749. constructor(options) {
  50750. /**
  50751. * @description 对返回的字段内容进行过滤,需保留的字段列表。
  50752. * @member {Array.<string>} FieldsFilter.prototype.include
  50753. */
  50754. this.include = undefined;
  50755. /**
  50756. * @description 对返回的字段内容进行过滤,需排除的字段列表。
  50757. * @member {Array.<string>} FieldsFilter.prototype.exclude
  50758. */
  50759. this.exclude = undefined;
  50760. this.CLASS_NAME = 'SuperMap.FieldsFilter';
  50761. Util_Util.extend(this, options);
  50762. }
  50763. /**
  50764. * @function FieldsFilter.prototype.destroy
  50765. * @description 释放资源,将引用资源的属性置空。
  50766. */
  50767. destroy() {
  50768. var me = this;
  50769. me.include = undefined;
  50770. me.exclude = undefined;
  50771. }
  50772. /**
  50773. * @function FieldsFilter.prototype.constructFromObject
  50774. * @description 目标对象新增该类的可选参数。
  50775. * @param {Object} data 要转换的数据。
  50776. * @param {FieldsFilter} obj 返回的模型。
  50777. * @return {FieldsFilter} 返回结果。
  50778. */
  50779. static constructFromObject(data, obj) {
  50780. if (data) {
  50781. obj = obj || new FieldsFilter();
  50782. if (data.hasOwnProperty('include')) {
  50783. obj.include = data.include
  50784. }
  50785. if (data.hasOwnProperty('exclude')) {
  50786. obj.exclude = data.exclude
  50787. }
  50788. }
  50789. return obj;
  50790. }
  50791. }
  50792. ;// CONCATENATED MODULE: ./src/common/iServer/Sortby.js
  50793. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50794. * This program are made available under the terms of the Apache License, Version 2.0
  50795. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50796. /**
  50797. * @class Sortby
  50798. * @deprecatedclass SuperMap.Sortby
  50799. * @classdesc 通过指定字段进行排序的方法类。
  50800. * @category BaseTypes Util
  50801. * @param {Object} options - 参数。
  50802. * @param {string} options.field 属性名称。
  50803. * @param {Sortby.Direction} options.direction 排序规则,默认升序。
  50804. * @usage
  50805. */
  50806. class Sortby {
  50807. constructor(options) {
  50808. /**
  50809. * @description 属性名称。
  50810. * @member {string} Sortby.prototype.field
  50811. */
  50812. this.field = undefined;
  50813. /**
  50814. * @description 排序规则。
  50815. * @member {Sortby.Direction} Sortby.prototype.direction
  50816. * @default Sortby.Direction.ASC
  50817. */
  50818. this.direction = Sortby.Direction.ASC;
  50819. this.CLASS_NAME = 'SuperMap.Sortby';
  50820. Util_Util.extend(this, options);
  50821. }
  50822. /**
  50823. * @function Sortby.prototype.destroy
  50824. * @description 释放资源,将引用资源的属性置空。
  50825. */
  50826. destroy() {
  50827. var me = this;
  50828. me.field = undefined;
  50829. me.direction = 'ASC';
  50830. }
  50831. /**
  50832. * @function Sortby.prototype.constructFromObject
  50833. * @description 目标对象新增该类的可选参数。
  50834. * @param {Object} data 要转换的数据。
  50835. * @param {Sortby} obj 返回的模型。
  50836. * @return {Sortby} 返回结果。
  50837. */
  50838. static constructFromObject(data, obj) {
  50839. if (data) {
  50840. obj = obj || new Sortby();
  50841. if (data.hasOwnProperty('field')) {
  50842. obj.field = data.field;
  50843. }
  50844. if (data.hasOwnProperty('direction')) {
  50845. obj.direction = data.direction;
  50846. }
  50847. }
  50848. return obj;
  50849. }
  50850. }
  50851. /**
  50852. * @enum Direction
  50853. * @description 排序的类型枚举。
  50854. * @memberOf Sortby
  50855. * @readonly
  50856. * @type {string}
  50857. */
  50858. Sortby.Direction = {
  50859. /** 升序。 */
  50860. ASC: 'ASC',
  50861. /** 降序。 */
  50862. DESC: 'DESC'
  50863. };
  50864. ;// CONCATENATED MODULE: ./src/common/iServer/ImageSearchParameter.js
  50865. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50866. * This program are made available under the terms of the Apache License, Version 2.0
  50867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50868. /**
  50869. * @class ImageSearchParameter
  50870. * @deprecatedclass SuperMap.ImageSearchParameter
  50871. * @classdesc 影像服务查询参数类。
  50872. * @category iServer Image
  50873. * @param {Object} options - 可选参数。
  50874. * @param {Array.<number>} [options.bbox] 指定查询范围。只有具有几何对象(geometry)属性的Features,并且该几何对象与该参数指定的范围相交的 Features 才会被选择出来。该参数可以包含4个数值或者6个数值,这取决于使用的坐标参考系统是否包含高程值: * 左下角坐标轴 1 的值 * 左下角坐标轴 2 的值 * 坐标轴 3 的最小值(可选) * 右上角坐标轴 1 的值 * 右上角坐标轴 2 的值 * 坐标轴 3 的最大值(可选) 坐标参考系统为 WGS 84 经度/纬度 (http://www.opengis.net/def/crs/OGC/1.3/CRS84)。对于 “WGS 84 经度/纬度” 坐标参考系统,该参数值的格式通常为:最小经度,最小纬度,最大经度,最大纬度。如果包含了高程值,该参数的格式为:最小经度,最小纬度,最小高程值,最大经度,最大纬度,最大高程值。如果一个 Feature 具有多个空间几何对象(geometry)属性,由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
  50875. * @param {Array.<string>} [options.collections] 影像集合的ID数组,将在该指定的Collection中搜索Items。
  50876. * @param {Array.<string>} [options.ids] 只返回指定 Item 的 ID 数组中的Item。返回的 Item 的 ID 值数组。设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
  50877. * @param {number} [options.limit] 返回的最大结果数,即响应文档包含的 Item 的数目。
  50878. * @param {FieldsFilter} [options.fields] 通过‘include’和‘exclude’属性分别指定哪些字段包含在查询结果的 Feature 描述中,哪些需要排除。返回结果中的stac_version,id,bbox,assets,links,geometry,type,properties这些字段为必须字段,若要返回结果中不含这种字段信息,需要显示地进行排除设置,如:排除geometry和bbox字段;在POST请求中,则需要将这些字段添加到“exclude”字段中,例如: "fields": { "exclude": ["geometry","bbox"] } } 。而对于返回的“properties”对象中的扩展字段内容,可以将字段前添加到‘include’字段中,如: "fields": { "include": ["properties.SmFileName","properties.SmHighPS"] } ,表示properties.SmFileName和properties.SmHighPS 属性都包含在查询结果中。
  50879. * @param {Object} [options.query] 定义查询哪些属性,查询运算符将应用于这些属性。运算符包括:eq、neq、gt、lt、gte、lte、startsWith、endsWith、contains、in。其中in是Array.<string>类型,例如:{ "SmFileName": { "eq":"B49C001002.tif" }}
  50880. * @param {Array.<Sortby>} [options.sortby] 由包含属性名称和排序规则的对象构成的数组。
  50881. * @usage
  50882. */
  50883. class ImageSearchParameter {
  50884. constructor(options) {
  50885. /**
  50886. * @description 指定查询范围。只有具有几何对象(geometry)属性的Features,并且该几何对象与该参数指定的范围相交的 Features 才会被选择出来该参数可以包含4个数值或者6个数值,这取决于使用的坐标参考系统是否包含高程值: * 左下角坐标轴 1 的值 * 左下角坐标轴 2 的值 * 坐标轴 3 的最小值(可选) * 右上角坐标轴 1 的值 * 右上角坐标轴 2 的值 * 坐标轴 3 的最大值(可选) 坐标参考系统为 WGS 84 经度/纬度 (http://www.opengis.net/def/crs/OGC/1.3/CRS84). 对于 “WGS 84 经度/纬度” 坐标参考系统,该参数值的格式通常为:最小经度,最小纬度,最大经度,最大纬度。如果包含了高程值,该参数的格式为:最小经度,最小纬度,最小高程值,最大经度,最大纬度,最大高程值。如果一个 Feature 具有多个空间几何对象(geometry)属性,由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
  50887. * @member {Array.<number>} ImageSearchParameter.prototype.bbox
  50888. */
  50889. this.bbox = undefined;
  50890. /**
  50891. * @description 影像集合的ID数组,将在该指定的Collection中搜索Items。
  50892. * @member {Array.<string>} ImageSearchParameter.prototype.collections
  50893. */
  50894. this.collections = undefined;
  50895. /**
  50896. * @description 返回的 Item 的 ID 值数组。设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
  50897. * @member {Array.<string>} ImageSearchParameter.prototype.ids
  50898. */
  50899. this.ids = undefined;
  50900. /**
  50901. * @description 单页返回的最大结果数。最小值为1,最大值为10000。
  50902. * @member {number} ImageSearchParameter.prototype.limit
  50903. */
  50904. this.limit = undefined;
  50905. /**
  50906. * @description 通过‘include’和‘exclude’属性分别指定哪些字段包含在查询结果的 Feature 描述中,哪些需要排除。返回结果中的stac_version,id,bbox,assets,links,geometry,type,properties这些字段为必须字段,若要返回结果中不含这种字段信息,需要显示地进行排除设置,如:排除geometry和bbox字段;在POST请求中,则需要将这些字段添加到“exclude”字段中,例如: "fields": { "exclude": ["geometry","bbox"] } } 。而对于返回的“properties”对象中的扩展字段内容,可以将字段前添加到‘include’字段中,如: "fields": { "include": ["properties.SmFileName","properties.SmHighPS"] } } ,表示properties.SmFileName和properties.SmHighPS 属性都包含在查询结果中。
  50907. * @member {FieldsFilter} ImageSearchParameter.prototype.fields
  50908. */
  50909. this.fields = undefined;
  50910. /**
  50911. * @description 定义查询哪些属性,查询运算符将应用于这些属性。
  50912. * @member {Object} ImageSearchParameter.prototype.query
  50913. */
  50914. this.query = undefined;
  50915. /**
  50916. * @description 由包含属性名称和排序规则的对象构成的数组。
  50917. * @member {Array.<Sortby>} ImageSearchParameter.prototype.sortby
  50918. */
  50919. this.sortby = undefined;
  50920. this.CLASS_NAME = 'SuperMap.ImageSearchParameter';
  50921. Util_Util.extend(this, options);
  50922. }
  50923. /**
  50924. * @function ImageSearchParameter.prototype.destroy
  50925. * @description 释放资源,将引用资源的属性置空。
  50926. */
  50927. destroy() {
  50928. var me = this;
  50929. me.bbox = undefined;
  50930. me.collections = undefined;
  50931. me.ids = undefined;
  50932. me.limit = undefined;
  50933. me.fields = undefined;
  50934. me.query = undefined;
  50935. me.sortby = undefined;
  50936. }
  50937. /**
  50938. * @function ImageSearchParameter.prototype.constructFromObject
  50939. * @description 目标对象新增该类的可选参数。
  50940. * @param {Object} data 要转换的数据。
  50941. * @param {ImageSearchParameter} obj 返回的模型。
  50942. * @return {ImageSearchParameter} 返回结果。
  50943. */
  50944. static constructFromObject(data, obj) {
  50945. if (data) {
  50946. obj = obj || new ImageSearchParameter();
  50947. if (data.hasOwnProperty('bbox')) {
  50948. obj.bbox = data.bbox;
  50949. }
  50950. if (data.hasOwnProperty('collections')) {
  50951. obj.collections = data.collections;
  50952. }
  50953. if (data.hasOwnProperty('ids')) {
  50954. obj.ids = data.ids;
  50955. }
  50956. if (data.hasOwnProperty('limit')) {
  50957. obj.limit = data.limit;
  50958. }
  50959. if (data.hasOwnProperty('fields')) {
  50960. obj.fields = (FieldsFilter.constructFromObject && FieldsFilter.constructFromObject(data.fields, {})) || data.fields;
  50961. }
  50962. if (data.hasOwnProperty('query')) {
  50963. obj.query = data.query;
  50964. }
  50965. if (data.hasOwnProperty('sortby')) {
  50966. obj.sortby = data.sortby;
  50967. if (data.sortby) {
  50968. obj.sortby = data.sortby.map((item) => {
  50969. return (Sortby.constructFromObject && Sortby.constructFromObject(item, {})) || item;
  50970. });
  50971. }
  50972. }
  50973. }
  50974. return obj;
  50975. }
  50976. }
  50977. ;// CONCATENATED MODULE: ./src/common/iServer/ImageStretchOption.js
  50978. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  50979. * This program are made available under the terms of the Apache License, Version 2.0
  50980. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50981. /**
  50982. * @class ImageStretchOption
  50983. * @deprecatedclass SuperMap.ImageStretchOption
  50984. * @classdesc 影像拉伸类。
  50985. * @category iServer Image
  50986. * @param {Object} options - 可选参数。
  50987. * @param {ImageStretchOption.StretchType} [options.stretchType] 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
  50988. * @param {number} [options.stdevCoefficient] 标准差系数。
  50989. * @param {number} [options.gaussianCoefficient] 高斯系数。
  50990. * @param {boolean} [options.useMedianValue] 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
  50991. * @param {number} [options.minPercent] 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
  50992. * @param {number} [options.maxPercent] 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
  50993. * @usage
  50994. */
  50995. class ImageStretchOption {
  50996. constructor(options) {
  50997. /**
  50998. * @description 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
  50999. * @member {ImageStretchOption.StretchType} ImageStretchOption.prototype.stretchType
  51000. */
  51001. this.stretchType = undefined;
  51002. /**
  51003. * @description 标准差系数。
  51004. * @member {number} ImageStretchOption.prototype.stdevCoefficient
  51005. */
  51006. this.stdevCoefficient = undefined;
  51007. /**
  51008. * @description 高斯系数。
  51009. * @member {number} ImageStretchOption.prototype.gaussianCoefficient
  51010. */
  51011. this.gaussianCoefficient = undefined;
  51012. /**
  51013. * @description 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
  51014. * @member {boolean} ImageStretchOption.prototype.useMedianValue
  51015. */
  51016. this.useMedianValue = undefined;
  51017. /**
  51018. * @description 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
  51019. * @member {number} ImageStretchOption.prototype.minPercent
  51020. */
  51021. this.minPercent = undefined;
  51022. /**
  51023. * @description 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
  51024. * @member {number} ImageStretchOption.prototype.maxPercent
  51025. */
  51026. this.maxPercent = undefined;
  51027. this.CLASS_NAME = 'SuperMap.ImageStretchOption';
  51028. Util_Util.extend(this, options);
  51029. }
  51030. /**
  51031. * @function ImageStretchOption.prototype.destroy
  51032. * @description 释放资源,将引用资源的属性置空。
  51033. */
  51034. destroy() {
  51035. var me = this;
  51036. me.stretchType = undefined;
  51037. me.stdevCoefficient = undefined;
  51038. me.gaussianCoefficient = undefined;
  51039. me.useMedianValue = undefined;
  51040. me.minPercent = undefined;
  51041. me.maxPercent = undefined;
  51042. }
  51043. /**
  51044. * @function ImageStretchOption.prototype.constructFromObject
  51045. * @description 目标对象新增该类的可选参数。
  51046. * @param {Object} data 要转换的数据。
  51047. * @param {ImageStretchOption} obj 返回的模型。
  51048. * @return {ImageStretchOption} 返回结果。
  51049. */
  51050. static constructFromObject(data, obj) {
  51051. if (data) {
  51052. obj = obj || new ImageStretchOption();
  51053. if (data.hasOwnProperty('stretchType')) {
  51054. obj.stretchType = data.stretchType;
  51055. }
  51056. if (data.hasOwnProperty('stdevCoefficient')) {
  51057. obj.stdevCoefficient = data.stdevCoefficient;
  51058. }
  51059. if (data.hasOwnProperty('gaussianCoefficient')) {
  51060. obj.gaussianCoefficient = data.gaussianCoefficient;
  51061. }
  51062. if (data.hasOwnProperty('useMedianValue')) {
  51063. obj.useMedianValue = data.useMedianValue;
  51064. }
  51065. if (data.hasOwnProperty('minPercent')) {
  51066. obj.minPercent = data.minPercent;
  51067. }
  51068. if (data.hasOwnProperty('maxPercent')) {
  51069. obj.maxPercent = data.maxPercent;
  51070. }
  51071. }
  51072. return obj;
  51073. }
  51074. }
  51075. /**
  51076. * @enum StretchType
  51077. * @description 影像拉伸类型枚举。
  51078. * @memberOf ImageStretchOption
  51079. * @readonly
  51080. * @type {string}
  51081. */
  51082. ImageStretchOption.StretchType = {
  51083. /** 无拉伸。 */
  51084. NONE: 'NONE',
  51085. /** 高斯拉伸。 */
  51086. GAUSSIAN: 'GAUSSIAN',
  51087. /** 百分比截断拉伸。 */
  51088. PERCENTCLIP: 'PERCENTCLIP',
  51089. /** 最值拉伸。 */
  51090. MINIMUMMAXIMUM: 'MINIMUMMAXIMUM',
  51091. /** 标准差拉伸。 */
  51092. STANDARDDEVIATION: 'STANDARDDEVIATION'
  51093. };
  51094. ;// CONCATENATED MODULE: ./src/common/iServer/ImageRenderingRule.js
  51095. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51096. * This program are made available under the terms of the Apache License, Version 2.0
  51097. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51098. /**
  51099. * @class ImageRenderingRule
  51100. * @deprecatedclass SuperMap.ImageRenderingRule
  51101. * @classdesc 定义请求的影像如何进行渲染或者处理,如:影像的拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。
  51102. * @category iServer Image
  51103. * @param {Object} options - 可选参数。
  51104. * @param {ImageRenderingRule.DisplayMode} [options.displayMode] 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
  51105. * @param {string} [options.displayBands] 影像显示的波段或者波段组合。若影像的显示模式为STRETCHED,该属性指定一个波段的索引号(波段索引号从0开始计数);若影像的显示模式为COMPOSITE,该属性为组合的波段索引号,例如:属性值3,2,1表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
  51106. * @param {ImageStretchOption} [options.stretchOption] 影像的拉伸参数。
  51107. * @param {ImageRenderingRule.InterpolationMode} [options.interpolationMode] 影像显示时使用的插值算法。
  51108. * @param {Array.<string>} [options.colorScheme] 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
  51109. * @param {Array.<string>} [options.colorTable] 影像的颜色表。颜色表为栅格值与RGBA颜色值的对照表。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。以下示例表示该颜色对照表由三组构成,第一组高程值为500,对应的颜色为红色;第二组高程值为700,对应的颜色为绿色;第三组高程值为700,对应的颜色为蓝色。示例:"500: 255,0,0", "700: 0,255,0" , "900: 0,0,255"。
  51110. * @param {number} [options.brightness] 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
  51111. * @param {number} [options.contrast] 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
  51112. * @param {string} [options.noData] 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
  51113. * @param {string} [options.noDataColor] 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
  51114. * @param {boolean} [options.noDataTransparent] 无值是否透明显示,true表示透明显示无值;否则为false。
  51115. * @param {string} [options.backgroundValue] 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
  51116. * @param {string} [options.backgroundColor] 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
  51117. * @param {boolean} [options.backgroundTransparent] 背景值是否透明显示,true表示透明显示背景值;否则为false。
  51118. * @param {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} [options.gridFunctions] 栅格函数链。
  51119. * @usage
  51120. */
  51121. class ImageRenderingRule {
  51122. constructor(options) {
  51123. /**
  51124. * @description 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
  51125. * @member {ImageRenderingRule.DisplayMode} ImageRenderingRule.prototype.displayMode
  51126. */
  51127. this.displayMode = undefined;
  51128. /**
  51129. * @description 影像显示的波段或者波段组合。该参数为一个数组,数组元素为波段索引号。若影像的显示模式为Stretched,该属性指定一个显示的波段;若影像的显示模式为Composite,该属性为组合的波段索引号,例如:属性值4,3,2表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
  51130. * @member {string} ImageRenderingRule.prototype.displayBands
  51131. */
  51132. this.displayBands = undefined;
  51133. /**
  51134. * @description 影像的拉伸参数。
  51135. * @member {ImageStretchOption} ImageRenderingRule.prototype.stretchOption
  51136. */
  51137. this.stretchOption = undefined;
  51138. /**
  51139. * @description 影像显示时使用的插值算法。
  51140. * @member {ImageRenderingRule.InterpolationMode} ImageRenderingRule.prototype.interpolationMode
  51141. */
  51142. this.interpolationMode = undefined;
  51143. /**
  51144. * @description 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
  51145. * @member {Array.<string>} ImageRenderingRule.prototype.colorScheme
  51146. */
  51147. this.colorScheme = undefined;
  51148. /**
  51149. * @description 影像的颜色表。颜色表为栅格值与RGBA颜色值的对照表。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。以下示例表示该颜色对照表由三组构成,第一组高程值为500,对应的颜色为红色;第二组高程值为700,对应的颜色为绿色;第三组高程值为700,对应的颜色为蓝色。示例:"500: 255,0,0", "700: 0,255,0" , "900: 0,0,255"
  51150. * @member {Array.<string>} ImageRenderingRule.prototype.colorTable
  51151. */
  51152. this.colorTable = undefined;
  51153. /**
  51154. * @description 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
  51155. * @member {number} ImageRenderingRule.prototype.brightness
  51156. */
  51157. this.brightness = undefined;
  51158. /**
  51159. * @description 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
  51160. * @member {number} ImageRenderingRule.prototype.contrast
  51161. */
  51162. this.contrast = undefined;
  51163. /**
  51164. * @description 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
  51165. * @member {string} ImageRenderingRule.prototype.noData
  51166. */
  51167. this.noData = undefined;
  51168. /**
  51169. * @description 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
  51170. * @member {string} ImageRenderingRule.prototype.noDataColor
  51171. */
  51172. this.noDataColor = undefined;
  51173. /**
  51174. * @description 无值是否透明显示,true表示透明显示无值;否则为false。
  51175. * @member {boolean} ImageRenderingRule.prototype.noDataTransparent
  51176. */
  51177. this.noDataTransparent = undefined;
  51178. /**
  51179. * @description 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
  51180. * @member {string} ImageRenderingRule.prototype.backgroundValue
  51181. */
  51182. this.backgroundValue = undefined;
  51183. /**
  51184. * @description 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
  51185. * @member {string} ImageRenderingRule.prototype.backgroundColor
  51186. */
  51187. this.backgroundColor = undefined;
  51188. /**
  51189. * @description 背景值是否透明显示,true表示透明显示背景值;否则为false。
  51190. * @member {boolean} ImageRenderingRule.prototype.backgroundTransparent
  51191. */
  51192. this.backgroundTransparent = undefined;
  51193. /**
  51194. * @description 栅格函数选项,通过应用栅格函数,可以对影像进行快速显示处理。
  51195. * @member {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} ImageRenderingRule.prototype.gridFunctions
  51196. */
  51197. this.gridFunctions = undefined;
  51198. this.CLASS_NAME = 'SuperMap.ImageRenderingRule';
  51199. Util_Util.extend(this, options);
  51200. }
  51201. /**
  51202. * @function ImageRenderingRule.prototype.destroy
  51203. * @description 释放资源,将引用资源的属性置空。
  51204. */
  51205. destroy() {
  51206. var me = this;
  51207. me.displayMode = undefined;
  51208. me.displayBands = undefined;
  51209. me.stretchOption = undefined;
  51210. me.interpolationMode = undefined;
  51211. me.colorScheme = undefined;
  51212. me.colorTable = undefined;
  51213. me.brightness = undefined;
  51214. me.contrast = undefined;
  51215. me.noData = undefined;
  51216. me.noDataColor = undefined;
  51217. me.noDataTransparent = undefined;
  51218. me.backgroundValue = undefined;
  51219. me.backgroundColor = undefined;
  51220. me.backgroundTransparent = undefined;
  51221. me.gridFuncOptions = undefined;
  51222. }
  51223. /**
  51224. * @function ImageRenderingRule.prototype.constructFromObject
  51225. * @description 目标对象新增该类的可选参数。
  51226. * @param {Object} data 要转换的数据。
  51227. * @param {ImageRenderingRule} obj 返回的模型。
  51228. * @return {ImageRenderingRule} 返回结果。
  51229. */
  51230. static constructFromObject(data, obj) {
  51231. if (data) {
  51232. obj = obj || new ImageRenderingRule();
  51233. if (data.hasOwnProperty('displayMode')) {
  51234. obj.displayMode = data.displayMode;
  51235. }
  51236. if (data.hasOwnProperty('displayBands')) {
  51237. obj.displayBands = data.displayBands;
  51238. }
  51239. if (data.hasOwnProperty('stretchOption')) {
  51240. obj.stretchOption =
  51241. (ImageStretchOption.constructFromObject && ImageStretchOption.constructFromObject(data.stretchOption, {})) ||
  51242. data.stretchOption;
  51243. }
  51244. if (data.hasOwnProperty('interpolationMode')) {
  51245. obj.interpolationMode = data.interpolationMode;
  51246. }
  51247. if (data.hasOwnProperty('colorScheme')) {
  51248. obj.colorScheme = data.colorScheme;
  51249. }
  51250. if (data.hasOwnProperty('colorTable')) {
  51251. obj.colorTable = data.colorTable;
  51252. }
  51253. if (data.hasOwnProperty('brightness')) {
  51254. obj.brightness = data.brightness;
  51255. }
  51256. if (data.hasOwnProperty('contrast')) {
  51257. obj.contrast = data.contrast;
  51258. }
  51259. if (data.hasOwnProperty('noData')) {
  51260. obj.noData = data.noData;
  51261. }
  51262. if (data.hasOwnProperty('noDataColor')) {
  51263. obj.noDataColor = data.noDataColor;
  51264. }
  51265. if (data.hasOwnProperty('backgroundValue')) {
  51266. obj.backgroundValue = data.backgroundValue;
  51267. }
  51268. if (data.hasOwnProperty('noDataTransparent')) {
  51269. obj.noDataTransparent = data.noDataTransparent;
  51270. }
  51271. if (data.hasOwnProperty('backgroundColor')) {
  51272. obj.backgroundColor = data.backgroundColor;
  51273. }
  51274. if (data.hasOwnProperty('backgroundTransparent')) {
  51275. obj.backgroundTransparent = data.backgroundTransparent;
  51276. }
  51277. if (data.hasOwnProperty('gridFunctions')) {
  51278. obj.gridFunctions = data.gridFunctions;
  51279. }
  51280. }
  51281. return obj;
  51282. }
  51283. }
  51284. /**
  51285. * @enum DisplayMode
  51286. * @description 影像显示模式。
  51287. * @memberOf ImageRenderingRule
  51288. * @readonly
  51289. * @type {string}
  51290. */
  51291. ImageRenderingRule.DisplayMode = {
  51292. COMPOSITE: 'COMPOSITE',
  51293. STRETCHED: 'Stretched'
  51294. };
  51295. /**
  51296. * @enum InterpolationMode
  51297. * @description 影像显示时使用的插值算法枚举。
  51298. * @memberOf ImageRenderingRule
  51299. * @readonly
  51300. * @type {string}
  51301. */
  51302. ImageRenderingRule.InterpolationMode = {
  51303. /** 最邻近插值模式。 */
  51304. NEARESTNEIGHBOR: 'NEARESTNEIGHBOR',
  51305. /** 高质量的双线性插值模式。 */
  51306. HIGHQUALITYBILINEAR: 'HIGHQUALITYBILINEAR',
  51307. /** 默认插值模式。 */
  51308. DEFAULT: 'DEFAULT'
  51309. };
  51310. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFHillShade.js
  51311. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51312. * This program are made available under the terms of the Apache License, Version 2.0
  51313. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51314. /**
  51315. * @class ImageGFHillShade
  51316. * @deprecatedclass SuperMap.ImageGFHillShade
  51317. * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。
  51318. * @category iServer Image
  51319. * @param {Object} options - 可选参数。
  51320. * @param {string} [options.girdFuncName='GFHillShade'] 栅格函数名称,参数值为:GFHillShade。
  51321. * @param {number} [options.Azimuth = 315] 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
  51322. * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  51323. * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  51324. * @usage
  51325. */
  51326. class ImageGFHillShade {
  51327. constructor(options) {
  51328. /**
  51329. * @description 栅格函数名称,参数值为:GFHillShade。
  51330. * @member {string} ImageGFHillShade.prototype.girdFuncName
  51331. * @default 'GFHillShade'
  51332. */
  51333. this.girdFuncName = 'GFHillShade';
  51334. /**
  51335. * @description 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
  51336. * @member {number} ImageGFHillShade.prototype.Azimuth
  51337. */
  51338. this.Azimuth = 315;
  51339. /**
  51340. * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  51341. * @member {number} ImageGFHillShade.prototype.Altitude
  51342. */
  51343. this.Altitude = 45;
  51344. /**
  51345. * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  51346. * @member {number} ImageGFHillShade.prototype.ZFactor
  51347. */
  51348. this.ZFactor = 1;
  51349. this.CLASS_NAME = 'SuperMap.ImageGFHillShade';
  51350. Util_Util.extend(this, options);
  51351. }
  51352. /**
  51353. * @function ImageGFHillShade.prototype.destroy
  51354. * @description 释放资源,将引用资源的属性置空。
  51355. */
  51356. destroy() {
  51357. var me = this;
  51358. me.girdFuncName = 'GFHillShade';
  51359. me.Azimuth = 315;
  51360. me.Altitude = 45;
  51361. me.ZFactor = 1;
  51362. }
  51363. /**
  51364. * @function ImageGFHillShade.prototype.constructFromObject
  51365. * @description 目标对象新增该类的可选参数。
  51366. * @param {Object} data 要转换的数据。
  51367. * @param {ImageGFHillShade} obj 返回的模型。
  51368. * @return {ImageGFHillShade} 返回结果。
  51369. */
  51370. static constructFromObject(data, obj) {
  51371. if (data) {
  51372. obj = obj || new ImageGFHillShade();
  51373. if (data.hasOwnProperty('girdFuncName')) {
  51374. obj.girdFuncName = data.girdFuncName
  51375. }
  51376. if (data.hasOwnProperty('Azimuth')) {
  51377. obj.Azimuth = data.Azimuth
  51378. }
  51379. if (data.hasOwnProperty('Altitude')) {
  51380. obj.Altitude = data.Altitude
  51381. }
  51382. if (data.hasOwnProperty('ZFactor')) {
  51383. obj.ZFactor = data.ZFactor
  51384. }
  51385. }
  51386. return obj;
  51387. }
  51388. }
  51389. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFAspect.js
  51390. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51391. * This program are made available under the terms of the Apache License, Version 2.0
  51392. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51393. /**
  51394. * @class ImageGFAspect
  51395. * @deprecatedclass SuperMap.ImageGFAspect
  51396. * @classdesc 栅格函数对象:对DEM数据生成坡向渲图。
  51397. * @category iServer Image
  51398. * @param {Object} options -可选参数。
  51399. * @param {string} [options.girdFuncName='GFAspect'] 栅格函数名称,参数值为:GFAspect。
  51400. * @param {number} [options.Azimuth] 光源方位角,固定为360度。
  51401. * @usage
  51402. */
  51403. class ImageGFAspect {
  51404. constructor(options) {
  51405. /**
  51406. * @description 栅格函数名称,参数值为:GFAspect。
  51407. * @member {string} ImageGFAspect.prototype.girdFuncName
  51408. * @default 'GFAspect'
  51409. */
  51410. this.girdFuncName = 'GFAspect';
  51411. /**
  51412. * @description 光源方位角,固定为360度。
  51413. * @member {number} ImageGFAspect.prototype.Azimuth
  51414. */
  51415. this.Azimuth = undefined;
  51416. this.CLASS_NAME = 'SuperMap.ImageGFAspect';
  51417. Util_Util.extend(this, options);
  51418. }
  51419. /**
  51420. * @function ImageGFAspect.prototype.destroy
  51421. * @description 释放资源,将引用资源的属性置空。
  51422. */
  51423. destroy() {
  51424. var me = this;
  51425. me.girdFuncName = 'GFAspect';
  51426. me.Azimuth = undefined;
  51427. }
  51428. /**
  51429. * @function ImageGFAspect.prototype.constructFromObject
  51430. * @description 目标对象新增该类的可选参数。
  51431. * @param {Object} data 要转换的数据。
  51432. * @param {ImageGFAspect} obj 返回的模型。
  51433. * @return {ImageGFAspect} 返回结果。
  51434. */
  51435. static constructFromObject(data, obj) {
  51436. if (data) {
  51437. obj = obj || new ImageGFAspect();
  51438. if (data.hasOwnProperty('girdFuncName')) {
  51439. obj.girdFuncName = data.girdFuncName
  51440. }
  51441. if (data.hasOwnProperty('Azimuth')) {
  51442. obj.Azimuth = data.Azimuth
  51443. }
  51444. }
  51445. return obj;
  51446. }
  51447. }
  51448. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFOrtho.js
  51449. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51450. * This program are made available under the terms of the Apache License, Version 2.0
  51451. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51452. /**
  51453. * @class ImageGFOrtho
  51454. * @deprecatedclass SuperMap.ImageGFOrtho
  51455. * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。该栅格函数不需要输入参数,采用系统默认设置。
  51456. * @category iServer Image
  51457. * @param {Object} options - 可选参数。
  51458. * @param {string} [options.girdFuncName='GFOrtho'] 栅格函数名称,参数值为:GFOrtho。
  51459. * @usage
  51460. */
  51461. class ImageGFOrtho {
  51462. constructor(options) {
  51463. /**
  51464. * @description 栅格函数名称,参数值为:GFOrtho。
  51465. * @member {string} ImageGFOrtho.prototype.girdFuncName
  51466. * @default 'GFOrtho'
  51467. */
  51468. this.girdFuncName = 'GFOrtho';
  51469. this.CLASS_NAME = 'SuperMap.ImageGFOrtho';
  51470. Util_Util.extend(this, options);
  51471. }
  51472. /**
  51473. * @function ImageGFOrtho.prototype.destroy
  51474. * @description 释放资源,将引用资源的属性置空。
  51475. */
  51476. destroy() {
  51477. var me = this;
  51478. me.girdFuncName = 'GFOrtho';
  51479. }
  51480. /**
  51481. * @function ImageGFOrtho.prototype.constructFromObject
  51482. * @description 目标对象新增该类的可选参数。
  51483. * @param {Object} data 要转换的数据。
  51484. * @param {ImageGFOrtho} obj 返回的模型。
  51485. * @return {ImageGFOrtho} 返回结果。
  51486. */
  51487. static constructFromObject(data, obj) {
  51488. if (data) {
  51489. obj = obj || new ImageGFOrtho();
  51490. if (data.hasOwnProperty('girdFuncName')) {
  51491. obj.girdFuncName = data.girdFuncName
  51492. }
  51493. }
  51494. return obj;
  51495. }
  51496. }
  51497. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFSlope.js
  51498. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51499. * This program are made available under the terms of the Apache License, Version 2.0
  51500. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51501. /**
  51502. * @class ImageGFSlope
  51503. * @deprecatedclass SuperMap.ImageGFSlope
  51504. * @classdesc 栅格函数对象:对DEM数据生成坡度图。
  51505. * @category iServer Image
  51506. * @param {Object} options - 可选参数。
  51507. * @param {string} [options.girdFuncName='GFSlope'] 栅格函数名称,参数值为:GFSlope。
  51508. * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  51509. * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  51510. * @usage
  51511. */
  51512. class ImageGFSlope {
  51513. constructor(options) {
  51514. /**
  51515. * @description 栅格函数名称,参数值为:GFSlope。
  51516. * @member {string} ImageGFSlope.prototype.girdFuncName
  51517. * @default 'GFSlope'
  51518. */
  51519. this.girdFuncName = 'GFSlope';
  51520. /**
  51521. * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  51522. * @member {number} ImageGFSlope.prototype.Altitude
  51523. */
  51524. this.Altitude = 45;
  51525. /**
  51526. * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  51527. * @member {number} ImageGFSlope.prototype.ZFactor
  51528. */
  51529. this.ZFactor = 1;
  51530. this.CLASS_NAME = 'SuperMap.ImageGFSlope';
  51531. Util_Util.extend(this, options);
  51532. }
  51533. /**
  51534. * @function ImageGFSlope.prototype.destroy
  51535. * @description 释放资源,将引用资源的属性置空。
  51536. */
  51537. destroy() {
  51538. var me = this;
  51539. me.girdFuncName = 'GFSlope';
  51540. me.Altitude = 45;
  51541. me.ZFactor = 1;
  51542. }
  51543. /**
  51544. * @function ImageGFSlope.prototype.constructFromObject
  51545. * @description 目标对象新增该类的可选参数。
  51546. * @param {Object} data 要转换的数据。
  51547. * @param {ImageGFSlope} obj 返回的模型。
  51548. * @return {ImageGFSlope} 返回结果。
  51549. */
  51550. static constructFromObject(data, obj) {
  51551. if (data) {
  51552. obj = obj || new ImageGFSlope();
  51553. if (data.hasOwnProperty('girdFuncName')) {
  51554. obj.girdFuncName = data.girdFuncName
  51555. }
  51556. if (data.hasOwnProperty('Altitude')) {
  51557. obj.Altitude = data.Altitude
  51558. }
  51559. if (data.hasOwnProperty('ZFactor')) {
  51560. obj.ZFactor = data.ZFactor
  51561. }
  51562. }
  51563. return obj;
  51564. }
  51565. }
  51566. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphNodeParameter.js
  51567. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51568. * This program are made available under the terms of the Apache License, Version 2.0
  51569. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51570. /**
  51571. * @private
  51572. * @class KnowledgeGraphNodeParameter
  51573. * @deprecatedclass SuperMap.KnowledgeGraphNodeParameter
  51574. * @classdesc 知识图谱实体的参数设置。
  51575. * @category iServer KnowledgeGraph
  51576. * @version 11.1.0
  51577. * @param {Object} options - 参数。
  51578. * @param {string} options.id - 实体id。
  51579. * @param {Array.<string>} [options.labels] - 实体分类。
  51580. * @param {Object} [options.properties] - 属性。
  51581. * @usage
  51582. */
  51583. // {
  51584. // "id": 5348024557502471,
  51585. // "properties": {
  51586. // "server": "test1",
  51587. // "_labelfieldname": "FEATUREGUID",
  51588. // "_entityname": "院落",
  51589. // "_bindfindid": "院落@ST_YARDA@1",
  51590. // "FEATUREGUID": "{409E615B-A545-4E07-872D-B12EDA0B4A1A}",
  51591. // "_findid": 1,
  51592. // "ENTITYNAME": "公共管理与公共服务"
  51593. // },
  51594. // "labels": ["院落"]
  51595. // }
  51596. class KnowledgeGraphNodeParameter {
  51597. constructor(options) {
  51598. /**
  51599. * @member {string} KnowledgeGraphNodeParameter.prototype.id
  51600. * @description 实体ID。
  51601. */
  51602. this.id = null;
  51603. /**
  51604. * @member {Array.<string>} KnowledgeGraphNodeParameter.prototype.labels
  51605. * @description 实体分类。
  51606. */
  51607. this.labels = null;
  51608. /**
  51609. * @member {Object} KnowledgeGraphNodeParameter.prototype.properties
  51610. * @description 实体属性。
  51611. */
  51612. this.properties = null;
  51613. this.CLASS_NAME = 'SuperMap.KnowledgeGraphNodeParameter';
  51614. Util.extend(this, options);
  51615. }
  51616. destroy() {
  51617. var me = this;
  51618. me.id = null;
  51619. me.labels = null;
  51620. me.properties = null;
  51621. }
  51622. }
  51623. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphEdgeParameter.js
  51624. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51625. * This program are made available under the terms of the Apache License, Version 2.0
  51626. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51627. /**
  51628. * @private
  51629. * @class KnowledgeGraphEdgeParameter
  51630. * @deprecatedclass SuperMap.KnowledgeGraphEdgeParameter
  51631. * @classdesc 知识图谱关系的参数设置。
  51632. * @category iServer KnowledgeGraph
  51633. * @version 11.1.0
  51634. * @param {Object} options - 参数。
  51635. * @param {string} options.id - 边id。
  51636. * @param {string} options.start - 开始实体id。
  51637. * @param {string} options.end - 结束实体id。
  51638. * @param {string} [options.type] - 标签,关系。
  51639. * @param {Object} [options.properties] - 属性。
  51640. * @usage
  51641. */
  51642. class KnowledgeGraphEdgeParameter {
  51643. constructor(options) {
  51644. /**
  51645. * @member {string} KnowledgeGraphEdgeParameter.prototype.id
  51646. * @description 边id。
  51647. */
  51648. this.id = null;
  51649. /**
  51650. * @member {string} KnowledgeGraphEdgeParameter.prototype.start
  51651. * @description 开始实体id。
  51652. */
  51653. this.start = null;
  51654. /**
  51655. * @member {string} KnowledgeGraphEdgeParameter.prototype.end
  51656. * @description 结束实体id。
  51657. */
  51658. this.end = null;
  51659. /**
  51660. * @member {string} KnowledgeGraphEdgeParameter.prototype.type
  51661. * @description 标签,关系。
  51662. */
  51663. this.type = null;
  51664. /**
  51665. * @member {Object} KnowledgeGraphEdgeParameter.prototype.properties
  51666. * @description 实体属性。
  51667. */
  51668. this.properties = null;
  51669. this.CLASS_NAME = 'SuperMap.KnowledgeGraphEdgeParameter';
  51670. Util.extend(this, options);
  51671. }
  51672. destroy() {
  51673. var me = this;
  51674. me.id = null;
  51675. me.start = null;
  51676. me.end = null;
  51677. me.type = null;
  51678. me.properties = null;
  51679. }
  51680. }
  51681. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphService.js
  51682. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51683. * This program are made available under the terms of the Apache License, Version 2.0
  51684. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51685. /**
  51686. * @class KnowledgeGraphService
  51687. * @category iServer KnowledgeGraph
  51688. * @classdesc 知识图谱服务类
  51689. * @version 11.1.0
  51690. * @extends {ProcessingServiceBase}
  51691. * @param {string} url - 服务地址。
  51692. * @param {Object} options - 可选参数。
  51693. * @param {string} [options.proxy] - 服务代理地址。
  51694. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  51695. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  51696. * @param {Object} [options.headers] - 请求头。
  51697. * @usage
  51698. */
  51699. class KnowledgeGraphService_KnowledgeGraphService extends CommonServiceBase {
  51700. constructor(url, options) {
  51701. super(url, options);
  51702. this.options = options || {};
  51703. this.eventCount = 0;
  51704. this.CLASS_NAME = 'SuperMap.KnowledgeGraphService';
  51705. }
  51706. /**
  51707. * @function KnowledgeGraphService.prototype.destroy
  51708. * @override
  51709. */
  51710. destroy() {
  51711. super.destroy();
  51712. }
  51713. /**
  51714. * @function KnowledgeGraphService.prototype.query
  51715. * @description 通过查询语句查询知识图谱数据。
  51716. * @param {string} params - 查询条件。
  51717. * @param {RequestCallback} callback 回调函数。
  51718. */
  51719. query(params, callback) {
  51720. const paramKey = 'cypherQuery';
  51721. const url = Util_Util.urlAppend(this.url + '/query.json', `${paramKey}=${params}`);
  51722. this.processAsync({ url, method: 'GET', callback });
  51723. }
  51724. // /**
  51725. // * @function KnowledgeGraphService.prototype.queryById
  51726. // * @description 根据实体id查询关联节点。
  51727. // * @param {string} id - 实体id。
  51728. // * @param {RequestCallback} callback 回调函数。
  51729. // */
  51730. // queryById(id, callback) {
  51731. // const paramKey = 'cypherQuery';
  51732. // const url = Util.urlAppend(this.url + '/query.json', `${paramKey}=match p=(n)-[]-(m) where id(n)=${id} return p;`);
  51733. // this.processAsync({ url, method: 'GET', callback });
  51734. // }
  51735. // /**
  51736. // * @function KnowledgeGraphService.prototype.getMetaData
  51737. // * @description 获取元信息(展示所有实体类型和关系类型。)
  51738. // * @param {RequestCallback} callback 回调函数。
  51739. // */
  51740. // getMetaData(callback) {
  51741. // const url = this.url + 'management/metadata.json';
  51742. // this.processAsync({ url, method: 'GET', callback });
  51743. // }
  51744. /**
  51745. * @function KnowledgeGraphService.prototype.getGraphMaps
  51746. * @description 获取图谱列表
  51747. * @param {RequestCallback} callback 回调函数。
  51748. */
  51749. getGraphMaps(callback) {
  51750. const url = this.url + '/graphmaps.json';
  51751. this.processAsync({ url, method: 'GET', callback });
  51752. }
  51753. /**
  51754. * @function KnowledgeGraphService.prototype.getGraphMap
  51755. * @description 获取图谱图序列化数据
  51756. * @param {string} graphMapName 图谱名称
  51757. * @param {RequestCallback} callback 回调函数
  51758. */
  51759. getGraphMap(graphMapName, callback) {
  51760. const url = this.url + `/graphmaps/${graphMapName}.json`;
  51761. this.processAsync({ url, method: 'GET', callback });
  51762. }
  51763. /**
  51764. * @function KnowledgeGraphService.prototype.getGraphMapData
  51765. * @description 将iServer GraphMap服务的数据格式转换为KnowledgeGraph的数据格式。
  51766. * @param {string} graphMapName - 图谱名称
  51767. * @returns {Promise} Promise 对象。
  51768. */
  51769. async getGraphMapData(graphMapName) {
  51770. let data = [];
  51771. const graphMap = await this._getGraphMapData(graphMapName);
  51772. if (!graphMap) {
  51773. return;
  51774. }
  51775. const query = (graphMap.dataContent.queries && graphMap.dataContent.queries.query) || [];
  51776. let queries = [];
  51777. if (typeof query === 'string') {
  51778. queries = [query];
  51779. } else {
  51780. queries = query;
  51781. }
  51782. const expandQueries = this._getGraphMapExpandQuery(graphMap);
  51783. if (expandQueries.length) {
  51784. queries.push(...expandQueries);
  51785. }
  51786. for (let j = 0; j < queries.length; j++) {
  51787. const cypherQuery = queries[j];
  51788. const res = await this._queryDataBySql(cypherQuery);
  51789. data = data.concat([], res);
  51790. }
  51791. return { data, graphMap };
  51792. }
  51793. /**
  51794. * @private
  51795. * @function KnowledgeGraphService.prototype._getGraphMapExpandQuery
  51796. * @description 获取graphMap图谱展开节点的query条件
  51797. * @param {Object} graphMap -将iServer GraphMap图谱服务的数据
  51798. * @param {Array.<string>} 查询条件
  51799. */
  51800. _getGraphMapExpandQuery(graphMap) {
  51801. const queries = [];
  51802. const expandIds = (graphMap.dataContent.expand && JSON.parse(graphMap.dataContent.expand)) || [];
  51803. expandIds.forEach((id) => {
  51804. queries.push(`match p=(n)-[]-(m) where id(n)=${id} return p;`);
  51805. });
  51806. return queries;
  51807. }
  51808. // /**
  51809. // * @private
  51810. // * @function KnowledgeGraphService.prototype.getEntities
  51811. // * @description 获取实体。
  51812. // * @param {Object} params - 查询条件。{type:'院落', count:1}
  51813. // * @param {number} [params.count] - 返回个数
  51814. // * @param {RequestCallback} callback 回调函数
  51815. // */
  51816. // getEntities(params, callback) {
  51817. // const url = Util.urlAppend(this.url + '/entities.json', params);
  51818. // this.processAsync({ url, params, method: 'GET', callback });
  51819. // }
  51820. // /**
  51821. // * @private
  51822. // * @function KnowledgeGraphService.prototype.getEdges
  51823. // * @description 获取实体。
  51824. // * @param {Object} params - 查询条件。{type:'院落', count:1}
  51825. // * @param {number} [params.count] - 返回个数
  51826. // * @param {RequestCallback} callback 回调函数
  51827. // */
  51828. // getEdges(params, callback) {
  51829. // const url = Util.urlAppend(this.url + '/edges.json', params);
  51830. // this.processAsync({ url, params, method: 'GET', callback });
  51831. // }
  51832. // /**
  51833. // * @private
  51834. // * @function KnowledgeGraphService.prototype.getEntities
  51835. // * @description 获取实体。
  51836. // * @param {number} id - 查询条件。{type:'院落', count:1}
  51837. // * @param {RequestCallback} callback 回调函数
  51838. // */
  51839. // deleteEntitiy(id, callback) {
  51840. // const url = Util.urlAppend(this.url + '/entities.json', `id=${id}`);
  51841. // this.processAsync({ url, method: 'DELETE', callback });
  51842. // }
  51843. // /**
  51844. // * @private
  51845. // * @function KnowledgeGraphService.prototype.addNode
  51846. // * @description 获取实体。
  51847. // * @param {Object} params - 查询条件
  51848. // * @param {number} [params.count] - 返回个数
  51849. // * @param {RequestCallback} callback 回调函数
  51850. // */
  51851. // addNode(params, callback) {
  51852. // if (!(params instanceof KnowledgeGraphNodeParameter)) {
  51853. // return;
  51854. // }
  51855. // const url = Util.urlAppend(this.url + '/entities.json', params);
  51856. // this.processAsync({ url, params, method: 'PUT', callback });
  51857. // }
  51858. // /**
  51859. // * @private
  51860. // * @function KnowledgeGraphService.prototype.addEdge
  51861. // * @description 获取实体。
  51862. // * @param {Object} params - 查询条件
  51863. // * @param {number} [params.count] - 返回个数
  51864. // * @param {RequestCallback} callback 回调函数
  51865. // */
  51866. // addEdge(params, callback) {
  51867. // if (!(params instanceof KnowledgeGraphEdgeParameter)) {
  51868. // return;
  51869. // }
  51870. // const url = Util.urlAppend(this.url + '/edges.json', params);
  51871. // this.processAsync({ url, params, method: 'PUT', callback });
  51872. // }
  51873. /**
  51874. * @function KnowledgeGraphService.prototype.processAsync
  51875. * @description 负责将客户端的动态分段服务参数传递到服务端。
  51876. * @param {string} url - 服务地址
  51877. * @param {Object} params - 参数
  51878. */
  51879. processAsync({ url, params, method, callback }) {
  51880. let eventId = ++this.eventCount;
  51881. let eventListeners = {
  51882. scope: this,
  51883. processCompleted: function (result) {
  51884. if (eventId === result.result.eventId && callback) {
  51885. delete result.result.eventId;
  51886. callback(result);
  51887. this.events && this.events.un(eventListeners);
  51888. return false;
  51889. }
  51890. },
  51891. processFailed: function (result) {
  51892. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  51893. delete result.eventId;
  51894. callback(result);
  51895. this.events && this.events.un(eventListeners);
  51896. return false;
  51897. }
  51898. }
  51899. };
  51900. this.events.on(eventListeners);
  51901. const requestParams = {
  51902. method,
  51903. url,
  51904. scope: this,
  51905. success(result, options) {
  51906. result.eventId = eventId;
  51907. this.serviceProcessCompleted(result, options);
  51908. },
  51909. failure(result, options) {
  51910. result.eventId = eventId;
  51911. this.serviceProcessFailed(result, options);
  51912. }
  51913. };
  51914. if (params) {
  51915. requestParams.params = params;
  51916. }
  51917. this.request(requestParams);
  51918. }
  51919. /**
  51920. * @private
  51921. * @function _getGraphMapData
  51922. * @description 获取图谱信息
  51923. * @param {string} graphMapName - 图谱名称
  51924. * @returns {Promise} Promise 对象
  51925. */
  51926. _getGraphMapData(graphMapName) {
  51927. return new Promise((resolve, reject) => {
  51928. this.getGraphMap(graphMapName, (res) => {
  51929. if (res.type === 'processFailed') {
  51930. reject(res.error);
  51931. } else {
  51932. if (res.result.data === '') {
  51933. reject('无数据');
  51934. } else {
  51935. resolve(res.result.graphMap);
  51936. }
  51937. }
  51938. });
  51939. });
  51940. }
  51941. /**
  51942. * @private
  51943. * @function _queryDataBySql
  51944. * @description 查询实体和关系数据。
  51945. * @param {string} cypherQuery - 查询语句
  51946. * @returns {Promise} Promise 对象。
  51947. */
  51948. _queryDataBySql(cypherQuery) {
  51949. return new Promise((resolve, reject) => {
  51950. this.query(cypherQuery, (res) => {
  51951. if (res.type === 'processFailed') {
  51952. reject(res.error);
  51953. } else {
  51954. resolve(res.result);
  51955. }
  51956. });
  51957. });
  51958. }
  51959. }
  51960. ;// CONCATENATED MODULE: ./src/common/iServer/index.js
  51961. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51962. * This program are made available under the terms of the Apache License, Version 2.0
  51963. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51964. ;// CONCATENATED MODULE: ./src/common/online/OnlineResources.js
  51965. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51966. * This program are made available under the terms of the Apache License, Version 2.0
  51967. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51968. /**
  51969. * @enum ServiceStatus
  51970. * @category BaseTypes Constant
  51971. * @description 服务发布状态。
  51972. * @usage
  51973. * ```
  51974. * // 浏览器
  51975. * <script type="text/javascript" src="{cdn}"></script>
  51976. * <script>
  51977. * const result = {namespace}.ServiceStatus.DOES_NOT_INVOLVE;
  51978. *
  51979. * </script>
  51980. * // ES6 Import
  51981. * import { ServiceStatus } from '{npm}';
  51982. *
  51983. * const result = ServiceStatus.DOES_NOT_INVOLVE;
  51984. * ```
  51985. */
  51986. var ServiceStatus = {
  51987. /** 不涉及,不可发布。 */
  51988. DOES_NOT_INVOLVE: "DOES_NOT_INVOLVE",
  51989. /** 发布失败。 */
  51990. PUBLISH_FAILED: "PUBLISH_FAILED",
  51991. /** 已发布。 */
  51992. PUBLISHED: "PUBLISHED",
  51993. /** 正在发布。 */
  51994. PUBLISHING: "PUBLISHING",
  51995. /** 未发布。 */
  51996. UNPUBLISHED: "UNPUBLISHED",
  51997. /** 取消服务失败。 */
  51998. UNPUBLISHED_FAILED: "UNPUBLISHED_FAILED"
  51999. };
  52000. /**
  52001. * @enum DataItemOrderBy
  52002. * @category BaseTypes Constant
  52003. * @description 数据排序字段。
  52004. * @usage
  52005. * ```
  52006. * // 浏览器
  52007. * <script type="text/javascript" src="{cdn}"></script>
  52008. * <script>
  52009. * const result = {namespace}.DataItemOrderBy.FILENAME;
  52010. *
  52011. * </script>
  52012. * // ES6 Import
  52013. * import { DataItemOrderBy } from '{npm}';
  52014. *
  52015. * const result = DataItemOrderBy.FILENAME;
  52016. * ```
  52017. */
  52018. var DataItemOrderBy = {
  52019. /** 文件名。 */
  52020. FILENAME: "FILENAME",
  52021. /** ID。 */
  52022. ID: "ID",
  52023. /** 最后修改时间。 */
  52024. LASTMODIFIEDTIME: "LASTMODIFIEDTIME",
  52025. /** 作者昵称。 */
  52026. NICKNAME: "NICKNAME",
  52027. /** SERVICESTATUS。 */
  52028. SERVICESTATUS: "SERVICESTATUS",
  52029. /** 大小。 */
  52030. SIZE: "SIZE",
  52031. /** 状态。 */
  52032. STATUS: "STATUS",
  52033. /** 类型。 */
  52034. TYPE: "TYPE",
  52035. /** 更新时间。 */
  52036. UPDATETIME: "UPDATETIME",
  52037. /** 作者名。 */
  52038. USERNAME: "USERNAME"
  52039. };
  52040. /**
  52041. * @enum FilterField {number}
  52042. * @category BaseTypes Constant
  52043. * @description 关键字查询时的过滤字段。
  52044. * @usage
  52045. * ```
  52046. * // 浏览器
  52047. * <script type="text/javascript" src="{cdn}"></script>
  52048. * <script>
  52049. * const result = {namespace}.FilterField.LINKPAGE;
  52050. *
  52051. * </script>
  52052. * // ES6 Import
  52053. * import { FilterField } from '{npm}';
  52054. *
  52055. * const result = FilterField.LINKPAGE;
  52056. * ```
  52057. */
  52058. var FilterField = {
  52059. /** 服务地址。 */
  52060. LINKPAGE: "LINKPAGE",
  52061. /** 服务中包含的地图的名称。 */
  52062. MAPTITLE: "MAPTITLE",
  52063. /** 服务创建者昵称。 */
  52064. NICKNAME: "NICKNAME",
  52065. /** 服务名称。 */
  52066. RESTITLE: "RESTITLE",
  52067. /** 服务创建者用户名。 */
  52068. USERNAME: "USERNAME"
  52069. };
  52070. ;// CONCATENATED MODULE: ./src/common/online/OnlineServiceBase.js
  52071. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52072. * This program are made available under the terms of the Apache License, Version 2.0
  52073. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52074. /**
  52075. * @class OnlineServiceBase
  52076. * @deprecatedclass SuperMap.OnlineServiceBase
  52077. * @classdesc Online 服务基类(使用 key 作为权限限制的类需要实现此类)。
  52078. * @category iPortal/Online Core
  52079. * @param {Object} options - 可选参数。
  52080. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  52081. * @param {Object} [options.headers] - 请求头。
  52082. * @usage
  52083. */
  52084. class OnlineServiceBase {
  52085. constructor(options) {
  52086. options = options || {};
  52087. Util_Util.extend(this, options);
  52088. this.CLASS_NAME = "SuperMap.OnlineServiceBase";
  52089. }
  52090. /**
  52091. * @function OnlineServiceBase.prototype.request
  52092. * @description 请求 online 服务
  52093. * @param {string} [method='GET'] - 请求方式, 'GET', 'PUT', 'POST', 'DELETE'。
  52094. * @param {string} url - 服务地址。
  52095. * @param {Object} param - URL 查询参数。
  52096. * @param {Object} [requestOptions] - http 请求参数, 比如请求头,超时时间等。
  52097. * @returns {Promise} 包含请求结果的 Promise 对象。
  52098. */
  52099. request(method, url, param, requestOptions = {}) {
  52100. url = SecurityManager.appendCredential(url);
  52101. requestOptions['crossOrigin'] = this.options.crossOrigin;
  52102. requestOptions['headers'] = this.options.headers;
  52103. return FetchRequest.commit(method, url, param, requestOptions).then(function(response) {
  52104. return response.json();
  52105. });
  52106. }
  52107. }
  52108. ;// CONCATENATED MODULE: ./src/common/online/OnlineData.js
  52109. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52110. * This program are made available under the terms of the Apache License, Version 2.0
  52111. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52112. /**
  52113. * @class OnlineData
  52114. * @deprecatedclass SuperMap.OnlineData
  52115. * @classdesc Online myData 服务。
  52116. * @category iPortal/Online Resources Data
  52117. * @param {string} serviceRootUrl - 服务地址。
  52118. * @param {Object} options - 可选参数。
  52119. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  52120. * @param {Object} [options.headers] - 请求头。
  52121. * @usage
  52122. * @extends OnlineServiceBase
  52123. */
  52124. class OnlineData extends OnlineServiceBase {
  52125. //TODO 目前并没有对接服务支持的所有操作,日后需要补充完整
  52126. constructor(serviceRootUrl, options) {
  52127. super(serviceRootUrl);
  52128. options = options || {};
  52129. //MD5
  52130. this.MD5 = null;
  52131. //文件类型。
  52132. this.type = null;
  52133. //数据上传者名称。
  52134. this.userName = null;
  52135. //文件名称。
  52136. this.fileName = null;
  52137. //文件大小,单位为 B 。
  52138. this.size = null;
  52139. //服务发布状态。
  52140. this.serviceStatus = null;
  52141. //服务 id 。
  52142. this.serviceId = null;
  52143. //数据项 id 。
  52144. this.id = null;
  52145. //最后修改时间。
  52146. this.lastModfiedTime = null;
  52147. //文件状态。
  52148. this.status = null;
  52149. //数据文件存储 id 。
  52150. this.storageId = null;
  52151. //数据的发布信息。
  52152. this.publishInfo = null;
  52153. //数据的权限信息。
  52154. this.authorizeSetting = null;
  52155. //用户的昵称。
  52156. this.nickname = null;
  52157. //数据的标签。
  52158. this.tags = [];
  52159. //数据的描述信息。
  52160. this.description = null;
  52161. //数据发布的服务信息集合。
  52162. this.dataItemServices = null;
  52163. //数据坐标类型。
  52164. this.coordType = null;
  52165. //数据审核信息
  52166. this.dataCheckResult = null;
  52167. //数据元数据信息
  52168. this.dataMetaInfo = null;
  52169. //数据的缩略图路径。
  52170. this.thumbnail = null;
  52171. Util_Util.extend(this, options);
  52172. if (this.id) {
  52173. this.serviceUrl = serviceRootUrl + "/" + this.id;
  52174. }
  52175. this.CLASS_NAME = "SuperMap.OnlineData";
  52176. }
  52177. /**
  52178. * @function OnlineData.prototype.load
  52179. * @description 通过 URL 请求获取该服务完整信息。
  52180. * @returns {Promise} 不包含请求结果的 Promise 对象,请求返回结果自动填充到该类属性中。
  52181. */
  52182. load() {
  52183. if (!this.serviceUrl) {
  52184. return;
  52185. }
  52186. var me = this;
  52187. return me.request("GET", this.serviceUrl).then(function (result) {
  52188. Util_Util.extend(me, result);
  52189. });
  52190. }
  52191. /**
  52192. * @function OnlineData.prototype.getPublishedServices
  52193. * @description 获取数据发布的所有服务。
  52194. * @returns {Object} 数据发布的所有服务。
  52195. */
  52196. getPublishedServices() {
  52197. return this.dataItemServices;
  52198. }
  52199. /**
  52200. * @function OnlineData.prototype.getAuthorizeSetting
  52201. * @description 获取数据的权限信息。
  52202. * @returns {Object} 权限信息。
  52203. */
  52204. getAuthorizeSetting() {
  52205. return this.authorizeSetting;
  52206. }
  52207. }
  52208. ;// CONCATENATED MODULE: ./src/common/online/Online.js
  52209. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52210. * This program are made available under the terms of the Apache License, Version 2.0
  52211. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52212. /**
  52213. * @class Online
  52214. * @deprecatedclass SuperMap.Online
  52215. * @classdesc 对接 SuperMap Online 所有基础服务。
  52216. * @category iPortal/Online Resources
  52217. * @modulecategory Services
  52218. * @example
  52219. * var online=new Online();
  52220. * var services = online.queryDatas(param);
  52221. * service.then(function(services){
  52222. * var service= services[0];
  52223. * service.updateDataInfo();
  52224. * })
  52225. * @usage
  52226. */
  52227. class Online {
  52228. //TODO 目前并没有对接Online的所有操作,需要补充完整
  52229. //所有查询返回的是一个Promise,在外部使用的时候通过Promise的then方法获取异步结果
  52230. constructor() {
  52231. this.rootUrl = "https://www.supermapol.com";
  52232. this.webUrl = this.rootUrl + "/web";
  52233. var mContentUrl = this.webUrl + "/mycontent";
  52234. this.mDatasUrl = mContentUrl + "/datas";
  52235. this.CLASS_NAME = "SuperMap.Online";
  52236. }
  52237. /**
  52238. * @function Online.prototype.load
  52239. * @description 加载 online,验证 online 是否可用。
  52240. * @returns {Promise} 包含网络请求结果的 Promise 对象。
  52241. */
  52242. load() {
  52243. return FetchRequest.get(this.rootUrl).then(function (response) {
  52244. return response;
  52245. });
  52246. }
  52247. /**
  52248. * @function Online.prototype.login
  52249. * @description 登录Online
  52250. */
  52251. login() {
  52252. SecurityManager.loginOnline(this.rootUrl, true);
  52253. }
  52254. /**
  52255. * @function Online.prototype.queryDatas
  52256. * @description 查询 Online “我的内容” 下 “我的数据” 服务(需要登录状态获取),并返回可操作的服务对象。
  52257. * @param {OnlineQueryDatasParameter} parameter - myDatas 服务资源查询参数。
  52258. * @returns {Promise} 包含所有数据服务信息的 Promise 对象。
  52259. */
  52260. queryDatas(parameter) {
  52261. var me = this, url = me.mDatasUrl;
  52262. if (parameter) {
  52263. parameter = parameter.toJSON();
  52264. }
  52265. return FetchRequest.get(url, parameter).then(function (json) {
  52266. if (!json || !json.content || json.content.length < 1) {
  52267. return;
  52268. }
  52269. var services = [], contents = json.content, len = contents.length;
  52270. for (var i = 0; i < len; i++) {
  52271. var content = contents[i];
  52272. var service = new OnlineData(me.mDatasUrl, content);
  52273. services.push(service);
  52274. }
  52275. return services;
  52276. });
  52277. }
  52278. }
  52279. ;// CONCATENATED MODULE: ./src/common/online/OnlineQueryDatasParameter.js
  52280. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52281. * This program are made available under the terms of the Apache License, Version 2.0
  52282. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52283. /**
  52284. * @class OnlineQueryDatasParameter
  52285. * @deprecatedclass SuperMap.OnlineQueryDatasParameter
  52286. * @classdesc myDatas 服务资源查询参数。
  52287. * @category iPortal/Online Resources Data
  52288. * @param {Object} options - 参数。
  52289. * @usage
  52290. */
  52291. class OnlineQueryDatasParameter {
  52292. constructor(options) {
  52293. options = options || {};
  52294. /**
  52295. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.userNames
  52296. * @description 数据作者名。可以根据数据作者名查询,默认查询全部。
  52297. */
  52298. this.userNames = null;
  52299. /**
  52300. * @member {Array.<Object>} OnlineQueryDatasParameter.prototype.types
  52301. * @description 数据类型。
  52302. */
  52303. this.types = null;
  52304. /**
  52305. * @member {string} OnlineQueryDatasParameter.prototype.fileName
  52306. * @description 文件名称。
  52307. */
  52308. this.fileName = null;
  52309. /**
  52310. * @member {string} OnlineQueryDatasParameter.prototype.serviceStatuses
  52311. * @description 服务发布状态。
  52312. */
  52313. this.serviceStatuses = null;
  52314. /**
  52315. * @member {string} OnlineQueryDatasParameter.prototype.serviceId
  52316. * @description 服务 ID。
  52317. */
  52318. this.serviceId = null;
  52319. /**
  52320. * @member {Array.<number>} OnlineQueryDatasParameter.prototype.ids
  52321. * @description 由数据项 ID 组成的整型数组。
  52322. */
  52323. this.ids = null;
  52324. /**
  52325. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.keywords
  52326. * @description 关键字。
  52327. */
  52328. this.keywords = null;
  52329. /**
  52330. * @member {string} OnlineQueryDatasParameter.prototype.orderBy
  52331. * @description 排序字段。
  52332. */
  52333. this.orderBy = null;
  52334. /**
  52335. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.tags
  52336. * @description 数据的标签。
  52337. */
  52338. this.tags = null;
  52339. /**
  52340. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.filterFields
  52341. * @description 用于关键字查询时的过滤字段。
  52342. */
  52343. this.filterFields = null;
  52344. Util_Util.extend(this, options)
  52345. this.CLASS_NAME = "SuperMap.OnlineQueryDatasParameter";
  52346. }
  52347. /**
  52348. * @function OnlineQueryDatasParameter.prototype.toJSON
  52349. * @description 返回对应的 JSON 对象。
  52350. * @returns {Object} 对应的 JSON 对象。
  52351. */
  52352. toJSON() {
  52353. var me = this;
  52354. var jsonObj = {
  52355. "types": me.types,
  52356. "fileName": me.fileName,
  52357. "serviceStatuses": me.serviceStatuses,
  52358. "serviceId": me.serviceId,
  52359. "ids": me.ids,
  52360. "keywords": me.keywords,
  52361. "orderBy": me.orderBy,
  52362. "tags": me.tags,
  52363. "filterFields": me.filterFields
  52364. };
  52365. for (var key in jsonObj) {
  52366. if (jsonObj[key] == null) {
  52367. delete jsonObj[key]
  52368. }
  52369. }
  52370. return jsonObj;
  52371. }
  52372. }
  52373. ;// CONCATENATED MODULE: ./src/common/online/index.js
  52374. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52375. * This program are made available under the terms of the Apache License, Version 2.0
  52376. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52377. ;// CONCATENATED MODULE: ./src/common/security/KeyServiceParameter.js
  52378. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52379. * This program are made available under the terms of the Apache License, Version 2.0
  52380. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52381. /**
  52382. * @class KeyServiceParameter
  52383. * @deprecatedclass SuperMap.KeyServiceParameter
  52384. * @classdesc key申请参数
  52385. * @category Security
  52386. * @param {Object} options - 参数。
  52387. * @param {string} options.name - 申请服务名称。
  52388. * @param {number} options.serviceIds - 服务 ID。
  52389. * @param {ClientType} [options.clientType=ClientType.SERVER] - 服务端类型。
  52390. * @param {number} options.limitation - 有效期
  52391. * @usage
  52392. */
  52393. class KeyServiceParameter {
  52394. constructor(options) {
  52395. this.name = null;
  52396. this.serviceIds = null;
  52397. this.clientType = ClientType.SERVER;
  52398. this.limitation = null;
  52399. Util_Util.extend(this, options);
  52400. this.CLASS_NAME = "SuperMap.KeyServiceParameter";
  52401. }
  52402. /**
  52403. * @function KeyServiceParameter.prototype.toJSON
  52404. * @description 转换成 JSON 对象
  52405. * @returns {Object} 参数的 JSON 对象
  52406. */
  52407. toJSON() {
  52408. return {
  52409. name: this.name,
  52410. serviceIds: this.serviceIds,
  52411. clientType: this.clientType,
  52412. limitation: this.limitation
  52413. }
  52414. }
  52415. }
  52416. ;// CONCATENATED MODULE: ./src/common/security/ServerInfo.js
  52417. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52418. * This program are made available under the terms of the Apache License, Version 2.0
  52419. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52420. /**
  52421. * @class ServerInfo
  52422. * @deprecatedclass SuperMap.ServerInfo
  52423. * @classdesc 服务器信息(安全相关),包含服务器类型,服务地址,token服务地址等。
  52424. * @category Security
  52425. * @param {string} type - 服务器类型。
  52426. * @param {Object} options - 参数。
  52427. * @param {string} options.server - 服务器地址,如:http://supermapiserver:8090/iserver。
  52428. * @param {string} [options.tokenServiceUrl] - 如:http://supermapiserver:8090/iserver/services/security/tokens.json。
  52429. * @param {string} [options.keyServiceUrl] - 如:http://supermapiserver:8092/web/mycontent/keys/register.json。
  52430. * @usage
  52431. */
  52432. class ServerInfo {
  52433. constructor(type, options) {
  52434. /**
  52435. * @member {ServerType} ServerInfo.prototype.type
  52436. * @description 服务器类型。
  52437. */
  52438. this.type = type;
  52439. /**
  52440. * @member {string} ServerInfo.prototype.server
  52441. * @description 服务器地址。
  52442. */
  52443. this.server = null;
  52444. /**
  52445. * @member {string} [ServerInfo.prototype.tokenServiceUrl]
  52446. * @description 如:http://supermapiserver:8090/iserver/services/security/tokens.json。
  52447. */
  52448. this.tokenServiceUrl = null;
  52449. /**
  52450. * @member {string} [ServerInfo.prototype.keyServiceUrl]
  52451. * @description 如:http://supermapiserver:8092/web/mycontent/keys/register.json。
  52452. */
  52453. this.keyServiceUrl = null;
  52454. Util_Util.extend(this, options);
  52455. this.CLASS_NAME = "SuperMap.ServerInfo";
  52456. this.type = this.type || ServerType.ISERVER;
  52457. if (!this.server) {
  52458. console.error('server url require is not undefined')
  52459. }
  52460. // var patten = /http:\/\/([^\/]+)/i;
  52461. //this.server = this.server.match(patten)[0];
  52462. var tokenServiceSuffix = "/services/security/tokens";
  52463. if (this.type === ServerType.ISERVER && this.server.indexOf("iserver") < 0) {
  52464. tokenServiceSuffix = "/iserver" + tokenServiceSuffix;
  52465. }
  52466. if (!this.tokenServiceUrl) {
  52467. this.tokenServiceUrl = Util_Util.urlPathAppend(this.server, tokenServiceSuffix);
  52468. }
  52469. if (!this.keyServiceUrl) {
  52470. if (this.type === ServerType.IPORTAL) {
  52471. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys/register");
  52472. } else if (this.type === ServerType.ONLINE) {
  52473. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys");
  52474. }
  52475. }
  52476. }
  52477. }
  52478. ;// CONCATENATED MODULE: ./src/common/security/TokenServiceParameter.js
  52479. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52480. * This program are made available under the terms of the Apache License, Version 2.0
  52481. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52482. /**
  52483. * @class TokenServiceParameter
  52484. * @deprecatedclass SuperMap.TokenServiceParameter
  52485. * @classdesc token 申请参数。
  52486. * @category Security
  52487. * @param {Object} options - 参数。
  52488. * @param {string} options.username - 用户名。
  52489. * @param {string} options.password - 密码。
  52490. * @param {ClientType} [options.clientType='ClientType.NONE'] - token 申请的客户端标识类型。
  52491. * @param {string} [options.ip] - clientType=IP 时,此为必选参数。
  52492. * @param {string} [options.referer] -clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  52493. * @param {number} [options.expiration=60] - 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  52494. * @usage
  52495. *
  52496. */
  52497. class TokenServiceParameter {
  52498. constructor(options) {
  52499. /**
  52500. * @member {string} TokenServiceParameter.prototype.userName
  52501. * @description 用户名。
  52502. */
  52503. this.userName = null;
  52504. /**
  52505. * @member {string} TokenServiceParameter.prototype.password
  52506. * @description 密码。
  52507. */
  52508. this.password = null;
  52509. /**
  52510. * @member {ClientType} TokenServiceParameter.prototype.clientType
  52511. * @description token 申请的客户端标识类型。
  52512. */
  52513. this.clientType = ClientType.NONE;
  52514. /**
  52515. * @member {string} [TokenServiceParameter.prototype.ip]
  52516. * @description clientType=IP 时,此为必选参数。
  52517. */
  52518. this.ip = null;
  52519. /**
  52520. * @member {string} [TokenServiceParameter.prototype.referer]
  52521. * @description clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  52522. */
  52523. this.referer = null;
  52524. /**
  52525. * @member {number} TokenServiceParameter.prototype.expiration
  52526. * @description 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  52527. */
  52528. this.expiration = 60;
  52529. Util_Util.extend(this, options);
  52530. this.CLASS_NAME = "SuperMap.TokenServiceParameter";
  52531. }
  52532. /**
  52533. * @function TokenServiceParameter.prototype.toJSON
  52534. * @description 将所有信息转成 JSON 字符串。
  52535. * @returns {string} 参数的 JSON 字符串。
  52536. */
  52537. toJSON() {
  52538. return {
  52539. userName: this.userName,
  52540. password: this.password,
  52541. clientType: this.clientType,
  52542. ip: this.ip,
  52543. referer: this.referer,
  52544. expiration: this.expiration
  52545. }
  52546. }
  52547. }
  52548. ;// CONCATENATED MODULE: ./src/common/security/index.js
  52549. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52550. * This program are made available under the terms of the Apache License, Version 2.0
  52551. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52552. ;// CONCATENATED MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  52553. const external_function_try_return_elasticsearch_catch_e_return_namespaceObject = function(){try{return elasticsearch}catch(e){return {}}}();
  52554. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_namespaceObject);
  52555. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  52556. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52557. * This program are made available under the terms of the Apache License, Version 2.0
  52558. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52559. /**
  52560. * @class ElasticSearch
  52561. * @deprecatedclass SuperMap.ElasticSearch
  52562. * @classdesc ElasticSearch服务类。
  52563. * @category ElasticSearch
  52564. * @modulecategory Services
  52565. * @param {string} url - ElasticSearch服务地址。
  52566. * @param {Object} options - 参数。
  52567. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  52568. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  52569. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  52570. * @param {Object} [options.geoFence] - 地理围栏。
  52571. * @description
  52572. * <h3 style="font-size: 20px;margin-top: 20px;margin-bottom: 10px;">11.1.0</h3>
  52573. * 该功能依赖<a href="https://github.com/elastic/elasticsearch">@elastic/elasticsearch</a>, webpack5或其他不包含Node.js Polyfills的打包工具,需要加入相关配置,以webpack为例:<br/>
  52574. <p style="margin-top:10px;">首先安装相关Polyfills</p><pre><code>npm i stream-http https-browserify stream-browserify tty-browserify browserify-zlib os-browserify buffer url assert process -D</code></pre>
  52575. 然后配置webpack<pre><code>module.exports: {
  52576. resolve: {
  52577. alias: {
  52578. process: 'process/browser',
  52579. },
  52580. mainFields: ['browser', 'main'],
  52581. fallback: {
  52582. fs: false,
  52583. http: require.resolve('stream-http'),
  52584. https: require.resolve('https-browserify'),
  52585. os: require.resolve('os-browserify/browser'),
  52586. stream: require.resolve('stream-browserify'),
  52587. tty: require.resolve('tty-browserify'),
  52588. zlib: require.resolve('browserify-zlib')
  52589. }
  52590. }
  52591. plugins: [
  52592. new webpack.ProvidePlugin({
  52593. process: 'process/browser',
  52594. Buffer: ['buffer', 'Buffer']
  52595. }),
  52596. ]
  52597. }</code></pre>
  52598. * @usage
  52599. */
  52600. class ElasticSearch {
  52601. constructor(url, options) {
  52602. options = options || {};
  52603. /**
  52604. * @member {string} ElasticSearch.prototype.url
  52605. * @description ElasticSearch服务地址。
  52606. */
  52607. this.url = url;
  52608. /**
  52609. * @member {Object} ElasticSearch.prototype.client
  52610. * @description client ES客户端。
  52611. */
  52612. try {
  52613. // 老版本
  52614. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  52615. host: this.url
  52616. });
  52617. } catch (e) {
  52618. // 新版本
  52619. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  52620. node: {
  52621. url: new URL(this.url)
  52622. }
  52623. });
  52624. }
  52625. /**
  52626. * @deprecated
  52627. * @member {function} [ElasticSearch.prototype.change]
  52628. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  52629. */
  52630. this.change = null;
  52631. /**
  52632. * @member {boolean} [ElasticSearch.prototype.openGeoFence=false]
  52633. * @description 是否开启地理围栏验证,默认为不开启。
  52634. */
  52635. this.openGeoFence = false;
  52636. /**
  52637. * @member {function} [ElasticSearch.prototype.outOfGeoFence]
  52638. * @description 数据超出地理围栏后执行的函数。
  52639. */
  52640. this.outOfGeoFence = null;
  52641. /**
  52642. * @member {Object} [ElasticSearch.prototype.geoFence]
  52643. * @description 地理围栏。
  52644. * @example {
  52645. * radius: 1000,//单位是m
  52646. * center: [104.40, 30.43],
  52647. * unit: 'meter|degree'
  52648. * }
  52649. */
  52650. this.geoFence = null;
  52651. /*
  52652. * Constant: EVENT_TYPES
  52653. * {Array.<String>}
  52654. * 此类支持的事件类型。
  52655. *
  52656. */
  52657. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  52658. /**
  52659. * @member {Events} ElasticSearch.prototype.events
  52660. * @description 事件。
  52661. */
  52662. this.events = new Events(this, null, this.EVENT_TYPES);
  52663. /**
  52664. * @member {Object} ElasticSearch.prototype.eventListeners
  52665. * @description 监听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  52666. * 相当于调用 Events.on(eventListeners)。
  52667. */
  52668. this.eventListeners = null;
  52669. Util_Util.extend(this, options);
  52670. if (this.eventListeners instanceof Object) {
  52671. this.events.on(this.eventListeners);
  52672. }
  52673. }
  52674. /**
  52675. * @function ElasticSearch.prototype.setGeoFence
  52676. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  52677. * @param {Geometry} geoFence - 地理围栏。
  52678. */
  52679. setGeoFence(geoFence) {
  52680. this.geoFence = geoFence;
  52681. }
  52682. /**
  52683. * @function ElasticSearch.prototype.bulk
  52684. * @description 批量操作API,允许执行多个索引/删除操作。
  52685. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  52686. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  52687. * @param {Object} params - 参数。
  52688. * @param {function} callback - 回调函数。
  52689. */
  52690. bulk(params, callback) {
  52691. return this.client.bulk(params, this._handleCallback(callback));
  52692. }
  52693. /**
  52694. * @function ElasticSearch.prototype.clearScroll
  52695. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  52696. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  52697. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  52698. * @param {Object} params - 参数。
  52699. * @param {function} callback - 回调函数。
  52700. */
  52701. clearScroll(params, callback) {
  52702. return this.client.clearScroll(params, this._handleCallback(callback));
  52703. }
  52704. /**
  52705. * @function ElasticSearch.prototype.count
  52706. * @description 获取集群、索引、类型或查询的文档个数。
  52707. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  52708. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  52709. * @param {Object} params - 参数。
  52710. * @param {function} callback - 回调函数。
  52711. */
  52712. count(params, callback) {
  52713. return this.client.count(params, this._handleCallback(callback));
  52714. }
  52715. /**
  52716. * @function ElasticSearch.prototype.create
  52717. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且ID已经存在的文档将发生错误。</br>
  52718. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  52719. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  52720. * @param {Object} params - 参数。
  52721. * @param {function} callback - 回调函数。
  52722. */
  52723. create(params, callback) {
  52724. return this.client.create(params, this._handleCallback(callback));
  52725. }
  52726. /**
  52727. * @function ElasticSearch.prototype.delete
  52728. * @description 根据其ID从特定索引中删除键入的JSON文档。
  52729. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  52730. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  52731. * @param {Object} params - 参数。
  52732. * @param {function} callback - 回调函数。
  52733. */
  52734. delete(params, callback) {
  52735. return this.client.delete(params, this._handleCallback(callback));
  52736. }
  52737. /**
  52738. * @function ElasticSearch.prototype.deleteByQuery
  52739. * @description 根据其ID从特定索引中删除键入的JSON文档。
  52740. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  52741. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  52742. * @param {Object} params - 参数。
  52743. * @param {function} callback - 回调函数。
  52744. */
  52745. deleteByQuery(params, callback) {
  52746. return this.client.deleteByQuery(params, this._handleCallback(callback));
  52747. }
  52748. /**
  52749. * @function ElasticSearch.prototype.deleteScript
  52750. * @description 根据其ID删除脚本。</br>
  52751. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  52752. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  52753. * @param {Object} params - 参数。
  52754. * @param {function} callback - 回调函数。
  52755. */
  52756. deleteScript(params, callback) {
  52757. return this.client.deleteScript(params, this._handleCallback(callback));
  52758. }
  52759. /**
  52760. * @function ElasticSearch.prototype.deleteTemplate
  52761. * @description 根据其ID删除模板。</br>
  52762. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  52763. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  52764. * @param {Object} params - 参数。
  52765. * @param {function} callback - 回调函数。
  52766. */
  52767. deleteTemplate(params, callback) {
  52768. return this.client.deleteTemplate(params, this._handleCallback(callback));
  52769. }
  52770. /**
  52771. * @function ElasticSearch.prototype.exists
  52772. * @description 检查给定文档是否存在。</br>
  52773. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  52774. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  52775. * @param {Object} params - 参数。
  52776. * @param {function} callback - 回调函数。
  52777. */
  52778. exists(params, callback) {
  52779. return this.client.exists(params, this._handleCallback(callback));
  52780. }
  52781. /**
  52782. * @function ElasticSearch.prototype.existsSource
  52783. * @description 检查资源是否存在。</br>
  52784. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  52785. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  52786. * @param {Object} params - 参数。
  52787. * @param {function} callback - 回调函数。
  52788. */
  52789. existsSource(params, callback) {
  52790. return this.client.existsSource(params, this._handleCallback(callback));
  52791. }
  52792. /**
  52793. * @function ElasticSearch.prototype.explain
  52794. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  52795. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  52796. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  52797. * @param {Object} params - 参数。
  52798. * @param {function} callback - 回调函数。
  52799. */
  52800. explain(params, callback) {
  52801. return this.client.explain(params, this._handleCallback(callback));
  52802. }
  52803. /**
  52804. * @function ElasticSearch.prototype.fieldCaps
  52805. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  52806. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  52807. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  52808. * @param {Object} params - 参数。
  52809. * @param {function} callback - 回调函数。
  52810. */
  52811. fieldCaps(params, callback) {
  52812. return this.client.fieldCaps(params, this._handleCallback(callback));
  52813. }
  52814. /**
  52815. * @function ElasticSearch.prototype.get
  52816. * @description 从索引获取一个基于其ID的类型的JSON文档。</br>
  52817. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  52818. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  52819. * @param {Object} params - 参数。
  52820. * @param {function} callback - 回调函数。
  52821. */
  52822. get(params, callback) {
  52823. return this.client.get(params, this._handleCallback(callback));
  52824. }
  52825. /**
  52826. * @function ElasticSearch.prototype.getScript
  52827. * @description 获取脚本。</br>
  52828. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  52829. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  52830. * @param {Object} params - 参数。
  52831. * @param {function} callback - 回调函数。
  52832. */
  52833. getScript(params, callback) {
  52834. return this.client.getScript(params, this._handleCallback(callback));
  52835. }
  52836. /**
  52837. * @function ElasticSearch.prototype.getSource
  52838. * @description 通过索引,类型和ID获取文档的源。</br>
  52839. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  52840. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  52841. * @param {Object} params - 参数。
  52842. * @param {function} callback - 回调函数。
  52843. */
  52844. getSource(params, callback) {
  52845. return this.client.getSource(params, this._handleCallback(callback));
  52846. }
  52847. /**
  52848. * @function ElasticSearch.prototype.getTemplate
  52849. * @description 获取模板。</br>
  52850. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  52851. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  52852. * @param {Object} params - 参数。
  52853. * @param {function} callback - 回调函数。
  52854. */
  52855. getTemplate(params, callback) {
  52856. return this.client.getTemplate(params, this._handleCallback(callback));
  52857. }
  52858. /**
  52859. * @function ElasticSearch.prototype.index
  52860. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  52861. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  52862. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  52863. * @param {Object} params - 参数。
  52864. * @param {function} callback - 回调函数。
  52865. */
  52866. index(params, callback) {
  52867. return this.client.index(params, this._handleCallback(callback));
  52868. }
  52869. /**
  52870. * @function ElasticSearch.prototype.info
  52871. * @description 从当前集群获取基本信息。</br>
  52872. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  52873. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  52874. * @param {Object} params - 参数。
  52875. * @param {function} callback - 回调函数。
  52876. */
  52877. info(params, callback) {
  52878. return this.client.info(params, this._handleCallback(callback));
  52879. }
  52880. /**
  52881. * @function ElasticSearch.prototype.mget
  52882. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  52883. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  52884. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  52885. * @param {Object} params - 参数。
  52886. * @param {function} callback - 回调函数。
  52887. */
  52888. mget(params, callback) {
  52889. return this.client.mget(params, this._handleCallback(callback));
  52890. }
  52891. /**
  52892. * @function ElasticSearch.prototype.msearch
  52893. * @description 在同一请求中执行多个搜索请求。</br>
  52894. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  52895. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  52896. * @param {Object} params - 参数。
  52897. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  52898. * 回调参数:error,response,结果存储在response.responses中。
  52899. */
  52900. msearch(params, callback) {
  52901. let me = this;
  52902. return me.client.msearch(params)
  52903. .then(function (resp) {
  52904. resp = resp.body || resp;
  52905. me._update(resp.responses, callback);
  52906. return resp;
  52907. }, function (err) {
  52908. callback(err);
  52909. me.events.triggerEvent('error', {error: err});
  52910. return err;
  52911. });
  52912. }
  52913. /**
  52914. * @function ElasticSearch.prototype.msearchTemplate
  52915. * @description 在同一请求中执行多个搜索模板请求。</br>
  52916. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  52917. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  52918. * @param {Object} params - 参数。
  52919. * @param {function} callback - 回调函数。
  52920. */
  52921. msearchTemplate(params, callback) {
  52922. return this.client.msearchTemplate(params, this._handleCallback(callback));
  52923. }
  52924. /**
  52925. * @function ElasticSearch.prototype.mtermvectors
  52926. * @description 多termvectors API允许一次获得多个termvectors。</br>
  52927. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  52928. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  52929. * @param {Object} params - 参数。
  52930. * @param {function} callback - 回调函数。
  52931. */
  52932. mtermvectors(params, callback) {
  52933. return this.client.mtermvectors(params, this._handleCallback(callback));
  52934. }
  52935. /**
  52936. * @function ElasticSearch.prototype.ping
  52937. * @description 测试连接。</br>
  52938. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  52939. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  52940. * @param {Object} params - 参数。
  52941. * @param {function} callback - 回调函数。
  52942. */
  52943. ping(params, callback) {
  52944. return this.client.ping(params, this._handleCallback(callback));
  52945. }
  52946. /**
  52947. * @function ElasticSearch.prototype.putScript
  52948. * @description 添加脚本。</br>
  52949. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  52950. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  52951. * @param {Object} params - 参数。
  52952. * @param {function} callback - 回调函数。
  52953. */
  52954. putScript(params, callback) {
  52955. return this.client.putScript(params, this._handleCallback(callback));
  52956. }
  52957. /**
  52958. * @function ElasticSearch.prototype.putTemplate
  52959. * @description 添加模板。</br>
  52960. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  52961. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  52962. * @param {Object} params - 参数。
  52963. * @param {function} callback - 回调函数。
  52964. */
  52965. putTemplate(params, callback) {
  52966. return this.client.putTemplate(params, this._handleCallback(callback));
  52967. }
  52968. /**
  52969. * @function ElasticSearch.prototype.reindex
  52970. * @description 重新索引。</br>
  52971. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  52972. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  52973. * @param {Object} params - 参数。
  52974. * @param {function} callback - 回调函数。
  52975. */
  52976. reindex(params, callback) {
  52977. return this.client.reindex(params, this._handleCallback(callback));
  52978. }
  52979. /**
  52980. * @function ElasticSearch.prototype.reindexRessrottle
  52981. * @description 重新索引。</br>
  52982. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  52983. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  52984. * @param {Object} params - 参数。
  52985. * @param {function} callback - 回调函数。
  52986. */
  52987. reindexRessrottle(params, callback) {
  52988. return this.client.reindexRessrottle(params, this._handleCallback(callback));
  52989. }
  52990. /**
  52991. * @function ElasticSearch.prototype.renderSearchTemplate
  52992. * @description 搜索模板。</br>
  52993. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  52994. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  52995. * @param {Object} params - 参数。
  52996. * @param {function} callback - 回调函数。
  52997. */
  52998. renderSearchTemplate(params, callback) {
  52999. return this.client.renderSearchTemplate(params, this._handleCallback(callback));
  53000. }
  53001. /**
  53002. * @function ElasticSearch.prototype.scroll
  53003. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  53004. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  53005. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  53006. * @param {Object} params - 参数。
  53007. * @param {function} callback - 回调函数。
  53008. */
  53009. scroll(params, callback) {
  53010. return this.client.scroll(params, this._handleCallback(callback));
  53011. }
  53012. /**
  53013. * @function ElasticSearch.prototype.search
  53014. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  53015. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  53016. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  53017. * @param {Object} params - 参数。
  53018. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  53019. * 回调参数:error,response,结果存储在response.responses中。
  53020. */
  53021. search(params, callback) {
  53022. let me = this;
  53023. return me.client.search(params)
  53024. .then(function (resp) {
  53025. resp = resp.body || resp;
  53026. me._update(resp, callback);
  53027. return resp;
  53028. }, function (err) {
  53029. callback && callback(err);
  53030. me.events.triggerEvent('error', {error: err});
  53031. return err;
  53032. });
  53033. }
  53034. /**
  53035. * @function ElasticSearch.prototype.searchShards
  53036. * @description 返回要执行搜索请求的索引和分片。
  53037. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  53038. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  53039. * @param {Object} params - 参数。
  53040. * @param {function} callback - 回调函数。
  53041. */
  53042. searchShards(params, callback) {
  53043. return this.client.searchShards(params, this._handleCallback(callback));
  53044. }
  53045. /**
  53046. * @function ElasticSearch.prototype.searchTemplate
  53047. * @description 搜索模板。
  53048. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  53049. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  53050. * @param {Object} params - 参数。
  53051. * @param {function} callback - 回调函数。
  53052. */
  53053. searchTemplate(params, callback) {
  53054. return this.client.searchTemplate(params, this._handleCallback(callback));
  53055. }
  53056. /**
  53057. * @function ElasticSearch.prototype.suggest
  53058. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  53059. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  53060. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  53061. * @param {Object} params - 参数。
  53062. * @param {function} callback - 回调函数。
  53063. */
  53064. suggest(params, callback) {
  53065. return this.client.suggest(params, this._handleCallback(callback));
  53066. }
  53067. /**
  53068. * @function ElasticSearch.prototype.termvectors
  53069. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  53070. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  53071. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  53072. * @param {Object} params - 参数。
  53073. * @param {function} callback - 回调函数。
  53074. */
  53075. termvectors(params, callback) {
  53076. return this.client.termvectors(params, this._handleCallback(callback));
  53077. }
  53078. /**
  53079. * @function ElasticSearch.prototype.update
  53080. * @description 更新文档的部分。
  53081. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  53082. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  53083. * @param {Object} params - 参数。
  53084. * @param {function} callback - 回调函数。
  53085. */
  53086. update(params, callback) {
  53087. return this.client.update(params, this._handleCallback(callback));
  53088. }
  53089. /**
  53090. * @function ElasticSearch.prototype.updateByQuery
  53091. * @description 通过查询API来更新文档。
  53092. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  53093. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  53094. * @param {Object} params - 参数。
  53095. * @param {function} callback - 回调函数。
  53096. */
  53097. updateByQuery(params, callback) {
  53098. return this.client.updateByQuery(params, this._handleCallback(callback));
  53099. }
  53100. /**
  53101. * @function ElasticSearch.prototype._handleCallback
  53102. * @description 处理ElasticSearch 16.x和5.x的callback兼容。 5.x的回调参数多包了一层body
  53103. * @param {function} callback - 回调函数。
  53104. * @private
  53105. */
  53106. _handleCallback(callback) {
  53107. return function () {
  53108. let args = Array.from(arguments);
  53109. const error = args.shift();
  53110. let resp = args.shift();
  53111. const body = resp && resp.body;
  53112. if (body) {
  53113. const { statusCode, headers } = resp;
  53114. args = [statusCode, headers];
  53115. resp = body;
  53116. }
  53117. callback.call(this, error, resp, ...args);
  53118. };
  53119. }
  53120. _update(data, callback) {
  53121. let me = this;
  53122. if (!data) {
  53123. return;
  53124. }
  53125. me.data = data;
  53126. if (me.openGeoFence && me.geoFence) {
  53127. me._validateDatas(data);
  53128. }
  53129. me.events.triggerEvent('change', {data: me.data});
  53130. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  53131. if (me.change) {
  53132. me.change && me.change(data);
  53133. } else {
  53134. //加responses是为了保持跟原来es自身的数据结构一致
  53135. callback && callback(undefined, {responses: data});
  53136. }
  53137. }
  53138. _validateDatas(datas) {
  53139. if (!datas) {
  53140. return;
  53141. }
  53142. if (!(datas instanceof Array)) {
  53143. datas = [datas];
  53144. }
  53145. var i, len = datas.length;
  53146. for (i = 0; i < len; i++) {
  53147. this._validateData(datas[i]);
  53148. }
  53149. }
  53150. _validateData(data) {
  53151. let me = this;
  53152. data.hits.hits.map(function (source) {
  53153. let content = source._source;
  53154. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  53155. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  53156. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  53157. let contentX = content.x * meterUnit;
  53158. let contentY = content.y * meterUnit;
  53159. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  53160. let radius = me.geoFence.radius;
  53161. if (distance > radius) {
  53162. me.outOfGeoFence && me.outOfGeoFence(data);
  53163. me.events.triggerEvent('outOfGeoFence', {data: data});
  53164. }
  53165. return source;
  53166. });
  53167. }
  53168. _distance(x1, y1, x2, y2) {
  53169. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  53170. }
  53171. _getMeterPerMapUnit(mapUnit) {
  53172. let earchRadiusInMeters = 6378137;
  53173. let meterPerMapUnit;
  53174. if (mapUnit === 'meter') {
  53175. meterPerMapUnit = 1;
  53176. } else if (mapUnit === 'degree') {
  53177. // 每度表示多少米。
  53178. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  53179. }
  53180. return meterPerMapUnit;
  53181. }
  53182. }
  53183. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/index.js
  53184. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53185. * This program are made available under the terms of the Apache License, Version 2.0
  53186. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53187. ;// CONCATENATED MODULE: ./src/common/thirdparty/index.js
  53188. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53189. * This program are made available under the terms of the Apache License, Version 2.0
  53190. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53191. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Util.js
  53192. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53193. * This program are made available under the terms of the Apache License, Version 2.0
  53194. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53195. /**
  53196. * @private
  53197. * @class LevelRenderer.Tool.Util
  53198. * @category Visualization Theme
  53199. * LevelRenderer 基础工具类
  53200. *
  53201. */
  53202. class levelRenderer_Util_Util {
  53203. constructor() {
  53204. /**
  53205. * @member {Object} LevelRenderer.Tool.Util.prototype.BUILTIN_OBJECT
  53206. * @description 用于处理merge时无法遍历Date等对象的问题
  53207. */
  53208. this.BUILTIN_OBJECT = {
  53209. '[object Function]': 1,
  53210. '[object RegExp]': 1,
  53211. '[object Date]': 1,
  53212. '[object Error]': 1,
  53213. '[object CanvasGradient]': 1
  53214. };
  53215. /**
  53216. * @member {Object} LevelRenderer.Tool.Util.prototype._ctx
  53217. */
  53218. this._ctx = null;
  53219. /**
  53220. * Property: _canvas
  53221. * {Object}
  53222. */
  53223. this._canvas = null;
  53224. /**
  53225. * Property: _pixelCtx
  53226. * {Object}
  53227. */
  53228. this._pixelCtx = null;
  53229. /**
  53230. * Property: _width
  53231. * {Object}
  53232. */
  53233. this._width = null;
  53234. /**
  53235. * Property: _height
  53236. * {Object}
  53237. */
  53238. this._height = null;
  53239. /**
  53240. * Property: _offsetX
  53241. * {Object}
  53242. */
  53243. this._offsetX = 0;
  53244. /**
  53245. * Property: _offsetY
  53246. * {Object}
  53247. */
  53248. this._offsetY = 0;
  53249. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Util";
  53250. }
  53251. /**
  53252. * @function LevelRenderer.Tool.Util.prototype.clone
  53253. * @description 对一个object进行深度拷贝。
  53254. *
  53255. * @param {Object} source - 需要进行拷贝的对象。
  53256. * @return {Object} 拷贝后的新对象。
  53257. */
  53258. clone(source) {
  53259. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  53260. if (typeof source == 'object' && source !== null) {
  53261. var result = source;
  53262. if (source instanceof Array) {
  53263. result = [];
  53264. for (var i = 0, len = source.length; i < len; i++) {
  53265. result[i] = this.clone(source[i]);
  53266. }
  53267. } else if (!BUILTIN_OBJECT[Object.prototype.toString.call(source)]) {
  53268. result = {};
  53269. for (var key in source) {
  53270. if (source.hasOwnProperty(key)) {
  53271. result[key] = this.clone(source[key]);
  53272. }
  53273. }
  53274. }
  53275. return result;
  53276. }
  53277. return source;
  53278. }
  53279. /**
  53280. * @function LevelRenderer.Tool.Util.prototype.mergeItem
  53281. * @description 合并源对象的单个属性到目标对象。
  53282. *
  53283. * @param {Object} target - 目标对象。
  53284. * @param {Object} source - 源对象。
  53285. * @param {string} key - 键。
  53286. * @param {boolean} overwrite - 是否覆盖。
  53287. * @return {Object} 目标对象
  53288. */
  53289. mergeItem(target, source, key, overwrite) {
  53290. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  53291. if (source.hasOwnProperty(key)) {
  53292. if (typeof target[key] == 'object'
  53293. && !BUILTIN_OBJECT[Object.prototype.toString.call(target[key])]
  53294. ) {
  53295. // 如果需要递归覆盖,就递归调用merge
  53296. this.merge(
  53297. target[key],
  53298. source[key],
  53299. overwrite
  53300. );
  53301. } else if (overwrite || !(key in target)) {
  53302. // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况
  53303. target[key] = source[key];
  53304. }
  53305. }
  53306. }
  53307. /**
  53308. * @function LevelRenderer.Tool.Util.prototype.merge
  53309. * @description 合并源对象的属性到目标对象。
  53310. *
  53311. * @param {Object} target - 目标对象。
  53312. * @param {Object} source - 源对象。
  53313. * @param {boolean} overwrite - 是否覆盖。
  53314. * @return {Object} 目标对象。
  53315. */
  53316. merge(target, source, overwrite) {
  53317. for (var i in source) {
  53318. this.mergeItem(target, source, i, overwrite);
  53319. }
  53320. return target;
  53321. }
  53322. /**
  53323. * @function LevelRenderer.Tool.Util.prototype.getContext
  53324. * @description 获取 Canvas 上下文。
  53325. * @return {Object} 上下文。
  53326. */
  53327. getContext() {
  53328. if (!this._ctx) {
  53329. this._ctx = document.createElement('canvas').getContext('2d');
  53330. }
  53331. return this._ctx;
  53332. }
  53333. /**
  53334. * @function LevelRenderer.Tool.Util.prototype.getPixelContext
  53335. * @description 获取像素拾取专用的上下文。
  53336. * @return {Object} 像素拾取专用的上下文。
  53337. */
  53338. getPixelContext() {
  53339. if (!this._pixelCtx) {
  53340. this._canvas = document.createElement('canvas');
  53341. this._width = this._canvas.width;
  53342. this._height = this._canvas.height;
  53343. this._pixelCtx = this._canvas.getContext('2d');
  53344. }
  53345. return this._pixelCtx;
  53346. }
  53347. /**
  53348. * @function LevelRenderer.Tool.Util.prototype.adjustCanvasSize
  53349. * @description 如果坐标处在_canvas外部,改变_canvas的大小,修改canvas的大小 需要重新设置translate
  53350. *
  53351. * @param {number} x - 横坐标。
  53352. * @param {number} y - 纵坐标。
  53353. *
  53354. */
  53355. adjustCanvasSize(x, y) {
  53356. var _canvas = this._canvas;
  53357. var _pixelCtx = this._pixelCtx;
  53358. var _width = this._width;
  53359. var _height = this._height;
  53360. var _offsetX = this._offsetX;
  53361. var _offsetY = this._offsetY;
  53362. // 每次加的长度
  53363. var _v = 100;
  53364. var _flag;
  53365. if (x + _offsetX > _width) {
  53366. _width = x + _offsetX + _v;
  53367. _canvas.width = _width;
  53368. _flag = true;
  53369. }
  53370. if (y + _offsetY > _height) {
  53371. _height = y + _offsetY + _v;
  53372. _canvas.height = _height;
  53373. _flag = true;
  53374. }
  53375. if (x < -_offsetX) {
  53376. _offsetX = Math.ceil(-x / _v) * _v;
  53377. _width += _offsetX;
  53378. _canvas.width = _width;
  53379. _flag = true;
  53380. }
  53381. if (y < -_offsetY) {
  53382. _offsetY = Math.ceil(-y / _v) * _v;
  53383. _height += _offsetY;
  53384. _canvas.height = _height;
  53385. _flag = true;
  53386. }
  53387. if (_flag) {
  53388. _pixelCtx.translate(_offsetX, _offsetY);
  53389. }
  53390. }
  53391. /**
  53392. * @function LevelRenderer.Tool.Util.prototype.getPixelOffset
  53393. * @description 获取像素canvas的偏移量。
  53394. * @return {Object} 偏移量。
  53395. */
  53396. getPixelOffset() {
  53397. return {
  53398. x: this._offsetX,
  53399. y: this._offsetY
  53400. };
  53401. }
  53402. /**
  53403. * @function LevelRenderer.Tool.Util.prototype.indexOf
  53404. * @description 查询数组中元素的index
  53405. * @return {Object} 偏移量。
  53406. */
  53407. indexOf(array, value) {
  53408. if (array.indexOf) {
  53409. return array.indexOf(value);
  53410. }
  53411. for (var i = 0, len = array.length; i < len; i++) {
  53412. if (array[i] === value) {
  53413. return i;
  53414. }
  53415. }
  53416. return -1;
  53417. }
  53418. /**
  53419. * @function LevelRenderer.Tool.Util.prototype.inherits
  53420. * @description 构造类继承关系
  53421. *
  53422. * @param {function} clazz - 源类。
  53423. * @param {function} baseClazz - 基类。
  53424. * @return {Object} 偏移量。
  53425. */
  53426. inherits(clazz, baseClazz) {
  53427. var clazzPrototype = clazz.prototype;
  53428. function F() {
  53429. }
  53430. F.prototype = baseClazz.prototype;
  53431. clazz.prototype = new F();
  53432. for (var prop in clazzPrototype) {
  53433. clazz.prototype[prop] = clazzPrototype[prop];
  53434. }
  53435. clazz.constructor = clazz;
  53436. }
  53437. }
  53438. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Color.js
  53439. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53440. * This program are made available under the terms of the Apache License, Version 2.0
  53441. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53442. /**
  53443. * @class LevelRenderer.Tool.Color
  53444. * @category Visualization Theme
  53445. * @classdesc LevelRenderer 工具-颜色辅助类
  53446. * @private
  53447. */
  53448. class Color {
  53449. constructor() {
  53450. /**
  53451. * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Color.prototype.util
  53452. * @description LevelRenderer 基础工具对象。
  53453. */
  53454. this.util = new levelRenderer_Util_Util();
  53455. /**
  53456. * @member {Object} LevelRenderer.Tool.Color.prototype._ctx
  53457. * @description _ctx。
  53458. */
  53459. this._ctx = null;
  53460. /**
  53461. * @member {Array.<string>} LevelRenderer.Tool.Color.prototype.palette
  53462. * @description 默认色板。色板是一个包含图表默认颜色系列的数组,当色板中所有颜色被使用过后,又将从新回到色板中的第一个颜色。
  53463. */
  53464. this.palette = [
  53465. '#ff9277', ' #dddd00', ' #ffc877', ' #bbe3ff', ' #d5ffbb',
  53466. '#bbbbff', ' #ddb000', ' #b0dd00', ' #e2bbff', ' #ffbbe3',
  53467. '#ff7777', ' #ff9900', ' #83dd00', ' #77e3ff', ' #778fff',
  53468. '#c877ff', ' #ff77ab', ' #ff6600', ' #aa8800', ' #77c7ff',
  53469. '#ad77ff', ' #ff77ff', ' #dd0083', ' #777700', ' #00aa00',
  53470. '#0088aa', ' #8400dd', ' #aa0088', ' #dd0000', ' #772e00'
  53471. ];
  53472. /**
  53473. * @member {Array.<string>} LevelRenderer.Tool.Color.prototype._palette
  53474. * @description 复位色板,用于复位 palette
  53475. */
  53476. this._palette = this.palette;
  53477. /**
  53478. * @member {string} LevelRenderer.Tool.Color.prototype.highlightColor
  53479. * @description 高亮色
  53480. */
  53481. this.highlightColor = 'rgba(0,0,255,1)';
  53482. /**
  53483. * @member {string} LevelRenderer.Tool.Color.prototype._highlightColor
  53484. * @description 复位高亮色
  53485. */
  53486. this._highlightColor = this.highlightColor;
  53487. /**
  53488. * @member {string} LevelRenderer.Tool.Color.prototype.colorRegExp
  53489. * @description 颜色格式,正则表达式。
  53490. */
  53491. this.colorRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i;
  53492. /**
  53493. * @member {string} LevelRenderer.Tool.Color.prototype._nameColors
  53494. * @description 颜色名。
  53495. */
  53496. this._nameColors = {
  53497. aliceblue: '#f0f8ff',
  53498. antiquewhite: '#faebd7',
  53499. aqua: '#0ff',
  53500. aquamarine: '#7fffd4',
  53501. azure: '#f0ffff',
  53502. beige: '#f5f5dc',
  53503. bisque: '#ffe4c4',
  53504. black: '#000',
  53505. blanchedalmond: '#ffebcd',
  53506. blue: '#00f',
  53507. blueviolet: '#8a2be2',
  53508. brown: '#a52a2a',
  53509. burlywood: '#deb887',
  53510. cadetblue: '#5f9ea0',
  53511. chartreuse: '#7fff00',
  53512. chocolate: '#d2691e',
  53513. coral: '#ff7f50',
  53514. cornflowerblue: '#6495ed',
  53515. cornsilk: '#fff8dc',
  53516. crimson: '#dc143c',
  53517. cyan: '#0ff',
  53518. darkblue: '#00008b',
  53519. darkcyan: '#008b8b',
  53520. darkgoldenrod: '#b8860b',
  53521. darkgray: '#a9a9a9',
  53522. darkgrey: '#a9a9a9',
  53523. darkgreen: '#006400',
  53524. darkkhaki: '#bdb76b',
  53525. darkmagenta: '#8b008b',
  53526. darkolivegreen: '#556b2f',
  53527. darkorange: '#ff8c00',
  53528. darkorchid: '#9932cc',
  53529. darkred: '#8b0000',
  53530. darksalmon: '#e9967a',
  53531. darkseagreen: '#8fbc8f',
  53532. darkslateblue: '#483d8b',
  53533. darkslategray: '#2f4f4f',
  53534. darkslategrey: '#2f4f4f',
  53535. darkturquoise: '#00ced1',
  53536. darkviolet: '#9400d3',
  53537. deeppink: '#ff1493',
  53538. deepskyblue: '#00bfff',
  53539. dimgray: '#696969',
  53540. dimgrey: '#696969',
  53541. dodgerblue: '#1e90ff',
  53542. firebrick: '#b22222',
  53543. floralwhite: '#fffaf0',
  53544. forestgreen: '#228b22',
  53545. fuchsia: '#f0f',
  53546. gainsboro: '#dcdcdc',
  53547. ghostwhite: '#f8f8ff',
  53548. gold: '#ffd700',
  53549. goldenrod: '#daa520',
  53550. gray: '#808080',
  53551. grey: '#808080',
  53552. green: '#008000',
  53553. greenyellow: '#adff2f',
  53554. honeydew: '#f0fff0',
  53555. hotpink: '#ff69b4',
  53556. indianred: '#cd5c5c',
  53557. indigo: '#4b0082',
  53558. ivory: '#fffff0',
  53559. khaki: '#f0e68c',
  53560. lavender: '#e6e6fa',
  53561. lavenderblush: '#fff0f5',
  53562. lawngreen: '#7cfc00',
  53563. lemonchiffon: '#fffacd',
  53564. lightblue: '#add8e6',
  53565. lightcoral: '#f08080',
  53566. lightcyan: '#e0ffff',
  53567. lightgoldenrodyellow: '#fafad2',
  53568. lightgray: '#d3d3d3',
  53569. lightgrey: '#d3d3d3',
  53570. lightgreen: '#90ee90',
  53571. lightpink: '#ffb6c1',
  53572. lightsalmon: '#ffa07a',
  53573. lightseagreen: '#20b2aa',
  53574. lightskyblue: '#87cefa',
  53575. lightslategray: '#789',
  53576. lightslategrey: '#789',
  53577. lightsteelblue: '#b0c4de',
  53578. lightyellow: '#ffffe0',
  53579. lime: '#0f0',
  53580. limegreen: '#32cd32',
  53581. linen: '#faf0e6',
  53582. magenta: '#f0f',
  53583. maroon: '#800000',
  53584. mediumaquamarine: '#66cdaa',
  53585. mediumblue: '#0000cd',
  53586. mediumorchid: '#ba55d3',
  53587. mediumpurple: '#9370d8',
  53588. mediumseagreen: '#3cb371',
  53589. mediumslateblue: '#7b68ee',
  53590. mediumspringgreen: '#00fa9a',
  53591. mediumturquoise: '#48d1cc',
  53592. mediumvioletred: '#c71585',
  53593. midnightblue: '#191970',
  53594. mintcream: '#f5fffa',
  53595. mistyrose: '#ffe4e1',
  53596. moccasin: '#ffe4b5',
  53597. navajowhite: '#ffdead',
  53598. navy: '#000080',
  53599. oldlace: '#fdf5e6',
  53600. olive: '#808000',
  53601. olivedrab: '#6b8e23',
  53602. orange: '#ffa500',
  53603. orangered: '#ff4500',
  53604. orchid: '#da70d6',
  53605. palegoldenrod: '#eee8aa',
  53606. palegreen: '#98fb98',
  53607. paleturquoise: '#afeeee',
  53608. palevioletred: '#d87093',
  53609. papayawhip: '#ffefd5',
  53610. peachpuff: '#ffdab9',
  53611. peru: '#cd853f',
  53612. pink: '#ffc0cb',
  53613. plum: '#dda0dd',
  53614. powderblue: '#b0e0e6',
  53615. purple: '#800080',
  53616. red: '#f00',
  53617. rosybrown: '#bc8f8f',
  53618. royalblue: '#4169e1',
  53619. saddlebrown: '#8b4513',
  53620. salmon: '#fa8072',
  53621. sandybrown: '#f4a460',
  53622. seagreen: '#2e8b57',
  53623. seashell: '#fff5ee',
  53624. sienna: '#a0522d',
  53625. silver: '#c0c0c0',
  53626. skyblue: '#87ceeb',
  53627. slateblue: '#6a5acd',
  53628. slategray: '#708090',
  53629. slategrey: '#708090',
  53630. snow: '#fffafa',
  53631. springgreen: '#00ff7f',
  53632. steelblue: '#4682b4',
  53633. tan: '#d2b48c',
  53634. teal: '#008080',
  53635. thistle: '#d8bfd8',
  53636. tomato: '#ff6347',
  53637. turquoise: '#40e0d0',
  53638. violet: '#ee82ee',
  53639. wheat: '#f5deb3',
  53640. white: '#fff',
  53641. whitesmoke: '#f5f5f5',
  53642. yellow: '#ff0',
  53643. yellowgreen: '#9acd32'
  53644. };
  53645. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Color";
  53646. }
  53647. /**
  53648. * @function LevelRenderer.Tool.Color.prototype.customPalette
  53649. * @description 自定义调色板。
  53650. * @param {Array.<string>} userPalete - 颜色板。
  53651. */
  53652. customPalette(userPalete) {
  53653. this.palette = userPalete;
  53654. }
  53655. /**
  53656. * @function LevelRenderer.Tool.Color.prototype.resetPalette
  53657. * @description 复位默认色板。
  53658. */
  53659. resetPalette() {
  53660. this.palette = this._palette;
  53661. }
  53662. /**
  53663. * @function LevelRenderer.Tool.Color.prototype.getColor
  53664. * @description 获取色板颜色。
  53665. * @param {number} idx - 色板位置。
  53666. * @param {Array.<string>} userPalete - 色板。
  53667. * @returns {string} 颜色值。
  53668. */
  53669. getColor(idx, userPalete) {
  53670. idx = idx | 0;
  53671. userPalete = userPalete || this.palette;
  53672. return userPalete[idx % userPalete.length];
  53673. }
  53674. /**
  53675. * @function LevelRenderer.Tool.Color.prototype.customHighlight
  53676. * @description 自定义默认高亮颜色。
  53677. * @param {string} userHighlightColor - 自定义高亮色。
  53678. */
  53679. customHighlight(userHighlightColor) {
  53680. this.highlightColor = userHighlightColor;
  53681. }
  53682. /**
  53683. * @function LevelRenderer.Tool.Color.prototype.resetHighlight
  53684. * @description 重置默认高亮颜色。将当前的高亮色作为默认高亮颜色
  53685. */
  53686. resetHighlight() {
  53687. this.highlightColor = this._highlightColor;
  53688. }
  53689. /**
  53690. * @function LevelRenderer.Tool.Color.prototype.getHighlightColor
  53691. * @description 获取默认高亮颜色
  53692. * @returns {string} 颜色值。
  53693. */
  53694. getHighlightColor() {
  53695. return this.highlightColor;
  53696. }
  53697. /**
  53698. * @function LevelRenderer.Tool.Color.prototype.getRadialGradient
  53699. * @description 径向渐变。
  53700. * @param {number} x0 - 渐变起点横坐标。
  53701. * @param {number} y0 - 渐变起点纵坐标。
  53702. * @param {number} r0 - 半径
  53703. * @param {number} x1 - 渐变终点横坐标。
  53704. * @param {number} y1 - 渐变终点纵坐标。
  53705. * @param {number} r1 - 半径
  53706. * @param {Array} colorList - 颜色列表。
  53707. * @returns {CanvasGradient} Cavans 渐变颜色。
  53708. */
  53709. getRadialGradient(x0, y0, r0, x1, y1, r1, colorList) {
  53710. var util = this.util;
  53711. if (!this._ctx) {
  53712. this._ctx = util.getContext();
  53713. }
  53714. var gradient = this._ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
  53715. for (var i = 0, l = colorList.length; i < l; i++) {
  53716. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  53717. }
  53718. gradient.__nonRecursion = true;
  53719. return gradient;
  53720. }
  53721. /**
  53722. * @function LevelRenderer.Tool.Color.prototype.getLinearGradient
  53723. * @description 线性渐变。
  53724. * @param {number} x0 - 渐变起点横坐标。
  53725. * @param {number} y0 - 渐变起点纵坐标。
  53726. * @param {number} x1 - 渐变终点横坐标。
  53727. * @param {number} y1 - 渐变终点纵坐标。
  53728. * @param {Array} colorList - 颜色列表。
  53729. * @returns {CanvasGradient} Cavans 渐变颜色。
  53730. */
  53731. getLinearGradient(x0, y0, x1, y1, colorList) {
  53732. var util = this.util;
  53733. if (!this._ctx) {
  53734. this._ctx = util.getContext();
  53735. }
  53736. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  53737. for (var i = 0, l = colorList.length; i < l; i++) {
  53738. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  53739. }
  53740. gradient.__nonRecursion = true;
  53741. return gradient;
  53742. }
  53743. /**
  53744. * @function LevelRenderer.Tool.Color.prototype.getStepColors
  53745. * @description 获取两种颜色之间渐变颜色数组。
  53746. * @param {Object} start - 起始颜色对象。
  53747. * @param {Object} end - 结束颜色对象。
  53748. * @param {number} step - 渐变级数。
  53749. * @returns {Array} 颜色数组。
  53750. */
  53751. getStepColors(start, end, step) {
  53752. start = this.toRGBA(start);
  53753. end = this.toRGBA(end);
  53754. start = this.getData(start);
  53755. end = this.getData(end);
  53756. var colors = [];
  53757. var stepR = (end[0] - start[0]) / step;
  53758. var stepG = (end[1] - start[1]) / step;
  53759. var stepB = (end[2] - start[2]) / step;
  53760. var stepA = (end[3] - start[3]) / step;
  53761. // 生成颜色集合
  53762. // fix by linfeng 颜色堆积
  53763. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  53764. colors[i] = this.toColor([
  53765. this.adjust(Math.floor(r), [0, 255]),
  53766. this.adjust(Math.floor(g), [0, 255]),
  53767. this.adjust(Math.floor(b), [0, 255]),
  53768. a.toFixed(4) - 0
  53769. ], 'rgba');
  53770. r += stepR;
  53771. g += stepG;
  53772. b += stepB;
  53773. a += stepA;
  53774. }
  53775. r = end[0];
  53776. g = end[1];
  53777. b = end[2];
  53778. a = end[3];
  53779. colors[i] = this.toColor([r, g, b, a], 'rgba');
  53780. return colors;
  53781. }
  53782. /**
  53783. * @function LevelRenderer.Tool.Color.prototype.getGradientColors
  53784. * @description 获取指定级数的渐变颜色数组。
  53785. * @param {Array.<string>} colors - 颜色数组。
  53786. * @param {number} [step=20] - 渐变级数。
  53787. * @returns {Array.<string>} 颜色数组。
  53788. */
  53789. getGradientColors(colors, step) {
  53790. var ret = [];
  53791. var len = colors.length;
  53792. if (step === undefined) {
  53793. step = 20;
  53794. }
  53795. if (len === 1) {
  53796. ret = this.getStepColors(colors[0], colors[0], step);
  53797. } else if (len > 1) {
  53798. for (var i = 0, n = len - 1; i < n; i++) {
  53799. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  53800. if (i < n - 1) {
  53801. steps.pop();
  53802. }
  53803. ret = ret.concat(steps);
  53804. }
  53805. }
  53806. return ret;
  53807. }
  53808. /**
  53809. * @function LevelRenderer.Tool.Color.prototype.toColor
  53810. * @description 颜色值数组转为指定格式颜色。
  53811. * @param {Array} data - 颜色值数组。
  53812. * @param {string} format - 格式,默认'rgb'
  53813. * @returns {string} 颜色。
  53814. */
  53815. toColor(data, format) {
  53816. format = format || 'rgb';
  53817. if (data && (data.length === 3 || data.length === 4)) {
  53818. data = this.map(data,
  53819. function (c) {
  53820. return c > 1 ? Math.ceil(c) : c;
  53821. }
  53822. );
  53823. if (format.indexOf('hex') > -1) {
  53824. return '#' + ((1 << 24) + (data[0] << 16) + (data[1] << 8) + (+data[2])).toString(16).slice(1);
  53825. } else if (format.indexOf('hs') > -1) {
  53826. var sx = this.map(data.slice(1, 3),
  53827. function (c) {
  53828. return c + '%';
  53829. }
  53830. );
  53831. data[1] = sx[0];
  53832. data[2] = sx[1];
  53833. }
  53834. if (format.indexOf('a') > -1) {
  53835. if (data.length === 3) {
  53836. data.push(1);
  53837. }
  53838. data[3] = this.adjust(data[3], [0, 1]);
  53839. return format + '(' + data.slice(0, 4).join(',') + ')';
  53840. }
  53841. return format + '(' + data.slice(0, 3).join(',') + ')';
  53842. }
  53843. }
  53844. /**
  53845. * @function LevelRenderer.Tool.Color.prototype.toArray
  53846. * @description 颜色字符串转换为rgba数组。
  53847. * @param {string} color - 颜色。
  53848. * @returns {Array.<number>} 颜色值数组。
  53849. */
  53850. toArray(color) {
  53851. color = this.trim(color);
  53852. if (color.indexOf('rgba') < 0) {
  53853. color = this.toRGBA(color);
  53854. }
  53855. var data = [];
  53856. var i = 0;
  53857. color.replace(/[\d.]+/g, function (n) {
  53858. if (i < 3) {
  53859. n = n | 0;
  53860. } else {
  53861. // Alpha
  53862. n = +n;
  53863. }
  53864. data[i++] = n;
  53865. });
  53866. return data;
  53867. }
  53868. /**
  53869. * @function LevelRenderer.Tool.Color.prototype.convert
  53870. * @description 颜色格式转化。
  53871. * @param {Array} data - 颜色值数组。
  53872. * @param {string} format - 格式,默认'rgb'
  53873. * @returns {string} 颜色。
  53874. */
  53875. convert(color, format) {
  53876. if (!this.isCalculableColor(color)) {
  53877. return color;
  53878. }
  53879. var data = this.getData(color);
  53880. var alpha = data[3];
  53881. if (typeof alpha === 'undefined') {
  53882. alpha = 1;
  53883. }
  53884. if (color.indexOf('hsb') > -1) {
  53885. data = this._HSV_2_RGB(data);
  53886. } else if (color.indexOf('hsl') > -1) {
  53887. data = this._HSL_2_RGB(data);
  53888. }
  53889. if (format.indexOf('hsb') > -1 || format.indexOf('hsv') > -1) {
  53890. data = this._RGB_2_HSB(data);
  53891. } else if (format.indexOf('hsl') > -1) {
  53892. data = this._RGB_2_HSL(data);
  53893. }
  53894. data[3] = alpha;
  53895. return this.toColor(data, format);
  53896. }
  53897. /**
  53898. * @function LevelRenderer.Tool.Color.prototype.toRGBA
  53899. * @description 转换为rgba格式的颜色。
  53900. * @param {string} color - 颜色。
  53901. * @returns {string} 颜色。
  53902. */
  53903. toRGBA(color) {
  53904. return this.convert(color, 'rgba');
  53905. }
  53906. /**
  53907. * @function LevelRenderer.Tool.Color.prototype.toRGB
  53908. * @description 转换为rgb数字格式的颜色。
  53909. * @param {string} color - 颜色。
  53910. * @returns {string} 颜色。
  53911. */
  53912. toRGB(color) {
  53913. return this.convert(color, 'rgb');
  53914. }
  53915. /**
  53916. * @function LevelRenderer.Tool.Color.prototype.toHex
  53917. * @description 转换为16进制颜色。
  53918. * @param {string} color - 颜色。
  53919. * @returns {string} 16进制颜色,#rrggbb格式
  53920. */
  53921. toHex(color) {
  53922. return this.convert(color, 'hex');
  53923. }
  53924. /**
  53925. * @function LevelRenderer.Tool.Color.prototype.toHSVA
  53926. * @description 转换为HSV颜色。
  53927. * @param {string} color - 颜色。
  53928. * @returns {string} HSVA颜色,hsva(h,s,v,a)
  53929. */
  53930. toHSVA(color) {
  53931. return this.convert(color, 'hsva');
  53932. }
  53933. /**
  53934. * @function LevelRenderer.Tool.Color.prototype.toHSV
  53935. * @description 转换为HSV颜色。
  53936. * @param {string} color - 颜色。
  53937. * @returns {string} HSV颜色,hsv(h,s,v)
  53938. */
  53939. toHSV(color) {
  53940. return this.convert(color, 'hsv');
  53941. }
  53942. /**
  53943. * @function LevelRenderer.Tool.Color.prototype.toHSBA
  53944. * @description 转换为HSBA颜色。
  53945. * @param {string} color - 颜色。
  53946. * @returns {string} HSBA颜色,hsba(h,s,b,a)
  53947. */
  53948. toHSBA(color) {
  53949. return this.convert(color, 'hsba');
  53950. }
  53951. /**
  53952. * @function LevelRenderer.Tool.Color.prototype.toHSB
  53953. * @description 转换为HSB颜色。
  53954. * @param {string} color - 颜色。
  53955. * @returns {string} HSB颜色,hsb(h,s,b)
  53956. */
  53957. toHSB(color) {
  53958. return this.convert(color, 'hsb');
  53959. }
  53960. /**
  53961. * @function LevelRenderer.Tool.Color.prototype.toHSLA
  53962. * @description 转换为HSLA颜色。
  53963. * @param {string} color - 颜色。
  53964. * @returns {string} HSLA颜色,hsla(h,s,l,a)
  53965. */
  53966. toHSLA(color) {
  53967. return this.convert(color, 'hsla');
  53968. }
  53969. /**
  53970. * @function LevelRenderer.Tool.Color.prototype.toHSL
  53971. * @description 转换为HSL颜色。
  53972. * @param {string} color - 颜色。
  53973. * @returns {string} HSL颜色,hsl(h,s,l)
  53974. */
  53975. toHSL(color) {
  53976. return this.convert(color, 'hsl');
  53977. }
  53978. /**
  53979. * @function LevelRenderer.Tool.Color.prototype.toName
  53980. * @description 转换颜色名。
  53981. * @param {string} color - 颜色。
  53982. * @returns {string} 颜色名
  53983. */
  53984. toName(color) {
  53985. for (var key in this._nameColors) {
  53986. if (this.toHex(this._nameColors[key]) === this.toHex(color)) {
  53987. return key;
  53988. }
  53989. }
  53990. return null;
  53991. }
  53992. /**
  53993. * @function LevelRenderer.Tool.Color.prototype.trim
  53994. * @description 移除颜色中多余空格。
  53995. * @param {string} color - 颜色。
  53996. * @returns {string} 无空格颜色
  53997. */
  53998. trim(color) {
  53999. return String(color).replace(/\s+/g, '');
  54000. }
  54001. /**
  54002. * @function LevelRenderer.Tool.Color.prototype.normalize
  54003. * @description 颜色规范化。
  54004. * @param {string} color - 颜色。
  54005. * @returns {string} 规范化后的颜色
  54006. */
  54007. normalize(color) {
  54008. // 颜色名
  54009. if (this._nameColors[color]) {
  54010. color = this._nameColors[color];
  54011. }
  54012. // 去掉空格
  54013. color = this.trim(color);
  54014. // hsv与hsb等价
  54015. color = color.replace(/hsv/i, 'hsb');
  54016. // rgb转为rrggbb
  54017. if (/^#[\da-f]{3}$/i.test(color)) {
  54018. color = parseInt(color.slice(1), 16);
  54019. var r = (color & 0xf00) << 8;
  54020. var g = (color & 0xf0) << 4;
  54021. var b = color & 0xf;
  54022. color = '#' + ((1 << 24) + (r << 4) + r + (g << 4) + g + (b << 4) + b).toString(16).slice(1);
  54023. }
  54024. // 或者使用以下正则替换,不过 chrome 下性能相对差点
  54025. // color = color.replace(/^#([\da-f])([\da-f])([\da-f])$/i, '#$1$1$2$2$3$3');
  54026. return color;
  54027. }
  54028. /**
  54029. * @function LevelRenderer.Tool.Color.prototype.lift
  54030. * @description 颜色加深或减淡,当level>0加深,当level<0减淡。
  54031. * @param {string} color - 颜色。
  54032. * @param {number} level - 升降程度,取值区间[-1,1]。
  54033. * @returns {string} 加深或减淡后颜色值
  54034. */
  54035. lift(color, level) {
  54036. if (!this.isCalculableColor(color)) {
  54037. return color;
  54038. }
  54039. var direct = level > 0 ? 1 : -1;
  54040. if (typeof level === 'undefined') {
  54041. level = 0;
  54042. }
  54043. level = Math.abs(level) > 1 ? 1 : Math.abs(level);
  54044. color = this.toRGB(color);
  54045. var data = this.getData(color);
  54046. for (var i = 0; i < 3; i++) {
  54047. if (direct === 1) {
  54048. data[i] = data[i] * (1 - level) | 0;
  54049. } else {
  54050. data[i] = ((255 - data[i]) * level + data[i]) | 0;
  54051. }
  54052. }
  54053. return 'rgb(' + data.join(',') + ')';
  54054. }
  54055. /**
  54056. * @function LevelRenderer.Tool.Color.prototype.reverse
  54057. * @description 颜色翻转。[255-r,255-g,255-b,1-a]
  54058. * @param {string} color - 颜色。
  54059. * @returns {string} 翻转颜色
  54060. */
  54061. reverse(color) {
  54062. if (!this.isCalculableColor(color)) {
  54063. return color;
  54064. }
  54065. var data = this.getData(this.toRGBA(color));
  54066. data = this.map(data,
  54067. function (c) {
  54068. return 255 - c;
  54069. }
  54070. );
  54071. return this.toColor(data, 'rgb');
  54072. }
  54073. /**
  54074. * @function LevelRenderer.Tool.Color.prototype.mix
  54075. * @description 简单两种颜色混合
  54076. * @param {string} color1 - 第一种颜色。
  54077. * @param {string} color2 - 第二种颜色。
  54078. * @param {number} weight - 混合权重[0-1]。
  54079. * @returns {string} 结果色。rgb(r,g,b)或rgba(r,g,b,a)
  54080. */
  54081. mix(color1, color2, weight) {
  54082. if (!this.isCalculableColor(color1) || !this.isCalculableColor(color2)) {
  54083. return color1;
  54084. }
  54085. if (typeof weight === 'undefined') {
  54086. weight = 0.5;
  54087. }
  54088. weight = 1 - this.adjust(weight, [0, 1]);
  54089. var w = weight * 2 - 1;
  54090. var data1 = this.getData(this.toRGBA(color1));
  54091. var data2 = this.getData(this.toRGBA(color2));
  54092. var d = data1[3] - data2[3];
  54093. var weight1 = (((w * d === -1) ? w : (w + d) / (1 + w * d)) + 1) / 2;
  54094. var weight2 = 1 - weight1;
  54095. var data = [];
  54096. for (var i = 0; i < 3; i++) {
  54097. data[i] = data1[i] * weight1 + data2[i] * weight2;
  54098. }
  54099. var alpha = data1[3] * weight + data2[3] * (1 - weight);
  54100. alpha = Math.max(0, Math.min(1, alpha));
  54101. if (data1[3] === 1 && data2[3] === 1) {// 不考虑透明度
  54102. return this.toColor(data, 'rgb');
  54103. }
  54104. data[3] = alpha;
  54105. return this.toColor(data, 'rgba');
  54106. }
  54107. /**
  54108. * @function LevelRenderer.Tool.Color.prototype.random
  54109. * @description 随机颜色
  54110. * @returns {string} 颜色值,#rrggbb格式
  54111. */
  54112. random() {
  54113. return '#' + Math.random().toString(16).slice(2, 8);
  54114. }
  54115. /**
  54116. * @function LevelRenderer.Tool.Color.prototype.getData
  54117. * @description 获取颜色值数组,返回值范围。
  54118. * RGB 范围[0-255]
  54119. * HSL/HSV/HSB 范围[0-1]
  54120. * A透明度范围[0-1]
  54121. * 支持格式:
  54122. * #rgb
  54123. * #rrggbb
  54124. * rgb(r,g,b)
  54125. * rgb(r%,g%,b%)
  54126. * rgba(r,g,b,a)
  54127. * hsb(h,s,b) // hsv与hsb等价
  54128. * hsb(h%,s%,b%)
  54129. * hsba(h,s,b,a)
  54130. * hsl(h,s,l)
  54131. * hsl(h%,s%,l%)
  54132. * hsla(h,s,l,a)
  54133. * @param {string} color - 颜色。
  54134. * @returns {Array.<number>} 颜色值数组或null
  54135. */
  54136. getData(color) {
  54137. color = this.normalize(color);
  54138. var r = color.match(this.colorRegExp);
  54139. if (r === null) {
  54140. throw new Error('The color format error'); // 颜色格式错误
  54141. }
  54142. var d;
  54143. var a;
  54144. var data = [];
  54145. var rgb;
  54146. if (r[2]) {
  54147. // #rrggbb
  54148. d = r[2].replace('#', '').split('');
  54149. rgb = [d[0] + d[1], d[2] + d[3], d[4] + d[5]];
  54150. data = this.map(rgb,
  54151. function (c) {
  54152. return Color.prototype.adjust.call(this, parseInt(c, 16), [0, 255]);
  54153. }
  54154. );
  54155. } else if (r[4]) {
  54156. // rgb rgba
  54157. var rgba = (r[4]).split(',');
  54158. a = rgba[3];
  54159. rgb = rgba.slice(0, 3);
  54160. data = this.map(
  54161. rgb,
  54162. function (c) {
  54163. c = Math.floor(
  54164. c.indexOf('%') > 0 ? parseInt(c, 0) * 2.55 : c
  54165. );
  54166. return Color.prototype.adjust.call(this, c, [0, 255]);
  54167. }
  54168. );
  54169. if (typeof a !== 'undefined') {
  54170. data.push(this.adjust(parseFloat(a), [0, 1]));
  54171. }
  54172. } else if (r[5] || r[6]) {
  54173. // hsb hsba hsl hsla
  54174. var hsxa = (r[5] || r[6]).split(',');
  54175. var h = parseInt(hsxa[0], 0) / 360;
  54176. var s = hsxa[1];
  54177. var x = hsxa[2];
  54178. a = hsxa[3];
  54179. data = this.map([s, x],
  54180. function (c) {
  54181. return Color.prototype.adjust.call(this, parseFloat(c) / 100, [0, 1]);
  54182. }
  54183. );
  54184. data.unshift(h);
  54185. if (typeof a !== 'undefined') {
  54186. data.push(this.adjust(parseFloat(a), [0, 1]));
  54187. }
  54188. }
  54189. return data;
  54190. }
  54191. /**
  54192. * @function LevelRenderer.Tool.Color.prototype.alpha
  54193. * @description 设置颜色透明度
  54194. * @param {string} color - 颜色。
  54195. * @param {number} a - 透明度,区间[0,1]。
  54196. * @returns {string} rgba颜色值
  54197. */
  54198. alpha(color, a) {
  54199. if (!this.isCalculableColor(color)) {
  54200. return color;
  54201. }
  54202. if (a === null) {
  54203. a = 1;
  54204. }
  54205. var data = this.getData(this.toRGBA(color));
  54206. data[3] = this.adjust(Number(a).toFixed(4), [0, 1]);
  54207. return this.toColor(data, 'rgba');
  54208. }
  54209. /**
  54210. * @function LevelRenderer.Tool.Color.prototype.map
  54211. * @description 数组映射
  54212. * @param {Array} array - 数组。
  54213. * @param {function} fun - 函数。
  54214. * @returns {string} 数组映射结果
  54215. */
  54216. map(array, fun) {
  54217. if (typeof fun !== 'function') {
  54218. throw new TypeError();
  54219. }
  54220. var len = array ? array.length : 0;
  54221. for (var i = 0; i < len; i++) {
  54222. array[i] = fun(array[i]);
  54223. }
  54224. return array;
  54225. }
  54226. /**
  54227. * @function LevelRenderer.Tool.Color.prototype.adjust
  54228. * @description 调整值区间
  54229. * @param {Array.<number>} value - 数组。
  54230. * @param {Array.<number>} region - 区间。
  54231. * @returns {number} 调整后的值
  54232. */
  54233. adjust(value, region) {
  54234. // < to <= & > to >=
  54235. // modify by linzhifeng 2014-05-25 because -0 == 0
  54236. if (value <= region[0]) {
  54237. value = region[0];
  54238. } else if (value >= region[1]) {
  54239. value = region[1];
  54240. }
  54241. return value;
  54242. }
  54243. /**
  54244. * @function LevelRenderer.Tool.Color.prototype.isCalculableColor
  54245. * @description 判断是否是可计算的颜色
  54246. * @param {string} color - 颜色。
  54247. * @returns {boolean} 是否是可计算的颜色
  54248. */
  54249. isCalculableColor(color) {
  54250. return color instanceof Array || typeof color === 'string';
  54251. }
  54252. /**
  54253. * @function LevelRenderer.Tool.Color.prototype._HSV_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  54254. */
  54255. _HSV_2_RGB(data) {
  54256. var H = data[0];
  54257. var S = data[1];
  54258. var V = data[2];
  54259. // HSV from 0 to 1
  54260. var R;
  54261. var G;
  54262. var B;
  54263. if (S === 0) {
  54264. R = V * 255;
  54265. G = V * 255;
  54266. B = V * 255;
  54267. } else {
  54268. var h = H * 6;
  54269. if (h === 6) {
  54270. h = 0;
  54271. }
  54272. var i = h | 0;
  54273. var v1 = V * (1 - S);
  54274. var v2 = V * (1 - S * (h - i));
  54275. var v3 = V * (1 - S * (1 - (h - i)));
  54276. var r = 0;
  54277. var g = 0;
  54278. var b = 0;
  54279. if (i === 0) {
  54280. r = V;
  54281. g = v3;
  54282. b = v1;
  54283. } else if (i === 1) {
  54284. r = v2;
  54285. g = V;
  54286. b = v1;
  54287. } else if (i === 2) {
  54288. r = v1;
  54289. g = V;
  54290. b = v3;
  54291. } else if (i === 3) {
  54292. r = v1;
  54293. g = v2;
  54294. b = V;
  54295. } else if (i === 4) {
  54296. r = v3;
  54297. g = v1;
  54298. b = V;
  54299. } else {
  54300. r = V;
  54301. g = v1;
  54302. b = v2;
  54303. }
  54304. // RGB results from 0 to 255
  54305. R = r * 255;
  54306. G = g * 255;
  54307. B = b * 255;
  54308. }
  54309. return [R, G, B];
  54310. }
  54311. /**
  54312. * @function LevelRenderer.Tool.Color.prototype._HSL_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  54313. */
  54314. _HSL_2_RGB(data) {
  54315. var H = data[0];
  54316. var S = data[1];
  54317. var L = data[2];
  54318. // HSL from 0 to 1
  54319. var R;
  54320. var G;
  54321. var B;
  54322. if (S === 0) {
  54323. R = L * 255;
  54324. G = L * 255;
  54325. B = L * 255;
  54326. } else {
  54327. var v2;
  54328. if (L < 0.5) {
  54329. v2 = L * (1 + S);
  54330. } else {
  54331. v2 = (L + S) - (S * L);
  54332. }
  54333. var v1 = 2 * L - v2;
  54334. R = 255 * this._HUE_2_RGB(v1, v2, H + (1 / 3));
  54335. G = 255 * this._HUE_2_RGB(v1, v2, H);
  54336. B = 255 * this._HUE_2_RGB(v1, v2, H - (1 / 3));
  54337. }
  54338. return [R, G, B];
  54339. }
  54340. /**
  54341. * @function LevelRenderer.Tool.Color.prototype._HUE_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  54342. */
  54343. _HUE_2_RGB(v1, v2, vH) {
  54344. if (vH < 0) {
  54345. vH += 1;
  54346. }
  54347. if (vH > 1) {
  54348. vH -= 1;
  54349. }
  54350. if ((6 * vH) < 1) {
  54351. return (v1 + (v2 - v1) * 6 * vH);
  54352. }
  54353. if ((2 * vH) < 1) {
  54354. return (v2);
  54355. }
  54356. if ((3 * vH) < 2) {
  54357. return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
  54358. }
  54359. return v1;
  54360. }
  54361. /**
  54362. * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  54363. */
  54364. _RGB_2_HSB(data) {
  54365. // RGB from 0 to 255
  54366. var R = (data[0] / 255);
  54367. var G = (data[1] / 255);
  54368. var B = (data[2] / 255);
  54369. var vMin = Math.min(R, G, B); // Min. value of RGB
  54370. var vMax = Math.max(R, G, B); // Max. value of RGB
  54371. var delta = vMax - vMin; // Delta RGB value
  54372. var V = vMax;
  54373. var H;
  54374. var S;
  54375. // HSV results from 0 to 1
  54376. if (delta === 0) {
  54377. H = 0;
  54378. S = 0;
  54379. } else {
  54380. S = delta / vMax;
  54381. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  54382. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  54383. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  54384. if (R === vMax) {
  54385. H = deltaB - deltaG;
  54386. } else if (G === vMax) {
  54387. H = (1 / 3) + deltaR - deltaB;
  54388. } else if (B === vMax) {
  54389. H = (2 / 3) + deltaG - deltaR;
  54390. }
  54391. if (H < 0) {
  54392. H += 1;
  54393. }
  54394. if (H > 1) {
  54395. H -= 1;
  54396. }
  54397. }
  54398. H = H * 360;
  54399. S = S * 100;
  54400. V = V * 100;
  54401. return [H, S, V];
  54402. }
  54403. /**
  54404. * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSL。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  54405. */
  54406. _RGB_2_HSL(data) {
  54407. // RGB from 0 to 255
  54408. var R = (data[0] / 255);
  54409. var G = (data[1] / 255);
  54410. var B = (data[2] / 255);
  54411. var vMin = Math.min(R, G, B); // Min. value of RGB
  54412. var vMax = Math.max(R, G, B); // Max. value of RGB
  54413. var delta = vMax - vMin; // Delta RGB value
  54414. var L = (vMax + vMin) / 2;
  54415. var H;
  54416. var S;
  54417. // HSL results from 0 to 1
  54418. if (delta === 0) {
  54419. H = 0;
  54420. S = 0;
  54421. } else {
  54422. if (L < 0.5) {
  54423. S = delta / (vMax + vMin);
  54424. } else {
  54425. S = delta / (2 - vMax - vMin);
  54426. }
  54427. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  54428. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  54429. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  54430. if (R === vMax) {
  54431. H = deltaB - deltaG;
  54432. } else if (G === vMax) {
  54433. H = (1 / 3) + deltaR - deltaB;
  54434. } else if (B === vMax) {
  54435. H = (2 / 3) + deltaG - deltaR;
  54436. }
  54437. if (H < 0) {
  54438. H += 1;
  54439. }
  54440. if (H > 1) {
  54441. H -= 1;
  54442. }
  54443. }
  54444. H = H * 360;
  54445. S = S * 100;
  54446. L = L * 100;
  54447. return [H, S, L];
  54448. }
  54449. }
  54450. ;// CONCATENATED MODULE: ./src/common/util/ColorsPickerUtil.js
  54451. var ColorRender = new Color();
  54452. // let "http://www.qzu.zj.cn": "#bd10e0"
  54453. // "www.qzct.net": "#7ed321" = new LevelRenderer.Tool.Color();
  54454. /**
  54455. * @name ColorsPickerUtil
  54456. * @namespace
  54457. * @category BaseTypes Util
  54458. * @classdesc 色带选择器工具类。用于1、创建canvas对象,2、从几种颜色中获取一定数量的渐变色。
  54459. * @usage
  54460. * ```
  54461. * // 浏览器
  54462. * <script type="text/javascript" src="{cdn}"></script>
  54463. * <script>
  54464. * const result = {namespace}.ColorsPickerUtil.createCanvas();
  54465. *
  54466. * // 弃用的写法
  54467. * const result = SuperMap.ColorsPickerUtil.createCanvas();
  54468. *
  54469. * </script>
  54470. *
  54471. * // ES6 Import
  54472. * import { ColorsPickerUtil } from '{npm}';
  54473. *
  54474. * const result = ColorsPickerUtil.createCanvas();
  54475. * ```
  54476. */
  54477. class ColorsPickerUtil {
  54478. /**
  54479. * @function ColorsPickerUtil.createCanvas
  54480. * @description 创建DOM canvas。
  54481. * @param {number} height - canvas 高度。
  54482. * @param {number} width - canvas 宽度。
  54483. */
  54484. static createCanvas (height, width){
  54485. var canvas = document.createElement("canvas");
  54486. canvas.height = height;
  54487. canvas.width = width;
  54488. return canvas.getContext("2d");
  54489. }
  54490. /**
  54491. * @function ColorsPickerUtil.getLinearGradient
  54492. * @description 线性渐变。
  54493. * @param {number} x0 - 渐变起点 x 坐标。
  54494. * @param {number} y0 - 渐变起点 y 坐标。
  54495. * @param {number} x1 - 渐变终点 x 坐标。
  54496. * @param {number} y1 - 渐变终点 y 坐标。
  54497. * @param {Array} colorList 颜色列表。
  54498. * @returns {CanvasGradient} Cavans 渐变颜色。
  54499. */
  54500. static getLinearGradient (x0, y0, x1, y1, colorList){
  54501. if (!this._ctx) {
  54502. this._ctx = this.getContext();
  54503. }
  54504. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  54505. var leng = colorList.length;
  54506. var add = 1/(leng -1);
  54507. var offset = 0;
  54508. for (var i = 0; i < leng; i++) {
  54509. gradient.addColorStop(offset, colorList[i]);
  54510. offset += add;
  54511. }
  54512. gradient.__nonRecursion = true;
  54513. return gradient;
  54514. }
  54515. /**
  54516. * @function ColorsPickerUtil.getContext
  54517. * @description 获取 Cavans 上下文。
  54518. * @returns {Object} Cavans 上下文。
  54519. */
  54520. static getContext () {
  54521. if (!this._ctx) {
  54522. this._ctx = document.createElement('canvas').getContext('2d');
  54523. }
  54524. return this._ctx;
  54525. }
  54526. /**
  54527. * @function ColorsPickerUtil.getStepColors
  54528. * @description 获取两种颜色之间渐变颜色数组。
  54529. * @param {string} start - 起始颜色。
  54530. * @param {string} end - 结束颜色。
  54531. * @param {number} step - 渐变级数。
  54532. * @returns {Array} 颜色数组。
  54533. */
  54534. static getStepColors (start, end, step){
  54535. start = ColorRender.toRGBA(start);
  54536. end = ColorRender.toRGBA(end);
  54537. start = ColorRender.getData(start);
  54538. end = ColorRender.getData(end);
  54539. var colors = [];
  54540. var stepR = (end[0] - start[0]) / step;
  54541. var stepG = (end[1] - start[1]) / step;
  54542. var stepB = (end[2] - start[2]) / step;
  54543. var stepA = (end[3] - start[3]) / step;
  54544. // 生成颜色集合
  54545. // fix by linfeng 颜色堆积
  54546. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  54547. colors[i] = ColorRender.toColor([
  54548. ColorRender.adjust(Math.floor(r), [ 0, 255 ]),
  54549. ColorRender.adjust(Math.floor(g), [ 0, 255 ]),
  54550. ColorRender.adjust(Math.floor(b), [ 0, 255 ]),
  54551. a.toFixed(4) - 0
  54552. ],'hex');
  54553. r += stepR;
  54554. g += stepG;
  54555. b += stepB;
  54556. a += stepA;
  54557. }
  54558. r = end[0];
  54559. g = end[1];
  54560. b = end[2];
  54561. a = end[3];
  54562. colors[i] = ColorRender.toColor([r, g, b, a], 'hex');
  54563. return colors;
  54564. }
  54565. /**
  54566. * @function ColorsPickerUtil.getGradientColors
  54567. * @description 获取指定级数的渐变颜色数组。
  54568. * @param {Array.<string>} colors - 颜色组。
  54569. * @param {number} total - 颜色总数。
  54570. * @param {string} themeType - 专题类型。
  54571. * @returns {Array.<string>} 颜色数组。
  54572. */
  54573. static getGradientColors (colors, total, themeType){
  54574. var ret = [], step;
  54575. var i, n, len = colors.length;
  54576. if (total === undefined) {
  54577. return;
  54578. }
  54579. if(len >= total){
  54580. if(themeType === 'RANGE'){
  54581. for(i = 0; i<total; i++){
  54582. ret.push(colors[i]);
  54583. }
  54584. }else {
  54585. //1/2前后取色
  54586. for(i = 0; i<total; i++){
  54587. let ii = Math.floor(i/2);
  54588. if(i%2 === 0){
  54589. ret.push(colors[ii]);
  54590. }else {
  54591. let index = colors.length -1 - ii;
  54592. ret.push(colors[index]);
  54593. }
  54594. }
  54595. }
  54596. } else {
  54597. step = Math.ceil(total/(len-1));
  54598. for (i = 0, n = len - 1; i < n; i++) {
  54599. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  54600. if (i < n - 1) {
  54601. steps.pop();
  54602. }
  54603. ret = ret.concat(steps);
  54604. }
  54605. //删除多余元素
  54606. var nouse = ret.length - total;
  54607. for(var j = 0, index = 0; j< nouse; j++){
  54608. ret.splice(index+2,1);
  54609. }
  54610. }
  54611. return ret;
  54612. }
  54613. }
  54614. ;// CONCATENATED MODULE: ./src/common/util/ArrayStatistic.js
  54615. /**
  54616. * @name ArrayStatistic
  54617. * @namespace
  54618. * @category BaseTypes Util
  54619. * @classdesc 处理数组。
  54620. * @usage
  54621. * ```
  54622. * // 浏览器
  54623. * <script type="text/javascript" src="{cdn}"></script>
  54624. * <script>
  54625. * const result = {namespace}.ArrayStatistic.newInstance();
  54626. *
  54627. * // 弃用的写法
  54628. * const result = SuperMap.ArrayStatistic.newInstance();
  54629. *
  54630. * </script>
  54631. *
  54632. * // ES6 Import
  54633. * import { ArrayStatistic } from '{npm}';
  54634. *
  54635. * const result = ArrayStatistic.newInstance();
  54636. * ```
  54637. */
  54638. class ArrayStatistic {
  54639. // geostatsInstance: null,
  54640. /**
  54641. * @function ArrayStatistic.newInstance
  54642. * @description 初始化插件实例。
  54643. */
  54644. static newInstance() {
  54645. // if(!this.geostatsInstance) {
  54646. // // this.geostatsInstance = new geostats();
  54647. // // }
  54648. // window.dataList = [];
  54649. if(!this.geostatsInstance) {
  54650. this.geostatsInstance = new window.geostats();
  54651. }
  54652. return this.geostatsInstance;
  54653. }
  54654. /**
  54655. * @function ArrayStatistic.getInstance
  54656. * @description 设置需要被处理的数组。
  54657. * @param {Array} array - 数组。
  54658. */
  54659. static getInstance(array) {
  54660. let instance = this.newInstance();
  54661. instance.setSerie(array);
  54662. return instance;
  54663. }
  54664. /**
  54665. * @function ArrayStatistic.getArrayStatistic
  54666. * @description 获取数组统计的值。
  54667. * @param {Array.<number>} array - 需要统计的数组。
  54668. * @param {string} type - 统计方法。
  54669. */
  54670. static getArrayStatistic(array, type){
  54671. if(!array.length) {
  54672. return 0;
  54673. }
  54674. if(type === "Sum" || type === "求和"){
  54675. return this.getSum(array);
  54676. } else if(type === "Maximum" || type === "最大值"){
  54677. return this.getMax(array);
  54678. } else if(type === "Minimum" || type === "最小值"){
  54679. return this.getMin(array);
  54680. } else if(type === "Average" || type === "平均值"){
  54681. return this.getMean(array);
  54682. } else if(type === "Median" || type === "中位数"){
  54683. return this.getMedian(array);
  54684. } else if(type === "times" || type === "计数"){
  54685. return this.getTimes(array);
  54686. }
  54687. }
  54688. /**
  54689. * @function ArrayStatistic.getArraySegments
  54690. * @description 获取数组分段后的数值。
  54691. * @param {Array.<number>} array - 需要分段的数组。
  54692. * @param {string} type - 分段方法。
  54693. * @param {number} segNum - 分段个数。
  54694. */
  54695. static getArraySegments(array, type, segNum) {
  54696. if(type === "offset") {
  54697. return this.getEqInterval(array, segNum);
  54698. } else if(type === "jenks") {
  54699. return this.getJenks(array, segNum);
  54700. } else if(type === "square") {
  54701. // 数据都必须 >= 0
  54702. let minValue = this.getMin(array);
  54703. if(minValue >= 0){
  54704. return this.getSqrtInterval(array, segNum);
  54705. }else {
  54706. //console.log('数据都必须 >= 0');
  54707. // Util.showMessage(Language.hasNegValue + Language.noSupportRange, 'ERROR');
  54708. return false;
  54709. }
  54710. } else if(type === "logarithm") {
  54711. // 数据都必须 > 0
  54712. let minValue = this.getMin(array);
  54713. if(minValue > 0){
  54714. return this.getGeometricProgression(array, segNum);
  54715. }else {
  54716. //console.log('数据都必须 > 0');
  54717. // Util.showMessage(Language.hasZeroNegValue + Language.noSupportRange, 'ERROR');
  54718. return false;
  54719. }
  54720. }
  54721. }
  54722. /**
  54723. * @function ArrayStatistic.getSum
  54724. * @description 求和。
  54725. * @param {Array.<number>} array 需要求和的参数。
  54726. * @returns {number} 返回求和结果。
  54727. */
  54728. static getSum(array){
  54729. return this.getInstance(array).sum();
  54730. }
  54731. /**
  54732. * @function ArrayStatistic.getMax
  54733. * @description 最大值。
  54734. * @param {Array.<number>} array 需要求最大值的参数。
  54735. * @returns {number} 返回最大值。
  54736. */
  54737. static getMax(array){
  54738. return this.getInstance(array).max();
  54739. }
  54740. /**
  54741. * @function ArrayStatistic.getMin
  54742. * @description 最小值。
  54743. * @param {Array.<number>} array 需要求最小值的参数。
  54744. * @returns {number} 返回最小值。
  54745. */
  54746. static getMin(array){
  54747. return this.getInstance(array).min();
  54748. }
  54749. /**
  54750. * @function ArrayStatistic.getMean
  54751. * @description 求平均数。
  54752. * @param {Array.<number>} array 需要求平均数的参数。
  54753. * @returns {number} 返回平均数。
  54754. */
  54755. static getMean(array){
  54756. return this.getInstance(array).mean();
  54757. }
  54758. /**
  54759. * @function ArrayStatistic.getMedian
  54760. * @description 求中位数。
  54761. * @param {Array.<number>} array 需要求中位数的参数。
  54762. * @returns {number} 返回中位数。
  54763. */
  54764. static getMedian(array) {
  54765. return this.getInstance(array).median();
  54766. }
  54767. /**
  54768. * @function ArrayStatistic.getTimes
  54769. * @description 计数。
  54770. * @param {Array.<number>} array 需要计数的参数。
  54771. * @returns {number} 返回计数结果。
  54772. */
  54773. static getTimes(array) {
  54774. return array.length;
  54775. }
  54776. /**
  54777. * @function ArrayStatistic.getEqInterval
  54778. * @description 等距分段法。
  54779. * @param {Array} array 需要进行等距分段的数组。
  54780. * @param {number} segNum 分段个数。
  54781. */
  54782. static getEqInterval(array, segNum) {
  54783. return this.getInstance(array).getClassEqInterval(segNum);
  54784. }
  54785. /**
  54786. * @function ArrayStatistic.getJenks
  54787. * @description 自然断裂法。
  54788. * @param {Array} array 需要进行自然断裂的参数。
  54789. * @param {number} segNum 分段个数。
  54790. */
  54791. static getJenks(array, segNum) {
  54792. return this.getInstance(array).getClassJenks(segNum);
  54793. }
  54794. /**
  54795. * @function ArrayStatistic.getSqrtInterval
  54796. * @description 平方根分段法。
  54797. * @param {Array} array 需要进行平方根分段的参数。
  54798. * @param {number} segNum 分段个数。
  54799. */
  54800. static getSqrtInterval(array, segNum) {
  54801. array = array.map(function(value) {
  54802. return Math.sqrt(value);
  54803. });
  54804. let breaks = this.getInstance(array).getClassEqInterval(segNum);
  54805. return (
  54806. breaks.map(function(value) {
  54807. return value * value;
  54808. })
  54809. )
  54810. }
  54811. /**
  54812. * @function ArrayStatistic.getGeometricProgression
  54813. * @description 对数分段法。
  54814. * @param {Array} array 需要进行对数分段的参数。
  54815. * @param {number} segNum 分段个数。
  54816. */
  54817. static getGeometricProgression(array, segNum) {
  54818. return this.getInstance(array).getClassGeometricProgression(segNum);
  54819. }
  54820. }
  54821. ;// CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  54822. /**
  54823. * @function getMeterPerMapUnit
  54824. * @description 单位换算,把米|度|千米|英寸|英尺换成米。
  54825. * @category BaseTypes Util
  54826. * @param {string} mapUnit 地图单位。
  54827. * @returns {number} 返回地图的距离单位。
  54828. * @usage
  54829. * ```
  54830. * // 浏览器
  54831. * <script type="text/javascript" src="{cdn}"></script>
  54832. * <script>
  54833. * const result = {namespace}.getMeterPerMapUnit(mapUnit);
  54834. *
  54835. * </script>
  54836. *
  54837. * // ES6 Import
  54838. * import { getMeterPerMapUnit } from '{npm}';
  54839. *
  54840. * const result = getMeterPerMapUnit(mapUnit);
  54841. * ```
  54842. */
  54843. var getMeterPerMapUnit = function(mapUnit) {
  54844. var earchRadiusInMeters = 6378137;
  54845. var meterPerMapUnit;
  54846. if (mapUnit === Unit.METER) {
  54847. meterPerMapUnit = 1;
  54848. } else if (mapUnit === Unit.DEGREE) {
  54849. // 每度表示多少米。
  54850. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  54851. } else if (mapUnit === Unit.KILOMETER) {
  54852. meterPerMapUnit = 1.0e-3;
  54853. } else if (mapUnit === Unit.INCH) {
  54854. meterPerMapUnit = 1 / 2.5399999918e-2;
  54855. } else if (mapUnit === Unit.FOOT) {
  54856. meterPerMapUnit = 0.3048;
  54857. } else {
  54858. return meterPerMapUnit;
  54859. }
  54860. return meterPerMapUnit;
  54861. };
  54862. /**
  54863. * @function getWrapNum
  54864. * @description 获取该坐标系的经纬度范围的经度或纬度。
  54865. * @category BaseTypes Util
  54866. * @param {number} x 经度或纬度。
  54867. * @param {boolean} includeMax 是否获取经度或纬度的最大值。
  54868. * @param {boolean} includeMin 是否获取经度或纬度的最小值。
  54869. * @param {number} range 坐标系的经纬度范围。
  54870. * @returns {number} 返回经度或纬度的值。
  54871. * @usage
  54872. * ```
  54873. * // 浏览器
  54874. * <script type="text/javascript" src="{cdn}"></script>
  54875. * <script>
  54876. * const result = {namespace}.getWrapNum(x, includeMax, includeMin, range);
  54877. *
  54878. * </script>
  54879. *
  54880. * // ES6 Import
  54881. * import { getWrapNum } from '{npm}';
  54882. *
  54883. * const result = getWrapNum(x, includeMax, includeMin, range);
  54884. * ```
  54885. */
  54886. function getWrapNum(x, includeMax = true, includeMin = true, range = [-180, 180]) {
  54887. var max = range[1],
  54888. min = range[0],
  54889. d = max - min;
  54890. if (x === max && includeMax) {
  54891. return x;
  54892. }
  54893. if (x === min && includeMin) {
  54894. return x;
  54895. }
  54896. var tmp = (((x - min) % d) + d) % d;
  54897. if (tmp === 0 && includeMax) {
  54898. return max;
  54899. }
  54900. return ((((x - min) % d) + d) % d) + min;
  54901. }
  54902. /**
  54903. * @function conversionDegree
  54904. * @description 转换经纬度。
  54905. * @category BaseTypes Util
  54906. * @param {number} degrees 经度或纬度。
  54907. * @returns {string} 返回度分秒。
  54908. * @usage
  54909. * ```
  54910. * // 浏览器
  54911. * <script type="text/javascript" src="{cdn}"></script>
  54912. * <script>
  54913. * const result = {namespace}.conversionDegree(degrees);
  54914. *
  54915. * </script>
  54916. *
  54917. * // ES6 Import
  54918. * import { conversionDegree } from '{npm}';
  54919. *
  54920. * const result = conversionDegree(degrees);
  54921. * ```
  54922. */
  54923. function conversionDegree(degrees) {
  54924. const degree = parseInt(degrees);
  54925. let fraction = parseInt((degrees - degree) * 60);
  54926. let second = parseInt(((degrees - degree) * 60 - fraction) * 60);
  54927. fraction = parseInt(fraction / 10) === 0 ? `0${fraction}` : fraction;
  54928. second = parseInt(second / 10) === 0 ? `0${second}` : second;
  54929. return `${degree}°${fraction}'${second}`;
  54930. }
  54931. /**
  54932. * @function scalesToResolutions
  54933. * @description 通过比例尺数组计算分辨率数组,没有传入比例尺数组时通过地图范围与地图最大级别进行计算。
  54934. * @version 11.0.1
  54935. * @param {Array} scales - 比例尺数组。
  54936. * @param {Object} bounds - 地图范围。
  54937. * @param {number} dpi - 屏幕分辨率。
  54938. * @param {string} mapUnit - 地图单位。
  54939. * @param {number} [level=22] - 地图最大级别。
  54940. * @returns {number} 分辨率。
  54941. * @usage
  54942. * ```
  54943. * // 浏览器
  54944. * <script type="text/javascript" src="{cdn}"></script>
  54945. * <script>
  54946. * const result = {namespace}.scalesToResolutions(scales, bounds, dpi, mapUnit);
  54947. *
  54948. * </script>
  54949. *
  54950. * // ES6 Import
  54951. * import { scalesToResolutions } from '{npm}';
  54952. *
  54953. * const result = scalesToResolutions(scales, bounds, dpi, mapUnit);
  54954. * ```
  54955. */
  54956. function scalesToResolutions(scales, bounds, dpi, mapUnit, level = 22) {
  54957. var resolutions = [];
  54958. if (scales && scales.length > 0) {
  54959. for (let i = 0; i < scales.length; i++) {
  54960. resolutions.push(scaleToResolution(scales[i], dpi, mapUnit));
  54961. }
  54962. } else {
  54963. const maxReolution = Math.abs(bounds.left - bounds.right) / 256;
  54964. for (let i = 0; i < level; i++) {
  54965. resolutions.push(maxReolution / Math.pow(2, i));
  54966. }
  54967. }
  54968. return resolutions.sort(function (a, b) {
  54969. return b - a;
  54970. });
  54971. }
  54972. /**
  54973. * @function getZoomByResolution
  54974. * @description 通过分辨率获取地图级别。
  54975. * @version 11.0.1
  54976. * @param {number} resolution - 分辨率。
  54977. * @param {Array} resolutions - 分辨率数组。
  54978. * @returns {number} 地图级别。
  54979. * @usage
  54980. * ```
  54981. * // 浏览器
  54982. * <script type="text/javascript" src="{cdn}"></script>
  54983. * <script>
  54984. * const result = {namespace}.getZoomByResolution(resolution, resolutions);
  54985. *
  54986. * </script>
  54987. *
  54988. * // ES6 Import
  54989. * import { getZoomByResolution } from '{npm}';
  54990. *
  54991. * const result = getZoomByResolution(resolution, resolutions);
  54992. * ```
  54993. */
  54994. function getZoomByResolution(resolution, resolutions) {
  54995. let zoom = 0;
  54996. let minDistance;
  54997. for (let i = 0; i < resolutions.length; i++) {
  54998. if (i === 0) {
  54999. minDistance = Math.abs(resolution - resolutions[i]);
  55000. }
  55001. if (minDistance > Math.abs(resolution - resolutions[i])) {
  55002. minDistance = Math.abs(resolution - resolutions[i]);
  55003. zoom = i;
  55004. }
  55005. }
  55006. return zoom;
  55007. }
  55008. /**
  55009. * @function scaleToResolution
  55010. * @description 通过比例尺计算分辨率。
  55011. * @version 11.0.1
  55012. * @param {number} scale - 比例尺。
  55013. * @param {number} dpi - 屏幕分辨率。
  55014. * @param {string} mapUnit - 地图单位。
  55015. * @returns {number} 分辨率。
  55016. * @usage
  55017. * ```
  55018. * // 浏览器
  55019. * <script type="text/javascript" src="{cdn}"></script>
  55020. * <script>
  55021. * const result = {namespace}.scaleToResolution(scale, dpi, mapUnit);
  55022. *
  55023. * </script>
  55024. *
  55025. * // ES6 Import
  55026. * import { scaleToResolution } from '{npm}';
  55027. *
  55028. * const result = scaleToResolution(scale, dpi, mapUnit);
  55029. * ```
  55030. */
  55031. function scaleToResolution(scale, dpi, mapUnit) {
  55032. const inchPerMeter = 1 / 0.0254;
  55033. const meterPerMapUnitValue = getMeterPerMapUnit(mapUnit);
  55034. const resolution = 1 / (scale * dpi * inchPerMeter * meterPerMapUnitValue);
  55035. return resolution;
  55036. }
  55037. /**
  55038. * 范围是否相交
  55039. * @param {Array} extent1 范围1
  55040. * @param {Array} extent2 范围2
  55041. * @return {boolean} 范围是否相交。
  55042. */
  55043. function intersects(extent1, extent2) {
  55044. return (
  55045. extent1[0] <= extent2[2] &&
  55046. extent1[2] >= extent2[0] &&
  55047. extent1[1] <= extent2[3] &&
  55048. extent1[3] >= extent2[1]
  55049. );
  55050. }
  55051. /**
  55052. * 获取两个范围的交集
  55053. * @param {Array} extent1 Extent 1
  55054. * @param {Array} extent2 Extent 2
  55055. * @return {Array} 相交范围数组.
  55056. * @api
  55057. */
  55058. function getIntersection(extent1, extent2) {
  55059. const intersection = [];
  55060. if (intersects(extent1, extent2)) {
  55061. if (extent1[0] > extent2[0]) {
  55062. intersection[0] = extent1[0];
  55063. } else {
  55064. intersection[0] = extent2[0];
  55065. }
  55066. if (extent1[1] > extent2[1]) {
  55067. intersection[1] = extent1[1];
  55068. } else {
  55069. intersection[1] = extent2[1];
  55070. }
  55071. if (extent1[2] < extent2[2]) {
  55072. intersection[2] = extent1[2];
  55073. } else {
  55074. intersection[2] = extent2[2];
  55075. }
  55076. if (extent1[3] < extent2[3]) {
  55077. intersection[3] = extent1[3];
  55078. } else {
  55079. intersection[3] = extent2[3];
  55080. }
  55081. }
  55082. return intersection;
  55083. }
  55084. ;// CONCATENATED MODULE: ./src/common/util/index.js
  55085. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55086. * This program are made available under the terms of the Apache License, Version 2.0
  55087. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55088. function toSuperMapGeometry(geoJSON) {
  55089. if (geoJSON && geoJSON.type) {
  55090. var format = new GeoJSONFormat();
  55091. var result = format.read(geoJSON, "FeatureCollection");
  55092. return result[0].geometry;
  55093. }
  55094. }
  55095. function toSuperMapPolygon(lnglatBounds) {
  55096. const west = lnglatBounds.getWest();
  55097. const east = lnglatBounds.getEast();
  55098. const sourth = lnglatBounds.getSouth();
  55099. const north = lnglatBounds.getNorth();
  55100. return new Polygon([
  55101. new LinearRing([
  55102. new GeometryPoint(west, sourth),
  55103. new GeometryPoint(east, sourth),
  55104. new GeometryPoint(east, north),
  55105. new GeometryPoint(west, north)
  55106. ])
  55107. ]);
  55108. }
  55109. /**
  55110. * @function Util.extend
  55111. * @description 对象拷贝赋值。
  55112. * @param {Object} dest - 目标对象。
  55113. * @param {Object} arguments - 待拷贝的对象。
  55114. * @returns {Object} 赋值后的目标对象。
  55115. */
  55116. function extend(dest) {
  55117. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  55118. var arg = Object.getOwnPropertyNames(arguments)[index];
  55119. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  55120. continue;
  55121. }
  55122. var obj = arguments[arg];
  55123. if (obj) {
  55124. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  55125. var key = Object.getOwnPropertyNames(obj)[j];
  55126. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  55127. continue;
  55128. }
  55129. dest[key] = obj[key];
  55130. }
  55131. }
  55132. }
  55133. return dest;
  55134. }
  55135. // EXTERNAL MODULE: ./node_modules/lodash.topairs/index.js
  55136. var lodash_topairs = __webpack_require__(52);
  55137. var lodash_topairs_default = /*#__PURE__*/__webpack_require__.n(lodash_topairs);
  55138. ;// CONCATENATED MODULE: ./src/common/style/CartoCSS.js
  55139. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55140. * This program are made available under the terms of the Apache License, Version 2.0
  55141. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55142. /**
  55143. * @class CartoCSS
  55144. * @deprecatedclass SuperMap.CartoCSS
  55145. * @classdesc CartoCSS 解析类,其主要功能为将 CartoCSS 字符串解析为 CartoCSS 的 shader 属性风格对象。
  55146. * @category BaseTypes Style
  55147. * @param {string} cartoStr - 样式表字符串。
  55148. * @example
  55149. * var cartocss = "@provinceLineColor:#ddd;
  55150. * #China_Provinces_L___China400{
  55151. * line-dasharray:10,10;
  55152. * line-color:@provinceLineColor;
  55153. * line-width:1;
  55154. * }";
  55155. * new CartoCSS(cartocss);
  55156. * @usage
  55157. */
  55158. /*eslint no-useless-escape: "off"*/
  55159. class CartoCSS {
  55160. constructor(cartoStr) {
  55161. this.env = null;
  55162. /**
  55163. * @member CartoCSS.prototype.parser
  55164. * @description 解析器。
  55165. */
  55166. this.parser = null;
  55167. /**
  55168. * @member CartoCSS.prototype.ruleSet
  55169. * @description CartoCSS 规则对象。
  55170. */
  55171. this.ruleSet = null;
  55172. /**
  55173. * @member CartoCSS.prototype.cartoStr
  55174. * @description CartoCSS 样式表字符串。
  55175. */
  55176. this.cartoStr = "";
  55177. /**
  55178. * @member CartoCSS.prototype.shaders
  55179. * @description Carto 着色器集。
  55180. */
  55181. this.shaders = null;
  55182. if (typeof cartoStr === "string") {
  55183. this.cartoStr = cartoStr;
  55184. this.env = {
  55185. frames: [],
  55186. errors: [],
  55187. error: function (obj) {
  55188. this.errors.push(obj);
  55189. }
  55190. };
  55191. this.parser = this.getParser(this.env);
  55192. this.parse(cartoStr);
  55193. this.shaders = this.toShaders();
  55194. }
  55195. }
  55196. /**
  55197. * @function CartoCSS.prototype.getParser
  55198. * @description 获取 CartoCSS 解析器。
  55199. */
  55200. getParser(env) {
  55201. var input, // LeSS input string
  55202. i, // current index in `input`
  55203. j, // current chunk
  55204. temp, // temporarily holds a chunk's state, for backtracking
  55205. memo, // temporarily holds `i`, when backtracking
  55206. furthest, // furthest index the parser has gone to
  55207. chunks, // chunkified input
  55208. current, // index of current chunk, in `input`
  55209. parser;
  55210. var that = this;
  55211. // This function is called after all files
  55212. // have been imported through `@import`.
  55213. var finish = function () {//NOSONAR
  55214. //所有文件导入完成之后调用
  55215. };
  55216. function save() {
  55217. temp = chunks[j];
  55218. memo = i;
  55219. current = i;
  55220. }
  55221. function restore() {
  55222. chunks[j] = temp;
  55223. i = memo;
  55224. current = i;
  55225. }
  55226. function sync() {
  55227. if (i > current) {
  55228. chunks[j] = chunks[j].slice(i - current);
  55229. current = i;
  55230. }
  55231. }
  55232. //
  55233. // Parse from a token, regexp or string, and move forward if match
  55234. //
  55235. function _match(tok) {
  55236. var match, length, c, endIndex;
  55237. // Non-terminal
  55238. if (tok instanceof Function) {
  55239. return tok.call(parser.parsers);
  55240. // Terminal
  55241. // Either match a single character in the input,
  55242. // or match a regexp in the current chunk (chunk[j]).
  55243. } else if (typeof(tok) === 'string') {
  55244. match = input.charAt(i) === tok ? tok : null;
  55245. length = 1;
  55246. sync();
  55247. } else {
  55248. sync();
  55249. match = tok.exec(chunks[j]);
  55250. if (match) {
  55251. length = match[0].length;
  55252. } else {
  55253. return null;
  55254. }
  55255. }
  55256. // The match is confirmed, add the match length to `i`,
  55257. // and consume any extra white-space characters (' ' || '\n')
  55258. // which come after that. The reason for this is that LeSS's
  55259. // grammar is mostly white-space insensitive.
  55260. if (match) {
  55261. var mem = i += length;
  55262. endIndex = i + chunks[j].length - length;
  55263. while (i < endIndex) {
  55264. c = input.charCodeAt(i);
  55265. if (!(c === 32 || c === 10 || c === 9)) {
  55266. break;
  55267. }
  55268. i++;
  55269. }
  55270. chunks[j] = chunks[j].slice(length + (i - mem));
  55271. current = i;
  55272. if (chunks[j].length === 0 && j < chunks.length - 1) {
  55273. j++;
  55274. }
  55275. if (typeof(match) === 'string') {
  55276. return match;
  55277. } else {
  55278. return match.length === 1 ? match[0] : match;
  55279. }
  55280. }
  55281. }
  55282. // Same as _match(), but don't change the state of the parser,
  55283. // just return the match.
  55284. function peek(tok) {
  55285. if (typeof(tok) === 'string') {
  55286. return input.charAt(i) === tok;
  55287. } else {
  55288. return !!tok.test(chunks[j]);
  55289. }
  55290. }
  55291. // Make an error object from a passed set of properties.
  55292. // Accepted properties:
  55293. // - `message`: Text of the error message.
  55294. // - `filename`: Filename where the error occurred.
  55295. // - `index`: Char. index where the error occurred.
  55296. function makeError(err) {
  55297. var einput;
  55298. var defautls = {
  55299. index: furthest,
  55300. filename: env.filename,
  55301. message: 'Parse error.',
  55302. line: 0,
  55303. column: -1
  55304. };
  55305. for (var prop in defautls) {
  55306. if (err[prop] === 0) {
  55307. err[prop] = defautls[prop];
  55308. }
  55309. }
  55310. if (err.filename && that.env.inputs && that.env.inputs[err.filename]) {
  55311. einput = that.env.inputs[err.filename];
  55312. } else {
  55313. einput = input;
  55314. }
  55315. err.line = (einput.slice(0, err.index).match(/\n/g) || '').length + 1;
  55316. for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
  55317. err.column++;
  55318. }
  55319. return new Error([err.filename, err.line, err.column, err.message].join(";"));
  55320. }
  55321. this.env = env = env || {};
  55322. this.env.filename = this.env.filename || null;
  55323. this.env.inputs = this.env.inputs || {};
  55324. // The Parser
  55325. parser = {
  55326. // Parse an input string into an abstract syntax tree.
  55327. // Throws an error on parse errors.
  55328. parse: function (str) {
  55329. var root, error = null;
  55330. i = j = current = furthest = 0;
  55331. chunks = [];
  55332. input = str.replace(/\r\n/g, '\n');
  55333. if (env.filename) {
  55334. that.env.inputs[env.filename] = input;
  55335. }
  55336. // Split the input into chunks.
  55337. chunks = (function (chunks) {
  55338. var j = 0,
  55339. skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
  55340. comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
  55341. string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
  55342. level = 0,
  55343. match,
  55344. chunk = chunks[0],
  55345. inParam;
  55346. for (var i = 0, c, cc; i < input.length;) {
  55347. skip.lastIndex = i;
  55348. if (match = skip.exec(input)) {
  55349. if (match.index === i) {
  55350. i += match[0].length;
  55351. chunk.push(match[0]);
  55352. }
  55353. }
  55354. c = input.charAt(i);
  55355. comment.lastIndex = string.lastIndex = i;
  55356. if (match = string.exec(input)) {
  55357. if (match.index === i) {
  55358. i += match[0].length;
  55359. chunk.push(match[0]);
  55360. continue;
  55361. }
  55362. }
  55363. if (!inParam && c === '/') {
  55364. cc = input.charAt(i + 1);
  55365. if (cc === '/' || cc === '*') {
  55366. if (match = comment.exec(input)) {
  55367. if (match.index === i) {
  55368. i += match[0].length;
  55369. chunk.push(match[0]);
  55370. continue;
  55371. }
  55372. }
  55373. }
  55374. }
  55375. switch (c) {
  55376. case '{'://NOSONAR
  55377. if (!inParam) {
  55378. level++;
  55379. chunk.push(c);
  55380. break;
  55381. }
  55382. case '}'://NOSONAR
  55383. if (!inParam) {
  55384. level--;
  55385. chunk.push(c);
  55386. chunks[++j] = chunk = [];
  55387. break;
  55388. }
  55389. case '('://NOSONAR
  55390. if (!inParam) {
  55391. inParam = true;
  55392. chunk.push(c);
  55393. break;
  55394. }
  55395. case ')'://NOSONAR
  55396. if (inParam) {
  55397. inParam = false;
  55398. chunk.push(c);
  55399. break;
  55400. }
  55401. default:
  55402. chunk.push(c);
  55403. break;
  55404. }
  55405. i++;
  55406. }
  55407. if (level !== 0) {
  55408. error = {
  55409. index: i - 1,
  55410. type: 'Parse',
  55411. message: (level > 0) ? "missing closing `}`" : "missing opening `{`"
  55412. };
  55413. }
  55414. return chunks.map(function (c) {
  55415. return c.join('');
  55416. });
  55417. })([[]]);
  55418. if (error) {
  55419. throw makeError(error);
  55420. }
  55421. // Sort rules by specificity: this function expects selectors to be
  55422. // split already.
  55423. //
  55424. // Written to be used as a .sort(Function);
  55425. // argument.
  55426. //
  55427. // [1, 0, 0, 467] > [0, 0, 1, 520]
  55428. var specificitySort = function (a, b) {
  55429. var as = a.specificity;
  55430. var bs = b.specificity;
  55431. if (as[0] != bs[0]) {return bs[0] - as[0];}
  55432. if (as[1] != bs[1]) {return bs[1] - as[1];}
  55433. if (as[2] != bs[2]) {return bs[2] - as[2];}
  55434. return bs[3] - as[3];
  55435. };
  55436. // Start with the primary rule.
  55437. // The whole syntax tree is held under a Ruleset node,
  55438. // with the `root` property set to true, so no `{}` are
  55439. // output.
  55440. root = new CartoCSS.Tree.Ruleset([], _match(this.parsers.primary));
  55441. root.root = true;
  55442. // Get an array of Ruleset objects, flattened
  55443. // and sorted according to specificitySort
  55444. root.toList = (function () {
  55445. return function (env) {
  55446. env.error = function (e) {
  55447. if (!env.errors) {env.errors = new Error('');}
  55448. if (env.errors.message) {
  55449. env.errors.message += '\n' + makeError(e).message;
  55450. } else {
  55451. env.errors.message = makeError(e).message;
  55452. }
  55453. };
  55454. env.frames = env.frames || [];
  55455. // call populates Invalid-caused errors
  55456. var definitions = this.flatten([], [], env);
  55457. definitions.sort(specificitySort);
  55458. return definitions;
  55459. };
  55460. })();
  55461. return root;
  55462. },
  55463. // Here in, the parsing rules/functions
  55464. //
  55465. // The basic structure of the syntax tree generated is as follows:
  55466. //
  55467. // Ruleset -> Rule -> Value -> Expression -> Entity
  55468. //
  55469. // In general, most rules will try to parse a token with the `_match()` function, and if the return
  55470. // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
  55471. // first, before parsing, that's when we use `peek()`.
  55472. parsers: {
  55473. // The `primary` rule is the *entry* and *exit* point of the parser.
  55474. // The rules here can appear at any level of the parse tree.
  55475. //
  55476. // The recursive nature of the grammar is an interplay between the `block`
  55477. // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
  55478. // as represented by this simplified grammar:
  55479. //
  55480. // primary → (ruleset | rule)+
  55481. // ruleset → selector+ block
  55482. // block → '{' primary '}'
  55483. //
  55484. // Only at one point is the primary rule not called from the
  55485. // block rule: at the root level.
  55486. primary: function () {
  55487. var node, root = [];
  55488. while ((node = _match(this.rule) || _match(this.ruleset) ||
  55489. _match(this.comment)) ||
  55490. _match(/^[\s\n]+/) || (node = _match(this.invalid))) {
  55491. if (node) {root.push(node);}
  55492. }
  55493. return root;
  55494. },
  55495. invalid: function () {
  55496. var chunk = _match(/^[^;\n]*[;\n]/);
  55497. // To fail gracefully, match everything until a semicolon or linebreak.
  55498. if (chunk) {
  55499. return new CartoCSS.Tree.Invalid(chunk, memo);
  55500. }
  55501. },
  55502. // We create a Comment node for CSS comments `/* */`,
  55503. // but keep the LeSS comments `//` silent, by just skipping
  55504. // over them.
  55505. comment: function () {
  55506. var comment;
  55507. if (input.charAt(i) !== '/') {return;}
  55508. if (input.charAt(i + 1) === '/') {
  55509. return new CartoCSS.Tree.Comment(_match(/^\/\/.*/), true);
  55510. } else if (comment = _match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
  55511. return new CartoCSS.Tree.Comment(comment);
  55512. }
  55513. },
  55514. // Entities are tokens which can be found inside an Expression
  55515. entities: {
  55516. // A string, which supports escaping " and ' "milky way" 'he\'s the one!'
  55517. quoted: function () {
  55518. if (input.charAt(i) !== '"' && input.charAt(i) !== "'") {return;}
  55519. var str = _match(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
  55520. if (str) {
  55521. return new CartoCSS.Tree.Quoted(str[1] || str[2]);
  55522. }
  55523. },
  55524. // A reference to a Mapnik field, like [NAME]
  55525. // Behind the scenes, this has the same representation, but Carto
  55526. // needs to be careful to warn when unsupported operations are used.
  55527. field: function () {
  55528. var l = '[', r = ']';
  55529. if (!_match(l)) {return;}
  55530. var field_name = _match(/(^[^\]]+)/);
  55531. if (!_match(r)) {return;}
  55532. if (field_name) {return new CartoCSS.Tree.Field(field_name[1]);}
  55533. },
  55534. // This is a comparison operator
  55535. comparison: function () {
  55536. var str = _match(/^=~|=|!=|<=|>=|<|>/);
  55537. if (str) {
  55538. return str;
  55539. }
  55540. },
  55541. // A catch-all word, such as: hard-light
  55542. // These can start with either a letter or a dash (-),
  55543. // and then contain numbers, underscores, and letters.
  55544. keyword: function () {
  55545. var k = _match(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);
  55546. if (k) {
  55547. return new CartoCSS.Tree.Keyword(k);
  55548. }
  55549. },
  55550. // A function call like rgb(255, 0, 255)
  55551. // The arguments are parsed with the `entities.arguments` parser.
  55552. call: function () {
  55553. var name, args;
  55554. if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) {return;}
  55555. name = name[1];
  55556. if (name === 'url') {
  55557. // url() is handled by the url parser instead
  55558. return null;
  55559. } else {
  55560. i += name.length;
  55561. }
  55562. var l = '(', r = ')';
  55563. _match(l); // Parse the '(' and consume whitespace.
  55564. args = _match(this.entities['arguments']);
  55565. if (!_match(r)) {return;}
  55566. if (name) {
  55567. return new CartoCSS.Tree.Call(name, args, i);
  55568. }
  55569. },
  55570. // Arguments are comma-separated expressions
  55571. 'arguments': function () {
  55572. var args = [], arg;
  55573. while (arg = _match(this.expression)) {
  55574. args.push(arg);
  55575. var q = ',';
  55576. if (!_match(q)) {
  55577. break;
  55578. }
  55579. }
  55580. return args;
  55581. },
  55582. literal: function () {
  55583. return _match(this.entities.dimension) ||
  55584. _match(this.entities.keywordcolor) ||
  55585. _match(this.entities.hexcolor) ||
  55586. _match(this.entities.quoted);
  55587. },
  55588. // Parse url() tokens
  55589. //
  55590. // We use a specific rule for urls, because they don't really behave like
  55591. // standard function calls. The difference is that the argument doesn't have
  55592. // to be enclosed within a string, so it can't be parsed as an Expression.
  55593. url: function () {
  55594. var value;
  55595. if (input.charAt(i) !== 'u' || !_match(/^url\(/)) {return;}
  55596. value = _match(this.entities.quoted) || _match(this.entities.variable) ||
  55597. _match(/^[\-\w%@_match\/.&=:;#+?~]+/) || '';
  55598. var r = ')';
  55599. if (!_match(r)) {
  55600. return new CartoCSS.Tree.Invalid(value, memo, 'Missing closing ) in URL.');
  55601. } else {
  55602. return new CartoCSS.Tree.URL((typeof value.value !== 'undefined' ||
  55603. value instanceof CartoCSS.Tree.Variable) ?
  55604. value : new CartoCSS.Tree.Quoted(value));
  55605. }
  55606. },
  55607. // A Variable entity, such as `@fink`, in
  55608. //
  55609. // width: @fink + 2px
  55610. //
  55611. // We use a different parser for variable definitions,
  55612. // see `parsers.variable`.
  55613. variable: function () {
  55614. var name, index = i;
  55615. if (input.charAt(i) === '@' && (name = _match(/^@[\w-]+/))) {
  55616. return new CartoCSS.Tree.Variable(name, index, env.filename);
  55617. }
  55618. },
  55619. hexcolor: function () {
  55620. var rgb;
  55621. if (input.charAt(i) === '#' && (rgb = _match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
  55622. return new CartoCSS.Tree.Color(rgb[1]);
  55623. }
  55624. },
  55625. keywordcolor: function () {
  55626. var rgb = chunks[j].match(/^[a-z]+/);
  55627. if (rgb && rgb[0] in CartoCSS.Tree.Reference.data.colors) {
  55628. return new CartoCSS.Tree.Color(CartoCSS.Tree.Reference.data.colors[_match(/^[a-z]+/)]);
  55629. }
  55630. },
  55631. // A Dimension, that is, a number and a unit. The only
  55632. // unit that has an effect is %
  55633. dimension: function () {
  55634. var c = input.charCodeAt(i);
  55635. if ((c > 57 || c < 45) || c === 47) {return;}
  55636. var value = _match(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
  55637. if (value) {
  55638. return new CartoCSS.Tree.Dimension(value[1], value[2], memo);
  55639. }
  55640. }
  55641. },
  55642. // The variable part of a variable definition.
  55643. // Used in the `rule` parser. Like @fink:
  55644. variable: function () {
  55645. var name;
  55646. if (input.charAt(i) === '@' && (name = _match(/^(@[\w-]+)\s*:/))) {
  55647. return name[1];
  55648. }
  55649. },
  55650. // Entities are the smallest recognized token,
  55651. // and can be found inside a rule's value.
  55652. entity: function () {
  55653. var property1 = _match(this.entities.call) || _match(this.entities.literal);
  55654. var property2 = _match(this.entities.field) || _match(this.entities.variable);
  55655. var property3 = _match(this.entities.url) || _match(this.entities.keyword);
  55656. return property1 || property2 || property3;
  55657. },
  55658. // A Rule terminator. Note that we use `peek()` to check for '}',
  55659. // because the `block` rule will be expecting it, but we still need to make sure
  55660. // it's there, if ';' was ommitted.
  55661. end: function () {
  55662. var q = ';';
  55663. return _match(q) || peek('}');
  55664. },
  55665. // Elements are the building blocks for Selectors. They consist of
  55666. // an element name, such as a tag a class, or `*`.
  55667. //增加对中文的支持,[\u4e00-\u9fa5]
  55668. element: function () {
  55669. var e = _match(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);
  55670. if (e) {return new CartoCSS.Tree.Element(e);}
  55671. },
  55672. // Attachments allow adding multiple lines, polygons etc. to an
  55673. // object. There can only be one attachment per selector.
  55674. attachment: function () {
  55675. var s = _match(/^::([\w\-]+(?:\/[\w\-]+)*)/);
  55676. if (s) {return s[1];}
  55677. },
  55678. // Selectors are made out of one or more Elements, see above.
  55679. selector: function () {
  55680. var a, attachment,
  55681. e, elements = [],
  55682. f, filters = new CartoCSS.Tree.Filterset(),
  55683. z, zooms = [],
  55684. segments = 0, conditions = 0;
  55685. while (
  55686. (e = _match(this.element)) ||
  55687. (z = _match(this.zoom)) ||
  55688. (f = _match(this.filter)) ||
  55689. (a = _match(this.attachment))
  55690. ) {
  55691. segments++;
  55692. if (e) {
  55693. elements.push(e);
  55694. } else if (z) {
  55695. zooms.push(z);
  55696. conditions++;
  55697. } else if (f) {
  55698. var err = filters.add(f);
  55699. if (err) {
  55700. throw makeError({
  55701. message: err,
  55702. index: i - 1
  55703. });
  55704. }
  55705. conditions++;
  55706. } else if (attachment) {
  55707. throw makeError({
  55708. message: 'Encountered second attachment name.',
  55709. index: i - 1
  55710. });
  55711. } else {
  55712. attachment = a;
  55713. }
  55714. var c = input.charAt(i);
  55715. if (c === '{' || c === '}' || c === ';' || c === ',') {
  55716. break;
  55717. }
  55718. }
  55719. if (segments) {
  55720. return new CartoCSS.Tree.Selector(filters, zooms, elements, attachment, conditions, memo);
  55721. }
  55722. },
  55723. filter: function () {
  55724. save();
  55725. var key, op, val, l = '[', r = ']';
  55726. if (!_match(l)) {return;}
  55727. if (key = _match(/^[a-zA-Z0-9\-_]+/) ||
  55728. _match(this.entities.quoted) ||
  55729. _match(this.entities.variable) ||
  55730. _match(this.entities.keyword) ||
  55731. _match(this.entities.field)) {
  55732. if (key instanceof CartoCSS.Tree.Quoted) {
  55733. key = new CartoCSS.Tree.Field(key.toString());
  55734. }
  55735. if ((op = _match(this.entities.comparison)) &&
  55736. (val = _match(this.entities.quoted) ||
  55737. _match(this.entities.variable) ||
  55738. _match(this.entities.dimension) ||
  55739. _match(this.entities.keyword) ||
  55740. _match(this.entities.field))) {
  55741. if (!_match(r)) {
  55742. throw makeError({
  55743. message: 'Missing closing ] of filter.',
  55744. index: memo - 1
  55745. });
  55746. }
  55747. if (!key.is) {key = new CartoCSS.Tree.Field(key);}
  55748. return new CartoCSS.Tree.Filter(key, op, val, memo, env.filename);
  55749. }
  55750. }
  55751. },
  55752. zoom: function () {
  55753. save();
  55754. var op, val, r = ']';
  55755. if (_match(/^\[\s*zoom/g) &&
  55756. (op = _match(this.entities.comparison)) &&
  55757. (val = _match(this.entities.variable) || _match(this.entities.dimension)) && _match(r)) {
  55758. return new CartoCSS.Tree.Zoom(op, val, memo);
  55759. } else {
  55760. // backtrack
  55761. restore();
  55762. }
  55763. },
  55764. // The `block` rule is used by `ruleset`
  55765. // It's a wrapper around the `primary` rule, with added `{}`.
  55766. block: function () {
  55767. var content, l = '{', r = '}';
  55768. if (_match(l) && (content = _match(this.primary)) && _match(r)) {
  55769. return content;
  55770. }
  55771. },
  55772. // div, .class, body > p {...}
  55773. ruleset: function () {
  55774. var selectors = [], s, rules, q = ',';
  55775. save();
  55776. while (s = _match(this.selector)) {
  55777. selectors.push(s);
  55778. while (_match(this.comment)) {//NOSONAR
  55779. }
  55780. if (!_match(q)) {
  55781. break;
  55782. }
  55783. while (_match(this.comment)) {//NOSONAR
  55784. }
  55785. }
  55786. if (s) {
  55787. while (_match(this.comment)) {//NOSONAR
  55788. }
  55789. }
  55790. if (selectors.length > 0 && (rules = _match(this.block))) {
  55791. if (selectors.length === 1 &&
  55792. selectors[0].elements.length &&
  55793. selectors[0].elements[0].value === 'Map') {
  55794. var rs = new CartoCSS.Tree.Ruleset(selectors, rules);
  55795. rs.isMap = true;
  55796. return rs;
  55797. }
  55798. return new CartoCSS.Tree.Ruleset(selectors, rules);
  55799. } else {
  55800. // Backtrack
  55801. restore();
  55802. }
  55803. },
  55804. rule: function () {
  55805. var name, value, c = input.charAt(i);
  55806. save();
  55807. if (c === '.' || c === '#') {
  55808. return;
  55809. }
  55810. if (name = _match(this.variable) || _match(this.property)) {
  55811. value = _match(this.value);
  55812. if (value && _match(this.end)) {
  55813. return new CartoCSS.Tree.Rule(name, value, memo, env.filename);
  55814. } else {
  55815. furthest = i;
  55816. restore();
  55817. }
  55818. }
  55819. },
  55820. font: function () {
  55821. var value = [], expression = [], e, q = ',';
  55822. while (e = _match(this.entity)) {
  55823. expression.push(e);
  55824. }
  55825. value.push(new CartoCSS.Tree.Expression(expression));
  55826. if (_match(q)) {
  55827. while (e = _match(this.expression)) {
  55828. value.push(e);
  55829. if (!_match(q)) {
  55830. break;
  55831. }
  55832. }
  55833. }
  55834. return new CartoCSS.Tree.Value(value);
  55835. },
  55836. // A Value is a comma-delimited list of Expressions
  55837. // In a Rule, a Value represents everything after the `:`,
  55838. // and before the `;`.
  55839. value: function () {
  55840. var e, expressions = [], q = ',';
  55841. while (e = _match(this.expression)) {
  55842. expressions.push(e);
  55843. if (!_match(q)) {
  55844. break;
  55845. }
  55846. }
  55847. if (expressions.length > 1) {
  55848. return new CartoCSS.Tree.Value(expressions.map(function (e) {
  55849. return e.value[0];
  55850. }));
  55851. } else if (expressions.length === 1) {
  55852. return new CartoCSS.Tree.Value(expressions);
  55853. }
  55854. },
  55855. // A sub-expression, contained by parenthensis
  55856. sub: function () {
  55857. var e, l = '(', r = ")";
  55858. if (_match(l) && (e = _match(this.expression)) && _match(r)) {
  55859. return e;
  55860. }
  55861. },
  55862. // This is a misnomer because it actually handles multiplication
  55863. // and division.
  55864. multiplication: function () {
  55865. var m, a, op, operation, q = '/';
  55866. if (m = _match(this.operand)) {
  55867. while ((op = (_match(q) || _match('*') || _match('%'))) && (a = _match(this.operand))) {
  55868. operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  55869. }
  55870. return operation || m;
  55871. }
  55872. },
  55873. addition: function () {
  55874. var m, a, op, operation, plus = '+';
  55875. if (m = _match(this.multiplication)) {
  55876. while ((op = _match(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && (_match(plus) || _match('-')))) &&
  55877. (a = _match(this.multiplication))) {
  55878. operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  55879. }
  55880. return operation || m;
  55881. }
  55882. },
  55883. // An operand is anything that can be part of an operation,
  55884. // such as a Color, or a Variable
  55885. operand: function () {
  55886. return _match(this.sub) || _match(this.entity);
  55887. },
  55888. // Expressions either represent mathematical operations,
  55889. // or white-space delimited Entities. @var * 2
  55890. expression: function () {
  55891. var e, entities = [];
  55892. while (e = _match(this.addition) || _match(this.entity)) {
  55893. entities.push(e);
  55894. }
  55895. if (entities.length > 0) {
  55896. return new CartoCSS.Tree.Expression(entities);
  55897. }
  55898. },
  55899. property: function () {
  55900. var name = _match(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);
  55901. if (name) {return name[1];}
  55902. }
  55903. }
  55904. };
  55905. return parser;
  55906. }
  55907. /**
  55908. * @function CartoCSS.prototype.parse
  55909. * @description 利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集。
  55910. * @returns {Object} CartoCSS规则集。
  55911. */
  55912. parse(str) {
  55913. var parser = this.parser;
  55914. var ruleSet = this.ruleSet = parser.parse(str);
  55915. return ruleSet;
  55916. }
  55917. /**
  55918. * @function CartoCSS.prototype.toShaders
  55919. * @description 将CartoCSS规则集转化为着色器。
  55920. * @returns {Array} CartoCSS着色器集。
  55921. */
  55922. toShaders() {
  55923. if (this.ruleSet) {
  55924. var ruleset = this.ruleSet;
  55925. if (ruleset) {
  55926. var defs = ruleset.toList(this.env);
  55927. defs.reverse();
  55928. var shaders = {};
  55929. var keys = [];
  55930. this._toShaders(shaders,keys,defs);
  55931. var ordered_shaders = [];
  55932. var done = {};
  55933. for (var i = 0, len0 = defs.length; i < len0; ++i) {
  55934. var def = defs[i];
  55935. var k = def.attachment;
  55936. var shader = shaders[keys[i]];
  55937. var shaderArray = [];
  55938. if (!done[k]) {
  55939. var j = 0;
  55940. for (var prop in shader) {
  55941. if (prop !== 'zoom' && prop !== 'frames' && prop !== "attachment" && prop != "elements") {
  55942. //对layer-index作特殊处理以实现图层的控制
  55943. if (prop === "layer-index") {
  55944. /*var getLayerIndex = Function("attributes", "zoom", "var _value = null;" + shader[prop].join('\n') + "; return _value; ");*/
  55945. var getLayerIndex = function (attributes, zoom) {//NOSONAR
  55946. var _value = null;
  55947. shader[prop].join('\n');
  55948. return _value;
  55949. };
  55950. var layerIndex = getLayerIndex();
  55951. Object.defineProperty(shaderArray, "layerIndex", {
  55952. configurable: true,
  55953. enumerable: false,
  55954. value: layerIndex
  55955. });
  55956. } else {
  55957. shaderArray[j++] = function (ops, shaderArray) {//NOSONAR
  55958. if (!Array.isArray(ops)) {
  55959. return ops;
  55960. }
  55961. var body = ops.join('\n');
  55962. var myKeyword = 'attributes["FEATUREID"]&&attributes["FEATUREID"]';
  55963. var index = body.indexOf(myKeyword);
  55964. if (index >= 0) {
  55965. //对featureID作一些特殊处理,以将featureID提取出来
  55966. if (!shaderArray.featureFilter) {
  55967. var featureFilterStart = index + myKeyword.length;
  55968. var featureFilterEnd = body.indexOf(")", featureFilterStart + 1);
  55969. var featureFilterStr = "featureId&&(featureId" + body.substring(featureFilterStart, featureFilterEnd) + ")";
  55970. /*var featureFilter = Function("featureId", "if(" + featureFilterStr + "){return true;}return false;");*/
  55971. var featureFilter = function (featureId) {
  55972. if (featureFilterStr) {
  55973. return true;
  55974. }
  55975. return false;
  55976. }
  55977. Object.defineProperty(shaderArray, "featureFilter", {
  55978. configurable: true,
  55979. enumerable: false,
  55980. value: featureFilter
  55981. });
  55982. }
  55983. return {
  55984. "property": prop,
  55985. "getValue": Function("attributes", "zoom", "seftFilter", "var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){" + body + ";} return _value; ")//NOSONAR
  55986. };
  55987. } else {
  55988. return {
  55989. "property": prop,
  55990. "getValue": Function("attributes", "zoom", "var _value = null;" + body + "; return _value; ")//NOSONAR
  55991. };
  55992. }
  55993. }(shader[prop], shaderArray);
  55994. }
  55995. }
  55996. }
  55997. Object.defineProperty(shaderArray, "attachment", {
  55998. configurable: true,
  55999. enumerable: false,
  56000. value: k
  56001. });
  56002. Object.defineProperty(shaderArray, "elements", {
  56003. configurable: true,
  56004. enumerable: false,
  56005. value: def.elements
  56006. });
  56007. ordered_shaders.push(shaderArray);
  56008. done[keys[i]] = true;
  56009. }
  56010. Object.defineProperty(shaderArray, "zoom", {
  56011. configurable: true,
  56012. enumerable: false,
  56013. value: def.zoom
  56014. });
  56015. //shader.frames.push(def.frame_offset);
  56016. }
  56017. return ordered_shaders;
  56018. }
  56019. }
  56020. return null;
  56021. }
  56022. _toShaders(shaders, keys,defs) {
  56023. for (let i = 0, len0 = defs.length; i < len0; ++i) {
  56024. let def = defs[i];
  56025. let element_str = [];
  56026. for (let j = 0, len1 = def.elements.length; j < len1; j++) {
  56027. element_str.push(def.elements[j]);
  56028. }
  56029. let filters = def.filters.filters;
  56030. let filterStr = [];
  56031. for (let attr in filters) {
  56032. filterStr.push(filters[attr].id);
  56033. }
  56034. let key = element_str.join("/") + "::" + def.attachment + "_" + filterStr.join("_");
  56035. keys.push(key);
  56036. let shader = shaders[key] = (shaders[key] || {});
  56037. //shader.frames = [];
  56038. shader.zoom = CartoCSS.Tree.Zoom.all;
  56039. let props = def.toJS(this.env);
  56040. for (let v in props) {
  56041. (shader[v] = (shader[v] || [])).push(props[v].join('\n'))
  56042. }
  56043. }
  56044. }
  56045. /**
  56046. * @function CartoCSS.prototype.getShaders
  56047. * @description 获取CartoCSS着色器。
  56048. * @returns {Array} 着色器集。
  56049. * @example
  56050. * //shaders的结构大概如下:
  56051. * var shaders=[
  56052. * {
  56053. * attachment:"one",
  56054. * elements:[],
  56055. * zoom:23,
  56056. * length:2,
  56057. * 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  56058. * 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  56059. * },
  56060. * {
  56061. * attachment:"two",
  56062. * elements:[],
  56063. * zoom:23,
  56064. * length:2,
  56065. * 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  56066. * 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  56067. * }
  56068. * ];
  56069. */
  56070. getShaders() {
  56071. return this.shaders;
  56072. }
  56073. /**
  56074. * @function CartoCSS.prototype.destroy
  56075. * @description CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象。
  56076. */
  56077. destroy() {
  56078. this.cartoStr = null;
  56079. this.env = null;
  56080. this.ruleSet = null;
  56081. this.parser = null;
  56082. this.shaders = null;
  56083. }
  56084. }
  56085. var _mapnik_reference_latest = {
  56086. "version": "2.1.1",
  56087. "style": {
  56088. "filter-mode": {
  56089. "type": [
  56090. "all",
  56091. "first"
  56092. ],
  56093. "doc": "Control the processing behavior of Rule filters within a Style. If 'all' is used then all Rules are processed sequentially independent of whether any previous filters matched. If 'first' is used then it means processing ends after the first match (a positive filter evaluation) and no further Rules in the Style are processed ('first' is usually the default for CSS implementations on top of Mapnik to simplify translation from CSS to Mapnik XML)",
  56094. "default-value": "all",
  56095. "default-meaning": "All Rules in a Style are processed whether they have filters or not and whether or not the filter conditions evaluate to true."
  56096. },
  56097. "image-filters": {
  56098. "css": "image-filters",
  56099. "default-value": "none",
  56100. "default-meaning": "no filters",
  56101. "type": "functions",
  56102. "functions": [
  56103. ["agg-stack-blur", 2],
  56104. ["emboss", 0],
  56105. ["blur", 0],
  56106. ["gray", 0],
  56107. ["sobel", 0],
  56108. ["edge-detect", 0],
  56109. ["x-gradient", 0],
  56110. ["y-gradient", 0],
  56111. ["invert", 0],
  56112. ["sharpen", 0]
  56113. ],
  56114. "doc": "A list of image filters."
  56115. },
  56116. "comp-op": {
  56117. "css": "comp-op",
  56118. "default-value": "src-over",
  56119. "default-meaning": "add the current layer on top of other layers",
  56120. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  56121. "type": ["clear",
  56122. "src",
  56123. "dst",
  56124. "src-over",
  56125. "dst-over",
  56126. "src-in",
  56127. "dst-in",
  56128. "src-out",
  56129. "dst-out",
  56130. "src-atop",
  56131. "dst-atop",
  56132. "xor",
  56133. "plus",
  56134. "minus",
  56135. "multiply",
  56136. "screen",
  56137. "overlay",
  56138. "darken",
  56139. "lighten",
  56140. "color-dodge",
  56141. "color-burn",
  56142. "hard-light",
  56143. "soft-light",
  56144. "difference",
  56145. "exclusion",
  56146. "contrast",
  56147. "invert",
  56148. "invert-rgb",
  56149. "grain-merge",
  56150. "grain-extract",
  56151. "hue",
  56152. "saturation",
  56153. "color",
  56154. "value"
  56155. ]
  56156. },
  56157. "opacity": {
  56158. "css": "opacity",
  56159. "type": "float",
  56160. "doc": "An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)",
  56161. "default-value": 1,
  56162. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  56163. }
  56164. },
  56165. "layer": {
  56166. "name": {
  56167. "default-value": "",
  56168. "type": "string",
  56169. "required": true,
  56170. "default-meaning": "No layer name has been provided",
  56171. "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"
  56172. },
  56173. "srs": {
  56174. "default-value": "",
  56175. "type": "string",
  56176. "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs",
  56177. "doc": "The spatial reference system definition for the layer, aka the projection. Can either be a proj4 literal string like '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' or, if the proper proj4 epsg/nad/etc identifier files are installed, a string that uses an id like: '+init=epsg:4326'"
  56178. },
  56179. "status": {
  56180. "default-value": true,
  56181. "type": "boolean",
  56182. "default-meaning": "This layer will be marked as active and available for processing",
  56183. "doc": "A property that can be set to false to disable this layer from being processed"
  56184. },
  56185. "minzoom": {
  56186. "default-value": "0",
  56187. "type": "float",
  56188. "default-meaning": "The layer will be visible at the minimum possible scale",
  56189. "doc": "The minimum scale denominator that this layer will be visible at. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"
  56190. },
  56191. "maxzoom": {
  56192. "default-value": "1.79769e+308",
  56193. "type": "float",
  56194. "default-meaning": "The layer will be visible at the maximum possible scale",
  56195. "doc": "The maximum scale denominator that this layer will be visible at. The default is the numeric limit of the C++ double type, which may vary slightly by system, but is likely a massive number like 1.79769e+308 and ensures that this layer will always be visible unless the value is reduced. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"
  56196. },
  56197. "queryable": {
  56198. "default-value": false,
  56199. "type": "boolean",
  56200. "default-meaning": "The layer will not be available for the direct querying of data values",
  56201. "doc": "This property was added for GetFeatureInfo/WMS compatibility and is rarely used. It is off by default meaning that in a WMS context the layer will not be able to be queried unless the property is explicitly set to true"
  56202. },
  56203. "clear-label-cache": {
  56204. "default-value": false,
  56205. "type": "boolean",
  56206. "default-meaning": "The renderer's collision detector cache (used for avoiding duplicate labels and overlapping markers) will not be cleared immediately before processing this layer",
  56207. "doc": "This property, by default off, can be enabled to allow a user to clear the collision detector cache before a given layer is processed. This may be desirable to ensure that a given layers data shows up on the map even if it normally would not because of collisions with previously rendered labels or markers"
  56208. },
  56209. "group-by": {
  56210. "default-value": "",
  56211. "type": "string",
  56212. "default-meaning": "No special layer grouping will be used during rendering",
  56213. "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering"
  56214. },
  56215. "buffer-size": {
  56216. "default-value": "0",
  56217. "type": "float",
  56218. "default-meaning": "No buffer will be used",
  56219. "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"
  56220. },
  56221. "maximum-extent": {
  56222. "default-value": "none",
  56223. "type": "bbox",
  56224. "default-meaning": "No clipping extent will be used",
  56225. "doc": "An extent to be used to limit the bounds used to query this specific layer data during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Layer."
  56226. }
  56227. },
  56228. "symbolizers": {
  56229. "*": {
  56230. "image-filters": {
  56231. "css": "image-filters",
  56232. "default-value": "none",
  56233. "default-meaning": "no filters",
  56234. "type": "functions",
  56235. "functions": [
  56236. ["agg-stack-blur", 2],
  56237. ["emboss", 0],
  56238. ["blur", 0],
  56239. ["gray", 0],
  56240. ["sobel", 0],
  56241. ["edge-detect", 0],
  56242. ["x-gradient", 0],
  56243. ["y-gradient", 0],
  56244. ["invert", 0],
  56245. ["sharpen", 0]
  56246. ],
  56247. "doc": "A list of image filters."
  56248. },
  56249. "comp-op": {
  56250. "css": "comp-op",
  56251. "default-value": "src-over",
  56252. "default-meaning": "add the current layer on top of other layers",
  56253. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  56254. "type": ["clear",
  56255. "src",
  56256. "dst",
  56257. "src-over",
  56258. "dst-over",
  56259. "src-in",
  56260. "dst-in",
  56261. "src-out",
  56262. "dst-out",
  56263. "src-atop",
  56264. "dst-atop",
  56265. "xor",
  56266. "plus",
  56267. "minus",
  56268. "multiply",
  56269. "screen",
  56270. "overlay",
  56271. "darken",
  56272. "lighten",
  56273. "color-dodge",
  56274. "color-burn",
  56275. "hard-light",
  56276. "soft-light",
  56277. "difference",
  56278. "exclusion",
  56279. "contrast",
  56280. "invert",
  56281. "invert-rgb",
  56282. "grain-merge",
  56283. "grain-extract",
  56284. "hue",
  56285. "saturation",
  56286. "color",
  56287. "value"
  56288. ]
  56289. },
  56290. "opacity": {
  56291. "css": "opacity",
  56292. "type": "float",
  56293. "doc": "An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)",
  56294. "default-value": 1,
  56295. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  56296. }
  56297. },
  56298. "map": {
  56299. "background-color": {
  56300. "css": "background-color",
  56301. "default-value": "none",
  56302. "default-meaning": "transparent",
  56303. "type": "color",
  56304. "doc": "Map Background color"
  56305. },
  56306. "background-image": {
  56307. "css": "background-image",
  56308. "type": "uri",
  56309. "default-value": "",
  56310. "default-meaning": "transparent",
  56311. "doc": "An image that is repeated below all features on a map as a background.",
  56312. "description": "Map Background image"
  56313. },
  56314. "srs": {
  56315. "css": "srs",
  56316. "type": "string",
  56317. "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
  56318. "default-meaning": "The proj4 literal of EPSG:4326 is assumed to be the Map's spatial reference and all data from layers within this map will be plotted using this coordinate system. If any layers do not declare an srs value then they will be assumed to be in the same srs as the Map and not transformations will be needed to plot them in the Map's coordinate space",
  56319. "doc": "Map spatial reference (proj4 string)"
  56320. },
  56321. "buffer-size": {
  56322. "css": "buffer-size",
  56323. "default-value": "0",
  56324. "type": "float",
  56325. "default-meaning": "No buffer will be used",
  56326. "doc": "Extra tolerance around the map (in pixels) used to ensure labels crossing tile boundaries are equally rendered in each tile (e.g. cut in each tile). Not intended to be used in combination with \"avoid-edges\"."
  56327. },
  56328. "maximum-extent": {
  56329. "css": "",
  56330. "default-value": "none",
  56331. "type": "bbox",
  56332. "default-meaning": "No clipping extent will be used",
  56333. "doc": "An extent to be used to limit the bounds used to query all layers during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Map."
  56334. },
  56335. "base": {
  56336. "css": "base",
  56337. "default-value": "",
  56338. "default-meaning": "This base path defaults to an empty string meaning that any relative paths to files referenced in styles or layers will be interpreted relative to the application process.",
  56339. "type": "string",
  56340. "doc": "Any relative paths used to reference files will be understood as relative to this directory path if the map is loaded from an in memory object rather than from the filesystem. If the map is loaded from the filesystem and this option is not provided it will be set to the directory of the stylesheet."
  56341. },
  56342. "paths-from-xml": {
  56343. "css": "",
  56344. "default-value": true,
  56345. "default-meaning": "Paths read from XML will be interpreted from the location of the XML",
  56346. "type": "boolean",
  56347. "doc": "value to control whether paths in the XML will be interpreted from the location of the XML or from the working directory of the program that calls load_map()"
  56348. },
  56349. "minimum-version": {
  56350. "css": "",
  56351. "default-value": "none",
  56352. "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility",
  56353. "type": "string",
  56354. "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"
  56355. },
  56356. "font-directory": {
  56357. "css": "font-directory",
  56358. "type": "uri",
  56359. "default-value": "none",
  56360. "default-meaning": "No map-specific fonts will be registered",
  56361. "doc": "Path to a directory which holds fonts which should be registered when the Map is loaded (in addition to any fonts that may be automatically registered)."
  56362. }
  56363. },
  56364. "polygon": {
  56365. "fill": {
  56366. "css": "polygon-fill",
  56367. "type": "color",
  56368. "default-value": "rgba(128,128,128,1)",
  56369. "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
  56370. "doc": "Fill color to assign to a polygon"
  56371. },
  56372. "fill-opacity": {
  56373. "css": "polygon-opacity",
  56374. "type": "float",
  56375. "doc": "The opacity of the polygon",
  56376. "default-value": 1,
  56377. "default-meaning": "opaque"
  56378. },
  56379. "gamma": {
  56380. "css": "polygon-gamma",
  56381. "type": "float",
  56382. "default-value": 1,
  56383. "default-meaning": "fully antialiased",
  56384. "range": "0-1",
  56385. "doc": "Level of antialiasing of polygon edges"
  56386. },
  56387. "gamma-method": {
  56388. "css": "polygon-gamma-method",
  56389. "type": [
  56390. "power",
  56391. "linear",
  56392. "none",
  56393. "threshold",
  56394. "multiply"
  56395. ],
  56396. "default-value": "power",
  56397. "default-meaning": "pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",
  56398. "doc": "An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"
  56399. },
  56400. "clip": {
  56401. "css": "polygon-clip",
  56402. "type": "boolean",
  56403. "default-value": true,
  56404. "default-meaning": "geometry will be clipped to map bounds before rendering",
  56405. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  56406. },
  56407. "smooth": {
  56408. "css": "polygon-smooth",
  56409. "type": "float",
  56410. "default-value": 0,
  56411. "default-meaning": "no smoothing",
  56412. "range": "0-1",
  56413. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  56414. },
  56415. "geometry-transform": {
  56416. "css": "polygon-geometry-transform",
  56417. "type": "functions",
  56418. "default-value": "none",
  56419. "default-meaning": "geometry will not be transformed",
  56420. "doc": "Allows transformation functions to be applied to the geometry.",
  56421. "functions": [
  56422. ["matrix", 6],
  56423. ["translate", 2],
  56424. ["scale", 2],
  56425. ["rotate", 3],
  56426. ["skewX", 1],
  56427. ["skewY", 1]
  56428. ]
  56429. },
  56430. "comp-op": {
  56431. "css": "polygon-comp-op",
  56432. "default-value": "src-over",
  56433. "default-meaning": "add the current symbolizer on top of other symbolizer",
  56434. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  56435. "type": ["clear",
  56436. "src",
  56437. "dst",
  56438. "src-over",
  56439. "dst-over",
  56440. "src-in",
  56441. "dst-in",
  56442. "src-out",
  56443. "dst-out",
  56444. "src-atop",
  56445. "dst-atop",
  56446. "xor",
  56447. "plus",
  56448. "minus",
  56449. "multiply",
  56450. "screen",
  56451. "overlay",
  56452. "darken",
  56453. "lighten",
  56454. "color-dodge",
  56455. "color-burn",
  56456. "hard-light",
  56457. "soft-light",
  56458. "difference",
  56459. "exclusion",
  56460. "contrast",
  56461. "invert",
  56462. "invert-rgb",
  56463. "grain-merge",
  56464. "grain-extract",
  56465. "hue",
  56466. "saturation",
  56467. "color",
  56468. "value"
  56469. ]
  56470. }
  56471. },
  56472. "line": {
  56473. "stroke": {
  56474. "css": "line-color",
  56475. "default-value": "rgba(0,0,0,1)",
  56476. "type": "color",
  56477. "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
  56478. "doc": "The color of a drawn line"
  56479. },
  56480. "stroke-width": {
  56481. "css": "line-width",
  56482. "default-value": 1,
  56483. "type": "float",
  56484. "doc": "The width of a line in pixels"
  56485. },
  56486. "stroke-opacity": {
  56487. "css": "line-opacity",
  56488. "default-value": 1,
  56489. "type": "float",
  56490. "default-meaning": "opaque",
  56491. "doc": "The opacity of a line"
  56492. },
  56493. "stroke-linejoin": {
  56494. "css": "line-join",
  56495. "default-value": "miter",
  56496. "type": [
  56497. "miter",
  56498. "round",
  56499. "bevel"
  56500. ],
  56501. "doc": "The behavior of lines when joining"
  56502. },
  56503. "stroke-linecap": {
  56504. "css": "line-cap",
  56505. "default-value": "butt",
  56506. "type": [
  56507. "butt",
  56508. "round",
  56509. "square"
  56510. ],
  56511. "doc": "The display of line endings"
  56512. },
  56513. "stroke-gamma": {
  56514. "css": "line-gamma",
  56515. "type": "float",
  56516. "default-value": 1,
  56517. "default-meaning": "fully antialiased",
  56518. "range": "0-1",
  56519. "doc": "Level of antialiasing of stroke line"
  56520. },
  56521. "stroke-gamma-method": {
  56522. "css": "line-gamma-method",
  56523. "type": [
  56524. "power",
  56525. "linear",
  56526. "none",
  56527. "threshold",
  56528. "multiply"
  56529. ],
  56530. "default-value": "power",
  56531. "default-meaning": "pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",
  56532. "doc": "An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"
  56533. },
  56534. "stroke-dasharray": {
  56535. "css": "line-dasharray",
  56536. "type": "numbers",
  56537. "doc": "A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported for more complex patterns.",
  56538. "default-value": "none",
  56539. "default-meaning": "solid line"
  56540. },
  56541. "stroke-dashoffset": {
  56542. "css": "line-dash-offset",
  56543. "type": "numbers",
  56544. "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)",
  56545. "default-value": "none",
  56546. "default-meaning": "solid line"
  56547. },
  56548. "stroke-miterlimit": {
  56549. "css": "line-miterlimit",
  56550. "type": "float",
  56551. "doc": "The limit on the ratio of the miter length to the stroke-width. Used to automatically convert miter joins to bevel joins for sharp angles to avoid the miter extending beyond the thickness of the stroking path. Normally will not need to be set, but a larger value can sometimes help avoid jaggy artifacts.",
  56552. "default-value": 4.0,
  56553. "default-meaning": "Will auto-convert miters to bevel line joins when theta is less than 29 degrees as per the SVG spec: 'miterLength / stroke-width = 1 / sin ( theta / 2 )'"
  56554. },
  56555. "clip": {
  56556. "css": "line-clip",
  56557. "type": "boolean",
  56558. "default-value": true,
  56559. "default-meaning": "geometry will be clipped to map bounds before rendering",
  56560. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  56561. },
  56562. "smooth": {
  56563. "css": "line-smooth",
  56564. "type": "float",
  56565. "default-value": 0,
  56566. "default-meaning": "no smoothing",
  56567. "range": "0-1",
  56568. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  56569. },
  56570. "offset": {
  56571. "css": "line-offset",
  56572. "type": "float",
  56573. "default-value": 0,
  56574. "default-meaning": "no offset",
  56575. "doc": "Offsets a line a number of pixels parallel to its actual path. Postive values move the line left, negative values move it right (relative to the directionality of the line)."
  56576. },
  56577. "rasterizer": {
  56578. "css": "line-rasterizer",
  56579. "type": [
  56580. "full",
  56581. "fast"
  56582. ],
  56583. "default-value": "full",
  56584. "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."
  56585. },
  56586. "geometry-transform": {
  56587. "css": "line-geometry-transform",
  56588. "type": "functions",
  56589. "default-value": "none",
  56590. "default-meaning": "geometry will not be transformed",
  56591. "doc": "Allows transformation functions to be applied to the geometry.",
  56592. "functions": [
  56593. ["matrix", 6],
  56594. ["translate", 2],
  56595. ["scale", 2],
  56596. ["rotate", 3],
  56597. ["skewX", 1],
  56598. ["skewY", 1]
  56599. ]
  56600. },
  56601. "comp-op": {
  56602. "css": "line-comp-op",
  56603. "default-value": "src-over",
  56604. "default-meaning": "add the current symbolizer on top of other symbolizer",
  56605. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  56606. "type": ["clear",
  56607. "src",
  56608. "dst",
  56609. "src-over",
  56610. "dst-over",
  56611. "src-in",
  56612. "dst-in",
  56613. "src-out",
  56614. "dst-out",
  56615. "src-atop",
  56616. "dst-atop",
  56617. "xor",
  56618. "plus",
  56619. "minus",
  56620. "multiply",
  56621. "screen",
  56622. "overlay",
  56623. "darken",
  56624. "lighten",
  56625. "color-dodge",
  56626. "color-burn",
  56627. "hard-light",
  56628. "soft-light",
  56629. "difference",
  56630. "exclusion",
  56631. "contrast",
  56632. "invert",
  56633. "invert-rgb",
  56634. "grain-merge",
  56635. "grain-extract",
  56636. "hue",
  56637. "saturation",
  56638. "color",
  56639. "value"
  56640. ]
  56641. }
  56642. },
  56643. "markers": {
  56644. "file": {
  56645. "css": "marker-file",
  56646. "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
  56647. "default-value": "",
  56648. "default-meaning": "An ellipse or circle, if width equals height",
  56649. "type": "uri"
  56650. },
  56651. "opacity": {
  56652. "css": "marker-opacity",
  56653. "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke",
  56654. "default-value": 1,
  56655. "default-meaning": "The stroke-opacity and fill-opacity will be used",
  56656. "type": "float"
  56657. },
  56658. "fill-opacity": {
  56659. "css": "marker-fill-opacity",
  56660. "doc": "The fill opacity of the marker",
  56661. "default-value": 1,
  56662. "default-meaning": "opaque",
  56663. "type": "float"
  56664. },
  56665. "stroke": {
  56666. "css": "marker-line-color",
  56667. "doc": "The color of the stroke around a marker shape.",
  56668. "default-value": "black",
  56669. "type": "color"
  56670. },
  56671. "stroke-width": {
  56672. "css": "marker-line-width",
  56673. "doc": "The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.",
  56674. "type": "float"
  56675. },
  56676. "stroke-opacity": {
  56677. "css": "marker-line-opacity",
  56678. "default-value": 1,
  56679. "default-meaning": "opaque",
  56680. "doc": "The opacity of a line",
  56681. "type": "float"
  56682. },
  56683. "placement": {
  56684. "css": "marker-placement",
  56685. "type": [
  56686. "point",
  56687. "line",
  56688. "interior"
  56689. ],
  56690. "default-value": "point",
  56691. "default-meaning": "Place markers at the center point (centroid) of the geometry",
  56692. "doc": "Attempt to place markers on a point, in the center of a polygon, or if markers-placement:line, then multiple times along a line. 'interior' placement can be used to ensure that points placed on polygons are forced to be inside the polygon interior"
  56693. },
  56694. "multi-policy": {
  56695. "css": "marker-multi-policy",
  56696. "type": [
  56697. "each",
  56698. "whole",
  56699. "largest"
  56700. ],
  56701. "default-value": "each",
  56702. "default-meaning": "If a feature contains multiple geometries and the placement type is either point or interior then a marker will be rendered for each",
  56703. "doc": "A special setting to allow the user to control rendering behavior for 'multi-geometries' (when a feature contains multiple geometries). This setting does not apply to markers placed along lines. The 'each' policy is default and means all geometries will get a marker. The 'whole' policy means that the aggregate centroid between all geometries will be used. The 'largest' policy means that only the largest (by bounding box areas) feature will get a rendered marker (this is how text labeling behaves by default)."
  56704. },
  56705. "marker-type": {
  56706. "css": "marker-type",
  56707. "type": [
  56708. "arrow",
  56709. "ellipse"
  56710. ],
  56711. "default-value": "ellipse",
  56712. "doc": "The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an arrow or an ellipse (a circle if height is equal to width)"
  56713. },
  56714. "width": {
  56715. "css": "marker-width",
  56716. "default-value": 10,
  56717. "doc": "The width of the marker, if using one of the default types.",
  56718. "type": "expression"
  56719. },
  56720. "height": {
  56721. "css": "marker-height",
  56722. "default-value": 10,
  56723. "doc": "The height of the marker, if using one of the default types.",
  56724. "type": "expression"
  56725. },
  56726. "fill": {
  56727. "css": "marker-fill",
  56728. "default-value": "blue",
  56729. "doc": "The color of the area of the marker.",
  56730. "type": "color"
  56731. },
  56732. "allow-overlap": {
  56733. "css": "marker-allow-overlap",
  56734. "type": "boolean",
  56735. "default-value": false,
  56736. "doc": "Control whether overlapping markers are shown or hidden.",
  56737. "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown."
  56738. },
  56739. "ignore-placement": {
  56740. "css": "marker-ignore-placement",
  56741. "type": "boolean",
  56742. "default-value": false,
  56743. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  56744. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  56745. },
  56746. "spacing": {
  56747. "css": "marker-spacing",
  56748. "doc": "Space between repeated labels",
  56749. "default-value": 100,
  56750. "type": "float"
  56751. },
  56752. "max-error": {
  56753. "css": "marker-max-error",
  56754. "type": "float",
  56755. "default-value": 0.2,
  56756. "doc": "The maximum difference between actual marker placement and the marker-spacing parameter. Setting a high value can allow the renderer to try to resolve placement conflicts with other symbolizers."
  56757. },
  56758. "transform": {
  56759. "css": "marker-transform",
  56760. "type": "functions",
  56761. "functions": [
  56762. ["matrix", 6],
  56763. ["translate", 2],
  56764. ["scale", 2],
  56765. ["rotate", 3],
  56766. ["skewX", 1],
  56767. ["skewY", 1]
  56768. ],
  56769. "default-value": "",
  56770. "default-meaning": "No transformation",
  56771. "doc": "SVG transformation definition"
  56772. },
  56773. "clip": {
  56774. "css": "marker-clip",
  56775. "type": "boolean",
  56776. "default-value": true,
  56777. "default-meaning": "geometry will be clipped to map bounds before rendering",
  56778. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  56779. },
  56780. "smooth": {
  56781. "css": "marker-smooth",
  56782. "type": "float",
  56783. "default-value": 0,
  56784. "default-meaning": "no smoothing",
  56785. "range": "0-1",
  56786. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  56787. },
  56788. "geometry-transform": {
  56789. "css": "marker-geometry-transform",
  56790. "type": "functions",
  56791. "default-value": "none",
  56792. "default-meaning": "geometry will not be transformed",
  56793. "doc": "Allows transformation functions to be applied to the geometry.",
  56794. "functions": [
  56795. ["matrix", 6],
  56796. ["translate", 2],
  56797. ["scale", 2],
  56798. ["rotate", 3],
  56799. ["skewX", 1],
  56800. ["skewY", 1]
  56801. ]
  56802. },
  56803. "comp-op": {
  56804. "css": "marker-comp-op",
  56805. "default-value": "src-over",
  56806. "default-meaning": "add the current symbolizer on top of other symbolizer",
  56807. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  56808. "type": ["clear",
  56809. "src",
  56810. "dst",
  56811. "src-over",
  56812. "dst-over",
  56813. "src-in",
  56814. "dst-in",
  56815. "src-out",
  56816. "dst-out",
  56817. "src-atop",
  56818. "dst-atop",
  56819. "xor",
  56820. "plus",
  56821. "minus",
  56822. "multiply",
  56823. "screen",
  56824. "overlay",
  56825. "darken",
  56826. "lighten",
  56827. "color-dodge",
  56828. "color-burn",
  56829. "hard-light",
  56830. "soft-light",
  56831. "difference",
  56832. "exclusion",
  56833. "contrast",
  56834. "invert",
  56835. "invert-rgb",
  56836. "grain-merge",
  56837. "grain-extract",
  56838. "hue",
  56839. "saturation",
  56840. "color",
  56841. "value"
  56842. ]
  56843. }
  56844. },
  56845. "shield": {
  56846. "name": {
  56847. "css": "shield-name",
  56848. "type": "expression",
  56849. "serialization": "content",
  56850. "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]"
  56851. },
  56852. "file": {
  56853. "css": "shield-file",
  56854. "required": true,
  56855. "type": "uri",
  56856. "default-value": "none",
  56857. "doc": "Image file to render behind the shield text"
  56858. },
  56859. "face-name": {
  56860. "css": "shield-face-name",
  56861. "type": "string",
  56862. "validate": "font",
  56863. "doc": "Font name and style to use for the shield text",
  56864. "default-value": "",
  56865. "required": true
  56866. },
  56867. "unlock-image": {
  56868. "css": "shield-unlock-image",
  56869. "type": "boolean",
  56870. "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image",
  56871. "default-value": false,
  56872. "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning."
  56873. },
  56874. "size": {
  56875. "css": "shield-size",
  56876. "type": "float",
  56877. "doc": "The size of the shield text in pixels"
  56878. },
  56879. "fill": {
  56880. "css": "shield-fill",
  56881. "type": "color",
  56882. "doc": "The color of the shield text"
  56883. },
  56884. "placement": {
  56885. "css": "shield-placement",
  56886. "type": [
  56887. "point",
  56888. "line",
  56889. "vertex",
  56890. "interior"
  56891. ],
  56892. "default-value": "point",
  56893. "doc": "How this shield should be placed. Point placement attempts to place it on top of points, line places along lines multiple times per feature, vertex places on the vertexes of polygons, and interior attempts to place inside of polygons."
  56894. },
  56895. "avoid-edges": {
  56896. "css": "shield-avoid-edges",
  56897. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  56898. "type": "boolean",
  56899. "default-value": false
  56900. },
  56901. "allow-overlap": {
  56902. "css": "shield-allow-overlap",
  56903. "type": "boolean",
  56904. "default-value": false,
  56905. "doc": "Control whether overlapping shields are shown or hidden.",
  56906. "default-meaning": "Do not allow shields to overlap with other map elements already placed."
  56907. },
  56908. "minimum-distance": {
  56909. "css": "shield-min-distance",
  56910. "type": "float",
  56911. "default-value": 0,
  56912. "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
  56913. },
  56914. "spacing": {
  56915. "css": "shield-spacing",
  56916. "type": "float",
  56917. "default-value": 0,
  56918. "doc": "The spacing between repeated occurrences of the same shield on a line"
  56919. },
  56920. "minimum-padding": {
  56921. "css": "shield-min-padding",
  56922. "default-value": 0,
  56923. "doc": "Determines the minimum amount of padding that a shield gets relative to other shields",
  56924. "type": "float"
  56925. },
  56926. "wrap-width": {
  56927. "css": "shield-wrap-width",
  56928. "type": "unsigned",
  56929. "default-value": 0,
  56930. "doc": "Length of a chunk of text in characters before wrapping text"
  56931. },
  56932. "wrap-before": {
  56933. "css": "shield-wrap-before",
  56934. "type": "boolean",
  56935. "default-value": false,
  56936. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  56937. },
  56938. "wrap-character": {
  56939. "css": "shield-wrap-character",
  56940. "type": "string",
  56941. "default-value": " ",
  56942. "doc": "Use this character instead of a space to wrap long names."
  56943. },
  56944. "halo-fill": {
  56945. "css": "shield-halo-fill",
  56946. "type": "color",
  56947. "default-value": "#FFFFFF",
  56948. "default-meaning": "white",
  56949. "doc": "Specifies the color of the halo around the text."
  56950. },
  56951. "halo-radius": {
  56952. "css": "shield-halo-radius",
  56953. "doc": "Specify the radius of the halo in pixels",
  56954. "default-value": 0,
  56955. "default-meaning": "no halo",
  56956. "type": "float"
  56957. },
  56958. "character-spacing": {
  56959. "css": "shield-character-spacing",
  56960. "type": "unsigned",
  56961. "default-value": 0,
  56962. "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."
  56963. },
  56964. "line-spacing": {
  56965. "css": "shield-line-spacing",
  56966. "doc": "Vertical spacing between lines of multiline labels (in pixels)",
  56967. "type": "unsigned"
  56968. },
  56969. "dx": {
  56970. "css": "shield-text-dx",
  56971. "type": "float",
  56972. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  56973. "default-value": 0
  56974. },
  56975. "dy": {
  56976. "css": "shield-text-dy",
  56977. "type": "float",
  56978. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  56979. "default-value": 0
  56980. },
  56981. "shield-dx": {
  56982. "css": "shield-dx",
  56983. "type": "float",
  56984. "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  56985. "default-value": 0
  56986. },
  56987. "shield-dy": {
  56988. "css": "shield-dy",
  56989. "type": "float",
  56990. "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  56991. "default-value": 0
  56992. },
  56993. "opacity": {
  56994. "css": "shield-opacity",
  56995. "type": "float",
  56996. "doc": "(Default 1.0) - opacity of the image used for the shield",
  56997. "default-value": 1
  56998. },
  56999. "text-opacity": {
  57000. "css": "shield-text-opacity",
  57001. "type": "float",
  57002. "doc": "(Default 1.0) - opacity of the text placed on top of the shield",
  57003. "default-value": 1
  57004. },
  57005. "horizontal-alignment": {
  57006. "css": "shield-horizontal-alignment",
  57007. "type": [
  57008. "left",
  57009. "middle",
  57010. "right",
  57011. "auto"
  57012. ],
  57013. "doc": "The shield's horizontal alignment from its centerpoint",
  57014. "default-value": "auto"
  57015. },
  57016. "vertical-alignment": {
  57017. "css": "shield-vertical-alignment",
  57018. "type": [
  57019. "top",
  57020. "middle",
  57021. "bottom",
  57022. "auto"
  57023. ],
  57024. "doc": "The shield's vertical alignment from its centerpoint",
  57025. "default-value": "middle"
  57026. },
  57027. "text-transform": {
  57028. "css": "shield-text-transform",
  57029. "type": [
  57030. "none",
  57031. "uppercase",
  57032. "lowercase",
  57033. "capitalize"
  57034. ],
  57035. "doc": "Transform the case of the characters",
  57036. "default-value": "none"
  57037. },
  57038. "justify-alignment": {
  57039. "css": "shield-justify-alignment",
  57040. "type": [
  57041. "left",
  57042. "center",
  57043. "right",
  57044. "auto"
  57045. ],
  57046. "doc": "Define how text in a shield's label is justified",
  57047. "default-value": "auto"
  57048. },
  57049. "clip": {
  57050. "css": "shield-clip",
  57051. "type": "boolean",
  57052. "default-value": true,
  57053. "default-meaning": "geometry will be clipped to map bounds before rendering",
  57054. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  57055. },
  57056. "comp-op": {
  57057. "css": "shield-comp-op",
  57058. "default-value": "src-over",
  57059. "default-meaning": "add the current symbolizer on top of other symbolizer",
  57060. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  57061. "type": ["clear",
  57062. "src",
  57063. "dst",
  57064. "src-over",
  57065. "dst-over",
  57066. "src-in",
  57067. "dst-in",
  57068. "src-out",
  57069. "dst-out",
  57070. "src-atop",
  57071. "dst-atop",
  57072. "xor",
  57073. "plus",
  57074. "minus",
  57075. "multiply",
  57076. "screen",
  57077. "overlay",
  57078. "darken",
  57079. "lighten",
  57080. "color-dodge",
  57081. "color-burn",
  57082. "hard-light",
  57083. "soft-light",
  57084. "difference",
  57085. "exclusion",
  57086. "contrast",
  57087. "invert",
  57088. "invert-rgb",
  57089. "grain-merge",
  57090. "grain-extract",
  57091. "hue",
  57092. "saturation",
  57093. "color",
  57094. "value"
  57095. ]
  57096. }
  57097. },
  57098. "line-pattern": {
  57099. "file": {
  57100. "css": "line-pattern-file",
  57101. "type": "uri",
  57102. "default-value": "none",
  57103. "required": true,
  57104. "doc": "An image file to be repeated and warped along a line"
  57105. },
  57106. "clip": {
  57107. "css": "line-pattern-clip",
  57108. "type": "boolean",
  57109. "default-value": true,
  57110. "default-meaning": "geometry will be clipped to map bounds before rendering",
  57111. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  57112. },
  57113. "smooth": {
  57114. "css": "line-pattern-smooth",
  57115. "type": "float",
  57116. "default-value": 0,
  57117. "default-meaning": "no smoothing",
  57118. "range": "0-1",
  57119. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  57120. },
  57121. "geometry-transform": {
  57122. "css": "line-pattern-geometry-transform",
  57123. "type": "functions",
  57124. "default-value": "none",
  57125. "default-meaning": "geometry will not be transformed",
  57126. "doc": "Allows transformation functions to be applied to the geometry.",
  57127. "functions": [
  57128. ["matrix", 6],
  57129. ["translate", 2],
  57130. ["scale", 2],
  57131. ["rotate", 3],
  57132. ["skewX", 1],
  57133. ["skewY", 1]
  57134. ]
  57135. },
  57136. "comp-op": {
  57137. "css": "line-pattern-comp-op",
  57138. "default-value": "src-over",
  57139. "default-meaning": "add the current symbolizer on top of other symbolizer",
  57140. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  57141. "type": ["clear",
  57142. "src",
  57143. "dst",
  57144. "src-over",
  57145. "dst-over",
  57146. "src-in",
  57147. "dst-in",
  57148. "src-out",
  57149. "dst-out",
  57150. "src-atop",
  57151. "dst-atop",
  57152. "xor",
  57153. "plus",
  57154. "minus",
  57155. "multiply",
  57156. "screen",
  57157. "overlay",
  57158. "darken",
  57159. "lighten",
  57160. "color-dodge",
  57161. "color-burn",
  57162. "hard-light",
  57163. "soft-light",
  57164. "difference",
  57165. "exclusion",
  57166. "contrast",
  57167. "invert",
  57168. "invert-rgb",
  57169. "grain-merge",
  57170. "grain-extract",
  57171. "hue",
  57172. "saturation",
  57173. "color",
  57174. "value"
  57175. ]
  57176. }
  57177. },
  57178. "polygon-pattern": {
  57179. "file": {
  57180. "css": "polygon-pattern-file",
  57181. "type": "uri",
  57182. "default-value": "none",
  57183. "required": true,
  57184. "doc": "Image to use as a repeated pattern fill within a polygon"
  57185. },
  57186. "alignment": {
  57187. "css": "polygon-pattern-alignment",
  57188. "type": [
  57189. "local",
  57190. "global"
  57191. ],
  57192. "default-value": "local",
  57193. "doc": "Specify whether to align pattern fills to the layer or to the map."
  57194. },
  57195. "gamma": {
  57196. "css": "polygon-pattern-gamma",
  57197. "type": "float",
  57198. "default-value": 1,
  57199. "default-meaning": "fully antialiased",
  57200. "range": "0-1",
  57201. "doc": "Level of antialiasing of polygon pattern edges"
  57202. },
  57203. "opacity": {
  57204. "css": "polygon-pattern-opacity",
  57205. "type": "float",
  57206. "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern",
  57207. "default-value": 1,
  57208. "default-meaning": "The image is rendered without modifications"
  57209. },
  57210. "clip": {
  57211. "css": "polygon-pattern-clip",
  57212. "type": "boolean",
  57213. "default-value": true,
  57214. "default-meaning": "geometry will be clipped to map bounds before rendering",
  57215. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  57216. },
  57217. "smooth": {
  57218. "css": "polygon-pattern-smooth",
  57219. "type": "float",
  57220. "default-value": 0,
  57221. "default-meaning": "no smoothing",
  57222. "range": "0-1",
  57223. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  57224. },
  57225. "geometry-transform": {
  57226. "css": "polygon-pattern-geometry-transform",
  57227. "type": "functions",
  57228. "default-value": "none",
  57229. "default-meaning": "geometry will not be transformed",
  57230. "doc": "Allows transformation functions to be applied to the geometry.",
  57231. "functions": [
  57232. ["matrix", 6],
  57233. ["translate", 2],
  57234. ["scale", 2],
  57235. ["rotate", 3],
  57236. ["skewX", 1],
  57237. ["skewY", 1]
  57238. ]
  57239. },
  57240. "comp-op": {
  57241. "css": "polygon-pattern-comp-op",
  57242. "default-value": "src-over",
  57243. "default-meaning": "add the current symbolizer on top of other symbolizer",
  57244. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  57245. "type": ["clear",
  57246. "src",
  57247. "dst",
  57248. "src-over",
  57249. "dst-over",
  57250. "src-in",
  57251. "dst-in",
  57252. "src-out",
  57253. "dst-out",
  57254. "src-atop",
  57255. "dst-atop",
  57256. "xor",
  57257. "plus",
  57258. "minus",
  57259. "multiply",
  57260. "screen",
  57261. "overlay",
  57262. "darken",
  57263. "lighten",
  57264. "color-dodge",
  57265. "color-burn",
  57266. "hard-light",
  57267. "soft-light",
  57268. "difference",
  57269. "exclusion",
  57270. "contrast",
  57271. "invert",
  57272. "invert-rgb",
  57273. "grain-merge",
  57274. "grain-extract",
  57275. "hue",
  57276. "saturation",
  57277. "color",
  57278. "value"
  57279. ]
  57280. }
  57281. },
  57282. "raster": {
  57283. "opacity": {
  57284. "css": "raster-opacity",
  57285. "default-value": 1,
  57286. "default-meaning": "opaque",
  57287. "type": "float",
  57288. "doc": "The opacity of the raster symbolizer on top of other symbolizers."
  57289. },
  57290. "filter-factor": {
  57291. "css": "raster-filter-factor",
  57292. "default-value": -1,
  57293. "default-meaning": "Allow the datasource to choose appropriate downscaling.",
  57294. "type": "float",
  57295. "doc": "This is used by the Raster or Gdal datasources to pre-downscale images using overviews. Higher numbers can sometimes cause much better scaled image output, at the cost of speed."
  57296. },
  57297. "scaling": {
  57298. "css": "raster-scaling",
  57299. "type": [
  57300. "near",
  57301. "fast",
  57302. "bilinear",
  57303. "bilinear8",
  57304. "bicubic",
  57305. "spline16",
  57306. "spline36",
  57307. "hanning",
  57308. "hamming",
  57309. "hermite",
  57310. "kaiser",
  57311. "quadric",
  57312. "catrom",
  57313. "gaussian",
  57314. "bessel",
  57315. "mitchell",
  57316. "sinc",
  57317. "lanczos",
  57318. "blackman"
  57319. ],
  57320. "default-value": "near",
  57321. "doc": "The scaling algorithm used to making different resolution versions of this raster layer. Bilinear is a good compromise between speed and accuracy, while lanczos gives the highest quality."
  57322. },
  57323. "mesh-size": {
  57324. "css": "raster-mesh-size",
  57325. "default-value": 16,
  57326. "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image",
  57327. "type": "unsigned",
  57328. "doc": "A reduced resolution mesh is used for raster reprojection, and the total image size is divided by the mesh-size to determine the quality of that mesh. Values for mesh-size larger than the default will result in faster reprojection but might lead to distortion."
  57329. },
  57330. "comp-op": {
  57331. "css": "raster-comp-op",
  57332. "default-value": "src-over",
  57333. "default-meaning": "add the current symbolizer on top of other symbolizer",
  57334. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  57335. "type": ["clear",
  57336. "src",
  57337. "dst",
  57338. "src-over",
  57339. "dst-over",
  57340. "src-in",
  57341. "dst-in",
  57342. "src-out",
  57343. "dst-out",
  57344. "src-atop",
  57345. "dst-atop",
  57346. "xor",
  57347. "plus",
  57348. "minus",
  57349. "multiply",
  57350. "screen",
  57351. "overlay",
  57352. "darken",
  57353. "lighten",
  57354. "color-dodge",
  57355. "color-burn",
  57356. "hard-light",
  57357. "soft-light",
  57358. "difference",
  57359. "exclusion",
  57360. "contrast",
  57361. "invert",
  57362. "invert-rgb",
  57363. "grain-merge",
  57364. "grain-extract",
  57365. "hue",
  57366. "saturation",
  57367. "color",
  57368. "value"
  57369. ]
  57370. }
  57371. },
  57372. "point": {
  57373. "file": {
  57374. "css": "point-file",
  57375. "type": "uri",
  57376. "required": false,
  57377. "default-value": "none",
  57378. "doc": "Image file to represent a point"
  57379. },
  57380. "allow-overlap": {
  57381. "css": "point-allow-overlap",
  57382. "type": "boolean",
  57383. "default-value": false,
  57384. "doc": "Control whether overlapping points are shown or hidden.",
  57385. "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown."
  57386. },
  57387. "ignore-placement": {
  57388. "css": "point-ignore-placement",
  57389. "type": "boolean",
  57390. "default-value": false,
  57391. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  57392. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  57393. },
  57394. "opacity": {
  57395. "css": "point-opacity",
  57396. "type": "float",
  57397. "default-value": 1.0,
  57398. "default-meaning": "Fully opaque",
  57399. "doc": "A value from 0 to 1 to control the opacity of the point"
  57400. },
  57401. "placement": {
  57402. "css": "point-placement",
  57403. "type": [
  57404. "centroid",
  57405. "interior"
  57406. ],
  57407. "doc": "How this point should be placed. Centroid calculates the geometric center of a polygon, which can be outside of it, while interior always places inside of a polygon.",
  57408. "default-value": "centroid"
  57409. },
  57410. "transform": {
  57411. "css": "point-transform",
  57412. "type": "functions",
  57413. "functions": [
  57414. ["matrix", 6],
  57415. ["translate", 2],
  57416. ["scale", 2],
  57417. ["rotate", 3],
  57418. ["skewX", 1],
  57419. ["skewY", 1]
  57420. ],
  57421. "default-value": "",
  57422. "default-meaning": "No transformation",
  57423. "doc": "SVG transformation definition"
  57424. },
  57425. "comp-op": {
  57426. "css": "point-comp-op",
  57427. "default-value": "src-over",
  57428. "default-meaning": "add the current symbolizer on top of other symbolizer",
  57429. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  57430. "type": ["clear",
  57431. "src",
  57432. "dst",
  57433. "src-over",
  57434. "dst-over",
  57435. "src-in",
  57436. "dst-in",
  57437. "src-out",
  57438. "dst-out",
  57439. "src-atop",
  57440. "dst-atop",
  57441. "xor",
  57442. "plus",
  57443. "minus",
  57444. "multiply",
  57445. "screen",
  57446. "overlay",
  57447. "darken",
  57448. "lighten",
  57449. "color-dodge",
  57450. "color-burn",
  57451. "hard-light",
  57452. "soft-light",
  57453. "difference",
  57454. "exclusion",
  57455. "contrast",
  57456. "invert",
  57457. "invert-rgb",
  57458. "grain-merge",
  57459. "grain-extract",
  57460. "hue",
  57461. "saturation",
  57462. "color",
  57463. "value"
  57464. ]
  57465. }
  57466. },
  57467. "text": {
  57468. "name": {
  57469. "css": "text-name",
  57470. "type": "expression",
  57471. "required": true,
  57472. "default-value": "",
  57473. "serialization": "content",
  57474. "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
  57475. },
  57476. "face-name": {
  57477. "css": "text-face-name",
  57478. "type": "string",
  57479. "validate": "font",
  57480. "doc": "Font name and style to render a label in",
  57481. "required": true
  57482. },
  57483. "size": {
  57484. "css": "text-size",
  57485. "type": "float",
  57486. "default-value": 10,
  57487. "doc": "Text size in pixels"
  57488. },
  57489. "text-ratio": {
  57490. "css": "text-ratio",
  57491. "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs",
  57492. "default-value": 0,
  57493. "type": "unsigned"
  57494. },
  57495. "wrap-width": {
  57496. "css": "text-wrap-width",
  57497. "doc": "Length of a chunk of text in characters before wrapping text",
  57498. "default-value": 0,
  57499. "type": "unsigned"
  57500. },
  57501. "wrap-before": {
  57502. "css": "text-wrap-before",
  57503. "type": "boolean",
  57504. "default-value": false,
  57505. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  57506. },
  57507. "wrap-character": {
  57508. "css": "text-wrap-character",
  57509. "type": "string",
  57510. "default-value": " ",
  57511. "doc": "Use this character instead of a space to wrap long text."
  57512. },
  57513. "spacing": {
  57514. "css": "text-spacing",
  57515. "type": "unsigned",
  57516. "doc": "Distance between repeated text labels on a line (aka. label-spacing)"
  57517. },
  57518. "character-spacing": {
  57519. "css": "text-character-spacing",
  57520. "type": "float",
  57521. "default-value": 0,
  57522. "doc": "Horizontal spacing adjustment between characters in pixels"
  57523. },
  57524. "line-spacing": {
  57525. "css": "text-line-spacing",
  57526. "default-value": 0,
  57527. "type": "unsigned",
  57528. "doc": "Vertical spacing adjustment between lines in pixels"
  57529. },
  57530. "label-position-tolerance": {
  57531. "css": "text-label-position-tolerance",
  57532. "default-value": 0,
  57533. "type": "unsigned",
  57534. "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"
  57535. },
  57536. "max-char-angle-delta": {
  57537. "css": "text-max-char-angle-delta",
  57538. "type": "float",
  57539. "default-value": "22.5",
  57540. "doc": "The maximum angle change, in degrees, allowed between adjacent characters in a label. This value internally is converted to radians to the default is 22.5*math.pi/180.0. The higher the value the fewer labels will be placed around around sharp corners."
  57541. },
  57542. "fill": {
  57543. "css": "text-fill",
  57544. "doc": "Specifies the color for the text",
  57545. "default-value": "#000000",
  57546. "type": "color"
  57547. },
  57548. "opacity": {
  57549. "css": "text-opacity",
  57550. "doc": "A number from 0 to 1 specifying the opacity for the text",
  57551. "default-value": 1.0,
  57552. "default-meaning": "Fully opaque",
  57553. "type": "float"
  57554. },
  57555. "halo-fill": {
  57556. "css": "text-halo-fill",
  57557. "type": "color",
  57558. "default-value": "#FFFFFF",
  57559. "default-meaning": "white",
  57560. "doc": "Specifies the color of the halo around the text."
  57561. },
  57562. "halo-radius": {
  57563. "css": "text-halo-radius",
  57564. "doc": "Specify the radius of the halo in pixels",
  57565. "default-value": 0,
  57566. "default-meaning": "no halo",
  57567. "type": "float"
  57568. },
  57569. "dx": {
  57570. "css": "text-dx",
  57571. "type": "float",
  57572. "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  57573. "default-value": 0
  57574. },
  57575. "dy": {
  57576. "css": "text-dy",
  57577. "type": "float",
  57578. "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  57579. "default-value": 0
  57580. },
  57581. "vertical-alignment": {
  57582. "css": "text-vertical-alignment",
  57583. "type": [
  57584. "top",
  57585. "middle",
  57586. "bottom",
  57587. "auto"
  57588. ],
  57589. "doc": "Position of label relative to point position.",
  57590. "default-value": "auto",
  57591. "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0."
  57592. },
  57593. "avoid-edges": {
  57594. "css": "text-avoid-edges",
  57595. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  57596. "default-value": false,
  57597. "type": "boolean"
  57598. },
  57599. "minimum-distance": {
  57600. "css": "text-min-distance",
  57601. "doc": "Minimum permitted distance to the next text symbolizer.",
  57602. "type": "float"
  57603. },
  57604. "minimum-padding": {
  57605. "css": "text-min-padding",
  57606. "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text",
  57607. "type": "float"
  57608. },
  57609. "minimum-path-length": {
  57610. "css": "text-min-path-length",
  57611. "type": "float",
  57612. "default-value": 0,
  57613. "default-meaning": "place labels on all paths",
  57614. "doc": "Place labels only on paths longer than this value."
  57615. },
  57616. "allow-overlap": {
  57617. "css": "text-allow-overlap",
  57618. "type": "boolean",
  57619. "default-value": false,
  57620. "doc": "Control whether overlapping text is shown or hidden.",
  57621. "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown."
  57622. },
  57623. "orientation": {
  57624. "css": "text-orientation",
  57625. "type": "expression",
  57626. "doc": "Rotate the text."
  57627. },
  57628. "placement": {
  57629. "css": "text-placement",
  57630. "type": [
  57631. "point",
  57632. "line",
  57633. "vertex",
  57634. "interior"
  57635. ],
  57636. "default-value": "point",
  57637. "doc": "Control the style of placement of a point versus the geometry it is attached to."
  57638. },
  57639. "placement-type": {
  57640. "css": "text-placement-type",
  57641. "doc": "Re-position and/or re-size text to avoid overlaps. \"simple\" for basic algorithm (using text-placements string,) \"dummy\" to turn this feature off.",
  57642. "type": [
  57643. "dummy",
  57644. "simple"
  57645. ],
  57646. "default-value": "dummy"
  57647. },
  57648. "placements": {
  57649. "css": "text-placements",
  57650. "type": "string",
  57651. "default-value": "",
  57652. "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` "
  57653. },
  57654. "text-transform": {
  57655. "css": "text-transform",
  57656. "type": [
  57657. "none",
  57658. "uppercase",
  57659. "lowercase",
  57660. "capitalize"
  57661. ],
  57662. "doc": "Transform the case of the characters",
  57663. "default-value": "none"
  57664. },
  57665. "horizontal-alignment": {
  57666. "css": "text-horizontal-alignment",
  57667. "type": [
  57668. "left",
  57669. "middle",
  57670. "right",
  57671. "auto"
  57672. ],
  57673. "doc": "The text's horizontal alignment from its centerpoint",
  57674. "default-value": "auto"
  57675. },
  57676. "justify-alignment": {
  57677. "css": "text-align",
  57678. "type": [
  57679. "left",
  57680. "right",
  57681. "center",
  57682. "auto"
  57683. ],
  57684. "doc": "Define how text is justified",
  57685. "default-value": "auto",
  57686. "default-meaning": "Auto alignment means that text will be centered by default except when using the `placement-type` parameter - in that case either right or left justification will be used automatically depending on where the text could be fit given the `text-placements` directives"
  57687. },
  57688. "clip": {
  57689. "css": "text-clip",
  57690. "type": "boolean",
  57691. "default-value": true,
  57692. "default-meaning": "geometry will be clipped to map bounds before rendering",
  57693. "doc": "geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."
  57694. },
  57695. "comp-op": {
  57696. "css": "text-comp-op",
  57697. "default-value": "src-over",
  57698. "default-meaning": "add the current symbolizer on top of other symbolizer",
  57699. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  57700. "type": ["clear",
  57701. "src",
  57702. "dst",
  57703. "src-over",
  57704. "dst-over",
  57705. "src-in",
  57706. "dst-in",
  57707. "src-out",
  57708. "dst-out",
  57709. "src-atop",
  57710. "dst-atop",
  57711. "xor",
  57712. "plus",
  57713. "minus",
  57714. "multiply",
  57715. "screen",
  57716. "overlay",
  57717. "darken",
  57718. "lighten",
  57719. "color-dodge",
  57720. "color-burn",
  57721. "hard-light",
  57722. "soft-light",
  57723. "difference",
  57724. "exclusion",
  57725. "contrast",
  57726. "invert",
  57727. "invert-rgb",
  57728. "grain-merge",
  57729. "grain-extract",
  57730. "hue",
  57731. "saturation",
  57732. "color",
  57733. "value"
  57734. ]
  57735. }
  57736. },
  57737. "building": {
  57738. "fill": {
  57739. "css": "building-fill",
  57740. "default-value": "#FFFFFF",
  57741. "doc": "The color of the buildings walls.",
  57742. "type": "color"
  57743. },
  57744. "fill-opacity": {
  57745. "css": "building-fill-opacity",
  57746. "type": "float",
  57747. "doc": "The opacity of the building as a whole, including all walls.",
  57748. "default-value": 1
  57749. },
  57750. "height": {
  57751. "css": "building-height",
  57752. "doc": "The height of the building in pixels.",
  57753. "type": "expression",
  57754. "default-value": "0"
  57755. }
  57756. }
  57757. },
  57758. "colors": {
  57759. "aliceblue": [240, 248, 255],
  57760. "antiquewhite": [250, 235, 215],
  57761. "aqua": [0, 255, 255],
  57762. "aquamarine": [127, 255, 212],
  57763. "azure": [240, 255, 255],
  57764. "beige": [245, 245, 220],
  57765. "bisque": [255, 228, 196],
  57766. "black": [0, 0, 0],
  57767. "blanchedalmond": [255, 235, 205],
  57768. "blue": [0, 0, 255],
  57769. "blueviolet": [138, 43, 226],
  57770. "brown": [165, 42, 42],
  57771. "burlywood": [222, 184, 135],
  57772. "cadetblue": [95, 158, 160],
  57773. "chartreuse": [127, 255, 0],
  57774. "chocolate": [210, 105, 30],
  57775. "coral": [255, 127, 80],
  57776. "cornflowerblue": [100, 149, 237],
  57777. "cornsilk": [255, 248, 220],
  57778. "crimson": [220, 20, 60],
  57779. "cyan": [0, 255, 255],
  57780. "darkblue": [0, 0, 139],
  57781. "darkcyan": [0, 139, 139],
  57782. "darkgoldenrod": [184, 134, 11],
  57783. "darkgray": [169, 169, 169],
  57784. "darkgreen": [0, 100, 0],
  57785. "darkgrey": [169, 169, 169],
  57786. "darkkhaki": [189, 183, 107],
  57787. "darkmagenta": [139, 0, 139],
  57788. "darkolivegreen": [85, 107, 47],
  57789. "darkorange": [255, 140, 0],
  57790. "darkorchid": [153, 50, 204],
  57791. "darkred": [139, 0, 0],
  57792. "darksalmon": [233, 150, 122],
  57793. "darkseagreen": [143, 188, 143],
  57794. "darkslateblue": [72, 61, 139],
  57795. "darkslategrey": [47, 79, 79],
  57796. "darkturquoise": [0, 206, 209],
  57797. "darkviolet": [148, 0, 211],
  57798. "deeppink": [255, 20, 147],
  57799. "deepskyblue": [0, 191, 255],
  57800. "dimgray": [105, 105, 105],
  57801. "dimgrey": [105, 105, 105],
  57802. "dodgerblue": [30, 144, 255],
  57803. "firebrick": [178, 34, 34],
  57804. "floralwhite": [255, 250, 240],
  57805. "forestgreen": [34, 139, 34],
  57806. "fuchsia": [255, 0, 255],
  57807. "gainsboro": [220, 220, 220],
  57808. "ghostwhite": [248, 248, 255],
  57809. "gold": [255, 215, 0],
  57810. "goldenrod": [218, 165, 32],
  57811. "gray": [128, 128, 128],
  57812. "grey": [128, 128, 128],
  57813. "green": [0, 128, 0],
  57814. "greenyellow": [173, 255, 47],
  57815. "honeydew": [240, 255, 240],
  57816. "hotpink": [255, 105, 180],
  57817. "indianred": [205, 92, 92],
  57818. "indigo": [75, 0, 130],
  57819. "ivory": [255, 255, 240],
  57820. "khaki": [240, 230, 140],
  57821. "lavender": [230, 230, 250],
  57822. "lavenderblush": [255, 240, 245],
  57823. "lawngreen": [124, 252, 0],
  57824. "lemonchiffon": [255, 250, 205],
  57825. "lightblue": [173, 216, 230],
  57826. "lightcoral": [240, 128, 128],
  57827. "lightcyan": [224, 255, 255],
  57828. "lightgoldenrodyellow": [250, 250, 210],
  57829. "lightgray": [211, 211, 211],
  57830. "lightgreen": [144, 238, 144],
  57831. "lightgrey": [211, 211, 211],
  57832. "lightpink": [255, 182, 193],
  57833. "lightsalmon": [255, 160, 122],
  57834. "lightseagreen": [32, 178, 170],
  57835. "lightskyblue": [135, 206, 250],
  57836. "lightslategray": [119, 136, 153],
  57837. "lightslategrey": [119, 136, 153],
  57838. "lightsteelblue": [176, 196, 222],
  57839. "lightyellow": [255, 255, 224],
  57840. "lime": [0, 255, 0],
  57841. "limegreen": [50, 205, 50],
  57842. "linen": [250, 240, 230],
  57843. "magenta": [255, 0, 255],
  57844. "maroon": [128, 0, 0],
  57845. "mediumaquamarine": [102, 205, 170],
  57846. "mediumblue": [0, 0, 205],
  57847. "mediumorchid": [186, 85, 211],
  57848. "mediumpurple": [147, 112, 219],
  57849. "mediumseagreen": [60, 179, 113],
  57850. "mediumslateblue": [123, 104, 238],
  57851. "mediumspringgreen": [0, 250, 154],
  57852. "mediumturquoise": [72, 209, 204],
  57853. "mediumvioletred": [199, 21, 133],
  57854. "midnightblue": [25, 25, 112],
  57855. "mintcream": [245, 255, 250],
  57856. "mistyrose": [255, 228, 225],
  57857. "moccasin": [255, 228, 181],
  57858. "navajowhite": [255, 222, 173],
  57859. "navy": [0, 0, 128],
  57860. "oldlace": [253, 245, 230],
  57861. "olive": [128, 128, 0],
  57862. "olivedrab": [107, 142, 35],
  57863. "orange": [255, 165, 0],
  57864. "orangered": [255, 69, 0],
  57865. "orchid": [218, 112, 214],
  57866. "palegoldenrod": [238, 232, 170],
  57867. "palegreen": [152, 251, 152],
  57868. "paleturquoise": [175, 238, 238],
  57869. "palevioletred": [219, 112, 147],
  57870. "papayawhip": [255, 239, 213],
  57871. "peachpuff": [255, 218, 185],
  57872. "peru": [205, 133, 63],
  57873. "pink": [255, 192, 203],
  57874. "plum": [221, 160, 221],
  57875. "powderblue": [176, 224, 230],
  57876. "purple": [128, 0, 128],
  57877. "red": [255, 0, 0],
  57878. "rosybrown": [188, 143, 143],
  57879. "royalblue": [65, 105, 225],
  57880. "saddlebrown": [139, 69, 19],
  57881. "salmon": [250, 128, 114],
  57882. "sandybrown": [244, 164, 96],
  57883. "seagreen": [46, 139, 87],
  57884. "seashell": [255, 245, 238],
  57885. "sienna": [160, 82, 45],
  57886. "silver": [192, 192, 192],
  57887. "skyblue": [135, 206, 235],
  57888. "slateblue": [106, 90, 205],
  57889. "slategray": [112, 128, 144],
  57890. "slategrey": [112, 128, 144],
  57891. "snow": [255, 250, 250],
  57892. "springgreen": [0, 255, 127],
  57893. "steelblue": [70, 130, 180],
  57894. "tan": [210, 180, 140],
  57895. "teal": [0, 128, 128],
  57896. "thistle": [216, 191, 216],
  57897. "tomato": [255, 99, 71],
  57898. "turquoise": [64, 224, 208],
  57899. "violet": [238, 130, 238],
  57900. "wheat": [245, 222, 179],
  57901. "white": [255, 255, 255],
  57902. "whitesmoke": [245, 245, 245],
  57903. "yellow": [255, 255, 0],
  57904. "yellowgreen": [154, 205, 50],
  57905. "transparent": [0, 0, 0, 0]
  57906. },
  57907. "filter": {
  57908. "value": [
  57909. "true",
  57910. "false",
  57911. "null",
  57912. "point",
  57913. "linestring",
  57914. "polygon",
  57915. "collection"
  57916. ]
  57917. }
  57918. };
  57919. CartoCSS['mapnik_reference'] = {
  57920. version: {
  57921. latest: _mapnik_reference_latest,
  57922. '2.1.1': _mapnik_reference_latest
  57923. }
  57924. };
  57925. CartoCSS.Tree = {};
  57926. CartoCSS.Tree.operate = function(op, a, b) {
  57927. switch (op) {
  57928. case '+': return a + b;
  57929. case '-': return a - b;
  57930. case '*': return a * b;
  57931. case '%': return a % b;
  57932. case '/': return a / b;
  57933. }
  57934. };
  57935. CartoCSS.Tree.functions = {
  57936. rgb: function (r, g, b) {
  57937. return this.rgba(r, g, b, 1.0);
  57938. },
  57939. rgba: function (r, g, b, a) {
  57940. var me = this;
  57941. var rgb = [r, g, b].map(function (c) {
  57942. return me.number(c);
  57943. });
  57944. a = me.number(a);
  57945. if (rgb.some(isNaN) || isNaN(a)) {return null;}
  57946. return new CartoCSS.Tree.Color(rgb, a);
  57947. },
  57948. // Only require val
  57949. stop: function (val) {
  57950. var color, mode;
  57951. if (arguments.length > 1) {color = arguments[1];}
  57952. if (arguments.length > 2) {mode = arguments[2];}
  57953. return {
  57954. is: 'tag',
  57955. val: val,
  57956. color: color,
  57957. mode: mode,
  57958. toString(env) {
  57959. return '\n\t<stop value="' + val.ev(env) + '"' +
  57960. (color ? ' color="' + color.ev(env) + '" ' : '') +
  57961. (mode ? ' mode="' + mode.ev(env) + '" ' : '') +
  57962. '/>';
  57963. }
  57964. };
  57965. },
  57966. hsl: function (h, s, l) {
  57967. return this.hsla(h, s, l, 1.0);
  57968. },
  57969. hsla: function (h, s, l, a) {
  57970. h = (this.number(h) % 360) / 360;
  57971. s = this.number(s);
  57972. l = this.number(l);
  57973. a = this.number(a);
  57974. if ([h, s, l, a].some(isNaN)) {return null;}
  57975. var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
  57976. m1 = l * 2 - m2;
  57977. return this.rgba(hue(h + 1 / 3) * 255,
  57978. hue(h) * 255,
  57979. hue(h - 1 / 3) * 255,
  57980. a);
  57981. function hue(h) {
  57982. h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
  57983. if (h * 6 < 1) {return m1 + (m2 - m1) * h * 6;} else if (h * 2 < 1) {return m2;} else if (h * 3 < 2) {return m1 + (m2 - m1) * (2 / 3 - h) * 6;} else {return m1;}
  57984. }
  57985. },
  57986. hue: function (color) {
  57987. if (!('toHSL' in color)) {return null;}
  57988. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().h));
  57989. },
  57990. saturation: function (color) {
  57991. if (!('toHSL' in color)) {return null;}
  57992. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().s * 100), '%');
  57993. },
  57994. lightness: function (color) {
  57995. if (!('toHSL' in color)) {return null;}
  57996. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().l * 100), '%');
  57997. },
  57998. alpha: function (color) {
  57999. if (!('toHSL' in color)) {return null;}
  58000. return new CartoCSS.Tree.Dimension(color.toHSL().a);
  58001. },
  58002. saturate: function (color, amount) {
  58003. if (!('toHSL' in color)) {return null;}
  58004. var hsl = color.toHSL();
  58005. hsl.s += amount.value / 100;
  58006. hsl.s = this.clamp(hsl.s);
  58007. return this.hsla_simple(hsl);
  58008. },
  58009. desaturate: function (color, amount) {
  58010. if (!('toHSL' in color)) {return null;}
  58011. var hsl = color.toHSL();
  58012. hsl.s -= amount.value / 100;
  58013. hsl.s = this.clamp(hsl.s);
  58014. return this.hsla_simple(hsl);
  58015. },
  58016. lighten: function (color, amount) {
  58017. if (!('toHSL' in color)) {return null;}
  58018. var hsl = color.toHSL();
  58019. hsl.l += amount.value / 100;
  58020. hsl.l = this.clamp(hsl.l);
  58021. return this.hsla_simple(hsl);
  58022. },
  58023. darken: function (color, amount) {
  58024. if (!('toHSL' in color)) {return null;}
  58025. var hsl = color.toHSL();
  58026. hsl.l -= amount.value / 100;
  58027. hsl.l = this.clamp(hsl.l);
  58028. return this.hsla_simple(hsl);
  58029. },
  58030. fadein: function (color, amount) {
  58031. if (!('toHSL' in color)) {return null;}
  58032. var hsl = color.toHSL();
  58033. hsl.a += amount.value / 100;
  58034. hsl.a = this.clamp(hsl.a);
  58035. return this.hsla_simple(hsl);
  58036. },
  58037. fadeout: function (color, amount) {
  58038. if (!('toHSL' in color)) {return null;}
  58039. var hsl = color.toHSL();
  58040. hsl.a -= amount.value / 100;
  58041. hsl.a = this.clamp(hsl.a);
  58042. return this.hsla_simple(hsl);
  58043. },
  58044. spin: function (color, amount) {
  58045. if (!('toHSL' in color)) {return null;}
  58046. var hsl = color.toHSL();
  58047. var hue = (hsl.h + amount.value) % 360;
  58048. hsl.h = hue < 0 ? 360 + hue : hue;
  58049. return this.hsla_simple(hsl);
  58050. },
  58051. replace: function (entity, a, b) {
  58052. if (entity.is === 'field') {
  58053. return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')';
  58054. } else {
  58055. return entity.replace(a, b);
  58056. }
  58057. },
  58058. //
  58059. // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
  58060. // http://sass-lang.com
  58061. //
  58062. mix: function (color1, color2, weight) {
  58063. var p = weight.value / 100.0;
  58064. var w = p * 2 - 1;
  58065. var a = color1.toHSL().a - color2.toHSL().a;
  58066. var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
  58067. var w2 = 1 - w1;
  58068. var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
  58069. color1.rgb[1] * w1 + color2.rgb[1] * w2,
  58070. color1.rgb[2] * w1 + color2.rgb[2] * w2];
  58071. var alpha = color1.alpha * p + color2.alpha * (1 - p);
  58072. return new CartoCSS.Tree.Color(rgb, alpha);
  58073. },
  58074. greyscale: function (color) {
  58075. return this.desaturate(color, new CartoCSS.Tree.Dimension(100));
  58076. },
  58077. '%': function (quoted /* arg, arg, ...*/) {
  58078. var args = Array.prototype.slice.call(arguments, 1),
  58079. str = quoted.value;
  58080. for (var i = 0; i < args.length; i++) {
  58081. str = str.replace(/%s/, args[i].value)
  58082. .replace(/%[da]/, args[i].toString());
  58083. }
  58084. str = str.replace(/%%/g, '%');
  58085. return new CartoCSS.Tree.Quoted(str);
  58086. },
  58087. hsla_simple: function (h) {
  58088. return this.hsla(h.h, h.s, h.l, h.a);
  58089. },
  58090. number: function (n) {
  58091. if (n instanceof CartoCSS.Tree.Dimension) {
  58092. return parseFloat(n.unit === '%' ? n.value / 100 : n.value);
  58093. } else if (typeof(n) === 'number') {
  58094. return n;
  58095. } else {
  58096. return NaN;
  58097. }
  58098. },
  58099. clamp: function (val) {
  58100. return Math.min(1, Math.max(0, val));
  58101. }
  58102. };
  58103. CartoCSS.Tree.Call = class Call {
  58104. constructor(name, args, index) {
  58105. this.is = 'call';
  58106. this.name = name;
  58107. this.args = args;
  58108. this.index = index;
  58109. }
  58110. // When evuating a function call,
  58111. // we either find the function in `tree.functions` [1],
  58112. // in which case we call it, passing the evaluated arguments,
  58113. // or we simply print it out as it appeared originally [2].
  58114. // The *functions.js* file contains the built-in functions.
  58115. // The reason why we evaluate the arguments, is in the case where
  58116. // we try to pass a variable to a function, like: `saturate(@color)`.
  58117. // The function should receive the value, not the variable.
  58118. 'ev'(env) {
  58119. var args = this.args.map(function (a) {
  58120. return a.ev(env);
  58121. });
  58122. for (var i = 0; i < args.length; i++) {
  58123. if (args[i].is === 'undefined') {
  58124. return {
  58125. is: 'undefined',
  58126. value: 'undefined'
  58127. };
  58128. }
  58129. }
  58130. if (this.name in CartoCSS.Tree.functions) {
  58131. if (CartoCSS.Tree.functions[this.name].length <= args.length) {
  58132. var val = CartoCSS.Tree.functions[this.name].apply(CartoCSS.Tree.functions, args);
  58133. if (val === null) {
  58134. env.error({
  58135. message: 'incorrect arguments given to ' + this.name + '()',
  58136. index: this.index,
  58137. type: 'runtime',
  58138. filename: this.filename
  58139. });
  58140. return {is: 'undefined', value: 'undefined'};
  58141. }
  58142. return val;
  58143. } else {
  58144. env.error({
  58145. message: 'incorrect number of arguments for ' + this.name +
  58146. '(). ' + CartoCSS.Tree.functions[this.name].length + ' expected.',
  58147. index: this.index,
  58148. type: 'runtime',
  58149. filename: this.filename
  58150. });
  58151. return {
  58152. is: 'undefined',
  58153. value: 'undefined'
  58154. };
  58155. }
  58156. } else {
  58157. var fn = CartoCSS.Tree.Reference.mapnikFunctions[this.name];
  58158. if (fn === undefined) {
  58159. var functions = lodash_topairs_default()(CartoCSS.Tree.Reference.mapnikFunctions);
  58160. // cheap closest, needs improvement.
  58161. var name = this.name;
  58162. var mean = functions.map(function (f) {
  58163. return [f[0], CartoCSS.Tree.Reference.editDistance(name, f[0]), f[1]];
  58164. }).sort(function (a, b) {
  58165. return a[1] - b[1];
  58166. });
  58167. env.error({
  58168. message: 'unknown function ' + this.name + '(), did you mean ' +
  58169. mean[0][0] + '(' + mean[0][2] + ')',
  58170. index: this.index,
  58171. type: 'runtime',
  58172. filename: this.filename
  58173. });
  58174. return {
  58175. is: 'undefined',
  58176. value: 'undefined'
  58177. };
  58178. }
  58179. if (fn !== args.length &&
  58180. // support variable-arg functions like `colorize-alpha`
  58181. fn !== -1) {
  58182. env.error({
  58183. message: 'function ' + this.name + '() takes ' +
  58184. fn + ' arguments and was given ' + args.length,
  58185. index: this.index,
  58186. type: 'runtime',
  58187. filename: this.filename
  58188. });
  58189. return {
  58190. is: 'undefined',
  58191. value: 'undefined'
  58192. };
  58193. } else {
  58194. // Save the evaluated versions of arguments
  58195. this.args = args;
  58196. return this;
  58197. }
  58198. }
  58199. }
  58200. toString(env, format) {
  58201. if (this.args.length) {
  58202. return this.name + '(' + this.args.join(',') + ')';
  58203. } else {
  58204. return this.name;
  58205. }
  58206. }
  58207. };
  58208. CartoCSS.Tree.Color = class Color {
  58209. constructor(rgb, a) {
  58210. this.is = 'color';
  58211. // The end goal here, is to parse the arguments
  58212. // into an integer triplet, such as `128, 255, 0`
  58213. //
  58214. // This facilitates operations and conversions.
  58215. if (Array.isArray(rgb)) {
  58216. this.rgb = rgb.slice(0, 3);
  58217. } else if (rgb.length == 6) {
  58218. this.rgb = rgb.match(/.{2}/g).map(function (c) {
  58219. return parseInt(c, 16);
  58220. });
  58221. } else {
  58222. this.rgb = rgb.split('').map(function (c) {
  58223. return parseInt(c + c, 16);
  58224. });
  58225. }
  58226. if (typeof(a) === 'number') {
  58227. this.alpha = a;
  58228. } else if (rgb.length === 4) {
  58229. this.alpha = rgb[3];
  58230. } else {
  58231. this.alpha = 1;
  58232. }
  58233. }
  58234. 'ev'() {
  58235. return this;
  58236. }
  58237. // If we have some transparency, the only way to represent it
  58238. // is via `rgba`. Otherwise, we use the hex representation,
  58239. // which has better compatibility with older browsers.
  58240. // Values are capped between `0` and `255`, rounded and zero-padded.
  58241. toString() {
  58242. /* if (this.alpha < 1.0) {*/
  58243. return 'rgba(' + this.rgb.map(function (c) {
  58244. return Math.round(c);
  58245. }).concat(this.alpha).join(', ') + ')';
  58246. /*} else {
  58247. return '#' + this.rgb.map(function(i) {
  58248. i = Math.round(i);
  58249. i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
  58250. return i.length === 1 ? '0' + i : i;
  58251. }).join('');
  58252. }*/
  58253. }
  58254. // Operations have to be done per-channel, if not,
  58255. // channels will spill onto each other. Once we have
  58256. // our result, in the form of an integer triplet,
  58257. // we create a new Color node to hold the result.
  58258. operate(env, op, other) {
  58259. var result = [];
  58260. if (!(other instanceof CartoCSS.Tree.Color)) {
  58261. other = other.toColor();
  58262. }
  58263. for (var c = 0; c < 3; c++) {
  58264. result[c] = CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]);
  58265. }
  58266. return new CartoCSS.Tree.Color(result);
  58267. }
  58268. toHSL() {
  58269. var r = this.rgb[0] / 255,
  58270. g = this.rgb[1] / 255,
  58271. b = this.rgb[2] / 255,
  58272. a = this.alpha;
  58273. var max = Math.max(r, g, b), min = Math.min(r, g, b);
  58274. var h, s, l = (max + min) / 2, d = max - min;
  58275. if (max === min) {
  58276. h = s = 0;
  58277. } else {
  58278. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  58279. switch (max) {
  58280. case r:
  58281. h = (g - b) / d + (g < b ? 6 : 0);
  58282. break;
  58283. case g:
  58284. h = (b - r) / d + 2;
  58285. break;
  58286. case b:
  58287. h = (r - g) / d + 4;
  58288. break;
  58289. default:
  58290. break;
  58291. }
  58292. h /= 6;
  58293. }
  58294. return {h: h * 360, s: s, l: l, a: a};
  58295. }
  58296. };
  58297. CartoCSS.Tree.Comment = class Comment {
  58298. constructor(value, silent) {
  58299. this.value = value;
  58300. this.silent = !!silent;
  58301. }
  58302. toString(env) {
  58303. return '<!--' + this.value + '-->';
  58304. }
  58305. 'ev'() {
  58306. return this;
  58307. }
  58308. };
  58309. CartoCSS.Tree.Definition = class Definition {
  58310. constructor(selector, rules) {
  58311. this.elements = selector.elements;
  58312. //assert.ok(selector.filters instanceof CartoCSS.Tree.Filterset);
  58313. this.rules = rules;
  58314. this.ruleIndex = {};
  58315. for (var i = 0; i < this.rules.length; i++) {
  58316. if ('zoom' in this.rules[i]) {this.rules[i] = this.rules[i].clone();}
  58317. this.rules[i].zoom = selector.zoom;
  58318. this.ruleIndex[this.rules[i].updateID()] = true;
  58319. }
  58320. this.filters = selector.filters;
  58321. this.zoom = selector.zoom;
  58322. this.attachment = selector.attachment || '__default__';
  58323. this.specificity = selector.specificity();
  58324. }
  58325. toString() {
  58326. var str = this.filters.toString();
  58327. for (var i = 0; i < this.rules.length; i++) {
  58328. str += '\n ' + this.rules[i];
  58329. }
  58330. return str;
  58331. }
  58332. toJS(env) {
  58333. var shaderAttrs = {};
  58334. // merge conditions from filters with zoom condition of the
  58335. // definition
  58336. var zoom = this.zoom;
  58337. //var frame_offset = this.frame_offset;
  58338. var _if = this.filters.toJS(env);
  58339. var filters = [zoom];
  58340. if (_if) {filters.push(_if);}
  58341. //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
  58342. _if = filters.join(" && ");
  58343. function eachRule(rule) {
  58344. if (rule instanceof CartoCSS.Tree.Rule) {
  58345. shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
  58346. if (_if) {
  58347. shaderAttrs[rule.name].push(
  58348. "if(" + _if + "){" + rule.value.toJS(env) + "}"
  58349. );
  58350. } else {
  58351. shaderAttrs[rule.name].push(rule.value.toJS(env));
  58352. }
  58353. } else {
  58354. if (rule instanceof CartoCSS.Tree.Ruleset) {
  58355. var sh = rule.toJS(env);
  58356. for (var v in sh) {
  58357. shaderAttrs[v] = shaderAttrs[v] || [];
  58358. for (var attr in sh[v]) {
  58359. shaderAttrs[v].push(sh[v][attr]);
  58360. }
  58361. }
  58362. }
  58363. }
  58364. }
  58365. for (var id in this.rules) {
  58366. eachRule(this.rules[id]);
  58367. }
  58368. return shaderAttrs;
  58369. }
  58370. };
  58371. CartoCSS.Tree.Dimension = class Dimension {
  58372. constructor(value, unit, index) {
  58373. this.is = 'float';
  58374. this.physical_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc'];
  58375. this.screen_units = ['px', '%'];
  58376. this.all_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'];
  58377. this.densities = {
  58378. m: 0.0254,
  58379. mm: 25.4,
  58380. cm: 2.54,
  58381. pt: 72,
  58382. pc: 6
  58383. };
  58384. this.value = parseFloat(value);
  58385. this.unit = unit || null;
  58386. this.index = index;
  58387. }
  58388. ev(env) {
  58389. if (this.unit && this.all_units.indexOf(this.unit)<0) {
  58390. env.error({
  58391. message: "Invalid unit: '" + this.unit + "'",
  58392. index: this.index
  58393. });
  58394. return {is: 'undefined', value: 'undefined'};
  58395. }
  58396. // normalize units which are not px or %
  58397. if (this.unit && this.physical_units.indexOf(this.unit)>=0) {
  58398. if (!env.ppi) {
  58399. env.error({
  58400. message: "ppi is not set, so metric units can't be used",
  58401. index: this.index
  58402. });
  58403. return {is: 'undefined', value: 'undefined'};
  58404. }
  58405. // convert all units to inch
  58406. // convert inch to px using ppi
  58407. this.value = (this.value / this.densities[this.unit]) * env.ppi;
  58408. this.unit = 'px';
  58409. }
  58410. return this;
  58411. }
  58412. toColor() {
  58413. return new CartoCSS.Tree.Color([this.value, this.value, this.value]);
  58414. }
  58415. round() {
  58416. this.value = Math.round(this.value);
  58417. return this;
  58418. }
  58419. toString() {
  58420. return this.value.toString();
  58421. }
  58422. operate(env, op, other) {
  58423. if (this.unit === '%' && other.unit !== '%') {
  58424. env.error({
  58425. message: 'If two operands differ, the first must not be %',
  58426. index: this.index
  58427. });
  58428. return {
  58429. is: 'undefined',
  58430. value: 'undefined'
  58431. };
  58432. }
  58433. if (this.unit !== '%' && other.unit === '%') {
  58434. if (op === '*' || op === '/' || op === '%') {
  58435. env.error({
  58436. message: 'Percent values can only be added or subtracted from other values',
  58437. index: this.index
  58438. });
  58439. return {
  58440. is: 'undefined',
  58441. value: 'undefined'
  58442. };
  58443. }
  58444. return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op,
  58445. this.value, this.value * other.value * 0.01),
  58446. this.unit);
  58447. }
  58448. //here the operands are either the same (% or undefined or px), or one is undefined and the other is px
  58449. return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op, this.value, other.value),
  58450. this.unit || other.unit);
  58451. }
  58452. };
  58453. CartoCSS.Tree.Element = class Element {
  58454. constructor(value) {
  58455. this.value = value.trim();
  58456. if (this.value[0] === '#') {
  58457. this.type = 'id';
  58458. this.clean = this.value.replace(/^#/, '');
  58459. }
  58460. if (this.value[0] === '.') {
  58461. this.type = 'class';
  58462. this.clean = this.value.replace(/^\./, '');
  58463. }
  58464. if (this.value.indexOf('*') !== -1) {
  58465. this.type = 'wildcard';
  58466. }
  58467. }
  58468. specificity() {
  58469. return [
  58470. (this.type === 'id') ? 1 : 0, // a
  58471. (this.type === 'class') ? 1 : 0 // b
  58472. ];
  58473. }
  58474. toString() {
  58475. return this.value;
  58476. }
  58477. };
  58478. CartoCSS.Tree.Expression = class Expression {
  58479. constructor(value) {
  58480. this.is = 'expression';
  58481. this.value = value;
  58482. }
  58483. ev(env) {
  58484. if (this.value.length > 1) {
  58485. return new CartoCSS.Tree.Expression(this.value.map(function (e) {
  58486. return e.ev(env);
  58487. }));
  58488. } else {
  58489. return this.value[0].ev(env);
  58490. }
  58491. }
  58492. toString(env) {
  58493. return this.value.map(function (e) {
  58494. return e.toString(env);
  58495. }).join(' ');
  58496. }
  58497. };
  58498. CartoCSS.Tree.Field = class Field {
  58499. constructor(content) {
  58500. this.is = 'field';
  58501. this.value = content || '';
  58502. }
  58503. toString() {
  58504. return '["' + this.value.toUpperCase() + '"]';
  58505. }
  58506. 'ev'() {
  58507. return this;
  58508. }
  58509. };
  58510. CartoCSS.Tree.Filter = class Filter {
  58511. constructor(key, op, val, index, filename) {
  58512. this.ops = {
  58513. '<': [' &lt; ', 'numeric'],
  58514. '>': [' &gt; ', 'numeric'],
  58515. '=': [' = ', 'both'],
  58516. '!=': [' != ', 'both'],
  58517. '<=': [' &lt;= ', 'numeric'],
  58518. '>=': [' &gt;= ', 'numeric'],
  58519. '=~': ['.match(', 'string', ')']
  58520. };
  58521. this.key = key;
  58522. this.op = op;
  58523. this.val = val;
  58524. this.index = index;
  58525. this.filename = filename;
  58526. this.id = this.key + this.op + this.val;
  58527. }
  58528. ev(env) {
  58529. this.key = this.key.ev(env);
  58530. this.val = this.val.ev(env);
  58531. return this;
  58532. }
  58533. toString() {
  58534. return '[' + this.id + ']';
  58535. }
  58536. };
  58537. CartoCSS.Tree.Filterset = class Filterset {
  58538. constructor() {
  58539. this.filters = {};
  58540. }
  58541. toJS(env) {
  58542. function eachFilter(filter) {
  58543. var op = filter.op;
  58544. if (op === "=") {
  58545. op = "==";
  58546. }
  58547. var val = filter.val;
  58548. if (filter._val !== undefined) {
  58549. val = filter._val.toString(true);
  58550. }
  58551. //对scale进行特殊处理,将值转换成数值
  58552. if (filter.key && filter.key.value === 'scale') {
  58553. val = +val;
  58554. } else if (typeof val === 'string' || typeof val === 'object') {
  58555. val = "'" + val + "'";
  58556. }
  58557. var attrs = "attributes";
  58558. return attrs + "&&" + attrs + filter.key + "&&" + attrs + filter.key + " " + op + val;
  58559. }
  58560. var results = [];
  58561. for (var id in this.filters) {
  58562. results.push(eachFilter(this.filters[id]));
  58563. }
  58564. return results.join(' && ');
  58565. }
  58566. toString() {
  58567. var arr = [];
  58568. for (var id in this.filters) {arr.push(this.filters[id].id);}
  58569. return arr.sort().join('\t');
  58570. }
  58571. ev(env) {
  58572. for (var i in this.filters) {
  58573. this.filters[i].ev(env);
  58574. }
  58575. return this;
  58576. }
  58577. clone() {
  58578. var clone = new CartoCSS.Tree.Filterset();
  58579. for (var id in this.filters) {
  58580. clone.filters[id] = this.filters[id];
  58581. }
  58582. return clone;
  58583. }
  58584. cloneWith(other) {
  58585. var additions = [];
  58586. for (var id in other.filters) {
  58587. var status = this.addable(other.filters[id]);
  58588. // status is true, false or null. if it's null we don't fail this
  58589. // clone nor do we add the filter.
  58590. if (status === false) {
  58591. return false;
  58592. }
  58593. if (status === true) {
  58594. // Adding the filter will override another value.
  58595. additions.push(other.filters[id]);
  58596. }
  58597. }
  58598. // Adding the other filters doesn't make this filterset invalid, but it
  58599. // doesn't add anything to it either.
  58600. if (!additions.length) {
  58601. return null;
  58602. }
  58603. // We can successfully add all filters. Now clone the filterset and add the
  58604. // new rules.
  58605. var clone = new CartoCSS.Tree.Filterset();
  58606. // We can add the rules that are already present without going through the
  58607. // add function as a Filterset is always in it's simplest canonical form.
  58608. for (id in this.filters) {
  58609. clone.filters[id] = this.filters[id];
  58610. }
  58611. // Only add new filters that actually change the filter.
  58612. while (id = additions.shift()) {
  58613. clone.add(id);
  58614. }
  58615. return clone;
  58616. }
  58617. addable(filter) {
  58618. var key = filter.key.toString(),
  58619. value = filter.val.toString();
  58620. if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);}
  58621. switch (filter.op) {
  58622. case '=':
  58623. // if there is already foo= and we're adding foo=
  58624. if (this.filters[key + '='] !== undefined) {
  58625. if (this.filters[key + '='].val.toString() != value) {
  58626. return false;
  58627. } else {
  58628. return null;
  58629. }
  58630. }
  58631. if (this.filters[key + '!=' + value] !== undefined) {return false;}
  58632. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  58633. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  58634. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  58635. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  58636. return true;
  58637. case '=~':
  58638. return true;
  58639. case '!=':
  58640. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;}
  58641. if (this.filters[key + '!=' + value] !== undefined) {return null;}
  58642. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  58643. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  58644. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  58645. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  58646. return true;
  58647. case '>':
  58648. if (key + '=' in this.filters) {
  58649. if (this.filters[key + '='].val <= value) {
  58650. return false;
  58651. } else {
  58652. return null;
  58653. }
  58654. }
  58655. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  58656. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;}
  58657. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  58658. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  58659. return true;
  58660. case '>=':
  58661. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;}
  58662. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  58663. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  58664. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  58665. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;}
  58666. return true;
  58667. case '<':
  58668. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val >= value) ? false : null;}
  58669. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  58670. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return false;}
  58671. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  58672. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  58673. return true;
  58674. case '<=':
  58675. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val > value) ? false : null;}
  58676. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  58677. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  58678. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  58679. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return null;}
  58680. return true;
  58681. default:
  58682. break;
  58683. }
  58684. }
  58685. conflict(filter) {
  58686. var key = filter.key.toString(),
  58687. value = filter.val.toString();
  58688. if (!isNaN(parseFloat(value))) {value = parseFloat(value);}
  58689. // if (a=b) && (a=c)
  58690. // if (a=b) && (a!=b)
  58691. // or (a!=b) && (a=b)
  58692. if ((filter.op === '=' && this.filters[key + '='] !== undefined &&
  58693. value != this.filters[key + '='].val.toString()) ||
  58694. (filter.op === '!=' && this.filters[key + '='] !== undefined &&
  58695. value == this.filters[key + '='].val.toString()) ||
  58696. (filter.op === '=' && this.filters[key + '!='] !== undefined &&
  58697. value === this.filters[key + '!='].val.toString())) {
  58698. return filter.toString() + ' added to ' + this.toString() + ' produces an invalid filter';
  58699. }
  58700. return false;
  58701. }
  58702. add(filter, env) {
  58703. var key = filter.key.toString(),
  58704. op = filter.op,
  58705. conflict = this.conflict(filter),
  58706. numval;
  58707. if (conflict) {return conflict;}
  58708. if (op === '=') {
  58709. for (var i in this.filters) {
  58710. if (this.filters[i].key === key) {delete this.filters[i];}
  58711. }
  58712. this.filters[key + '='] = filter;
  58713. } else if (op === '!=') {
  58714. this.filters[key + '!=' + filter.val] = filter;
  58715. } else if (op === '=~') {
  58716. this.filters[key + '=~' + filter.val] = filter;
  58717. } else if (op === '>') {
  58718. // If there are other filters that are also >
  58719. // but are less than this one, they don't matter, so
  58720. // remove them.
  58721. for (var j in this.filters) {
  58722. if (this.filters[j].key === key && this.filters[j].val <= filter.val) {
  58723. delete this.filters[j];
  58724. }
  58725. }
  58726. this.filters[key + '>'] = filter;
  58727. } else if (op === '>=') {
  58728. for (var k in this.filters) {
  58729. numval = (+this.filters[k].val.toString());
  58730. if (this.filters[k].key === key && numval < filter.val) {
  58731. delete this.filters[k];
  58732. }
  58733. }
  58734. if (this.filters[key + '!=' + filter.val] !== undefined) {
  58735. delete this.filters[key + '!=' + filter.val];
  58736. filter.op = '>';
  58737. this.filters[key + '>'] = filter;
  58738. } else {
  58739. this.filters[key + '>='] = filter;
  58740. }
  58741. } else if (op === '<') {
  58742. for (var l in this.filters) {
  58743. numval = (+this.filters[l].val.toString());
  58744. if (this.filters[l].key === key && numval >= filter.val) {
  58745. delete this.filters[l];
  58746. }
  58747. }
  58748. this.filters[key + '<'] = filter;
  58749. } else if (op === '<=') {
  58750. for (var m in this.filters) {
  58751. numval = (+this.filters[m].val.toString());
  58752. if (this.filters[m].key === key && numval > filter.val) {
  58753. delete this.filters[m];
  58754. }
  58755. }
  58756. if (this.filters[key + '!=' + filter.val] !== undefined) {
  58757. delete this.filters[key + '!=' + filter.val];
  58758. filter.op = '<';
  58759. this.filters[key + '<'] = filter;
  58760. } else {
  58761. this.filters[key + '<='] = filter;
  58762. }
  58763. }
  58764. }
  58765. };
  58766. CartoCSS.Tree.Fontset = class Fontset {
  58767. constructor(env, fonts) {
  58768. this.fonts = fonts;
  58769. this.name = 'fontset-' + env.effects.length;
  58770. }
  58771. };
  58772. CartoCSS.Tree.Invalid = class Invalid {
  58773. constructor(chunk, index, message) {
  58774. this.is = 'invalid';
  58775. this.chunk = chunk;
  58776. this.index = index;
  58777. this.type = 'syntax';
  58778. this.message = message || "Invalid code: " + this.chunk;
  58779. }
  58780. ev(env) {
  58781. env.error({
  58782. chunk: this.chunk,
  58783. index: this.index,
  58784. type: 'syntax',
  58785. message: this.message || "Invalid code: " + this.chunk
  58786. });
  58787. return {
  58788. is: 'undefined'
  58789. };
  58790. }
  58791. };
  58792. CartoCSS.Tree.Keyword = class Keyword {
  58793. ev() {
  58794. return this;
  58795. }
  58796. constructor(value) {
  58797. this.value = value;
  58798. var special = {
  58799. 'transparent': 'color',
  58800. 'true': 'boolean',
  58801. 'false': 'boolean'
  58802. };
  58803. this.is = special[value] ? special[value] : 'keyword';
  58804. }
  58805. toString() {
  58806. return this.value;
  58807. }
  58808. };
  58809. /*Layer:class Invalid ),*/
  58810. CartoCSS.Tree.Literal = class Literal {
  58811. constructor(content) {
  58812. this.value = content || '';
  58813. this.is = 'field';
  58814. }
  58815. toString() {
  58816. return this.value;
  58817. }
  58818. 'ev'() {
  58819. return this;
  58820. }
  58821. };
  58822. CartoCSS.Tree.Operation = class Operation {
  58823. constructor(op, operands, index) {
  58824. this.is = 'operation';
  58825. this.op = op.trim();
  58826. this.operands = operands;
  58827. this.index = index;
  58828. }
  58829. ev(env) {
  58830. var a = this.operands[0].ev(env),
  58831. b = this.operands[1].ev(env),
  58832. temp;
  58833. if (a.is === 'undefined' || b.is === 'undefined') {
  58834. return {
  58835. is: 'undefined',
  58836. value: 'undefined'
  58837. };
  58838. }
  58839. if (a instanceof CartoCSS.Tree.Dimension && b instanceof CartoCSS.Tree.Color) {
  58840. if (this.op === '*' || this.op === '+') {
  58841. temp = b;
  58842. b = a;
  58843. a = temp;
  58844. } else {
  58845. env.error({
  58846. name: "OperationError",
  58847. message: "Can't substract or divide a color from a number",
  58848. index: this.index
  58849. });
  58850. }
  58851. }
  58852. // Only concatenate plain strings, because this is easily
  58853. // pre-processed
  58854. if (a instanceof CartoCSS.Tree.Quoted && b instanceof CartoCSS.Tree.Quoted && this.op !== '+') {
  58855. env.error({
  58856. message: "Can't subtract, divide, or multiply strings.",
  58857. index: this.index,
  58858. type: 'runtime',
  58859. filename: this.filename
  58860. });
  58861. return {
  58862. is: 'undefined',
  58863. value: 'undefined'
  58864. };
  58865. }
  58866. // Fields, literals, dimensions, and quoted strings can be combined.
  58867. if (a instanceof CartoCSS.Tree.Field || b instanceof CartoCSS.Tree.Field ||
  58868. a instanceof CartoCSS.Tree.Literal || b instanceof CartoCSS.Tree.Literal) {
  58869. if (a.is === 'color' || b.is === 'color') {
  58870. env.error({
  58871. message: "Can't subtract, divide, or multiply colors in expressions.",
  58872. index: this.index,
  58873. type: 'runtime',
  58874. filename: this.filename
  58875. });
  58876. return {
  58877. is: 'undefined',
  58878. value: 'undefined'
  58879. };
  58880. } else {
  58881. return new CartoCSS.Tree.Literal(a.ev(env).toString(true) + this.op + b.ev(env).toString(true));
  58882. }
  58883. }
  58884. if (a.operate === undefined) {
  58885. env.error({
  58886. message: 'Cannot do math with type ' + a.is + '.',
  58887. index: this.index,
  58888. type: 'runtime',
  58889. filename: this.filename
  58890. });
  58891. return {
  58892. is: 'undefined',
  58893. value: 'undefined'
  58894. };
  58895. }
  58896. return a.operate(env, this.op, b);
  58897. }
  58898. };
  58899. CartoCSS.Tree.Quoted = class Quoted {
  58900. constructor(content) {
  58901. this.is = 'string';
  58902. this.value = content || '';
  58903. }
  58904. toString(quotes) {
  58905. var escapedValue = this.value
  58906. .replace(/&/g, '&amp;')
  58907. var xmlvalue = escapedValue
  58908. .replace(/\'/g, '\\\'')
  58909. .replace(/\"/g, '&quot;')
  58910. .replace(/</g, '&lt;')
  58911. .replace(/\>/g, '&gt;');
  58912. return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
  58913. }
  58914. ev() {
  58915. return this;
  58916. }
  58917. operate(env, op, other) {
  58918. return new CartoCSS.Tree.Quoted(CartoCSS.Tree.operate(op, this.toString(), other.toString(this.contains_field)));
  58919. }
  58920. };
  58921. CartoCSS.Tree.Reference = {
  58922. _validateValue: {
  58923. 'font': function (env, value) {
  58924. if (env.validation_data && env.validation_data.fonts) {
  58925. return env.validation_data.fonts.indexOf(value) != -1;
  58926. } else {
  58927. return true;
  58928. }
  58929. }
  58930. },
  58931. setData: function (data) {
  58932. this.data = data;
  58933. this.selector_cache = generateSelectorCache(data);
  58934. this.mapnikFunctions = generateMapnikFunctions(data);
  58935. this.required_cache = generateRequiredProperties(data);
  58936. function generateSelectorCache(data) {
  58937. var index = {};
  58938. for (var i in data.symbolizers) {
  58939. for (var j in data.symbolizers[i]) {
  58940. if (data.symbolizers[i][j].hasOwnProperty('css')) {
  58941. index[data.symbolizers[i][j].css] = [data.symbolizers[i][j], i, j];
  58942. }
  58943. }
  58944. }
  58945. return index;
  58946. }
  58947. function generateMapnikFunctions(data) {
  58948. var functions = {};
  58949. for (var i in data.symbolizers) {
  58950. for (var j in data.symbolizers[i]) {
  58951. if (data.symbolizers[i][j].type === 'functions') {
  58952. for (var k = 0; k < data.symbolizers[i][j].functions.length; k++) {
  58953. var fn = data.symbolizers[i][j].functions[k];
  58954. functions[fn[0]] = fn[1];
  58955. }
  58956. }
  58957. }
  58958. }
  58959. return functions;
  58960. }
  58961. function generateRequiredProperties(data) {
  58962. var cache = {};
  58963. for (var symbolizer_name in data.symbolizers) {
  58964. cache[symbolizer_name] = [];
  58965. for (var j in data.symbolizers[symbolizer_name]) {
  58966. if (data.symbolizers[symbolizer_name][j].required) {
  58967. cache[symbolizer_name].push(data.symbolizers[symbolizer_name][j].css);
  58968. }
  58969. }
  58970. }
  58971. return cache;
  58972. }
  58973. },
  58974. setVersion: function (version) {
  58975. if (CartoCSS.mapnik_reference.version.hasOwnProperty(version)) {
  58976. this.setData(CartoCSS.mapnik_reference.version[version]);
  58977. return true;
  58978. }
  58979. return false;
  58980. },
  58981. selectorData: function (selector, i) {
  58982. if (this.selector_cache && this.selector_cache[selector]) {return this.selector_cache[selector][i];}
  58983. },
  58984. validSelector: function (selector) {
  58985. return !!this.selector_cache[selector];
  58986. },
  58987. selectorName: function (selector) {
  58988. return this.selectorData(selector, 2);
  58989. },
  58990. selector: function (selector) {
  58991. return this.selectorData(selector, 0);
  58992. },
  58993. symbolizer: function (selector) {
  58994. return this.selectorData(selector, 1);
  58995. },
  58996. requiredProperties: function (symbolizer_name, rules) {
  58997. var req = this.required_cache[symbolizer_name];
  58998. for (var i in req) {
  58999. if (!(req[i] in rules)) {
  59000. return 'Property ' + req[i] + ' required for defining ' +
  59001. symbolizer_name + ' styles.';
  59002. }
  59003. }
  59004. },
  59005. isFont: function (selector) {
  59006. return this.selector(selector).validate === 'font';
  59007. },
  59008. editDistance: function (a, b) {
  59009. if (a.length === 0) {return b.length;}
  59010. if (b.length === 0) {return a.length;}
  59011. var matrix = [];
  59012. for (var i = 0; i <= b.length; i++) {
  59013. matrix[i] = [i];
  59014. }
  59015. for (var j = 0; j <= a.length; j++) {
  59016. matrix[0][j] = j;
  59017. }
  59018. for (i = 1; i <= b.length; i++) {
  59019. for (j = 1; j <= a.length; j++) {
  59020. if (b.charAt(i - 1) === a.charAt(j - 1)) {
  59021. matrix[i][j] = matrix[i - 1][j - 1];
  59022. } else {
  59023. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  59024. Math.min(matrix[i][j - 1] + 1, // insertion
  59025. matrix[i - 1][j] + 1)); // deletion
  59026. }
  59027. }
  59028. }
  59029. return matrix[b.length][a.length];
  59030. },
  59031. validValue: function (env, selector, value) {
  59032. function validateFunctions(value, selector) {
  59033. if (value.value[0].is === 'string') {return true;}
  59034. for (var i in value.value) {
  59035. for (var j in value.value[i].value) {
  59036. if (value.value[i].value[j].is !== 'call') {return false;}
  59037. var f = find(this.selector(selector).functions, function (x) {//NOSONAR
  59038. return x[0] === value.value[i].value[j].name;
  59039. });
  59040. if (!(f && f[1] === -1)) {
  59041. // This filter is unknown or given an incorrect number of arguments
  59042. if (!f || f[1] !== value.value[i].value[j].args.length) {return false;}
  59043. }
  59044. }
  59045. }
  59046. return true;
  59047. }
  59048. function validateKeyword(value, selector) {
  59049. if (typeof this.selector(selector).type === 'object') {
  59050. return this.selector(selector).type
  59051. .indexOf(value.value[0].value) !== -1;
  59052. } else {
  59053. // allow unquoted keywords as strings
  59054. return this.selector(selector).type === 'string';
  59055. }
  59056. }
  59057. var i;
  59058. if (!this.selector(selector)) {
  59059. return false;
  59060. } else if (value.value[0].is === 'keyword') {
  59061. return validateKeyword(value, selector);
  59062. } else if (value.value[0].is === 'undefined') {
  59063. // caught earlier in the chain - ignore here so that
  59064. // error is not overridden
  59065. return true;
  59066. } else if (this.selector(selector).type === 'numbers') {
  59067. for (i in value.value) {
  59068. if (value.value[i].is !== 'float') {
  59069. return false;
  59070. }
  59071. }
  59072. return true;
  59073. } else if (this.selector(selector).type === 'tags') {
  59074. if (!value.value) {return false;}
  59075. if (!value.value[0].value) {
  59076. return value.value[0].is === 'tag';
  59077. }
  59078. for (i = 0; i < value.value[0].value.length; i++) {
  59079. if (value.value[0].value[i].is !== 'tag') {return false;}
  59080. }
  59081. return true;
  59082. } else if (this.selector(selector).type == 'functions') {
  59083. // For backwards compatibility, you can specify a string for `functions`-compatible
  59084. // values, though they will not be validated.
  59085. return validateFunctions(value, selector);
  59086. } else if (this.selector(selector).type === 'expression') {
  59087. return true;
  59088. } else if (this.selector(selector).type === 'unsigned') {
  59089. if (value.value[0].is === 'float') {
  59090. value.value[0].round();
  59091. return true;
  59092. } else {
  59093. return false;
  59094. }
  59095. } else {
  59096. if (this.selector(selector).validate) {
  59097. var valid = false;
  59098. for (i = 0; i < value.value.length; i++) {
  59099. if (this.selector(selector).type === value.value[i].is &&
  59100. this._validateValue[this.selector(selector).validate](env, value.value[i].value)) {
  59101. return true;
  59102. }
  59103. }
  59104. return valid;
  59105. } else {
  59106. return this.selector(selector).type === value.value[0].is;
  59107. }
  59108. }
  59109. }
  59110. };
  59111. CartoCSS.Tree.Reference.setVersion("latest");
  59112. CartoCSS.Tree.Rule = class Rule {
  59113. constructor(name, value, index, filename) {
  59114. this.is = 'rule';
  59115. var parts = name.split('/');
  59116. this.name = parts.pop();
  59117. this.instance = parts.length ? parts[0] : '__default__';
  59118. this.value = (value instanceof CartoCSS.Tree.Value) ?
  59119. value : new CartoCSS.Tree.Value([value]);
  59120. this.index = index;
  59121. this.symbolizer = CartoCSS.Tree.Reference.symbolizer(this.name);
  59122. this.filename = filename;
  59123. this.variable = (name.charAt(0) === '@');
  59124. }
  59125. clone() {
  59126. var clone = Object.create(CartoCSS.Tree.Rule.prototype);
  59127. clone.name = this.name;
  59128. clone.value = this.value;
  59129. clone.index = this.index;
  59130. clone.instance = this.instance;
  59131. clone.symbolizer = this.symbolizer;
  59132. clone.filename = this.filename;
  59133. clone.variable = this.variable;
  59134. return clone;
  59135. }
  59136. updateID() {
  59137. return this.id = this.zoom + '#' + this.instance + '#' + this.name;
  59138. }
  59139. toString() {
  59140. return '[' + CartoCSS.Tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
  59141. }
  59142. ev(context) {
  59143. return new CartoCSS.Tree.Rule(this.name,
  59144. this.value.ev(context),
  59145. this.index,
  59146. this.filename);
  59147. }
  59148. };
  59149. CartoCSS.Tree.Ruleset = class Ruleset {
  59150. constructor(selectors, rules) {
  59151. this.is = 'ruleset';
  59152. this.selectors = selectors;
  59153. this.rules = rules;
  59154. // static cache of find() function
  59155. this._lookups = {};
  59156. }
  59157. ev(env) {
  59158. var i,
  59159. rule,
  59160. ruleset = new CartoCSS.Tree.Ruleset(this.selectors, this.rules.slice(0));
  59161. ruleset.root = this.root;
  59162. // push the current ruleset to the frames stack
  59163. env.frames.unshift(ruleset);
  59164. // Evaluate everything else
  59165. for (i = 0, rule; i < ruleset.rules.length; i++) {
  59166. rule = ruleset.rules[i];
  59167. ruleset.rules[i] = rule.ev ? rule.ev(env) : rule;
  59168. }
  59169. // Pop the stack
  59170. env.frames.shift();
  59171. return ruleset;
  59172. }
  59173. match(args) {
  59174. return !args || args.length === 0;
  59175. }
  59176. variables() {
  59177. if (this._variables) {
  59178. return this._variables;
  59179. } else {
  59180. return this._variables = this.rules.reduce(function (hash, r) {
  59181. if (r instanceof CartoCSS.Tree.Rule && r.variable === true) {
  59182. hash[r.name] = r;
  59183. }
  59184. return hash;
  59185. }, {});
  59186. }
  59187. }
  59188. variable(name) {
  59189. return this.variables()[name];
  59190. }
  59191. rulesets() {
  59192. if (this._rulesets) {
  59193. return this._rulesets;
  59194. } else {
  59195. return this._rulesets = this.rules.filter(function (r) {
  59196. return (r instanceof CartoCSS.Tree.Ruleset);
  59197. });
  59198. }
  59199. }
  59200. find(selector, self) {
  59201. self = self || this;
  59202. var rules = [], match,
  59203. key = selector.toString();
  59204. if (key in this._lookups) {
  59205. return this._lookups[key];
  59206. }
  59207. this.rulesets().forEach(function (rule) {
  59208. if (rule !== self) {
  59209. for (var j = 0; j < rule.selectors.length; j++) {
  59210. match = selector.match(rule.selectors[j]);
  59211. if (match) {
  59212. if (selector.elements.length > 1) {
  59213. Array.prototype.push.apply(rules, rule.find(
  59214. new CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
  59215. } else {
  59216. rules.push(rule);
  59217. }
  59218. break;
  59219. }
  59220. }
  59221. }
  59222. });
  59223. return this._lookups[key] = rules;
  59224. }
  59225. // Zooms can use variables. This replaces CartoCSS.Tree.Zoom objects on selectors
  59226. // with simple bit-arrays that we can compare easily.
  59227. evZooms(env) {
  59228. for (var i = 0; i < this.selectors.length; i++) {
  59229. var zval = CartoCSS.Tree.Zoom.all;
  59230. for (var z = 0; z < this.selectors[i].zoom.length; z++) {
  59231. zval = this.selectors[i].zoom[z].ev(env).zoom;
  59232. }
  59233. this.selectors[i].zoom = zval;
  59234. }
  59235. }
  59236. flatten(result, parents, env) {
  59237. var selectors = [], i, j;
  59238. if (this.selectors.length === 0) {
  59239. env.frames = env.frames.concat(this.rules);
  59240. }
  59241. // evaluate zoom variables on this object.
  59242. this.evZooms(env);
  59243. for (i = 0; i < this.selectors.length; i++) {
  59244. var child = this.selectors[i];
  59245. if (!child.filters) {
  59246. // This is an invalid filterset.
  59247. continue;
  59248. }
  59249. if (parents.length) {
  59250. for (j = 0; j < parents.length; j++) {
  59251. var parent = parents[j];
  59252. var mergedFilters = parent.filters.cloneWith(child.filters);
  59253. if (mergedFilters === null) {
  59254. // Filters could be added, but they didn't change the
  59255. // filters. This means that we only have to clone when
  59256. // the zoom levels or the attachment is different too.
  59257. if (parent.zoom === child.zoom &&
  59258. parent.attachment === child.attachment &&
  59259. parent.elements.join() === child.elements.join()) {
  59260. selectors.push(parent);
  59261. continue;
  59262. } else {
  59263. mergedFilters = parent.filters;
  59264. }
  59265. } else if (!mergedFilters) {
  59266. // The merged filters are invalid, that means we don't
  59267. // have to clone.
  59268. continue;
  59269. }
  59270. var clone = Object.create(CartoCSS.Tree.Selector.prototype);
  59271. clone.filters = mergedFilters;
  59272. clone.zoom = child.zoom;
  59273. clone.elements = parent.elements.concat(child.elements);
  59274. if (parent.attachment && child.attachment) {
  59275. clone.attachment = parent.attachment + '/' + child.attachment;
  59276. } else {clone.attachment = child.attachment || parent.attachment;}
  59277. clone.conditions = parent.conditions + child.conditions;
  59278. clone.index = child.index;
  59279. selectors.push(clone);
  59280. }
  59281. } else {
  59282. selectors.push(child);
  59283. }
  59284. }
  59285. var rules = [];
  59286. for (i = 0; i < this.rules.length; i++) {
  59287. var rule = this.rules[i];
  59288. // Recursively flatten any nested rulesets
  59289. if (rule instanceof CartoCSS.Tree.Ruleset) {
  59290. rule.flatten(result, selectors, env);
  59291. } else if (rule instanceof CartoCSS.Tree.Rule) {
  59292. rules.push(rule);
  59293. } else if (rule instanceof CartoCSS.Tree.Invalid) {
  59294. env.error(rule);
  59295. }
  59296. }
  59297. var index = rules.length ? rules[0].index : false;
  59298. for (i = 0; i < selectors.length; i++) {
  59299. // For specificity sort, use the position of the first rule to allow
  59300. // defining attachments that are under current element as a descendant
  59301. // selector.
  59302. if (index !== false) {
  59303. selectors[i].index = index;
  59304. }
  59305. result.push(new CartoCSS.Tree.Definition(selectors[i], rules.slice()));
  59306. }
  59307. return result;
  59308. }
  59309. };
  59310. CartoCSS.Tree.Selector = class Selector {
  59311. constructor(filters, zoom, elements, attachment, conditions, index) {
  59312. this.elements = elements || [];
  59313. this.attachment = attachment;
  59314. this.filters = filters || {};
  59315. this.zoom = typeof zoom !== 'undefined' ? zoom : CartoCSS.Tree.Zoom.all;
  59316. this.conditions = conditions;
  59317. this.index = index;
  59318. }
  59319. specificity() {
  59320. return this.elements.reduce(function (memo, e) {
  59321. var spec = e.specificity();
  59322. memo[0] += spec[0];
  59323. memo[1] += spec[1];
  59324. return memo;
  59325. }, [0, 0, this.conditions, this.index]);
  59326. }
  59327. };
  59328. /*style:class Invalid ),*/
  59329. CartoCSS.Tree.URL = class URL {
  59330. constructor(val, paths) {
  59331. this.is = 'uri';
  59332. this.value = val;
  59333. this.paths = paths;
  59334. }
  59335. toString() {
  59336. return this.value.toString();
  59337. }
  59338. ev(ctx) {
  59339. return new CartoCSS.Tree.URL(this.value.ev(ctx), this.paths);
  59340. }
  59341. };
  59342. CartoCSS.Tree.Value = class Value {
  59343. constructor(value) {
  59344. this.is = 'value';
  59345. this.value = value;
  59346. }
  59347. ev(env) {
  59348. if (this.value.length === 1) {
  59349. return this.value[0].ev(env);
  59350. } else {
  59351. return new CartoCSS.Tree.Value(this.value.map(function (v) {
  59352. return v.ev(env);
  59353. }));
  59354. }
  59355. }
  59356. toJS(env) {
  59357. //var v = this.value[0].value[0];
  59358. var val = this.ev(env);
  59359. var v = val.toString();
  59360. if (val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
  59361. v = "'" + v + "'";
  59362. } else if (val.is === 'field') {
  59363. // replace [varuable] by ctx['variable']
  59364. v = v.replace(/\[(.*)\]/g, "attributes['\_match1']")
  59365. } else if (val.value && typeof val.value === "object") {
  59366. v = "[" + v + "]";
  59367. }
  59368. return "_value = " + v + ";";
  59369. }
  59370. toString(env, selector, sep, format) {
  59371. return this.value.map(function (e) {
  59372. return e.toString(env, format);
  59373. }).join(sep || ', ');
  59374. }
  59375. clone() {
  59376. var obj = Object.create(CartoCSS.Tree.Value.prototype);
  59377. if (Array.isArray(obj)) {obj.value = this.value.slice();} else {obj.value = this.value;}
  59378. obj.is = this.is;
  59379. return obj;
  59380. }
  59381. };
  59382. CartoCSS.Tree.Variable = class Variable {
  59383. constructor(name, index, filename) {
  59384. this.is = 'variable';
  59385. this.name = name;
  59386. this.index = index;
  59387. this.filename = filename;
  59388. }
  59389. toString() {
  59390. return this.name;
  59391. }
  59392. ev(env) {
  59393. if (this._css) {return this._css;}
  59394. var thisframe = env.frames.filter(function (f) {
  59395. return f.name === this.name;
  59396. }.bind(this));
  59397. if (thisframe.length) {
  59398. return thisframe[0].value.ev(env);
  59399. } else {
  59400. env.error({
  59401. message: 'variable ' + this.name + ' is undefined',
  59402. index: this.index,
  59403. type: 'runtime',
  59404. filename: this.filename
  59405. });
  59406. return {
  59407. is: 'undefined',
  59408. value: 'undefined'
  59409. };
  59410. }
  59411. }
  59412. };
  59413. CartoCSS.Tree.Zoom = class Zoom {
  59414. constructor(op, value, index) {
  59415. this.op = op;
  59416. this.value = value;
  59417. this.index = index;
  59418. }
  59419. setZoom(zoom) {
  59420. this.zoom = zoom;
  59421. return this;
  59422. }
  59423. ev(env) {
  59424. var value = parseInt(this.value.ev(env).toString(), 10);
  59425. if (value > CartoCSS.Tree.Zoom.maxZoom || value < 0) {
  59426. env.error({
  59427. message: 'Only zoom levels between 0 and ' +
  59428. CartoCSS.Tree.Zoom.maxZoom + ' supported.',
  59429. index: this.index
  59430. });
  59431. }
  59432. switch (this.op) {
  59433. case '=':
  59434. this.zoom = "zoom && zoom === " + value;
  59435. return this;
  59436. case '>':
  59437. this.zoom = "zoom && zoom > " + value;
  59438. break;
  59439. case '>=':
  59440. this.zoom = "zoom && zoom >= " + value;
  59441. break;
  59442. case '<':
  59443. this.zoom = "zoom && zoom < " + value;
  59444. break;
  59445. case '<=':
  59446. this.zoom = "zoom && zoom <= " + value;
  59447. break;
  59448. default:
  59449. break;
  59450. }
  59451. /*
  59452. for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
  59453. if (i >= start && i <= end) {
  59454. zoom |= (1 << i);
  59455. }
  59456. }
  59457. this.zoom = zoom;
  59458. this.zoom=value+this.op+"zoom";*/
  59459. return this;
  59460. }
  59461. toString() {
  59462. var str = '';
  59463. for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
  59464. str += (this.zoom & (1 << i)) ? 'X' : '.';
  59465. }
  59466. return str;
  59467. }
  59468. };
  59469. // Covers all zoomlevels from 0 to 22
  59470. CartoCSS.Tree.Zoom.all = 23;
  59471. CartoCSS.Tree.Zoom.maxZoom = 22;
  59472. CartoCSS.Tree.Zoom.ranges = {
  59473. 0: 1000000000,
  59474. 1: 500000000,
  59475. 2: 200000000,
  59476. 3: 100000000,
  59477. 4: 50000000,
  59478. 5: 25000000,
  59479. 6: 12500000,
  59480. 7: 6500000,
  59481. 8: 3000000,
  59482. 9: 1500000,
  59483. 10: 750000,
  59484. 11: 400000,
  59485. 12: 200000,
  59486. 13: 100000,
  59487. 14: 50000,
  59488. 15: 25000,
  59489. 16: 12500,
  59490. 17: 5000,
  59491. 18: 2500,
  59492. 19: 1500,
  59493. 20: 750,
  59494. 21: 500,
  59495. 22: 250,
  59496. 23: 100
  59497. };
  59498. ;// CONCATENATED MODULE: ./src/common/style/ThemeStyle.js
  59499. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59500. * This program are made available under the terms of the Apache License, Version 2.0
  59501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59502. /**
  59503. * @class ThemeStyle
  59504. * @deprecatedclass SuperMap.ThemeStyle
  59505. * @classdesc 客户端专题图风格类。
  59506. * @modulecategory Overlay
  59507. * @category Visualization Theme
  59508. * @param {Object} options - 可选参数。
  59509. * @param {boolean} [options.fill=true] - 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  59510. * @param {string} [options.fillColor='#000000'] - 十六进制填充颜色。
  59511. * @param {number} [options.fillOpacity=1] - 填充不透明度。取值范围[0, 1]。
  59512. * @param {boolean} [options.stroke=false] - 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  59513. * @param {string} [options.strokeColor='#000000'] - 十六进制描边颜色。
  59514. * @param {number} [options.strokeOpacity=1] - 描边的不透明度。取值范围[0, 1]。
  59515. * @param {number} [options.strokeWidth=1] - 线宽度/描边宽度。
  59516. * @param {string} [options.strokeLinecap='butt'] - 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"。
  59517. * @param {string} [options.strokeLineJoin='iter'] - 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  59518. * @param {string} [options.strokeDashstyle='solid'] - 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。solid 表示实线。
  59519. * @param {number} [options.pointRadius=6] - 点半径,单位为像素。
  59520. * @param {number} [options.shadowBlur=0] - 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  59521. * @param {string} [options.shadowColor='#000000'] - 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  59522. * @param {number} [options.shadowOffsetX=0] - 阴影 X 方向偏移值。
  59523. * @param {number} [options.shadowOffsetY=0] - 阴影 Y 方向偏移值。
  59524. * @param {string} options.label - 专题要素附加文本标签内容。
  59525. * @param {string} [options.fontColor] - 附加文本字体颜色。
  59526. * @param {number} [options.fontSize=12] - 附加文本字体大小,单位是像素。
  59527. * @param {string} [options.fontStyle='normal'] - 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  59528. * @param {string} [options.fontVariant='normal'] - 附加文本字体变体。可设值:"normal", "small-caps"。
  59529. * @param {string} [options.fontWeight='normal'] - 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  59530. * @param {string} [options.fontFamily='arial,sans-serif'] - 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
  59531. * 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
  59532. * ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  59533. * @param {string} [options.labelPosition='top'] - 附加文本位置,可以是 'inside', 'left', 'right', 'top', 'bottom'。
  59534. * @param {string} [options.labelAlign='center'] - 附加文本水平对齐。可以是 'left', 'right', 'center'。
  59535. * @param {string} [options.labelBaseline='middle'] - 附加文本垂直对齐。可以是 'top', 'bottom', 'middle' 。
  59536. * @param {number} [options.labelXOffset=0] - 附加文本在x轴方向的偏移量。
  59537. * @param {number} [options.labelYOffset=0] - 附加文本在y轴方向的偏移量。
  59538. * @usage
  59539. */
  59540. class ThemeStyle {
  59541. constructor(options) {
  59542. options = options || {};
  59543. /**
  59544. * @member {boolean} [ThemeStyle.prototype.fill=true]
  59545. * @description 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  59546. */
  59547. this.fill = true;
  59548. /**
  59549. * @member {string} [ThemeStyle.prototype.fillColor="#000000"]
  59550. * @description 十六进制填充颜色。
  59551. */
  59552. this.fillColor = "#000000";
  59553. /**
  59554. * @member {number} [ThemeStyle.prototype.fillOpacity=1]
  59555. * @description 填充不透明度。取值范围[0, 1]。
  59556. */
  59557. this.fillOpacity = 1;
  59558. /**
  59559. * @member {boolean} [ThemeStyle.prototype.stroke=false]
  59560. * @description 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  59561. */
  59562. this.stroke = false;
  59563. /**
  59564. * @member {string} [ThemeStyle.prototype.strokeColor="#000000"]
  59565. * @description 十六进制描边颜色。
  59566. */
  59567. this.strokeColor = "#000000";
  59568. /**
  59569. * @member {number} [ThemeStyle.prototype.strokeOpacity=1]
  59570. * @description 描边的不透明度。取值范围[0, 1]。
  59571. */
  59572. this.strokeOpacity = 1;
  59573. /**
  59574. * @member {number} [ThemeStyle.prototype.strokeWidth=1]
  59575. * @description 线宽度/描边宽度。
  59576. */
  59577. this.strokeWidth = 1;
  59578. /**
  59579. * @member {string} [ThemeStyle.prototype.strokeLinecap="butt"]
  59580. * @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square" 。
  59581. */
  59582. this.strokeLinecap = "butt";
  59583. /**
  59584. * @member {string} [ThemeStyle.prototype.strokeLineJoin="miter"]
  59585. * @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  59586. */
  59587. this.strokeLineJoin = "miter";
  59588. /**
  59589. * @member {string} [ThemeStyle.prototype.strokeDashstyle="solid"]
  59590. * @description 虚线类型;strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
  59591. * solid 表示实线。
  59592. */
  59593. this.strokeDashstyle = "solid";
  59594. /**
  59595. * @member {number} [ThemeStyle.prototype.pointRadius=6]
  59596. * @description 点半径。单位为像素。
  59597. */
  59598. this.pointRadius = 6;
  59599. /**
  59600. * @member {number} [ThemeStyle.prototype.shadowBlur=0]
  59601. * @description 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  59602. */
  59603. this.shadowBlur = 0;
  59604. /**
  59605. * @member {string} [ThemeStyle.prototype.shadowColor='#000000']
  59606. * @description 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  59607. */
  59608. this.shadowColor = "#000000";
  59609. /**
  59610. * @member {number} [ThemeStyle.prototype.shadowOffsetX=0]
  59611. * @description 阴影 X 方向偏移值。
  59612. */
  59613. this.shadowOffsetX = 0;
  59614. /**
  59615. * @member {number} ThemeStyle.prototype.shadowOffsetY
  59616. * @description Y 方向偏移值。
  59617. */
  59618. this.shadowOffsetY = 0;
  59619. /**
  59620. * @member {string} [ThemeStyle.prototype.label]
  59621. * @description 专题要素附加文本标签内容。
  59622. */
  59623. this.label = "";
  59624. /**
  59625. * @member {boolean} [ThemeStyle.prototype.labelRect=false]
  59626. * @description 是否显示文本标签矩形背景。
  59627. */
  59628. this.labelRect = false;
  59629. /**
  59630. * @member {string} [ThemeStyle.prototype.fontColor]
  59631. * @description 附加文本字体颜色。
  59632. */
  59633. this.fontColor = "";
  59634. /**
  59635. * @member {number} [ThemeStyle.prototype.fontSize=12]
  59636. * @description 附加文本字体大小,单位是像素。
  59637. */
  59638. this.fontSize = 12;
  59639. /**
  59640. * @member {string} [ThemeStyle.prototype.fontStyle="normal"]
  59641. * @description 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  59642. */
  59643. this.fontStyle = "normal";
  59644. /**
  59645. * @member {string} [ThemeStyle.prototype.fontVariant="normal"]
  59646. * @description 附加文本字体变体。可设值:"normal", "small-caps"。
  59647. */
  59648. this.fontVariant = "normal";
  59649. /**
  59650. * @member {string} [ThemeStyle.prototype.fontWeight="normal"]
  59651. * @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  59652. */
  59653. this.fontWeight = "normal";
  59654. /**
  59655. * @member {string} [ThemeStyle.prototype.fontFamily="arial,sans-serif"]
  59656. * @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
  59657. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  59658. */
  59659. this.fontFamily = "arial,sans-serif";
  59660. /**
  59661. * @member {string} [ThemeStyle.prototype.labelPosition='top']
  59662. * @description 附加文本位置,可以是 'inside', 'left', 'right', 'top', 'bottom'。
  59663. */
  59664. this.labelPosition = "top";
  59665. /**
  59666. * @member {string} [ThemeStyle.prototype.labelAlign='center']
  59667. * @description 附加文本水平对齐。可以是 'left', 'right', 'center'。
  59668. */
  59669. this.labelAlign = "center";
  59670. /**
  59671. * @member {string} [ThemeStyle.prototype.labelBaseline='middle']
  59672. * @description 附加文本垂直对齐。可以是 'top', 'bottom', 'middle'。
  59673. */
  59674. this.labelBaseline = "middle";
  59675. /**
  59676. * @member {number} [ThemeStyle.prototype.labelXOffset=0]
  59677. * @description 附加文本在 X 轴方向的偏移量。
  59678. */
  59679. this.labelXOffset = 0;
  59680. /**
  59681. * @member {number} [ThemeStyle.prototype.labelYOffset=0]
  59682. * @description 附加文本在 Y 轴方向的偏移量。
  59683. */
  59684. this.labelYOffset = 0;
  59685. Util_Util.extend(this, options);
  59686. }
  59687. }
  59688. ;// CONCATENATED MODULE: ./src/common/style/index.js
  59689. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59690. * This program are made available under the terms of the Apache License, Version 2.0
  59691. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59692. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeParameters.js
  59693. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59694. * This program are made available under the terms of the Apache License, Version 2.0
  59695. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59696. /**
  59697. * @class ShapeParameters
  59698. * @aliasclass Feature.ShapeParameters
  59699. * @deprecatedclass SuperMap.Feature.ShapeParameters
  59700. * @category Visualization Theme
  59701. * @classdesc 图形参数基类
  59702. * @usage
  59703. */
  59704. class ShapeParameters {
  59705. constructor() {
  59706. /**
  59707. * @member {Array.<number>} [ShapeParameters.prototype.refOriginalPosition=[0,0]]
  59708. * @description 图形参考原点位置,图形的参考中心位置。
  59709. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  59710. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  59711. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  59712. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  59713. * 图形(Shape)的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  59714. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  59715. * refOriginalPosition 的值为 [0, 0] 时,图形的位置信息才是 canvas 绝对位置。
  59716. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  59717. */
  59718. this.refOriginalPosition = [0, 0];
  59719. /**
  59720. * @member {string} ShapeParameters.prototype.refDataID
  59721. * @description 图形所关联数据的 ID(<{@link FeatureVector}> 的 ID)。
  59722. */
  59723. this.refDataID = null;
  59724. /**
  59725. * @member {boolean} ShapeParameters.prototype.isHoverByRefDataID
  59726. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  59727. */
  59728. this.isHoverByRefDataID = false;
  59729. /**
  59730. * @member {string} ShapeParameters.prototype.refDataHoverGroup
  59731. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  59732. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  59733. */
  59734. this.refDataHoverGroup = null;
  59735. /**
  59736. * @member {Object} ShapeParameters.prototype.dataInfo
  59737. * @description 图形携带的附加数据。
  59738. */
  59739. this.dataInfo = null;
  59740. /**
  59741. * @member {boolean} ShapeParameters.prototype.clickable
  59742. * @description 是否可点击。
  59743. */
  59744. this.clickable = true;
  59745. /**
  59746. * @member {boolean} ShapeParameters.prototype.hoverable
  59747. * @description 是否可点击。
  59748. */
  59749. this.hoverable = true;
  59750. /**
  59751. * @member {Object} ShapeParameters.prototype.style
  59752. * @description 图形样式对象,可设样式属性在子类中确定。
  59753. */
  59754. this.style = null;
  59755. /**
  59756. * @member {Object} ShapeParameters.prototype.highlightStyle
  59757. * @description 高亮样式对象,可设样式属性与 style 的可设样式属性相同。
  59758. */
  59759. this.highlightStyle = {};
  59760. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters";
  59761. }
  59762. /**
  59763. * @function ShapeParameters.prototype.destroy
  59764. * @description 销毁对象。
  59765. */
  59766. destroy() {
  59767. this.refOriginalPosition = null;
  59768. this.refDataID = null;
  59769. this.isHoverByRefDataID = null;
  59770. this.refDataHoverGroup = null;
  59771. this.dataInfo = null;
  59772. this.clickable = null;
  59773. this.hoverable = null;
  59774. this.style = null;
  59775. this.highlightStyle = null;
  59776. }
  59777. }
  59778. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Point.js
  59779. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59780. * This program are made available under the terms of the Apache License, Version 2.0
  59781. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59782. /**
  59783. * @class ShapeParametersPoint
  59784. * @aliasclass Feature.ShapeParameters.Point
  59785. * @deprecatedclass SuperMap.Feature.ShapeParameters.Point
  59786. * @category Visualization Theme
  59787. * @classdesc 点参数对象。
  59788. * @extends {ShapeParameters}
  59789. * @param {number} x - 点 x 坐标。
  59790. * @param {number} y - 点 y 坐标。
  59791. * @usage
  59792. */
  59793. class Point_Point extends ShapeParameters {
  59794. constructor(x, y) {
  59795. super(x, y);
  59796. /**
  59797. * @member {number} ShapeParametersPoint.prototype.x
  59798. * @description 点 x 坐标。
  59799. */
  59800. this.x = !isNaN(x) ? x : 0;
  59801. /**
  59802. * @member {number} ShapeParametersPoint.prototype.y
  59803. * @description 点 y 坐标。
  59804. */
  59805. this.y = !isNaN(y) ? y : 0;
  59806. /**
  59807. * @member {number} ShapeParametersPoint.prototype.r
  59808. * @description 点的半径。
  59809. */
  59810. this.r = 6;
  59811. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Point";
  59812. }
  59813. /**
  59814. * @function ShapeParametersPoint.prototype.destroy
  59815. * @description 销毁对象。
  59816. */
  59817. destroy() {
  59818. this.x = null;
  59819. this.y = null;
  59820. this.r = null;
  59821. super.destroy();
  59822. }
  59823. }
  59824. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Line.js
  59825. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59826. * This program are made available under the terms of the Apache License, Version 2.0
  59827. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59828. /**
  59829. * @class ShapeParametersLine
  59830. * @aliasclass Feature.ShapeParameters.Line
  59831. * @deprecatedclass SuperMap.Feature.ShapeParameters.Line
  59832. * @category Visualization Theme
  59833. * @classdesc 线参数对象。
  59834. * @extends {ShapeParameters}
  59835. * @param {Array} pointList - 线要素节点数组,二维数组。
  59836. * @usage
  59837. */
  59838. class Line_Line extends ShapeParameters {
  59839. constructor(pointList) {
  59840. super(pointList);
  59841. /**
  59842. * @member {Array} ShapeParametersLine.prototype.pointList
  59843. * @description 线要素节点数组,二维数组。
  59844. * 数组形如:
  59845. * (start code)
  59846. * [
  59847. * [10, 20], //节点
  59848. * [30, 40],
  59849. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  59850. * ]
  59851. * (end)
  59852. */
  59853. this.pointList = pointList;
  59854. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Line";
  59855. }
  59856. /**
  59857. * @function ShapeParametersLine.prototype.destroy
  59858. * @description 销毁对象。
  59859. */
  59860. destroy() {
  59861. this.pointList = null;
  59862. super.destroy();
  59863. }
  59864. }
  59865. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Polygon.js
  59866. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59867. * This program are made available under the terms of the Apache License, Version 2.0
  59868. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59869. /**
  59870. * @class ShapeParametersPolygon
  59871. * @aliasclass Feature.ShapeParameters.Polygon
  59872. * @deprecatedclass SuperMap.Feature.ShapeParameters.Polygon
  59873. * @category Visualization Theme
  59874. * @classdesc 面参数对象。
  59875. * @extends {ShapeParameters}
  59876. * @param {Array} pointList - 横坐标。
  59877. * @usage
  59878. */
  59879. class feature_Polygon_Polygon extends ShapeParameters {
  59880. constructor(pointList) {
  59881. super(pointList);
  59882. /**
  59883. * @member {Array} ShapeParametersPolygon.prototype.pointList
  59884. * @description 面要素节点数组,二维数组。
  59885. * 数组形如:
  59886. * (start code)
  59887. * [
  59888. * [10, 20], //节点
  59889. * [30, 40],
  59890. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  59891. * ]
  59892. * (end)
  59893. */
  59894. this.pointList = pointList;
  59895. /**
  59896. * @member {Array} ShapeParametersPolygon.prototype.holePolygonPointLists
  59897. * @description 岛洞面多边形顶点数组(三维数组)
  59898. */
  59899. this.holePolygonPointLists = null;
  59900. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Polygon";
  59901. }
  59902. /**
  59903. * @function ShapeParametersPolygon.prototype.destroy
  59904. * @description 销毁对象。
  59905. */
  59906. destroy() {
  59907. this.pointList = null;
  59908. this.holePolygonPointLists = null;
  59909. super.destroy();
  59910. }
  59911. }
  59912. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Rectangle.js
  59913. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59914. * This program are made available under the terms of the Apache License, Version 2.0
  59915. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59916. /**
  59917. * @class ShapeParametersRectangle
  59918. * @aliasclass Feature.ShapeParameters.Rectangle
  59919. * @deprecatedclass SuperMap.Feature.ShapeParameters.Rectangle
  59920. * @category Visualization Theme
  59921. * @classdesc 矩形参数对象。
  59922. * @extends {ShapeParameters}
  59923. * @param {number} x - 矩形 x 坐标。
  59924. * @param {number} y - 矩形 y 坐标。
  59925. * @param {number} width - 矩形 width 宽度。
  59926. * @param {number} height - 矩形 height 高度。
  59927. * @usage
  59928. */
  59929. class Rectangle_Rectangle extends ShapeParameters {
  59930. constructor(x, y, width, height) {
  59931. super(x, y, width, height);
  59932. /**
  59933. * @member {number} ShapeParametersRectangle.prototype.x
  59934. * @description 左上角 x 坐标。
  59935. */
  59936. this.x = !isNaN(x) ? x : 0;
  59937. /**
  59938. * @member {number} ShapeParametersRectangle.prototype.y
  59939. * @description 左上角 y 坐标。
  59940. */
  59941. this.y = !isNaN(x) ? y : 0;
  59942. /**
  59943. * @member {number} ShapeParametersRectangle.prototype.width
  59944. * @description 宽度。
  59945. */
  59946. this.width = !isNaN(width) ? width : 0;
  59947. /**
  59948. * @member {number} ShapeParametersRectangle.prototype.height
  59949. * @description 高度。
  59950. */
  59951. this.height = !isNaN(height) ? height : 0;
  59952. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Rectangle";
  59953. }
  59954. /**
  59955. * @function ShapeParametersRectangle.prototype.destroy
  59956. * @description 销毁对象。
  59957. */
  59958. destroy() {
  59959. this.x = null;
  59960. this.y = null;
  59961. this.width = null;
  59962. this.height = null;
  59963. super.destroy();
  59964. }
  59965. }
  59966. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Sector.js
  59967. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59968. * This program are made available under the terms of the Apache License, Version 2.0
  59969. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59970. /**
  59971. * @class ShapeParametersSector
  59972. * @aliasclass Feature.ShapeParameters.Sector
  59973. * @deprecatedclass SuperMap.Feature.ShapeParameters.Sector
  59974. * @category Visualization Theme
  59975. * @classdesc 扇形参数对象。
  59976. * @extends {ShapeParameters}
  59977. * @param {number} x - 圆心 x 坐标。
  59978. * @param {number} y - 圆心 y 坐标。
  59979. * @param {number} r - 外圆半径。
  59980. * @param {number} startAngle - 起始角度。取值范围[0, 360)。
  59981. * @param {number} endAngle - 结束角度。取值范围(0, 360]。
  59982. * @param {number} [r0=0] - 内圆半径,指定后将出现内弧,同时扇边长度为'r - r0'。取值范围[0, r)。
  59983. * @usage
  59984. */
  59985. class Sector extends ShapeParameters {
  59986. constructor(x, y, r, startAngle, endAngle, r0, clockWise) {
  59987. super(x, y, r, startAngle, endAngle, r0, clockWise);
  59988. /**
  59989. * @member {number} ShapeParametersSector.prototype.x
  59990. * @description 圆心 x 坐标。
  59991. */
  59992. this.x = !isNaN(x) ? x : 0;
  59993. /**
  59994. * @member {number} ShapeParametersSector.prototype.Y
  59995. * @description 圆心 Y 坐标。
  59996. */
  59997. this.y = !isNaN(y) ? y : 0;
  59998. /**
  59999. * @member {number} ShapeParametersSector.prototype.r
  60000. * @description 外圆半径。
  60001. */
  60002. this.r = !isNaN(r) ? r : 0;
  60003. /**
  60004. * @member {number} ShapeParametersSector.prototype.startAngle
  60005. * @description 起始角度。取值范围[0, 360),默认值:null。
  60006. */
  60007. this.startAngle = !isNaN(startAngle) ? startAngle : 0;
  60008. /**
  60009. * @member {number} ShapeParametersSector.prototype.endAngle
  60010. * @description 结束角度。取值范围(0, 360],默认值:null。
  60011. */
  60012. this.endAngle = !isNaN(endAngle) ? endAngle : 0;
  60013. /**
  60014. * @member {number} [ShapeParametersSector.prototype.r0=0]
  60015. * @description 内圆半径,指定后将出现内弧,同时扇边长度为 r 减 r0。取值范围[0, r)。
  60016. */
  60017. this.r0 = !isNaN(r0) ? r0 : 0;
  60018. /**
  60019. * @member {number} [ShapeParametersSector.prototype.clockWise=false]
  60020. * @description 是否是顺时针。默认值:false。
  60021. */
  60022. this.clockWise = clockWise;
  60023. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Sector";
  60024. }
  60025. /**
  60026. * @function ShapeParametersSector.prototype.destroy
  60027. * @description 销毁对象。
  60028. */
  60029. destroy() {
  60030. this.x = null;
  60031. this.y = null;
  60032. this.r = null;
  60033. this.startAngle = null;
  60034. this.endAngle = null;
  60035. this.r0 = null;
  60036. this.clockWise = null;
  60037. super.destroy();
  60038. }
  60039. }
  60040. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Label.js
  60041. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60042. * This program are made available under the terms of the Apache License, Version 2.0
  60043. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60044. /**
  60045. * @class ShapeParametersLabel
  60046. * @aliasclass Feature.ShapeParameters.Label
  60047. * @deprecatedclass SuperMap.Feature.ShapeParameters.Label
  60048. * @category Visualization Theme
  60049. * @classdesc 标签参数对象。
  60050. * @extends {ShapeParameters}
  60051. * @param {number} x - 横坐标。
  60052. * @param {number} y - 纵坐标。
  60053. * @param {string} text - 图形中的附加文本。
  60054. * @usage
  60055. * ```
  60056. * // 浏览器
  60057. * <script type="text/javascript" src="{cdn}"></script>
  60058. * <script>
  60059. * new {namespace}.Feature.ShapeParameters.Label(x, y, text);
  60060. *
  60061. * // 弃用的写法
  60062. * new SuperMap.Feature.ShapeParameters.Label(x, y, text);
  60063. *
  60064. * </script>
  60065. * // ES6 Import
  60066. * import { ShapeParametersLabel } from '{npm}';
  60067. * new ShapeParametersLabel(x, y, text);
  60068. *
  60069. * // 弃用的写法
  60070. * import { Label } from '{npm}';
  60071. * new Label(x, y, text);
  60072. *
  60073. * ```
  60074. */
  60075. class Label extends ShapeParameters {
  60076. constructor(x, y, text) {
  60077. super(x, y, text);
  60078. /**
  60079. * @member {number} ShapeParametersLabel.prototype.x
  60080. * @description 标签 x 坐标。
  60081. */
  60082. this.x = x;
  60083. /**
  60084. * @member {number} ShapeParametersLabel.prototype.y
  60085. * @description 标签 y 坐标。
  60086. */
  60087. this.y = y;
  60088. /**
  60089. * @member {number} ShapeParametersLabel.prototype.text
  60090. * @description 标签的文本内容。
  60091. */
  60092. this.text = text;
  60093. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Label";
  60094. }
  60095. /**
  60096. * @function ShapeParametersLabel.prototype.destroy
  60097. * @description 销毁对象。
  60098. */
  60099. destroy() {
  60100. this.x = null;
  60101. this.y = null;
  60102. this.text = null;
  60103. super.destroy();
  60104. }
  60105. }
  60106. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Image.js
  60107. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60108. * This program are made available under the terms of the Apache License, Version 2.0
  60109. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60110. /**
  60111. * @class ShapeParametersImage
  60112. * @aliasclass Feature.ShapeParameters.Image
  60113. * @deprecatedclass SuperMap.Feature.ShapeParameters.Image
  60114. * @category Visualization Theme
  60115. * @classdesc 图片参数对象。
  60116. * @extends {ShapeParameters}
  60117. * @param {number} x - 左上角横坐标。
  60118. * @param {number} y - 左上角纵坐标。
  60119. * @param {(string|Object)} image - 图片地址或Cavans对象。
  60120. * @param {number} width - 绘制到画布上的宽度,默认为图片高度。
  60121. * @param {number} height - 绘制到画布上的高度,默认为图片高度。
  60122. * @param {number} sx - 从图片中裁剪的左上角横坐标。
  60123. * @param {number} sy - 从图片中裁剪的左上角纵坐标。
  60124. * @param {number} sWidth - 从图片中裁剪的宽度,默认为图片高度。
  60125. * @param {number} sHeight - 绘制到画布上的高度,默认为图片高度。
  60126. * @usage
  60127. */
  60128. class Image_Image extends ShapeParameters {
  60129. constructor(x, y, image, width, height, sx, sy, sWidth, sHeight) {
  60130. super(x, y, image, width, height, sx, sy, sWidth, sHeight);
  60131. /**
  60132. * @member {number} ShapeParametersImage.prototype.x
  60133. * @description 左上角横坐标,必设参数。
  60134. */
  60135. this.x = x;
  60136. /**
  60137. * @member {number} ShapeParametersImage.prototype.y
  60138. * @description 左上角纵坐标,必设参数。
  60139. */
  60140. this.y = y;
  60141. /**
  60142. * @member {(string|Object)} ShapeParametersImage.prototype.image
  60143. * @description 图片地址。
  60144. */
  60145. this.image = image;
  60146. /**
  60147. * @member {number} ShapeParametersImage.prototype.width
  60148. * @description 绘制到画布上的宽度,默认为图片高度。
  60149. */
  60150. this.width = width;
  60151. /**
  60152. * @member {number} ShapeParametersImage.prototype.height
  60153. * @description 绘制到画布上的高度,默认为图片高度。
  60154. */
  60155. this.height = height;
  60156. /**
  60157. * @member {number} ShapeParametersImage.prototype.sx
  60158. * @description 从图片中裁剪的左上角横坐标。
  60159. */
  60160. this.sx = sx;
  60161. /**
  60162. * @member {number} ShapeParametersImage.prototype.sy
  60163. * @description 从图片中裁剪的左上角纵坐标。
  60164. */
  60165. this.sy = sy;
  60166. /**
  60167. * @member {number} ShapeParametersImage.prototype.sWidth
  60168. * @description 从图片中裁剪的宽度,默认为图片高度。
  60169. */
  60170. this.sWidth = sWidth;
  60171. /**
  60172. * @member {number} ShapeParametersImage.prototype.sHeight
  60173. * @description 绘制到画布上的高度,默认为图片高度。
  60174. */
  60175. this.sHeight = sHeight;
  60176. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Image";
  60177. }
  60178. /**
  60179. * @function ShapeParametersImage.prototype.destroy
  60180. * @description 销毁对象。
  60181. */
  60182. destroy() {
  60183. this.x = null;
  60184. this.y = null;
  60185. this.image = null;
  60186. this.width = null;
  60187. this.height = null;
  60188. this.sx = null;
  60189. this.sy = null;
  60190. this.sWidth = null;
  60191. this.sHeight = null;
  60192. super.destroy();
  60193. }
  60194. }
  60195. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Circle.js
  60196. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60197. * This program are made available under the terms of the Apache License, Version 2.0
  60198. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60199. /**
  60200. * @class ShapeParametersCircle
  60201. * @aliasclass Feature.ShapeParameters.Circle
  60202. * @deprecatedclass SuperMap.Feature.ShapeParameters.Circle
  60203. * @classdesc 圆形参数对象。
  60204. * @category Visualization Theme
  60205. * @extends {ShapeParameters}
  60206. * @param {number} x - 圆心 x 坐标。
  60207. * @param {number} y - 圆心 y 坐标。
  60208. * @param {number} r - 圆半径。
  60209. * @usage
  60210. */
  60211. class Circle_Circle extends ShapeParameters {
  60212. constructor(x, y, r) {
  60213. super(x, y, r);
  60214. /**
  60215. * @member {number} ShapeParametersCircle.prototype.x
  60216. * @description 圆心 x 坐标。
  60217. */
  60218. this.x = !isNaN(x) ? x : 0;
  60219. /**
  60220. * @member {number} ShapeParametersCircle.prototype.y
  60221. * @description 圆心 y 坐标。
  60222. */
  60223. this.y = !isNaN(y) ? y : 0;
  60224. /**
  60225. * @member {number} ShapeParametersCircle.prototype.r
  60226. * @description 圆半径。
  60227. */
  60228. this.r = !isNaN(r) ? r : 0;
  60229. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Circle";
  60230. }
  60231. /**
  60232. * @function ShapeParametersCircle.prototype.destroy
  60233. * @description 销毁对象。
  60234. */
  60235. destroy() {
  60236. this.x = null;
  60237. this.y = null;
  60238. this.r = null;
  60239. super.destroy();
  60240. }
  60241. }
  60242. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Eventful.js
  60243. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60244. * This program are made available under the terms of the Apache License, Version 2.0
  60245. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60246. /**
  60247. * @class LevelRenderer.Eventful
  60248. * @category Visualization Theme
  60249. * @classdesc 事件分发器超类,所有支持事件处理的类均是此类的子类。
  60250. * 此类不可实例化。
  60251. * 支持的事件:
  60252. * Symbolizer properties:
  60253. * onclick - {function} 默认值:null。
  60254. * onmouseover - {function} 默认值:null。
  60255. * onmouseout - {function} 默认值:null。
  60256. * onmousemove - {function} 默认值:null。
  60257. * onmousewheel - {function} 默认值:null。
  60258. * onmousedown - {function} 默认值:null。
  60259. * onmouseup - {function} 默认值:null。
  60260. * ondragstart - {function} 默认值:null。
  60261. * ondragend - {function} 默认值:null。
  60262. * ondragenter - {function} 默认值:null。
  60263. * ondragleave - {function} 默认值:null。
  60264. * ondragover - {function} 默认值:null。
  60265. * ondrop - {function} 默认值:null。
  60266. * @private
  60267. */
  60268. class Eventful {
  60269. constructor() {
  60270. /**
  60271. * @member {Object} LevelRenderer.Eventful.prototype._handlers
  60272. * @description 事件处理对象(事件分发器)。
  60273. */
  60274. this._handlers = {};
  60275. this.CLASS_NAME = "SuperMap.LevelRenderer.Eventful";
  60276. }
  60277. /**
  60278. * @function {Object} LevelRenderer.Eventful.prototype.destroy
  60279. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  60280. */
  60281. destroy() {
  60282. this._handlers = null;
  60283. }
  60284. /**
  60285. * @function LevelRenderer.Eventful.prototype.one
  60286. * @description 单次触发绑定,dispatch后销毁。
  60287. * @param {string} event - 事件名。
  60288. * @param {boolean} handler - 响应函数。
  60289. * @param {Object} context - context。
  60290. * @returns {LevelRenderer.Eventful} this
  60291. */
  60292. one(event, handler, context) {
  60293. var _h = this._handlers;
  60294. if (!handler || !event) {
  60295. return this;
  60296. }
  60297. if (!_h[event]) {
  60298. _h[event] = [];
  60299. }
  60300. _h[event].push({
  60301. h: handler,
  60302. one: true,
  60303. ctx: context || this
  60304. });
  60305. return this;
  60306. }
  60307. /**
  60308. * @function LevelRenderer.Eventful.prototype.bind
  60309. * @description 绑定事件。
  60310. * @param {string} event - 事件名。
  60311. * @param {boolean} handler - 响应函数。
  60312. * @param {Object} context - context。
  60313. * @returns {LevelRenderer.Eventful} this
  60314. */
  60315. bind(event, handler, context) {
  60316. var _h = this._handlers;
  60317. if (!handler || !event) {
  60318. return this;
  60319. }
  60320. if (!_h[event]) {
  60321. _h[event] = [];
  60322. }
  60323. _h[event].push({
  60324. h: handler,
  60325. one: false,
  60326. ctx: context || this
  60327. });
  60328. return this;
  60329. }
  60330. /**
  60331. * @function LevelRenderer.Eventful.prototype.unbind
  60332. * @description 解绑事件。
  60333. * @param {string} event - 事件名。
  60334. * @param {boolean} handler - 响应函数。
  60335. * @returns {LevelRenderer.Eventful} this
  60336. */
  60337. unbind(event, handler) {
  60338. var _h = this._handlers;
  60339. if (!event) {
  60340. this._handlers = {};
  60341. return this;
  60342. }
  60343. if (handler) {
  60344. if (_h[event]) {
  60345. var newList = [];
  60346. for (var i = 0, l = _h[event].length; i < l; i++) {
  60347. if (_h[event][i]['h'] != handler) {
  60348. newList.push(_h[event][i]);
  60349. }
  60350. }
  60351. _h[event] = newList;
  60352. }
  60353. if (_h[event] && _h[event].length === 0) {
  60354. delete _h[event];
  60355. }
  60356. } else {
  60357. delete _h[event];
  60358. }
  60359. return this;
  60360. }
  60361. /**
  60362. * @function LevelRenderer.Eventful.prototype.dispatch
  60363. * @description 事件分发。
  60364. * @param {string} type - 事件类型。
  60365. * @returns {LevelRenderer.Eventful} this
  60366. */
  60367. dispatch(type) {
  60368. if (this._handlers[type]) {
  60369. var args = arguments;
  60370. var argLen = args.length;
  60371. if (argLen > 3) {
  60372. args = Array.prototype.slice.call(args, 1);
  60373. }
  60374. var _h = this._handlers[type];
  60375. var len = _h.length;
  60376. for (var i = 0; i < len;) {
  60377. // Optimize advise from backbone
  60378. switch (argLen) {
  60379. case 1:
  60380. _h[i]['h'].call(_h[i]['ctx']);
  60381. break;
  60382. case 2:
  60383. _h[i]['h'].call(_h[i]['ctx'], args[1]);
  60384. break;
  60385. case 3:
  60386. _h[i]['h'].call(_h[i]['ctx'], args[1], args[2]);
  60387. break;
  60388. default:
  60389. // have more than 2 given arguments
  60390. _h[i]['h'].apply(_h[i]['ctx'], args);
  60391. break;
  60392. }
  60393. if (_h[i]['one']) {
  60394. _h.splice(i, 1);
  60395. len--;
  60396. } else {
  60397. i++;
  60398. }
  60399. }
  60400. }
  60401. return this;
  60402. }
  60403. /**
  60404. * @function LevelRenderer.Eventful.prototype.dispatchWithContext
  60405. * @description 带有context的事件分发,最后一个参数是事件回调的 context。
  60406. * @param {string} type - 事件类型。
  60407. * @returns {LevelRenderer.Eventful} this
  60408. */
  60409. dispatchWithContext(type) {
  60410. if (this._handlers[type]) {
  60411. var args = arguments;
  60412. var argLen = args.length;
  60413. if (argLen > 4) {
  60414. args = Array.prototype.slice.call(args, 1, args.length - 1);
  60415. }
  60416. var ctx = args[args.length - 1];
  60417. var _h = this._handlers[type];
  60418. var len = _h.length;
  60419. for (var i = 0; i < len;) {
  60420. // Optimize advise from backbone
  60421. switch (argLen) {
  60422. case 1:
  60423. _h[i]['h'].call(ctx);
  60424. break;
  60425. case 2:
  60426. _h[i]['h'].call(ctx, args[1]);
  60427. break;
  60428. case 3:
  60429. _h[i]['h'].call(ctx, args[1], args[2]);
  60430. break;
  60431. default:
  60432. // have more than 2 given arguments
  60433. _h[i]['h'].apply(ctx, args);
  60434. break;
  60435. }
  60436. if (_h[i]['one']) {
  60437. _h.splice(i, 1);
  60438. len--;
  60439. } else {
  60440. i++;
  60441. }
  60442. }
  60443. }
  60444. return this;
  60445. }
  60446. }
  60447. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Vector.js
  60448. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60449. * This program are made available under the terms of the Apache License, Version 2.0
  60450. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60451. /**
  60452. * @private
  60453. * @class LevelRenderer.Tool.Vector
  60454. * @category Visualization Theme
  60455. * @classdesc LevelRenderer 二维向量类
  60456. *
  60457. */
  60458. class levelRenderer_Vector_Vector {
  60459. constructor() {
  60460. this.ArrayCtor = typeof Float32Array === 'undefined'
  60461. ? Array
  60462. : Float32Array;
  60463. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Vector";
  60464. }
  60465. /**
  60466. * @function LevelRenderer.Tool.Vector.prototype.create
  60467. * @description 创建一个向量。
  60468. *
  60469. * @param {number} x - x坐标
  60470. * @param {number} y - Y坐标
  60471. * @return {Vector2} 向量。
  60472. */
  60473. create(x, y) {
  60474. var ArrayCtor = this.ArrayCtor;
  60475. var out = new ArrayCtor(2);
  60476. out[0] = x || 0;
  60477. out[1] = y || 0;
  60478. return out;
  60479. }
  60480. /**
  60481. * @function LevelRenderer.Tool.Vector.prototype.copy
  60482. * @description 复制一个向量。
  60483. *
  60484. * @param {Vector2} out - 基础向量。
  60485. * @param {Vector2} v - 向量。
  60486. * @return {Vector2} 克隆向量。
  60487. */
  60488. copy(out, v) {
  60489. out[0] = v[0];
  60490. out[1] = v[1];
  60491. return out;
  60492. }
  60493. /**
  60494. * @function LevelRenderer.Tool.Vector.prototype.set
  60495. * @description 设置向量的两个项。
  60496. *
  60497. * @param {Vector2} out - 基础向量。
  60498. * @param {number} a - 项 a。
  60499. * @param {number} b - 项 b。
  60500. * @return {Vector2} 结果。
  60501. */
  60502. set(out, a, b) {
  60503. out[0] = a;
  60504. out[1] = b;
  60505. return out;
  60506. }
  60507. /**
  60508. * @function LevelRenderer.Tool.Vector.prototype.add
  60509. * @description 向量相加。
  60510. *
  60511. * @param {Vector2} out - 基础向量。
  60512. * @param {Vector2} v1 - 向量 v1。
  60513. * @param {Vector2} v2 - 向量 v2。
  60514. * @return {Vector2} 结果。
  60515. */
  60516. add(out, v1, v2) {
  60517. out[0] = v1[0] + v2[0];
  60518. out[1] = v1[1] + v2[1];
  60519. return out;
  60520. }
  60521. /**
  60522. * @function LevelRenderer.Tool.Vector.prototype.scaleAndAdd
  60523. * @description 向量缩放后相加。
  60524. * @param {Vector2} out - 基础向量。
  60525. * @param {Vector2} v1 - 向量 v1。
  60526. * @param {Vector2} v2 - 向量 v2(缩放向量)。
  60527. * @param {number} a - 缩放参数。
  60528. * @return {Vector2} 结果。
  60529. */
  60530. scaleAndAdd(out, v1, v2, a) {
  60531. out[0] = v1[0] + v2[0] * a;
  60532. out[1] = v1[1] + v2[1] * a;
  60533. return out;
  60534. }
  60535. /**
  60536. * @function LevelRenderer.Tool.Vector.prototype.sub
  60537. * @description 向量相减。
  60538. * @param {Vector2} out - 基础向量。
  60539. * @param {Vector2} v1 - 向量 v1。
  60540. * @param {Vector2} v2 - 向量 v2。
  60541. * @return {Vector2} 结果。
  60542. */
  60543. sub(out, v1, v2) {
  60544. out[0] = v1[0] - v2[0];
  60545. out[1] = v1[1] - v2[1];
  60546. return out;
  60547. }
  60548. /**
  60549. * @function LevelRenderer.Tool.Vector.prototype.len
  60550. * @description 向量长度。
  60551. * @param {Vector2} v - 向量。
  60552. * @return {number} 向量长度。
  60553. */
  60554. len(v) {
  60555. return Math.sqrt(this.lenSquare(v));
  60556. }
  60557. /**
  60558. * @function LevelRenderer.Tool.Vector.prototype.lenSquare
  60559. * @description 向量长度平方。
  60560. * @param {Vector2} v - 向量。
  60561. * @return {number} 向量长度平方。
  60562. */
  60563. lenSquare(v) {
  60564. return v[0] * v[0] + v[1] * v[1];
  60565. }
  60566. /**
  60567. * @function LevelRenderer.Tool.Vector.prototype.mul
  60568. * @description 向量乘法。
  60569. * @param {Vector2} out - 基础向量。
  60570. * @param {Vector2} v1 - 向量 v1。
  60571. * @param {Vector2} v2 - 向量 v2。
  60572. * @return {Vector2} 结果。
  60573. */
  60574. mul(out, v1, v2) {
  60575. out[0] = v1[0] * v2[0];
  60576. out[1] = v1[1] * v2[1];
  60577. return out;
  60578. }
  60579. /**
  60580. * @function LevelRenderer.Tool.Vector.prototype.div
  60581. * @description 向量除法。
  60582. *
  60583. * @param {Vector2} out - 基础向量。
  60584. * @param {Vector2} v1 - 向量 v1。
  60585. * @param {Vector2} v2 - 向量 v2。
  60586. * @return {Vector2} 结果。
  60587. */
  60588. div(out, v1, v2) {
  60589. out[0] = v1[0] / v2[0];
  60590. out[1] = v1[1] / v2[1];
  60591. return out;
  60592. }
  60593. /**
  60594. * @function LevelRenderer.Tool.Vector.prototype.dot
  60595. * @description 向量点乘。
  60596. *
  60597. * @param {Vector2} v1 - 向量 v1。
  60598. * @param {Vector2} v2 - 向量 v2。
  60599. * @return {number} 向量点乘。
  60600. */
  60601. dot(v1, v2) {
  60602. return v1[0] * v2[0] + v1[1] * v2[1];
  60603. }
  60604. /**
  60605. * @function LevelRenderer.Tool.Vector.prototype.scale
  60606. * @description 向量缩放。
  60607. *
  60608. * @param {Vector2} out - 基础向量。
  60609. * @param {Vector2} v - 向量v。
  60610. * @param {number} s -缩放参数。
  60611. * @return {Vector2} 结果。
  60612. */
  60613. scale(out, v, s) {
  60614. out[0] = v[0] * s;
  60615. out[1] = v[1] * s;
  60616. return out;
  60617. }
  60618. /**
  60619. * @function LevelRenderer.Tool.Vector.prototype.normalize
  60620. * @description 向量归一化。
  60621. *
  60622. * @param {Vector2} out - 基础向量。
  60623. * @param {Vector2} v - 向量 v。
  60624. * @return {Vector2} 结果。
  60625. */
  60626. normalize(out, v) {
  60627. var d = this.len(v);
  60628. if (d === 0) {
  60629. out[0] = 0;
  60630. out[1] = 0;
  60631. } else {
  60632. out[0] = v[0] / d;
  60633. out[1] = v[1] / d;
  60634. }
  60635. return out;
  60636. }
  60637. /**
  60638. * @function LevelRenderer.Tool.Vector.prototype.distance
  60639. * @description 计算向量间距离。
  60640. *
  60641. * @param {Vector2} v1 - 向量 v1。
  60642. * @param {Vector2} v2 - 向量 v2。
  60643. * @return {number} 向量间距离。
  60644. */
  60645. distance(v1, v2) {
  60646. return Math.sqrt(
  60647. (v1[0] - v2[0]) * (v1[0] - v2[0])
  60648. + (v1[1] - v2[1]) * (v1[1] - v2[1])
  60649. );
  60650. }
  60651. /**
  60652. * @function LevelRenderer.Tool.Vector.prototype.distanceSquare
  60653. * @description 向量距离平方。
  60654. *
  60655. * @param {Vector2} v1 - 向量 v1。
  60656. * @param {Vector2} v2 - 向量 v2。
  60657. * @return {number} 向量距离平方。
  60658. */
  60659. distanceSquare(v1, v2) {
  60660. return (v1[0] - v2[0]) * (v1[0] - v2[0])
  60661. + (v1[1] - v2[1]) * (v1[1] - v2[1]);
  60662. }
  60663. /**
  60664. * @function LevelRenderer.Tool.Vector.prototype.negate
  60665. * @description 求负向量。
  60666. *
  60667. * @param {Vector2} out - 基础向量。
  60668. * @param {Vector2} v - 向量 v。
  60669. * @return {Vector2} 负向量。
  60670. */
  60671. negate(out, v) {
  60672. out[0] = -v[0];
  60673. out[1] = -v[1];
  60674. return out;
  60675. }
  60676. /**
  60677. * @function LevelRenderer.Tool.Vector.prototype.lerp
  60678. * @description 两点之间线性插值。
  60679. *
  60680. * @param {Vector2} out - 基础向量。
  60681. * @param {Vector2} v1 - 向量 v1。
  60682. * @param {Vector2} v2 - 向量 v2。
  60683. * @param {number} t
  60684. * @return {Vector2} 结果。
  60685. */
  60686. lerp(out, v1, v2, t) {
  60687. out[0] = v1[0] + t * (v2[0] - v1[0]);
  60688. out[1] = v1[1] + t * (v2[1] - v1[1]);
  60689. return out;
  60690. }
  60691. /**
  60692. * @function LevelRenderer.Tool.Vector.prototype.applyTransform
  60693. * @description 矩阵左乘向量。
  60694. *
  60695. * @param {Vector2} out - 基础向量。
  60696. * @param {Vector2} v1 - 向量 v1。
  60697. * @param {Vector2} v2 - 向量 v2。
  60698. * @return {Vector2} 结果。
  60699. */
  60700. applyTransform(out, v, m) {
  60701. var x = v[0];
  60702. var y = v[1];
  60703. out[0] = m[0] * x + m[2] * y + m[4];
  60704. out[1] = m[1] * x + m[3] * y + m[5];
  60705. return out;
  60706. }
  60707. /**
  60708. * @function LevelRenderer.Tool.Vector.prototype.min
  60709. * @description 求两个向量最小值。
  60710. * @param {Vector2} out - 基础向量。
  60711. * @param {Vector2} v1 - 向量 v1。
  60712. * @param {Vector2} v2 - 向量 v2。
  60713. * @return {Vector2} 结果。
  60714. */
  60715. min(out, v1, v2) {
  60716. out[0] = Math.min(v1[0], v2[0]);
  60717. out[1] = Math.min(v1[1], v2[1]);
  60718. return out;
  60719. }
  60720. /**
  60721. * @function LevelRenderer.Tool.Vector.prototype.max
  60722. * @description 求两个向量最大值。
  60723. *
  60724. * @param {Vector2} out - 基础向量。
  60725. * @param {Vector2} v1 - 向量 v1。
  60726. * @param {Vector2} v2 - 向量 v2。
  60727. * @return {Vector2} 结果。
  60728. */
  60729. max(out, v1, v2) {
  60730. out[0] = Math.max(v1[0], v2[0]);
  60731. out[1] = Math.max(v1[1], v2[1]);
  60732. return out;
  60733. }
  60734. /**
  60735. * @function LevelRenderer.Tool.Vector.prototype.length
  60736. * @description 向量长度。
  60737. *
  60738. * @param {Vector2} v - 向量。
  60739. * @return {number} 向量长度。
  60740. */
  60741. length(v) {
  60742. return this.len(v);
  60743. }
  60744. /**
  60745. * @function LevelRenderer.Tool.Vector.prototype.lengthSquare
  60746. * @description 向量长度平方。
  60747. *
  60748. * @param {Vector2} v - 向量。
  60749. * @return {number} 向量长度平方。
  60750. */
  60751. lengthSquare(v) {
  60752. return this.lenSquare(v);
  60753. }
  60754. /**
  60755. * @function LevelRenderer.Tool.Vector.prototype.dist
  60756. * @description 计算向量间距离。
  60757. *
  60758. * @param {Vector2} v1 - 向量 v1。
  60759. * @param {Vector2} v2 - 向量 v2。
  60760. * @return {number} 向量间距离。
  60761. */
  60762. dist(v1, v2) {
  60763. return this.distance(v1, v2);
  60764. }
  60765. /**
  60766. * @function LevelRenderer.Tool.Vector.prototype.distSquare
  60767. * @description 向量距离平方。
  60768. *
  60769. * @param {Vector2} v1 - 向量 v1。
  60770. * @param {Vector2} v2 - 向量 v2。
  60771. * @return {number} 向量距离平方
  60772. */
  60773. distSquare(v1, v2) {
  60774. return this.distanceSquare(v1, v2);
  60775. }
  60776. }
  60777. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Curve.js
  60778. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60779. * This program are made available under the terms of the Apache License, Version 2.0
  60780. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60781. /**
  60782. * @class LevelRenderer.Tool.Curve
  60783. * @category Visualization Theme
  60784. * @classdesc LevelRenderer 工具-曲线
  60785. * @private
  60786. */
  60787. class Curve_Curve {
  60788. constructor() {
  60789. /**
  60790. * @member {LevelRenderer.Tool.Vector} LevelRenderer.Tool.Curve.prototype.vector
  60791. * @description 矢量工具。
  60792. */
  60793. this.vector = new levelRenderer_Vector_Vector();
  60794. /**
  60795. * @member {number} LevelRenderer.Tool.Curve.prototype.EPSILON
  60796. * @description e。
  60797. */
  60798. this.EPSILON = 1e-4;
  60799. /**
  60800. * @member {number} LevelRenderer.Tool.Curve.prototype.THREE_SQRT
  60801. * @description 3 的平方根。
  60802. */
  60803. this.THREE_SQRT = Math.sqrt(3);
  60804. /**
  60805. * @member {number} LevelRenderer.Tool.Curve.prototype.ONE_THIRD
  60806. * @description 1/3。
  60807. */
  60808. this.ONE_THIRD = 1 / 3;
  60809. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Curve";
  60810. }
  60811. /*
  60812. * Method: evalCubicCoeff
  60813. *
  60814. * Parameters:
  60815. * a - {number} 值。
  60816. * b - {number} 值。
  60817. * c - {number} 值。
  60818. * d - {number} 值。
  60819. * t - {number} 值。
  60820. *
  60821. * Returns:
  60822. * {number}
  60823. */
  60824. /*
  60825. evalCubicCoeff: function(a, b, c, d, t){
  60826. return ((a * t + b) * t + c) * t + d;
  60827. },
  60828. */
  60829. /**
  60830. * @function LevelRenderer.Tool.Curve.prototype.isAroundZero
  60831. * @description 判断一个值是否趋于0,判断参考值:1e-4。
  60832. * @param {number} val - 值。
  60833. * @returns {boolean} 值是否趋于0。
  60834. */
  60835. isAroundZero(val) {
  60836. return val > -this.EPSILON && val < this.EPSILON;
  60837. }
  60838. /**
  60839. * @function LevelRenderer.Tool.Curve.prototype.isNotAroundZero
  60840. * @description 判断一个值是否不趋于0,判断参考值:1e-4。
  60841. * @param {number} val - 值。
  60842. * @returns {boolean} 值是否不趋于0。
  60843. */
  60844. isNotAroundZero(val) {
  60845. return val > this.EPSILON || val < -this.EPSILON;
  60846. }
  60847. /**
  60848. * @function LevelRenderer.Tool.Curve.prototype.cubicAt
  60849. * @description 计算三次贝塞尔值
  60850. * @param {number} p0 - 点p0。
  60851. * @param {number} p1 - 点p1。
  60852. * @param {number} p2 - 点p2。
  60853. * @param {number} p3 - 点p3。
  60854. * @param {number} t - t值。
  60855. * @returns {number} 三次贝塞尔值。
  60856. */
  60857. cubicAt(p0, p1, p2, p3, t) {
  60858. var onet = 1 - t;
  60859. return onet * onet * (onet * p0 + 3 * t * p1)
  60860. + t * t * (t * p3 + 3 * onet * p2);
  60861. }
  60862. /**
  60863. * @function LevelRenderer.Tool.Curve.prototype.cubicDerivativeAt
  60864. * @description 计算三次贝塞尔导数值
  60865. * @param {number} p0 - 点p0。
  60866. * @param {number} p1 - 点p1。
  60867. * @param {number} p2 - 点p2。
  60868. * @param {number} p3 - 点p3。
  60869. * @param {number} t - t值。
  60870. * @returns {number} 三次贝塞尔导数值。
  60871. */
  60872. cubicDerivativeAt(p0, p1, p2, p3, t) {
  60873. var onet = 1 - t;
  60874. return 3 * (
  60875. ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet
  60876. + (p3 - p2) * t * t
  60877. );
  60878. }
  60879. /**
  60880. * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
  60881. * @description 计算三次贝塞尔方程根,使用盛金公式
  60882. * @param {number} p0 - 点p0。
  60883. * @param {number} p1 - 点p1。
  60884. * @param {number} p2 - 点p2。
  60885. * @param {number} p3 - 点p3。
  60886. * @param {number} val - 值。
  60887. * @param {Array.<number>} roots - 有效根数目。
  60888. * @returns {number} 有效根。
  60889. */
  60890. cubicRootAt(p0, p1, p2, p3, val, roots) {
  60891. // Evaluate roots of cubic functions
  60892. var a = p3 + 3 * (p1 - p2) - p0;
  60893. var b = 3 * (p2 - p1 * 2 + p0);
  60894. var c = 3 * (p1 - p0);
  60895. var d = p0 - val;
  60896. var A = b * b - 3 * a * c;
  60897. var B = b * c - 9 * a * d;
  60898. var C = c * c - 3 * b * d;
  60899. var n = 0;
  60900. if (this.isAroundZero(A) && this.isAroundZero(B)) {
  60901. if (this.isAroundZero(b)) {
  60902. roots[0] = 0;
  60903. } else {
  60904. let t1 = -c / b; //t1, t2, t3, b is not zero
  60905. if (t1 >= 0 && t1 <= 1) {
  60906. roots[n++] = t1;
  60907. }
  60908. }
  60909. } else {
  60910. var disc = B * B - 4 * A * C;
  60911. if (this.isAroundZero(disc)) {
  60912. var K = B / A;
  60913. let t1 = -b / a + K; // t1, a is not zero
  60914. let t2 = -K / 2; // t2, t3
  60915. if (t1 >= 0 && t1 <= 1) {
  60916. roots[n++] = t1;
  60917. }
  60918. if (t2 >= 0 && t2 <= 1) {
  60919. roots[n++] = t2;
  60920. }
  60921. } else if (disc > 0) {
  60922. let discSqrt = Math.sqrt(disc);
  60923. let Y1 = A * b + 1.5 * a * (-B + discSqrt);
  60924. let Y2 = A * b + 1.5 * a * (-B - discSqrt);
  60925. if (Y1 < 0) {
  60926. Y1 = -Math.pow(-Y1, this.ONE_THIRD);
  60927. } else {
  60928. Y1 = Math.pow(Y1, this.ONE_THIRD);
  60929. }
  60930. if (Y2 < 0) {
  60931. Y2 = -Math.pow(-Y2, this.ONE_THIRD);
  60932. } else {
  60933. Y2 = Math.pow(Y2, this.ONE_THIRD);
  60934. }
  60935. let t1 = (-b - (Y1 + Y2)) / (3 * a);
  60936. if (t1 >= 0 && t1 <= 1) {
  60937. roots[n++] = t1;
  60938. }
  60939. } else {
  60940. var T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A));
  60941. var theta = Math.acos(T) / 3;
  60942. var ASqrt = Math.sqrt(A);
  60943. var tmp = Math.cos(theta);
  60944. let t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
  60945. let t2 = (-b + ASqrt * (tmp + this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  60946. let t3 = (-b + ASqrt * (tmp - this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  60947. if (t1 >= 0 && t1 <= 1) {
  60948. roots[n++] = t1;
  60949. }
  60950. if (t2 >= 0 && t2 <= 1) {
  60951. roots[n++] = t2;
  60952. }
  60953. if (t3 >= 0 && t3 <= 1) {
  60954. roots[n++] = t3;
  60955. }
  60956. }
  60957. }
  60958. return n;
  60959. }
  60960. /**
  60961. * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
  60962. * @description 计算三次贝塞尔方程极限值的位置
  60963. * @param {number} p0 - 点p0。
  60964. * @param {number} p1 - 点p1。
  60965. * @param {number} p2 - 点p2。
  60966. * @param {number} p3 - 点p3。
  60967. * @param {Array.<number>} extrema - 值。
  60968. * @returns {number} 有效数目。
  60969. */
  60970. cubicExtrema(p0, p1, p2, p3, extrema) {
  60971. var b = 6 * p2 - 12 * p1 + 6 * p0;
  60972. var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
  60973. var c = 3 * p1 - 3 * p0;
  60974. var n = 0;
  60975. if (this.isAroundZero(a)) {
  60976. if (this.isNotAroundZero(b)) {
  60977. let t1 = -c / b;
  60978. if (t1 >= 0 && t1 <= 1) {
  60979. extrema[n++] = t1;
  60980. }
  60981. }
  60982. } else {
  60983. var disc = b * b - 4 * a * c;
  60984. if (this.isAroundZero(disc)) {
  60985. extrema[0] = -b / (2 * a);
  60986. } else if (disc > 0) {
  60987. let discSqrt = Math.sqrt(disc);
  60988. let t1 = (-b + discSqrt) / (2 * a);
  60989. let t2 = (-b - discSqrt) / (2 * a);
  60990. if (t1 >= 0 && t1 <= 1) {
  60991. extrema[n++] = t1;
  60992. }
  60993. if (t2 >= 0 && t2 <= 1) {
  60994. extrema[n++] = t2;
  60995. }
  60996. }
  60997. }
  60998. return n;
  60999. }
  61000. /**
  61001. * @function LevelRenderer.Tool.Curve.prototype.cubicSubdivide
  61002. * @description 细分三次贝塞尔曲线
  61003. * @param {number} p0 - 点p0。
  61004. * @param {number} p1 - 点p1。
  61005. * @param {number} p2 - 点p2。
  61006. * @param {number} p3 - 点p3。
  61007. * @param {number} t - t值。
  61008. * @param {Array.<number>} out - 投射点。
  61009. * @returns {number} 投射点。
  61010. */
  61011. cubicSubdivide(p0, p1, p2, p3, t, out) {
  61012. var p01 = (p1 - p0) * t + p0;
  61013. var p12 = (p2 - p1) * t + p1;
  61014. var p23 = (p3 - p2) * t + p2;
  61015. var p012 = (p12 - p01) * t + p01;
  61016. var p123 = (p23 - p12) * t + p12;
  61017. var p0123 = (p123 - p012) * t + p012;
  61018. // Seg0
  61019. out[0] = p0;
  61020. out[1] = p01;
  61021. out[2] = p012;
  61022. out[3] = p0123;
  61023. // Seg1
  61024. out[4] = p0123;
  61025. out[5] = p123;
  61026. out[6] = p23;
  61027. out[7] = p3;
  61028. }
  61029. /**
  61030. * @function LevelRenderer.Tool.Curve.prototype.cubicProjectPoint
  61031. * @description 投射点到三次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  61032. * @param {number} x0 - 点p0横坐标。
  61033. * @param {number} y0 - 点p0纵坐标。
  61034. * @param {number} x1 - 点p1横坐标。
  61035. * @param {number} y1 - 点p1纵坐标。
  61036. * @param {number} x2 - 点p2横坐标。
  61037. * @param {number} y2 - 点p2纵坐标。
  61038. * @param {number} x3 - 点p3横坐标。
  61039. * @param {number} y3 - 点p3纵坐标。
  61040. * @param {number} x - 点p横坐标。
  61041. * @param {number} y - 点p纵坐标。
  61042. * @param {Array.<number>} out - 投射点。
  61043. * @returns {number} 投射点。
  61044. */
  61045. cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
  61046. // 临时变量
  61047. var _v0 = this.vector.create();
  61048. var _v1 = this.vector.create();
  61049. var _v2 = this.vector.create();
  61050. // var _v3 = vector.create();
  61051. // http://pomax.github.io/bezierinfo/#projections
  61052. var t;
  61053. var interval = 0.005;
  61054. var d = Infinity;
  61055. _v0[0] = x;
  61056. _v0[1] = y;
  61057. // 先粗略估计一下可能的最小距离的 t 值
  61058. // PENDING
  61059. for (let _t = 0; _t < 1; _t += 0.05) {
  61060. _v1[0] = this.cubicAt(x0, x1, x2, x3, _t);
  61061. _v1[1] = this.cubicAt(y0, y1, y2, y3, _t);
  61062. let d1 = this.vector.distSquare(_v0, _v1);
  61063. if (d1 < d) {
  61064. t = _t;
  61065. d = d1;
  61066. }
  61067. }
  61068. d = Infinity;
  61069. // At most 32 iteration
  61070. for (let i = 0; i < 32; i++) {
  61071. if (interval < this.EPSILON) {
  61072. break;
  61073. }
  61074. let prev = t - interval;
  61075. let next = t + interval;
  61076. // t - interval
  61077. _v1[0] = this.cubicAt(x0, x1, x2, x3, prev);
  61078. _v1[1] = this.cubicAt(y0, y1, y2, y3, prev);
  61079. let d1 = this.vector.distSquare(_v1, _v0);
  61080. if (prev >= 0 && d1 < d) {
  61081. t = prev;
  61082. d = d1;
  61083. } else {
  61084. // t + interval
  61085. _v2[0] = this.cubicAt(x0, x1, x2, x3, next);
  61086. _v2[1] = this.cubicAt(y0, y1, y2, y3, next);
  61087. let d2 = this.vector.distSquare(_v2, _v0);
  61088. if (next <= 1 && d2 < d) {
  61089. t = next;
  61090. d = d2;
  61091. } else {
  61092. interval *= 0.5;
  61093. }
  61094. }
  61095. }
  61096. // t
  61097. if (out) {
  61098. out[0] = this.cubicAt(x0, x1, x2, x3, t);
  61099. out[1] = this.cubicAt(y0, y1, y2, y3, t);
  61100. }
  61101. // console.log(interval, i);
  61102. return Math.sqrt(d);
  61103. }
  61104. /**
  61105. * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
  61106. * @description 计算二次方贝塞尔值。
  61107. * @param {number} p0 - 点p0。
  61108. * @param {number} p1 - 点p1。
  61109. * @param {number} p2 - 点p2。
  61110. * @param {number} t - t值。
  61111. * @returns {number} 二次方贝塞尔值。
  61112. */
  61113. quadraticAt(p0, p1, p2, t) {
  61114. var onet = 1 - t;
  61115. return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
  61116. }
  61117. /**
  61118. * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
  61119. * @description 计算二次方贝塞尔导数值。
  61120. * @param {number} p0 - 点p0。
  61121. * @param {number} p1 - 点p1。
  61122. * @param {number} p2 - 点p2。
  61123. * @param {number} t - t值。
  61124. * @returns {number} 二次方贝塞尔导数值。
  61125. */
  61126. quadraticDerivativeAt(p0, p1, p2, t) {
  61127. return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
  61128. }
  61129. /**
  61130. * @function LevelRenderer.Tool.Curve.prototype.quadraticRootAt
  61131. * @description 计算二次方贝塞尔方程根
  61132. * @param {number} p0 - 点p0。
  61133. * @param {number} p1 - 点p1。
  61134. * @param {number} p2 - 点p2。
  61135. * @param {number} val - 值。
  61136. * @param {Array.<number>} roots - 有效根数目。
  61137. * @returns {number} 有效根数目。
  61138. */
  61139. quadraticRootAt(p0, p1, p2, val, roots) {
  61140. var a = p0 - 2 * p1 + p2;
  61141. var b = 2 * (p1 - p0);
  61142. var c = p0 - val;
  61143. var n = 0;
  61144. if (this.isAroundZero(a)) {
  61145. if (this.isNotAroundZero(b)) {
  61146. var t1 = -c / b;
  61147. if (t1 >= 0 && t1 <= 1) {
  61148. roots[n++] = t1;
  61149. }
  61150. }
  61151. } else {
  61152. var disc = b * b - 4 * a * c;
  61153. if (this.isAroundZero(disc)) {
  61154. let t1 = -b / (2 * a);
  61155. if (t1 >= 0 && t1 <= 1) {
  61156. roots[n++] = t1;
  61157. }
  61158. } else if (disc > 0) {
  61159. let discSqrt = Math.sqrt(disc);
  61160. let t1 = (-b + discSqrt) / (2 * a);
  61161. let t2 = (-b - discSqrt) / (2 * a);
  61162. if (t1 >= 0 && t1 <= 1) {
  61163. roots[n++] = t1;
  61164. }
  61165. if (t2 >= 0 && t2 <= 1) {
  61166. roots[n++] = t2;
  61167. }
  61168. }
  61169. }
  61170. return n;
  61171. }
  61172. /**
  61173. * @function LevelRenderer.Tool.Curve.prototype.quadraticExtremum
  61174. * @description 计算二次贝塞尔方程极限值
  61175. * @param {number} p0 - 点p0。
  61176. * @param {number} p1 - 点p1。
  61177. * @param {number} p2 - 点p2。
  61178. * @returns {number} 二次贝塞尔方程极限值。
  61179. */
  61180. quadraticExtremum(p0, p1, p2) {
  61181. var divider = p0 + p2 - 2 * p1;
  61182. if (divider === 0) {
  61183. // p1 is center of p0 and p2
  61184. return 0.5;
  61185. } else {
  61186. return (p0 - p1) / divider;
  61187. }
  61188. }
  61189. /**
  61190. * @function LevelRenderer.Tool.Curve.prototype.quadraticProjectPoint
  61191. * @description 投射点到二次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  61192. * @param {number} x0 - 点p0横坐标。
  61193. * @param {number} y0 - 点p0纵坐标。
  61194. * @param {number} x1 - 点p1横坐标。
  61195. * @param {number} y1 - 点p1纵坐标。
  61196. * @param {number} x2 - 点p2横坐标。
  61197. * @param {number} y2 - 点p2纵坐标。
  61198. * @param {number} x - 点p横坐标。
  61199. * @param {number} y - 点p纵坐标。
  61200. * @param {Array.<number>} out - 投射点。
  61201. * @returns {number} 投射距离。
  61202. */
  61203. quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
  61204. // 临时变量
  61205. var _v0 = this.vector.create();
  61206. var _v1 = this.vector.create();
  61207. var _v2 = this.vector.create();
  61208. // http://pomax.github.io/bezierinfo/#projections
  61209. var t;
  61210. var interval = 0.005;
  61211. var d = Infinity;
  61212. _v0[0] = x;
  61213. _v0[1] = y;
  61214. // 先粗略估计一下可能的最小距离的 t 值
  61215. // PENDING
  61216. for (let _t = 0; _t < 1; _t += 0.05) {
  61217. _v1[0] = this.quadraticAt(x0, x1, x2, _t);
  61218. _v1[1] = this.quadraticAt(y0, y1, y2, _t);
  61219. let d1 = this.vector.distSquare(_v0, _v1);
  61220. if (d1 < d) {
  61221. t = _t;
  61222. d = d1;
  61223. }
  61224. }
  61225. d = Infinity;
  61226. // At most 32 iteration
  61227. for (let i = 0; i < 32; i++) {
  61228. if (interval < this.EPSILON) {
  61229. break;
  61230. }
  61231. let prev = t - interval;
  61232. let next = t + interval;
  61233. // t - interval
  61234. _v1[0] = this.quadraticAt(x0, x1, x2, prev);
  61235. _v1[1] = this.quadraticAt(y0, y1, y2, prev);
  61236. let d1 = this.vector.distSquare(_v1, _v0);
  61237. if (prev >= 0 && d1 < d) {
  61238. t = prev;
  61239. d = d1;
  61240. } else {
  61241. // t + interval
  61242. _v2[0] = this.quadraticAt(x0, x1, x2, next);
  61243. _v2[1] = this.quadraticAt(y0, y1, y2, next);
  61244. let d2 = this.vector.distSquare(_v2, _v0);
  61245. if (next <= 1 && d2 < d) {
  61246. t = next;
  61247. d = d2;
  61248. } else {
  61249. interval *= 0.5;
  61250. }
  61251. }
  61252. }
  61253. // t
  61254. if (out) {
  61255. out[0] = this.quadraticAt(x0, x1, x2, t);
  61256. out[1] = this.quadraticAt(y0, y1, y2, t);
  61257. }
  61258. // console.log(interval, i);
  61259. return Math.sqrt(d);
  61260. }
  61261. }
  61262. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Area.js
  61263. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  61264. * This program are made available under the terms of the Apache License, Version 2.0
  61265. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61266. /**
  61267. * @class LevelRenderer.Tool.Area
  61268. * @category Visualization Theme
  61269. * @classdesc LevelRenderer 工具-图形范围判断
  61270. * @private
  61271. */
  61272. class Area {
  61273. constructor() {
  61274. /**
  61275. * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Areal.prototype.util
  61276. * @description 基础工具对象。
  61277. */
  61278. this.util = new levelRenderer_Util_Util();
  61279. /**
  61280. * @member {LevelRenderer.Tool.Curve} LevelRenderer.Tool.Areal.prototype.curve
  61281. * @description 曲线工具对象
  61282. */
  61283. this.curve = new Curve_Curve();
  61284. /**
  61285. * @member {Object} LevelRenderer.Tool.Areal.prototype._ctx
  61286. * @description Cavans2D 渲染上下文
  61287. */
  61288. this._ctx = null;
  61289. /**
  61290. * @member {Object} LevelRenderer.Tool.Areal.prototype._textWidthCache
  61291. * @description 文本宽度缓存
  61292. */
  61293. this._textWidthCache = {};
  61294. /**
  61295. * @member {Object} LevelRenderer.Tool.Areal.prototype._textHeightCache
  61296. * @description 文本高度缓存
  61297. */
  61298. this._textHeightCache = {};
  61299. /**
  61300. * @member {number} LevelRenderer.Tool.Areal.prototype._textWidthCacheCounter
  61301. * @description 文本宽度缓存数量
  61302. */
  61303. this._textWidthCacheCounter = 0;
  61304. /**
  61305. * @member {number} LevelRenderer.Tool.Areal.prototype._textHeightCacheCounter
  61306. * @description 文本高度缓存数量
  61307. */
  61308. this._textHeightCacheCounter = 0;
  61309. /**
  61310. * @member {number} LevelRenderer.Tool.Areal.prototype.TEXT_CACHE_MAX
  61311. * @description 文本最大缓存数量
  61312. */
  61313. this.TEXT_CACHE_MAX = 5000;
  61314. /**
  61315. * @member {number} LevelRenderer.Tool.Areal.prototype.PI2
  61316. * @description 2*PI 的值
  61317. */
  61318. this.PI2 = Math.PI * 2;
  61319. /**
  61320. * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.roots
  61321. * @description 临时数组
  61322. */
  61323. this.roots = [-1, -1, -1];
  61324. /**
  61325. * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.extrema
  61326. * @description 临时数组
  61327. */
  61328. this.extrema = [-1, -1];
  61329. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Area";
  61330. }
  61331. /**
  61332. * @function LevelRenderer.Tool.Areal.prototype.normalizeRadian
  61333. * @description 弧度标准化函数。
  61334. * @param {number} angle - 弧度值。
  61335. * @returns {number} 标准化后的弧度值。
  61336. */
  61337. normalizeRadian(angle) {
  61338. angle %= this.PI2;
  61339. if (angle < 0) {
  61340. angle += this.PI2;
  61341. }
  61342. return angle;
  61343. }
  61344. /**
  61345. * @function LevelRenderer.Tool.Areal.prototype.isInside
  61346. * @description 包含判断。
  61347. * @param {Object} shape - 图形。
  61348. * @param {number} area - 目标区域。
  61349. * @param {number} x - 横坐标。
  61350. * @param {number} y - 纵坐标。
  61351. * @returns {boolean} 图形是否包含鼠标位置。
  61352. */
  61353. isInside(shape, area, x, y) {
  61354. if (!area || !shape) {
  61355. // 无参数或不支持类型
  61356. return false;
  61357. }
  61358. var zoneType = shape.type;
  61359. this._ctx = this._ctx || this.util.getContext();
  61360. // 未实现或不可用时则数学运算,主要是line,brokenLine,ring
  61361. var _mathReturn = this._mathMethod(shape, area, x, y);
  61362. if (typeof _mathReturn != 'undefined') {
  61363. return _mathReturn;
  61364. }
  61365. if (shape.buildPath && this._ctx.isPointInPath) {
  61366. return this._buildPathMethod(shape, this._ctx, area, x, y);
  61367. }
  61368. // 上面的方法都行不通时
  61369. switch (zoneType) {
  61370. case 'ellipse': // Todo,不精确
  61371. case 'smicellipse': // Todo,不精确
  61372. return true;
  61373. // 旋轮曲线 不准确
  61374. case 'trochoid':
  61375. var _r = area.location == 'out'
  61376. ? area.r1 + area.r2 + area.d
  61377. : area.r1 - area.r2 + area.d;
  61378. return this.isInsideCircle(area, x, y, _r);
  61379. // 玫瑰线 不准确
  61380. case 'rose' :
  61381. return this.isInsideCircle(area, x, y, area.maxr);
  61382. // 路径,椭圆,曲线等-----------------13
  61383. default:
  61384. return false; // Todo,暂不支持
  61385. }
  61386. }
  61387. /**
  61388. * @function LevelRenderer.Tool.Areal.prototype._mathMethod
  61389. * @description 包含判断。用数学方法判断,三个方法中最快,但是支持的shape少。
  61390. * @param {Object} shape - 图形。
  61391. * @param {number} area - 目标区域。
  61392. * @param {number} x - 横坐标。
  61393. * @param {number} y - 纵坐标。
  61394. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  61395. */
  61396. _mathMethod(shape, area, x, y) {
  61397. var zoneType = shape.type;
  61398. // 在矩形内则部分图形需要进一步判断
  61399. switch (zoneType) {
  61400. // 贝塞尔曲线
  61401. case 'bezier-curve':
  61402. if (typeof(area.cpX2) === 'undefined') {
  61403. return this.isInsideQuadraticStroke(
  61404. area.xStart, area.yStart,
  61405. area.cpX1, area.cpY1,
  61406. area.xEnd, area.yEnd,
  61407. area.lineWidth, x, y
  61408. );
  61409. }
  61410. return this.isInsideCubicStroke(
  61411. area.xStart, area.yStart,
  61412. area.cpX1, area.cpY1,
  61413. area.cpX2, area.cpY2,
  61414. area.xEnd, area.yEnd,
  61415. area.lineWidth, x, y
  61416. );
  61417. // 线
  61418. case 'line':
  61419. return this.isInsideLine(
  61420. area.xStart, area.yStart,
  61421. area.xEnd, area.yEnd,
  61422. area.lineWidth, x, y
  61423. );
  61424. // 折线
  61425. case 'broken-line':
  61426. return this.isInsideBrokenLine(
  61427. area.pointList, area.lineWidth, x, y
  61428. );
  61429. // 扩展折线
  61430. case 'smicbroken-line': {
  61431. // SMIC-修改 - start
  61432. let icX = x;
  61433. let icY = y;
  61434. if (shape.refOriginalPosition) {
  61435. icX = x - shape.refOriginalPosition[0];
  61436. icY = y - shape.refOriginalPosition[1];
  61437. }
  61438. return this.isInsideBrokenLine(
  61439. area.pointList, area.lineWidth, icX, icY
  61440. );
  61441. }
  61442. //初始代码:
  61443. // return isInsideBrokenLine(
  61444. // area.pointList, area.lineWidth, x, y
  61445. // );
  61446. // SMIC-修改 - end
  61447. // 圆环
  61448. case 'ring':
  61449. return this.isInsideRing(
  61450. area.x, area.y, area.r0, area.r, x, y
  61451. );
  61452. case 'smicring': {
  61453. let areaX = area.x;
  61454. let areaY = area.y;
  61455. if (shape.refOriginalPosition) {
  61456. areaX = area.x + shape.refOriginalPosition[0];
  61457. areaY = area.y + shape.refOriginalPosition[1];
  61458. }
  61459. return this.isInsideRing(
  61460. areaX, areaY, area.r0, area.r, x, y
  61461. );
  61462. }
  61463. // 圆形
  61464. case 'circle':
  61465. return this.isInsideCircle(
  61466. area.x, area.y, area.r, x, y
  61467. );
  61468. // 扩展-点
  61469. case 'smicpoint': {
  61470. // SMIC-修改 - start
  61471. let icX = x;
  61472. let icY = y;
  61473. if (shape.refOriginalPosition) {
  61474. icX = x - shape.refOriginalPosition[0];
  61475. icY = y - shape.refOriginalPosition[1];
  61476. }
  61477. return this.isInsideCircle(
  61478. area.x, area.y, area.r, icX, icY
  61479. );
  61480. }
  61481. //初始代码:
  61482. // 无
  61483. // SMIC-修改 - end
  61484. // 扇形
  61485. case 'sector': {
  61486. let startAngle = area.startAngle * Math.PI / 180;
  61487. let endAngle = area.endAngle * Math.PI / 180;
  61488. if (!area.clockWise) {
  61489. startAngle = -startAngle;
  61490. endAngle = -endAngle;
  61491. }
  61492. return this.isInsideSector(
  61493. area.x, area.y, area.r0, area.r,
  61494. startAngle, endAngle,
  61495. !area.clockWise,
  61496. x, y
  61497. );
  61498. }
  61499. //初始代码:
  61500. // 无
  61501. // SMIC-增加 - end
  61502. // 扇形
  61503. case 'smicsector': {
  61504. let startAngle = area.startAngle * Math.PI / 180;
  61505. let endAngle = area.endAngle * Math.PI / 180;
  61506. if (!area.clockWise) {
  61507. startAngle = -startAngle;
  61508. endAngle = -endAngle;
  61509. }
  61510. let areaX = area.x;
  61511. let areaY = area.y;
  61512. if (shape.refOriginalPosition) {
  61513. areaX = area.x + shape.refOriginalPosition[0];
  61514. areaY = area.y + shape.refOriginalPosition[1];
  61515. }
  61516. return this.isInsideSector(
  61517. areaX, areaY, area.r0, area.r,
  61518. startAngle, endAngle,
  61519. !area.clockWise,
  61520. x, y
  61521. );
  61522. }
  61523. // 多边形
  61524. case 'path':
  61525. return this.isInsidePath(
  61526. area.pathArray, Math.max(area.lineWidth, 5),
  61527. area.brushType, x, y
  61528. );
  61529. case 'polygon':
  61530. case 'star':
  61531. case 'smicstar':
  61532. case 'isogon':
  61533. case 'smicisogon':
  61534. return this.isInsidePolygon(area.pointList, x, y);
  61535. // 扩展多边形
  61536. case 'smicpolygon': {
  61537. // SMIC-修改 - start
  61538. let icX = x;
  61539. let icY = y;
  61540. if (shape.refOriginalPosition) {
  61541. icX = x - shape.refOriginalPosition[0];
  61542. icY = y - shape.refOriginalPosition[1];
  61543. }
  61544. //岛洞面
  61545. if (shape.holePolygonPointLists && shape.holePolygonPointLists.length > 0) {
  61546. var isOnBase = this.isInsidePolygon(area.pointList, icX, icY);
  61547. // 遍历岛洞子面
  61548. var holePLS = shape.holePolygonPointLists;
  61549. var isOnHole = false;
  61550. for (var i = 0, holePLSen = holePLS.length; i < holePLSen; i++) {
  61551. var holePL = holePLS[i];
  61552. var isOnSubHole = this.isInsidePolygon(holePL, icX, icY);
  61553. if (isOnSubHole === true) {
  61554. isOnHole = true;
  61555. }
  61556. }
  61557. // 捕获判断
  61558. return isOnBase === true && isOnHole === false;
  61559. } else {
  61560. return this.isInsidePolygon(area.pointList, icX, icY);
  61561. }
  61562. }
  61563. // 初始代码:
  61564. // 无
  61565. // SMIC-修改 - end
  61566. // 文本
  61567. case 'text':
  61568. var rect = area.__rect || shape.getRect(area);
  61569. return this.isInsideRect(
  61570. rect.x, rect.y, rect.width, rect.height, x, y
  61571. );
  61572. // 扩展文本
  61573. case 'smictext':
  61574. //用文本背景矩形判断
  61575. var textBg = shape.getTextBackground(area);
  61576. return this.isInsidePolygon(textBg, x, y);
  61577. //初始代码:
  61578. // 无
  61579. // SMIC-修改 - end
  61580. // 矩形
  61581. case 'rectangle':
  61582. case 'image':
  61583. // 图片
  61584. return this.isInsideRect(
  61585. area.x, area.y, area.width, area.height, x, y
  61586. );
  61587. case 'smicimage': {
  61588. let areaX = area.x;
  61589. let areaY = area.y;
  61590. if (shape.refOriginalPosition) {
  61591. areaX = area.x + shape.refOriginalPosition[0];
  61592. areaY = area.y + shape.refOriginalPosition[1];
  61593. }
  61594. return this.isInsideRect(
  61595. areaX, areaY, area.width, area.height, x, y
  61596. );
  61597. }
  61598. //// 扩展矩形
  61599. //case 'smicpolygon':
  61600. // // SMIC-修改 - start
  61601. // var icX = x;
  61602. // var icY = y;
  61603. // if(shape.refOriginalPosition) {
  61604. // icX = x - shape.refOriginalPosition[0];
  61605. // icY = y - shape.refOriginalPosition[1];
  61606. // }
  61607. // return this.isInsideRect(
  61608. // area.x, area.y, area.width, area.height, icX, icY
  61609. // );
  61610. //初始代码:
  61611. // 无
  61612. // SMIC-修改 - end
  61613. }
  61614. }
  61615. /**
  61616. * @function LevelRenderer.Tool.Areal.prototype._buildPathMethod
  61617. * @description 包含判断。通过buildPath方法来判断,三个方法中较快,但是不支持线条类型的 shape。
  61618. * @param {Object} shape - 图形。
  61619. * @param {Object} context - 上下文。
  61620. * @param {number} area - 目标区域。
  61621. * @param {number} x - 横坐标。
  61622. * @param {number} y - 纵坐标。
  61623. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  61624. */
  61625. _buildPathMethod(shape, context, area, x, y) {
  61626. // 图形类实现路径创建了则用类的path
  61627. context.beginPath();
  61628. shape.buildPath(context, area);
  61629. context.closePath();
  61630. return context.isPointInPath(x, y);
  61631. }
  61632. /**
  61633. * @function LevelRenderer.Tool.Areal.prototype.isOutside
  61634. * @description 图形是否不包含鼠标位置。
  61635. * @param {Object} shape - 图形。
  61636. * @param {number} area - 目标区域。
  61637. * @param {number} x - 横坐标。
  61638. * @param {number} y - 纵坐标。
  61639. * @returns {boolean} 图形是否不包含鼠标位置, true表示坐标处在图形外。
  61640. */
  61641. isOutside(shape, area, x, y) {
  61642. return !this.isInside(shape, area, x, y);
  61643. }
  61644. /**
  61645. * @function LevelRenderer.Tool.Areal.prototype.isInsideLine
  61646. * @description 线段包含判断。
  61647. * @param {number} x0 - 线起始点横坐标。
  61648. * @param {number} y0 - 线起始点纵坐标。
  61649. * @param {number} x1 - 线终点横坐标。
  61650. * @param {number} y1 - 线终点纵坐标。
  61651. * @param {number} lineWidth - 线宽。
  61652. * @param {number} x - 鼠标位置横坐标。
  61653. * @param {number} y - 鼠标位置纵坐标。
  61654. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形内。
  61655. */
  61656. isInsideLine(x0, y0, x1, y1, lineWidth, x, y) {
  61657. if (lineWidth === 0) {
  61658. return false;
  61659. }
  61660. var _l = Math.max(lineWidth, 5);
  61661. var _a = 0;
  61662. var _b = 0;
  61663. // Quick reject
  61664. if (
  61665. (y > y0 + _l && y > y1 + _l)
  61666. || (y < y0 - _l && y < y1 - _l)
  61667. || (x > x0 + _l && x > x1 + _l)
  61668. || (x < x0 - _l && x < x1 - _l)
  61669. ) {
  61670. return false;
  61671. }
  61672. if (x0 !== x1) {
  61673. _a = (y0 - y1) / (x0 - x1);
  61674. _b = (x0 * y1 - x1 * y0) / (x0 - x1);
  61675. } else {
  61676. return Math.abs(x - x0) <= _l / 2;
  61677. }
  61678. var tmp = _a * x - y + _b;
  61679. var _s = tmp * tmp / (_a * _a + 1);
  61680. return _s <= _l / 2 * _l / 2;
  61681. }
  61682. /**
  61683. * @function LevelRenderer.Tool.Areal.prototype.isInsideCubicStroke
  61684. * @description 三次贝塞尔曲线描边包含判断。
  61685. * @param {number} x0 - 点1横坐标。
  61686. * @param {number} y0 - 点1纵坐标。
  61687. * @param {number} x1 - 点2横坐标。
  61688. * @param {number} y1 - 点2纵坐标。
  61689. * @param {number} x2 - 点3纵坐标。
  61690. * @param {number} y2 - 点3纵坐标。
  61691. * @param {number} lineWidth - 线宽。
  61692. * @param {number} x - 鼠标位置横坐标。
  61693. * @param {number} y - 鼠标位置纵坐标。
  61694. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  61695. */
  61696. isInsideCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
  61697. if (lineWidth === 0) {
  61698. return false;
  61699. }
  61700. var _l = Math.max(lineWidth, 5);
  61701. // Quick reject
  61702. if (
  61703. (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)
  61704. || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)
  61705. || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)
  61706. || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)
  61707. ) {
  61708. return false;
  61709. }
  61710. var d = this.curve.cubicProjectPoint(
  61711. x0, y0, x1, y1, x2, y2, x3, y3,
  61712. x, y, null
  61713. );
  61714. return d <= _l / 2;
  61715. }
  61716. /**
  61717. * @function LevelRenderer.Tool.Areal.prototype.isInsideQuadraticStroke
  61718. * @description 二次贝塞尔曲线描边包含判断。
  61719. * @param {number} x0 - 点1横坐标。
  61720. * @param {number} y0 - 点1纵坐标。
  61721. * @param {number} x1 - 点2横坐标。
  61722. * @param {number} y1 - 点2纵坐标。
  61723. * @param {number} x2 - 点3纵坐标。
  61724. * @param {number} y2 - 点3纵坐标。
  61725. * @param {number} lineWidth - 线宽。
  61726. * @param {number} x - 鼠标位置横坐标。
  61727. * @param {number} y - 鼠标位置纵坐标。
  61728. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  61729. */
  61730. isInsideQuadraticStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
  61731. if (lineWidth === 0) {
  61732. return false;
  61733. }
  61734. var _l = Math.max(lineWidth, 5);
  61735. // Quick reject
  61736. if (
  61737. (y > y0 + _l && y > y1 + _l && y > y2 + _l)
  61738. || (y < y0 - _l && y < y1 - _l && y < y2 - _l)
  61739. || (x > x0 + _l && x > x1 + _l && x > x2 + _l)
  61740. || (x < x0 - _l && x < x1 - _l && x < x2 - _l)
  61741. ) {
  61742. return false;
  61743. }
  61744. var d = this.curve.quadraticProjectPoint(
  61745. x0, y0, x1, y1, x2, y2,
  61746. x, y, null
  61747. );
  61748. return d <= _l / 2;
  61749. }
  61750. /**
  61751. * @function LevelRenderer.Tool.Areal.prototype.isInsideArcStroke
  61752. * @description 圆弧描边包含判断。
  61753. * @param {number} cx - 圆心横坐标。
  61754. * @param {number} cy - 圆心纵坐标。
  61755. * @param {number} r - 圆半径。
  61756. * @param {number} startAngle - 起始角度。
  61757. * @param {number} endAngle - 终止角度。
  61758. * @param {number} anticlockwise - 顺时针还是逆时针。
  61759. * @param {number} lineWidth - 线宽。
  61760. * @param {number} x - 鼠标位置横坐标。
  61761. * @param {number} y - 鼠标位置纵坐标。
  61762. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  61763. */
  61764. isInsideArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
  61765. var PI2 = this.PI2;
  61766. if (lineWidth === 0) {
  61767. return false;
  61768. }
  61769. var _l = Math.max(lineWidth, 5);
  61770. x -= cx;
  61771. y -= cy;
  61772. var d = Math.sqrt(x * x + y * y);
  61773. if ((d - _l > r) || (d + _l < r)) {
  61774. return false;
  61775. }
  61776. if (Math.abs(startAngle - endAngle) >= PI2) {
  61777. // Is a circle
  61778. return true;
  61779. }
  61780. if (anticlockwise) {
  61781. var tmp = startAngle;
  61782. startAngle = this.normalizeRadian(endAngle);
  61783. endAngle = this.normalizeRadian(tmp);
  61784. } else {
  61785. startAngle = this.normalizeRadian(startAngle);
  61786. endAngle = this.normalizeRadian(endAngle);
  61787. }
  61788. if (startAngle > endAngle) {
  61789. endAngle += PI2;
  61790. }
  61791. var angle = Math.atan2(y, x);
  61792. if (angle < 0) {
  61793. angle += PI2;
  61794. }
  61795. return (angle >= startAngle && angle <= endAngle)
  61796. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
  61797. }
  61798. /**
  61799. * @function LevelRenderer.Tool.Areal.prototype.isInsideBrokenLine
  61800. * @description 图形 BrokenLine 是否包含鼠标位置, true表示坐标处在图形内。
  61801. * @param {Array} points - 曲线点对象。
  61802. * @param {number} lineWidth - 线宽。
  61803. * @param {number} x - 鼠标位置横坐标。
  61804. * @param {number} y - 鼠标位置纵坐标。
  61805. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  61806. */
  61807. isInsideBrokenLine(points, lineWidth, x, y) {
  61808. var _lineWidth = Math.max(lineWidth, 10);
  61809. for (var i = 0, l = points.length - 1; i < l; i++) {
  61810. var x0 = points[i][0];
  61811. var y0 = points[i][1];
  61812. var x1 = points[i + 1][0];
  61813. var y1 = points[i + 1][1];
  61814. if (this.isInsideLine(x0, y0, x1, y1, _lineWidth, x, y)) {
  61815. return true;
  61816. }
  61817. }
  61818. return false;
  61819. }
  61820. /**
  61821. * @function LevelRenderer.Tool.Areal.prototype.isInsideRing
  61822. * @description 图形 Ring 是否包含鼠标位置, true表示坐标处在图形内。
  61823. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  61824. */
  61825. isInsideRing(cx, cy, r0, r, x, y) {
  61826. var d = (x - cx) * (x - cx) + (y - cy) * (y - cy);
  61827. return (d < r * r) && (d > r0 * r0);
  61828. }
  61829. /**
  61830. * @function LevelRenderer.Tool.Areal.prototype.isInsideRect
  61831. * @description 图形 Rect 是否包含鼠标位置, true表示坐标处在图形内。
  61832. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  61833. */
  61834. isInsideRect(x0, y0, width, height, x, y) {
  61835. return x >= x0 && x <= (x0 + width) && y >= y0 && y <= (y0 + height);
  61836. }
  61837. /**
  61838. * @function LevelRenderer.Tool.Areal.prototype.isInsideCircle
  61839. * @description 图形 Circle 是否包含鼠标位置, true表示坐标处在图形内。
  61840. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  61841. */
  61842. isInsideCircle(x0, y0, r, x, y) {
  61843. return (x - x0) * (x - x0) + (y - y0) * (y - y0) < r * r;
  61844. }
  61845. /**
  61846. * @function LevelRenderer.Tool.Areal.prototype.isInsideSector
  61847. * @description 图形 Sector 是否包含鼠标位置, true表示坐标处在图形内。
  61848. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  61849. */
  61850. isInsideSector(cx, cy, r0, r, startAngle, endAngle, anticlockwise, x, y) {
  61851. return this.isInsideArcStroke(cx, cy, (r0 + r) / 2, startAngle, endAngle, anticlockwise, r - r0, x, y);
  61852. }
  61853. /**
  61854. * @function LevelRenderer.Tool.Areal.prototype.isInsidePolygon
  61855. * @description 图形 Polygon 是否包含鼠标位置, true表示坐标处在图形内。与 canvas 一样采用 non-zero winding rule
  61856. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  61857. */
  61858. isInsidePolygon(points, x, y) {
  61859. var N = points.length;
  61860. var w = 0;
  61861. for (var i = 0, j = N - 1; i < N; i++) {
  61862. var x0 = points[j][0];
  61863. var y0 = points[j][1];
  61864. var x1 = points[i][0];
  61865. var y1 = points[i][1];
  61866. w += this.windingLine(x0, y0, x1, y1, x, y);
  61867. j = i;
  61868. }
  61869. return w !== 0;
  61870. }
  61871. /**
  61872. * @function LevelRenderer.Tool.Areal.prototype.windingLine
  61873. */
  61874. windingLine(x0, y0, x1, y1, x, y) {
  61875. if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
  61876. return 0;
  61877. }
  61878. if (y1 == y0) {
  61879. return 0;
  61880. }
  61881. var dir = y1 < y0 ? 1 : -1;
  61882. var t = (y - y0) / (y1 - y0);
  61883. var x_ = t * (x1 - x0) + x0;
  61884. return x_ > x ? dir : 0;
  61885. }
  61886. /**
  61887. * @function LevelRenderer.Tool.Areal.prototype.swapExtrema
  61888. */
  61889. swapExtrema() {
  61890. var tmp = this.extrema[0];
  61891. this.extrema[0] = this.extrema[1];
  61892. this.extrema[1] = tmp;
  61893. }
  61894. /**
  61895. * @function LevelRenderer.Tool.Areal.prototype.windingCubic
  61896. */
  61897. windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
  61898. var curve = this.curve;
  61899. var roots = this.roots;
  61900. var extrema = this.extrema;
  61901. // Quick reject
  61902. if (
  61903. (y > y0 && y > y1 && y > y2 && y > y3)
  61904. || (y < y0 && y < y1 && y < y2 && y < y3)
  61905. ) {
  61906. return 0;
  61907. }
  61908. var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);
  61909. if (nRoots === 0) {
  61910. return 0;
  61911. } else {
  61912. var w = 0;
  61913. var nExtrema = -1;
  61914. var y0_, y1_;
  61915. for (var i = 0; i < nRoots; i++) {
  61916. var t = roots[i];
  61917. var x_ = curve.cubicAt(x0, x1, x2, x3, t);
  61918. if (x_ < x) { // Quick reject
  61919. continue;
  61920. }
  61921. if (nExtrema < 0) {
  61922. nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);
  61923. if (extrema[1] < extrema[0] && nExtrema > 1) {
  61924. this.swapExtrema();
  61925. }
  61926. y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);
  61927. if (nExtrema > 1) {
  61928. y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);
  61929. }
  61930. }
  61931. if (nExtrema == 2) {
  61932. // 分成三段单调函数
  61933. if (t < extrema[0]) {
  61934. w += y0_ < y0 ? 1 : -1;
  61935. } else if (t < extrema[1]) {
  61936. w += y1_ < y0_ ? 1 : -1;
  61937. } else {
  61938. w += y3 < y1_ ? 1 : -1;
  61939. }
  61940. } else {
  61941. // 分成两段单调函数
  61942. if (t < extrema[0]) {
  61943. w += y0_ < y0 ? 1 : -1;
  61944. } else {
  61945. w += y3 < y0_ ? 1 : -1;
  61946. }
  61947. }
  61948. }
  61949. return w;
  61950. }
  61951. }
  61952. /**
  61953. * @function LevelRenderer.Tool.Areal.prototype.windingQuadratic
  61954. */
  61955. windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
  61956. var curve = this.curve;
  61957. var roots = this.roots;
  61958. // Quick reject
  61959. if (
  61960. (y > y0 && y > y1 && y > y2)
  61961. || (y < y0 && y < y1 && y < y2)
  61962. ) {
  61963. return 0;
  61964. }
  61965. var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);
  61966. if (nRoots === 0) {
  61967. return 0;
  61968. } else {
  61969. var t = curve.quadraticExtremum(y0, y1, y2);
  61970. if (t >= 0 && t <= 1) {
  61971. var w = 0;
  61972. var y_ = curve.quadraticAt(y0, y1, y2, t);
  61973. for (let i = 0; i < nRoots; i++) {
  61974. let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);
  61975. if (x_ > x) {
  61976. continue;
  61977. }
  61978. if (roots[i] < t) {
  61979. w += y_ < y0 ? 1 : -1;
  61980. } else {
  61981. w += y2 < y_ ? 1 : -1;
  61982. }
  61983. }
  61984. return w;
  61985. } else {
  61986. let x_ = curve.quadraticAt(x0, x1, x2, roots[0]);
  61987. if (x_ > x) {
  61988. return 0;
  61989. }
  61990. return y2 < y0 ? 1 : -1;
  61991. }
  61992. }
  61993. }
  61994. /**
  61995. * @function LevelRenderer.Tool.Areal.prototype.windingArc
  61996. * // TODO Arc 旋转
  61997. */
  61998. windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
  61999. var roots = this.roots;
  62000. var PI2 = this.PI2;
  62001. y -= cy;
  62002. if (y > r || y < -r) {
  62003. return 0;
  62004. }
  62005. let tmp = Math.sqrt(r * r - y * y);
  62006. roots[0] = -tmp;
  62007. roots[1] = tmp;
  62008. if (Math.abs(startAngle - endAngle) >= PI2) {
  62009. // Is a circle
  62010. startAngle = 0;
  62011. endAngle = PI2;
  62012. var dir = anticlockwise ? 1 : -1;
  62013. if (x >= roots[0] + cx && x <= roots[1] + cx) {
  62014. return dir;
  62015. } else {
  62016. return 0;
  62017. }
  62018. }
  62019. if (anticlockwise) {
  62020. let tmp = startAngle;
  62021. startAngle = this.normalizeRadian(endAngle);
  62022. endAngle = this.normalizeRadian(tmp);
  62023. } else {
  62024. startAngle = this.normalizeRadian(startAngle);
  62025. endAngle = this.normalizeRadian(endAngle);
  62026. }
  62027. if (startAngle > endAngle) {
  62028. endAngle += PI2;
  62029. }
  62030. var w = 0;
  62031. for (let i = 0; i < 2; i++) {
  62032. var x_ = roots[i];
  62033. if (x_ + cx > x) {
  62034. let angle = Math.atan2(y, x_);
  62035. let dir = anticlockwise ? 1 : -1;
  62036. if (angle < 0) {
  62037. angle = PI2 + angle;
  62038. }
  62039. if (
  62040. (angle >= startAngle && angle <= endAngle)
  62041. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
  62042. ) {
  62043. if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
  62044. dir = -dir;
  62045. }
  62046. w += dir;
  62047. }
  62048. }
  62049. }
  62050. return w;
  62051. }
  62052. /**
  62053. * @function LevelRenderer.Tool.Areal.prototype.isInsidePath
  62054. * @description 与 canvas 一样采用 non-zero winding rule
  62055. */
  62056. isInsidePath(pathArray, lineWidth, brushType, x, y) {
  62057. var w = 0;
  62058. var xi = 0;
  62059. var yi = 0;
  62060. var x0 = 0;
  62061. var y0 = 0;
  62062. var beginSubpath = true;
  62063. var firstCmd = true;
  62064. brushType = brushType || 'fill';
  62065. var hasStroke = brushType === 'stroke' || brushType === 'both';
  62066. var hasFill = brushType === 'fill' || brushType === 'both';
  62067. // var roots = [-1, -1, -1];
  62068. for (var i = 0; i < pathArray.length; i++) {
  62069. var seg = pathArray[i];
  62070. var p = seg.points;
  62071. // Begin a new subpath
  62072. if (beginSubpath || seg.command === 'M') {
  62073. if (i > 0) {
  62074. // Close previous subpath
  62075. if (hasFill) {
  62076. w += this.windingLine(xi, yi, x0, y0, x, y);
  62077. }
  62078. if (w !== 0) {
  62079. return true;
  62080. }
  62081. }
  62082. x0 = p[p.length - 2];
  62083. y0 = p[p.length - 1];
  62084. beginSubpath = false;
  62085. if (firstCmd && seg.command !== 'A') {
  62086. // 如果第一个命令不是M, 是lineTo, bezierCurveTo
  62087. // 等绘制命令的话,是会从该绘制的起点开始算的
  62088. // Arc 会在之后做单独处理所以这里忽略
  62089. firstCmd = false;
  62090. xi = x0;
  62091. yi = y0;
  62092. }
  62093. }
  62094. switch (seg.command) {
  62095. case 'M':
  62096. xi = p[0];
  62097. yi = p[1];
  62098. break;
  62099. case 'L':
  62100. if (hasStroke) {
  62101. if (this.isInsideLine(
  62102. xi, yi, p[0], p[1], lineWidth, x, y
  62103. )) {
  62104. return true;
  62105. }
  62106. }
  62107. if (hasFill) {
  62108. w += this.windingLine(xi, yi, p[0], p[1], x, y);
  62109. }
  62110. xi = p[0];
  62111. yi = p[1];
  62112. break;
  62113. case 'C':
  62114. if (hasStroke) {
  62115. if (this.isInsideCubicStroke(
  62116. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5],
  62117. lineWidth, x, y
  62118. )) {
  62119. return true;
  62120. }
  62121. }
  62122. if (hasFill) {
  62123. w += this.windingCubic(
  62124. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5], x, y
  62125. );
  62126. }
  62127. xi = p[4];
  62128. yi = p[5];
  62129. break;
  62130. case 'Q':
  62131. if (hasStroke) {
  62132. if (this.isInsideQuadraticStroke(
  62133. xi, yi, p[0], p[1], p[2], p[3],
  62134. lineWidth, x, y
  62135. )) {
  62136. return true;
  62137. }
  62138. }
  62139. if (hasFill) {
  62140. w += this.windingQuadratic(
  62141. xi, yi, p[0], p[1], p[2], p[3], x, y
  62142. );
  62143. }
  62144. xi = p[2];
  62145. yi = p[3];
  62146. break;
  62147. case 'A':
  62148. // TODO Arc 旋转
  62149. // TODO Arc 判断的开销比较大
  62150. var cx = p[0];
  62151. var cy = p[1];
  62152. var rx = p[2];
  62153. var ry = p[3];
  62154. var theta = p[4];
  62155. var dTheta = p[5];
  62156. var x1 = Math.cos(theta) * rx + cx;
  62157. var y1 = Math.sin(theta) * ry + cy;
  62158. // 不是直接使用 arc 命令
  62159. if (!firstCmd) {
  62160. w += this.windingLine(xi, yi, x1, y1);
  62161. } else {
  62162. firstCmd = false;
  62163. // 第一个命令起点还未定义
  62164. x0 = x1;
  62165. y0 = y1;
  62166. }
  62167. // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
  62168. var _x = (x - cx) * ry / rx + cx;
  62169. if (hasStroke) {
  62170. if (this.isInsideArcStroke(
  62171. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  62172. lineWidth, _x, y
  62173. )) {
  62174. return true;
  62175. }
  62176. }
  62177. if (hasFill) {
  62178. w += this.windingArc(
  62179. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  62180. _x, y
  62181. );
  62182. }
  62183. xi = Math.cos(theta + dTheta) * rx + cx;
  62184. yi = Math.sin(theta + dTheta) * ry + cy;
  62185. break;
  62186. case 'z':
  62187. if (hasStroke) {
  62188. if (this.isInsideLine(
  62189. xi, yi, x0, y0, lineWidth, x, y
  62190. )) {
  62191. return true;
  62192. }
  62193. }
  62194. beginSubpath = true;
  62195. break;
  62196. }
  62197. }
  62198. if (hasFill) {
  62199. w += this.windingLine(xi, yi, x0, y0, x, y);
  62200. }
  62201. return w !== 0;
  62202. }
  62203. /**
  62204. * @function LevelRenderer.Tool.Areal.prototype.getTextWidth
  62205. * @description 测算多行文本宽度
  62206. */
  62207. getTextWidth(text, textFont) {
  62208. var key = text + ':' + textFont;
  62209. if (this._textWidthCache[key]) {
  62210. return this._textWidthCache[key];
  62211. }
  62212. this._ctx = this._ctx || this.util.getContext();
  62213. this._ctx.save();
  62214. if (textFont) {
  62215. this._ctx.font = textFont;
  62216. }
  62217. text = (text + '').split('\n');
  62218. var width = 0;
  62219. for (var i = 0, l = text.length; i < l; i++) {
  62220. width = Math.max(
  62221. this._ctx.measureText(text[i]).width,
  62222. width
  62223. );
  62224. }
  62225. this._ctx.restore();
  62226. this._textWidthCache[key] = width;
  62227. if (++this._textWidthCacheCounter > this.TEXT_CACHE_MAX) {
  62228. // 内存释放
  62229. this._textWidthCacheCounter = 0;
  62230. this._textWidthCache = {};
  62231. }
  62232. return width;
  62233. }
  62234. /**
  62235. * @function LevelRenderer.Tool.Areal.prototype.getTextHeight
  62236. * @description 测算多行文本高度
  62237. */
  62238. getTextHeight(text, textFont) {
  62239. var key = text + ':' + textFont;
  62240. if (this._textHeightCache[key]) {
  62241. return this._textHeightCache[key];
  62242. }
  62243. this._ctx = this._ctx || this.util.getContext();
  62244. this._ctx.save();
  62245. if (textFont) {
  62246. this._ctx.font = textFont;
  62247. }
  62248. text = (text + '').split('\n');
  62249. // 比较粗暴
  62250. //var height = (this._ctx.measureText('国').width + 2) * text.length; //打包不支持中文,替换掉
  62251. var height = (this._ctx.measureText('ZH').width + 2) * text.length;
  62252. this._ctx.restore();
  62253. this._textHeightCache[key] = height;
  62254. if (++this._textHeightCacheCounter > this.TEXT_CACHE_MAX) {
  62255. // 内存释放
  62256. this._textHeightCacheCounter = 0;
  62257. this._textHeightCache = {};
  62258. }
  62259. return height;
  62260. }
  62261. }
  62262. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/ComputeBoundingBox.js
  62263. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62264. * This program are made available under the terms of the Apache License, Version 2.0
  62265. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62266. /**
  62267. * @class LevelRenderer.Tool.ComputeBoundingBox
  62268. * @category Visualization Theme
  62269. * @classdesc LevelRenderer 工具-图形 Bounds 计算
  62270. * @private
  62271. */
  62272. class ComputeBoundingBox {
  62273. constructor() {
  62274. if (arguments.length === 3) {
  62275. this.computeBoundingBox(arguments);
  62276. }
  62277. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.ComputeBoundingBox";
  62278. }
  62279. /**
  62280. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.computeBoundingBox
  62281. * @description 从顶点数组中计算出最小包围盒,写入'min'和'max'中。
  62282. * @param {Array.<Object>} points - 顶点数组。
  62283. * @param {Array.<number>} min - 最小
  62284. * @param {Array.<number>} max - 最大
  62285. */
  62286. computeBoundingBox(points, min, max) {
  62287. if (points.length === 0) {
  62288. return;
  62289. }
  62290. var left = points[0][0];
  62291. var right = points[0][0];
  62292. var top = points[0][1];
  62293. var bottom = points[0][1];
  62294. for (var i = 1; i < points.length; i++) {
  62295. var p = points[i];
  62296. if (p[0] < left) {
  62297. left = p[0];
  62298. }
  62299. if (p[0] > right) {
  62300. right = p[0];
  62301. }
  62302. if (p[1] < top) {
  62303. top = p[1];
  62304. }
  62305. if (p[1] > bottom) {
  62306. bottom = p[1];
  62307. }
  62308. }
  62309. min[0] = left;
  62310. min[1] = top;
  62311. max[0] = right;
  62312. max[1] = bottom;
  62313. }
  62314. /**
  62315. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.cubeBezier
  62316. * @description 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入'min'和'max'中。原:computeCubeBezierBoundingBox。
  62317. * @param {Array.<number>} p0 - 三阶贝塞尔曲线p0点
  62318. * @param {Array.<number>} p1 - 三阶贝塞尔曲线p1点
  62319. * @param {Array.<number>} p2 - 三阶贝塞尔曲线p2点
  62320. * @param {Array.<number>} p3 - 三阶贝塞尔曲线p3点
  62321. * @param {Array.<number>} min - 最小
  62322. * @param {Array.<number>} max - 最大
  62323. */
  62324. cubeBezier(p0, p1, p2, p3, min, max) {
  62325. var curve = new Curve_Curve();
  62326. var xDim = [];
  62327. curve.cubicExtrema(p0[0], p1[0], p2[0], p3[0], xDim);
  62328. for (let i = 0; i < xDim.length; i++) {
  62329. xDim[i] = curve.cubicAt(p0[0], p1[0], p2[0], p3[0], xDim[i]);
  62330. }
  62331. var yDim = [];
  62332. curve.cubicExtrema(p0[1], p1[1], p2[1], p3[1], yDim);
  62333. for (let i = 0; i < yDim.length; i++) {
  62334. yDim[i] = curve.cubicAt(p0[1], p1[1], p2[1], p3[1], yDim[i]);
  62335. }
  62336. xDim.push(p0[0], p3[0]);
  62337. yDim.push(p0[1], p3[1]);
  62338. var left = Math.min.apply(null, xDim);
  62339. var right = Math.max.apply(null, xDim);
  62340. var top = Math.min.apply(null, yDim);
  62341. var bottom = Math.max.apply(null, yDim);
  62342. min[0] = left;
  62343. min[1] = top;
  62344. max[0] = right;
  62345. max[1] = bottom;
  62346. }
  62347. /**
  62348. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.quadraticBezier
  62349. * @description 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入'min'和'max'中。原:computeQuadraticBezierBoundingBox。
  62350. * @param {Array.<number>} p0 - 二阶贝塞尔曲线p0点
  62351. * @param {Array.<number>} p1 - 二阶贝塞尔曲线p1点
  62352. * @param {Array.<number>} p2 - 二阶贝塞尔曲线p2点
  62353. * @param {Array.<number>} min - 最小
  62354. * @param {Array.<number>} max - 最大
  62355. */
  62356. quadraticBezier(p0, p1, p2, min, max) {
  62357. var curve = new Curve_Curve();
  62358. // Find extremities, where derivative in x dim or y dim is zero
  62359. var t1 = curve.quadraticExtremum(p0[0], p1[0], p2[0]);
  62360. var t2 = curve.quadraticExtremum(p0[1], p1[1], p2[1]);
  62361. t1 = Math.max(Math.min(t1, 1), 0);
  62362. t2 = Math.max(Math.min(t2, 1), 0);
  62363. var ct1 = 1 - t1;
  62364. var ct2 = 1 - t2;
  62365. var x1 = ct1 * ct1 * p0[0]
  62366. + 2 * ct1 * t1 * p1[0]
  62367. + t1 * t1 * p2[0];
  62368. var y1 = ct1 * ct1 * p0[1]
  62369. + 2 * ct1 * t1 * p1[1]
  62370. + t1 * t1 * p2[1];
  62371. var x2 = ct2 * ct2 * p0[0]
  62372. + 2 * ct2 * t2 * p1[0]
  62373. + t2 * t2 * p2[0];
  62374. var y2 = ct2 * ct2 * p0[1]
  62375. + 2 * ct2 * t2 * p1[1]
  62376. + t2 * t2 * p2[1];
  62377. min[0] = Math.min(p0[0], p2[0], x1, x2);
  62378. min[1] = Math.min(p0[1], p2[1], y1, y2);
  62379. max[0] = Math.max(p0[0], p2[0], x1, x2);
  62380. max[1] = Math.max(p0[1], p2[1], y1, y2);
  62381. }
  62382. /**
  62383. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.arc
  62384. * @description 从圆弧中计算出最小包围盒,写入'min'和'max'中。原:computeArcBoundingBox。
  62385. * @param {number} x - 圆弧中心点 x
  62386. * @param {number} y - 圆弧中心点 y
  62387. * @param {number} r - 圆弧半径
  62388. * @param {number} startAngle - 圆弧开始角度
  62389. * @param {number} endAngle - 圆弧结束角度
  62390. * @param {number} anticlockwise - 是否是顺时针
  62391. * @param {number} min - 最小
  62392. * @param {number} max - 最大
  62393. */
  62394. arc(x, y, r, startAngle, endAngle, anticlockwise, min, max) {
  62395. var vec2 = new levelRenderer_Vector_Vector();
  62396. var start = vec2.create();
  62397. var end = vec2.create();
  62398. var extremity = vec2.create();
  62399. start[0] = Math.cos(startAngle) * r + x;
  62400. start[1] = Math.sin(startAngle) * r + y;
  62401. end[0] = Math.cos(endAngle) * r + x;
  62402. end[1] = Math.sin(endAngle) * r + y;
  62403. vec2.min(min, start, end);
  62404. vec2.max(max, start, end);
  62405. // Thresh to [0, Math.PI * 2]
  62406. startAngle = startAngle % (Math.PI * 2);
  62407. if (startAngle < 0) {
  62408. startAngle = startAngle + Math.PI * 2;
  62409. }
  62410. endAngle = endAngle % (Math.PI * 2);
  62411. if (endAngle < 0) {
  62412. endAngle = endAngle + Math.PI * 2;
  62413. }
  62414. if (startAngle > endAngle && !anticlockwise) {
  62415. endAngle += Math.PI * 2;
  62416. } else if (startAngle < endAngle && anticlockwise) {
  62417. startAngle += Math.PI * 2;
  62418. }
  62419. if (anticlockwise) {
  62420. var tmp = endAngle;
  62421. endAngle = startAngle;
  62422. startAngle = tmp;
  62423. }
  62424. // var number = 0;
  62425. // var step = (anticlockwise ? -Math.PI : Math.PI) / 2;
  62426. for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
  62427. if (angle > startAngle) {
  62428. extremity[0] = Math.cos(angle) * r + x;
  62429. extremity[1] = Math.sin(angle) * r + y;
  62430. vec2.min(min, extremity, min);
  62431. vec2.max(max, extremity, max);
  62432. }
  62433. }
  62434. }
  62435. }
  62436. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Env.js
  62437. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62438. * This program are made available under the terms of the Apache License, Version 2.0
  62439. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62440. /**
  62441. * @class LevelRenderer.Tool.Env
  62442. * @category Visualization Theme
  62443. * @classdesc 环境识别
  62444. * @private
  62445. */
  62446. class Env {
  62447. constructor() {
  62448. // Zepto.js
  62449. // (c) 2010-2013 Thomas Fuchs
  62450. // Zepto.js may be freely distributed under the MIT license.
  62451. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Env";
  62452. var me = this;
  62453. function detect(ua) {
  62454. var os = me.os = {};
  62455. var browser = me.browser = {};
  62456. var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/);
  62457. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  62458. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  62459. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  62460. var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
  62461. var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
  62462. var touchpad = webos && ua.match(/TouchPad/);
  62463. var kindle = ua.match(/Kindle\/([\d.]+)/);
  62464. var silk = ua.match(/Silk\/([\d._]+)/);
  62465. var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
  62466. var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/);
  62467. var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/);
  62468. var playbook = ua.match(/PlayBook/);
  62469. var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/);
  62470. var firefox = ua.match(/Firefox\/([\d.]+)/);
  62471. var ie = ua.match(/MSIE ([\d.]+)/);
  62472. var safari = webkit && ua.match(/Mobile\//) && !chrome;
  62473. var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome;
  62474. // Todo: clean this up with a better OS/browser seperation:
  62475. // - discern (more) between multiple browsers on android
  62476. // - decide if kindle fire in silk mode is android or not
  62477. // - Firefox on Android doesn't specify the Android version
  62478. // - possibly devide in os, device and browser hashes
  62479. /*eslint-disable*/
  62480. if (browser.webkit = !!webkit) {
  62481. browser.version = webkit[1];
  62482. }
  62483. if (android) {
  62484. os.android = true;
  62485. os.version = android[2];
  62486. }
  62487. if (iphone && !ipod) {
  62488. os.ios = os.iphone = true;
  62489. os.version = iphone[2].replace(/_/g, '.');
  62490. }
  62491. if (ipad) {
  62492. os.ios = os.ipad = true;
  62493. os.version = ipad[2].replace(/_/g, '.');
  62494. }
  62495. if (ipod) {
  62496. os.ios = os.ipod = true;
  62497. os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
  62498. }
  62499. if (webos) {
  62500. os.webos = true;
  62501. os.version = webos[2];
  62502. }
  62503. if (touchpad) {
  62504. os.touchpad = true;
  62505. }
  62506. if (blackberry) {
  62507. os.blackberry = true;
  62508. os.version = blackberry[2];
  62509. }
  62510. if (bb10) {
  62511. os.bb10 = true;
  62512. os.version = bb10[2];
  62513. }
  62514. if (rimtabletos) {
  62515. os.rimtabletos = true;
  62516. os.version = rimtabletos[2];
  62517. }
  62518. if (playbook) {
  62519. browser.playbook = true;
  62520. }
  62521. if (kindle) {
  62522. os.kindle = true;
  62523. os.version = kindle[1];
  62524. }
  62525. if (silk) {
  62526. browser.silk = true;
  62527. browser.version = silk[1];
  62528. }
  62529. if (!silk && os.android && ua.match(/Kindle Fire/)) {
  62530. browser.silk = true;
  62531. }
  62532. if (chrome) {
  62533. browser.chrome = true;
  62534. browser.version = chrome[1];
  62535. }
  62536. if (firefox) {
  62537. browser.firefox = true;
  62538. browser.version = firefox[1];
  62539. }
  62540. if (ie) {
  62541. browser.ie = true;
  62542. browser.version = ie[1];
  62543. }
  62544. if (safari && (ua.match(/Safari/) || !!os.ios)) {
  62545. browser.safari = true;
  62546. }
  62547. if (webview) {
  62548. browser.webview = true;
  62549. }
  62550. if (ie) {
  62551. browser.ie = true;
  62552. browser.version = ie[1];
  62553. }
  62554. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
  62555. (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));
  62556. os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
  62557. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
  62558. (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))));
  62559. return {
  62560. browser: browser,
  62561. os: os,
  62562. // 原生canvas支持
  62563. canvasSupported: document.createElement('canvas').getContext ? true : false
  62564. };
  62565. }
  62566. return detect(navigator.userAgent);
  62567. }
  62568. destory() {
  62569. return true;
  62570. }
  62571. }
  62572. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Event.js
  62573. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62574. * This program are made available under the terms of the Apache License, Version 2.0
  62575. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62576. /**
  62577. * @class LevelRenderer.Tool.Event
  62578. * @category Visualization Theme
  62579. * @classdesc LevelRenderer 工具-事件辅助类
  62580. * @private
  62581. */
  62582. class Event_Event {
  62583. constructor() {
  62584. /**
  62585. * @member {function} LevelRenderer.Tool.Event.prototype.stop
  62586. * @description 停止冒泡和阻止默认行为
  62587. */
  62588. this.stop = typeof window.addEventListener === 'function'
  62589. ? function (e) {
  62590. e.preventDefault();
  62591. e.stopPropagation();
  62592. e.cancelBubble = true;
  62593. }
  62594. : function (e) {
  62595. e.returnValue = false;
  62596. e.cancelBubble = true;
  62597. };
  62598. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Event";
  62599. }
  62600. /**
  62601. * @function LevelRenderer.Tool.Event.prototype.getX
  62602. * @description 提取鼠标(手指)x坐标。
  62603. * @param {Event} e - 事件。
  62604. * @returns {number} 鼠标(手指)x坐标。
  62605. */
  62606. getX(e) {
  62607. return typeof e.zrenderX != 'undefined' && e.zrenderX
  62608. || typeof e.offsetX != 'undefined' && e.offsetX
  62609. || typeof e.layerX != 'undefined' && e.layerX
  62610. || typeof e.clientX != 'undefined' && e.clientX;
  62611. }
  62612. /**
  62613. * @function LevelRenderer.Tool.Event.prototype.getY
  62614. * @description 提取鼠标(手指)y坐标。
  62615. * @param {Event} e - 事件。
  62616. * @returns {number} 鼠标(手指)y坐标。
  62617. */
  62618. getY(e) {
  62619. return typeof e.zrenderY != 'undefined' && e.zrenderY
  62620. || typeof e.offsetY != 'undefined' && e.offsetY
  62621. || typeof e.layerY != 'undefined' && e.layerY
  62622. || typeof e.clientY != 'undefined' && e.clientY;
  62623. }
  62624. /**
  62625. * @function LevelRenderer.Tool.Event.prototype.getDelta
  62626. * @description 提取鼠标滚轮变化。
  62627. * @param {Event} e - 事件。
  62628. * @returns {number} 滚轮变化,正值说明滚轮是向上滚动,如果是负值说明滚轮是向下滚动。
  62629. */
  62630. getDelta(e) {
  62631. return typeof e.zrenderDelta != 'undefined' && e.zrenderDelta
  62632. || typeof e.wheelDelta != 'undefined' && e.wheelDelta
  62633. || typeof e.detail != 'undefined' && -e.detail;
  62634. }
  62635. }
  62636. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Http.js
  62637. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62638. * This program are made available under the terms of the Apache License, Version 2.0
  62639. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62640. /**
  62641. * @private
  62642. * @class LevelRenderer.Tool.Http
  62643. * @category Visualization Theme
  62644. * @classdesc LevelRenderer 工具-Http
  62645. */
  62646. class Http {
  62647. constructor() {
  62648. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Http"
  62649. }
  62650. /**
  62651. * @function LevelRenderer.Tool.Http.prototype.get
  62652. * @description get请求。
  62653. * @param {(string|IHTTPGetOption)} url - 请求url
  62654. * @param {function} onsuccess - 请求成功函数
  62655. * @param {function} onerror - 请求失败函数
  62656. * @param {Object} opts - 额外参数
  62657. * @returns {number} cos值
  62658. */
  62659. get(url, onsuccess, onerror) {
  62660. if (typeof(url) === 'object') {
  62661. var obj = url;
  62662. url = obj.url;
  62663. onsuccess = obj.onsuccess;
  62664. onerror = obj.onerror;
  62665. }
  62666. var xhr = window.XMLHttpRequest
  62667. ? new XMLHttpRequest()
  62668. : new window.ActiveXObject('Microsoft.XMLHTTP');
  62669. xhr.open('GET', url, true);
  62670. xhr.onreadystatechange = function () {
  62671. if (xhr.readyState == 4) {
  62672. if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
  62673. onsuccess && onsuccess(xhr.responseText);
  62674. } else {
  62675. onerror && onerror();
  62676. }
  62677. xhr.onreadystatechange = new Function();
  62678. xhr = null;
  62679. }
  62680. };
  62681. xhr.send(null);
  62682. }
  62683. }
  62684. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Config.js
  62685. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62686. * This program are made available under the terms of the Apache License, Version 2.0
  62687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62688. class Config {
  62689. }
  62690. /**
  62691. * @enum EVENT
  62692. * @description 事件
  62693. * @type {Object}
  62694. * @private
  62695. */
  62696. Config.EVENT = {
  62697. //窗口大小变化
  62698. RESIZE: 'resize',
  62699. //鼠标按钮被(手指)按下,事件对象是:目标图形元素或空
  62700. CLICK: 'click',
  62701. //双击事件
  62702. DBLCLICK: 'dblclick',
  62703. //鼠标滚轮变化,事件对象是:目标图形元素或空
  62704. MOUSEWHEEL: 'mousewheel',
  62705. //鼠标(手指)被移动,事件对象是:目标图形元素或空
  62706. MOUSEMOVE: 'mousemove',
  62707. //鼠标移到某图形元素之上,事件对象是:目标图形元素
  62708. MOUSEOVER: 'mouseover',
  62709. //鼠标从某图形元素移开,事件对象是:目标图形元素
  62710. MOUSEOUT: 'mouseout',
  62711. //鼠标按钮(手指)被按下,事件对象是:目标图形元素或空
  62712. MOUSEDOWN: 'mousedown',
  62713. //鼠标按键(手指)被松开,事件对象是:目标图形元素或空
  62714. MOUSEUP: 'mouseup',
  62715. //全局离开,MOUSEOUT触发比较频繁,一次离开优化绑定
  62716. GLOBALOUT: 'globalout',
  62717. // 一次成功元素拖拽的行为事件过程是:
  62718. // dragstart > dragenter > dragover [> dragleave] > drop > dragend
  62719. //开始拖拽时触发,事件对象是:被拖拽图形元素
  62720. DRAGSTART: 'dragstart',
  62721. //拖拽完毕时触发(在drop之后触发),事件对象是:被拖拽图形元素
  62722. DRAGEND: 'dragend',
  62723. //拖拽图形元素进入目标图形元素时触发,事件对象是:目标图形元素
  62724. DRAGENTER: 'dragenter',
  62725. //拖拽图形元素在目标图形元素上移动时触发,事件对象是:目标图形元素
  62726. DRAGOVER: 'dragover',
  62727. //拖拽图形元素离开目标图形元素时触发,事件对象是:目标图形元素
  62728. DRAGLEAVE: 'dragleave',
  62729. //拖拽图形元素放在目标图形元素内时触发,事件对象是:目标图形元素
  62730. DROP: 'drop',
  62731. //touch end - start < delay is click
  62732. touchClickDelay: 300
  62733. };
  62734. /**
  62735. * @enum catchBrushException
  62736. * @description 是否异常捕获
  62737. * @type {boolean}
  62738. * @private
  62739. */
  62740. Config.catchBrushException = false;
  62741. /**
  62742. * @enum debugMode
  62743. * @description debug 日志选项:catchBrushException 为 true 下有效。
  62744. * 0 : 不生成debug数据,发布用
  62745. * 1 : 异常抛出,调试用
  62746. * 2 : 控制台输出,调试用
  62747. * @type {boolean}
  62748. * @private
  62749. */
  62750. Config.debugMode = 0;
  62751. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Log.js
  62752. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62753. * This program are made available under the terms of the Apache License, Version 2.0
  62754. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62755. /**
  62756. * @private
  62757. * @class LevelRenderer.Tool.Log
  62758. * @category Visualization Theme
  62759. * @classdesc LevelRenderer 工具-日志
  62760. */
  62761. class Log {
  62762. constructor() {
  62763. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Log";
  62764. return function () {
  62765. if (+Config.debugMode === 0) {
  62766. return;
  62767. } else if (+Config.debugMode === 1) {
  62768. for (let k in arguments) {
  62769. throw new Error(arguments[k]);
  62770. }
  62771. } else if (+Config.debugMode > 1) {
  62772. for (let k in arguments) {
  62773. console.log(arguments[k]);
  62774. }
  62775. }
  62776. };
  62777. /* for debug
  62778. return function(mes) {
  62779. document.getElementById('wrong-message').innerHTML =
  62780. mes + ' ' + (new Date() - 0)
  62781. + '<br/>'
  62782. + document.getElementById('wrong-message').innerHTML;
  62783. };
  62784. */
  62785. }
  62786. destory() {
  62787. return true;
  62788. }
  62789. }
  62790. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Math.js
  62791. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62792. * This program are made available under the terms of the Apache License, Version 2.0
  62793. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62794. /**
  62795. * @private
  62796. * @class LevelRenderer.Tool.Math
  62797. * @category Visualization Theme
  62798. * @classdesc LevelRenderer 工具-数学辅助类
  62799. */
  62800. class MathTool {
  62801. constructor() {
  62802. /**
  62803. * @member {number} LevelRenderer.Tool.Math._radians
  62804. * @description 角度与弧度转化参数
  62805. */
  62806. this._radians = window.Math.PI / 180;
  62807. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Math";
  62808. }
  62809. /**
  62810. * @function LevelRenderer.Tool.Math.prototype.sin
  62811. * @description 正弦函数。
  62812. * @param {number} angle - 弧度(角度)参数。
  62813. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  62814. * @returns {number} sin 值。
  62815. */
  62816. sin(angle, isDegrees) {
  62817. return window.Math.sin(isDegrees ? angle * this._radians : angle);
  62818. }
  62819. /**
  62820. * @function LevelRenderer.Tool.Math.prototype.cos
  62821. * @description 余弦函数。
  62822. * @param {number} angle - 弧度(角度)参数。
  62823. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  62824. * @returns {number} cos 值。
  62825. */
  62826. cos(angle, isDegrees) {
  62827. return window.Math.cos(isDegrees ? angle * this._radians : angle);
  62828. }
  62829. /**
  62830. * @function LevelRenderer.Tool.Math.prototype.degreeToRadian
  62831. * @description 角度转弧度。
  62832. * @param {number} angle - 弧度(角度)参数。
  62833. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  62834. * @returns {number} 弧度值。
  62835. */
  62836. degreeToRadian(angle) {
  62837. return angle * this._radians;
  62838. }
  62839. /**
  62840. * @function LevelRenderer.Tool.Math.prototype.radianToDegree
  62841. * @description 弧度转角度。
  62842. * @param {number} angle - 弧度(角度)参数。
  62843. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  62844. * @returns {number} 角度。
  62845. */
  62846. radianToDegree(angle) {
  62847. return angle / this._radians;
  62848. }
  62849. }
  62850. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Matrix.js
  62851. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  62852. * This program are made available under the terms of the Apache License, Version 2.0
  62853. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62854. /**
  62855. * @private
  62856. * @class LevelRenderer.Tool.Matrix
  62857. * @category Visualization Theme
  62858. * @classdesc LevelRenderer 工具-3x2矩阵操作类
  62859. */
  62860. class Matrix {
  62861. constructor() {
  62862. /**
  62863. * @member {Object} LevelRenderer.Tool.Matrix.prototype.ArrayCtor
  62864. * @description 数组类型控制
  62865. */
  62866. this.ArrayCtor = typeof Float32Array === 'undefined'
  62867. ? Array
  62868. : Float32Array;
  62869. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Matrix";
  62870. }
  62871. /**
  62872. * @function LevelRenderer.Tool.Matrix.prototype.create
  62873. * @description 创建一个单位矩阵。
  62874. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  62875. */
  62876. create() {
  62877. var ArrayCtor = this.ArrayCtor;
  62878. var out = new ArrayCtor(6);
  62879. this.identity(out);
  62880. return out;
  62881. }
  62882. /**
  62883. * @function LevelRenderer.Tool.Matrix.prototype.identity
  62884. * @description 设置矩阵为单位矩阵。
  62885. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  62886. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  62887. */
  62888. identity(out) {
  62889. out[0] = 1;
  62890. out[1] = 0;
  62891. out[2] = 0;
  62892. out[3] = 1;
  62893. out[4] = 0;
  62894. out[5] = 0;
  62895. return out;
  62896. }
  62897. /**
  62898. * @function LevelRenderer.Tool.Matrix.prototype.copy
  62899. * @description 复制矩阵。
  62900. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  62901. * @returns {(Float32Array|Array.<number>)} 克隆矩阵。
  62902. */
  62903. copy(out, m) {
  62904. out[0] = m[0];
  62905. out[1] = m[1];
  62906. out[2] = m[2];
  62907. out[3] = m[3];
  62908. out[4] = m[4];
  62909. out[5] = m[5];
  62910. return out;
  62911. }
  62912. /**
  62913. * @function LevelRenderer.Tool.Matrix.prototype.mul
  62914. * @description 矩阵相乘。
  62915. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  62916. * @param {(Float32Array|Array.<number>)} m1 - 矩阵m1。
  62917. * @param {(Float32Array|Array.<number>)} m2- 矩阵m2。
  62918. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  62919. */
  62920. mul(out, m1, m2) {
  62921. out[0] = m1[0] * m2[0] + m1[2] * m2[1];
  62922. out[1] = m1[1] * m2[0] + m1[3] * m2[1];
  62923. out[2] = m1[0] * m2[2] + m1[2] * m2[3];
  62924. out[3] = m1[1] * m2[2] + m1[3] * m2[3];
  62925. out[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
  62926. out[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
  62927. return out;
  62928. }
  62929. /**
  62930. * @function LevelRenderer.Tool.Matrix.prototype.mul
  62931. * @description 平移变换。
  62932. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  62933. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  62934. * @param {(Float32Array|Array.<number>)} v- 平移参数。
  62935. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  62936. */
  62937. translate(out, a, v) {
  62938. out[0] = a[0];
  62939. out[1] = a[1];
  62940. out[2] = a[2];
  62941. out[3] = a[3];
  62942. out[4] = a[4] + v[0];
  62943. out[5] = a[5] + v[1];
  62944. return out;
  62945. }
  62946. /**
  62947. * @function LevelRenderer.Tool.Matrix.prototype.rotate
  62948. * @description 平移变换。
  62949. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  62950. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  62951. * @param {(Float32Array|Array.<number>)} rad - 旋转参数。
  62952. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  62953. */
  62954. rotate(out, a, rad) {
  62955. var aa = a[0];
  62956. var ac = a[2];
  62957. var atx = a[4];
  62958. var ab = a[1];
  62959. var ad = a[3];
  62960. var aty = a[5];
  62961. var st = Math.sin(rad);
  62962. var ct = Math.cos(rad);
  62963. out[0] = aa * ct + ab * st;
  62964. out[1] = -aa * st + ab * ct;
  62965. out[2] = ac * ct + ad * st;
  62966. out[3] = -ac * st + ct * ad;
  62967. out[4] = ct * atx + st * aty;
  62968. out[5] = ct * aty - st * atx;
  62969. return out;
  62970. }
  62971. /**
  62972. * @function LevelRenderer.Tool.Matrix.prototype.scale
  62973. * @description 缩放变换。
  62974. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  62975. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  62976. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  62977. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  62978. */
  62979. scale(out, a, v) {
  62980. var vx = v[0];
  62981. var vy = v[1];
  62982. out[0] = a[0] * vx;
  62983. out[1] = a[1] * vy;
  62984. out[2] = a[2] * vx;
  62985. out[3] = a[3] * vy;
  62986. out[4] = a[4] * vx;
  62987. out[5] = a[5] * vy;
  62988. return out;
  62989. }
  62990. /**
  62991. * @function LevelRenderer.Tool.Matrix.prototype.invert
  62992. * @description 求逆矩阵。
  62993. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  62994. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  62995. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  62996. */
  62997. invert(out, a) {
  62998. var aa = a[0];
  62999. var ac = a[2];
  63000. var atx = a[4];
  63001. var ab = a[1];
  63002. var ad = a[3];
  63003. var aty = a[5];
  63004. var det = aa * ad - ab * ac;
  63005. if (!det) {
  63006. return null;
  63007. }
  63008. det = 1.0 / det;
  63009. out[0] = ad * det;
  63010. out[1] = -ab * det;
  63011. out[2] = -ac * det;
  63012. out[3] = aa * det;
  63013. out[4] = (ac * aty - ad * atx) * det;
  63014. out[5] = (ab * atx - aa * aty) * det;
  63015. return out;
  63016. }
  63017. /**
  63018. * @function LevelRenderer.Tool.Matrix.prototype.mulVector
  63019. * @description 矩阵左乘向量。
  63020. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  63021. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  63022. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  63023. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  63024. */
  63025. mulVector(out, a, v) {
  63026. var aa = a[0];
  63027. var ac = a[2];
  63028. var atx = a[4];
  63029. var ab = a[1];
  63030. var ad = a[3];
  63031. var aty = a[5];
  63032. out[0] = v[0] * aa + v[1] * ac + atx;
  63033. out[1] = v[0] * ab + v[1] * ad + aty;
  63034. return out;
  63035. }
  63036. }
  63037. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SUtil.js
  63038. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63039. * This program are made available under the terms of the Apache License, Version 2.0
  63040. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63041. class SUtil_SUtil {
  63042. /**
  63043. * @function LevelRenderer.SUtil.SUtil_smoothBezier
  63044. * @description 贝塞尔平滑曲线。
  63045. * @private
  63046. * @param {Array} points - 线段顶点数组。
  63047. * @param {number} smooth - 平滑等级, 0-1。
  63048. * @param {boolean} isLoop - isLoop。
  63049. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  63050. * @param {Array.<number>} [originalPosition=[0, 0]] - 参考原点。
  63051. * @return {Array} 生成的平滑节点数组。
  63052. */
  63053. static SUtil_smoothBezier(points, smooth, isLoop, constraint, originalPosition) {
  63054. if (!originalPosition || originalPosition.length !== 2) {
  63055. originalPosition = [0, 0];
  63056. }
  63057. var __OP = originalPosition;
  63058. var cps = [];
  63059. var v = [];
  63060. var v1 = [];
  63061. var v2 = [];
  63062. var hasConstraint = !!constraint;
  63063. var min, max;
  63064. if (hasConstraint) {
  63065. min = [Infinity, Infinity];
  63066. max = [-Infinity, -Infinity];
  63067. let len = points.length;
  63068. for (let i = 0; i < len; i++) {
  63069. SUtil_SUtil.Util_vector.min(min, min, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  63070. SUtil_SUtil.Util_vector.max(max, max, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  63071. }
  63072. // 与指定的包围盒做并集
  63073. SUtil_SUtil.Util_vector.min(min, min, constraint[0]);
  63074. SUtil_SUtil.Util_vector.max(max, max, constraint[1]);
  63075. }
  63076. let len = points.length;
  63077. for (let i = 0; i < len; i++) {
  63078. let point = [points[i][0] + __OP[0], points[i][1] + __OP[1]];
  63079. let prevPoint;
  63080. let nextPoint;
  63081. if (isLoop) {
  63082. prevPoint = [points[i ? i - 1 : len - 1][0] + __OP[0], points[i ? i - 1 : len - 1][1] + __OP[1]];
  63083. nextPoint = [points[(i + 1) % len][0] + __OP[0], points[(i + 1) % len][1] + __OP[1]];
  63084. } else {
  63085. if (i === 0 || i === len - 1) {
  63086. cps.push([points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  63087. continue;
  63088. } else {
  63089. prevPoint = [points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]];
  63090. nextPoint = [points[i + 1][0] + __OP[0], points[i + 1][1] + __OP[1]];
  63091. }
  63092. }
  63093. SUtil_SUtil.Util_vector.sub(v, nextPoint, prevPoint);
  63094. // use degree to scale the handle length
  63095. SUtil_SUtil.Util_vector.scale(v, v, smooth);
  63096. let d0 = SUtil_SUtil.Util_vector.distance(point, prevPoint);
  63097. let d1 = SUtil_SUtil.Util_vector.distance(point, nextPoint);
  63098. let sum = d0 + d1;
  63099. if (sum !== 0) {
  63100. d0 /= sum;
  63101. d1 /= sum;
  63102. }
  63103. SUtil_SUtil.Util_vector.scale(v1, v, -d0);
  63104. SUtil_SUtil.Util_vector.scale(v2, v, d1);
  63105. let cp0 = SUtil_SUtil.Util_vector.add([], point, v1);
  63106. let cp1 = SUtil_SUtil.Util_vector.add([], point, v2);
  63107. if (hasConstraint) {
  63108. SUtil_SUtil.Util_vector.max(cp0, cp0, min);
  63109. SUtil_SUtil.Util_vector.min(cp0, cp0, max);
  63110. SUtil_SUtil.Util_vector.max(cp1, cp1, min);
  63111. SUtil_SUtil.Util_vector.min(cp1, cp1, max);
  63112. }
  63113. cps.push(cp0);
  63114. cps.push(cp1);
  63115. }
  63116. if (isLoop) {
  63117. cps.push(cps.shift());
  63118. }
  63119. return cps;
  63120. }
  63121. /**
  63122. * @function LevelRenderer.SUtil.SUtil_smoothSpline
  63123. * @description 插值折线。
  63124. * @private
  63125. * @param {Array} points - 线段顶点数组。
  63126. * @param {boolean} isLoop - isLoop。
  63127. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  63128. * @param {Array.<number>} originalPosition - 参考原点。默认值:[0, 0]。
  63129. * @return {Array} 生成的平滑节点数组。
  63130. */
  63131. static SUtil_smoothSpline(points, isLoop, constraint, originalPosition) {
  63132. if (!originalPosition || originalPosition.length !== 2) {
  63133. originalPosition = [0, 0];
  63134. }
  63135. var __OP = originalPosition;
  63136. var len = points.length;
  63137. var ret = [];
  63138. var distance = 0;
  63139. for (let i = 1; i < len; i++) {
  63140. distance += SUtil_SUtil.Util_vector.distance([points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]], [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  63141. }
  63142. var segs = distance / 5;
  63143. segs = segs < len ? len : segs;
  63144. for (let i = 0; i < segs; i++) {
  63145. let pos = i / (segs - 1) * (isLoop ? len : len - 1);
  63146. let idx = Math.floor(pos);
  63147. let w = pos - idx;
  63148. let p0;
  63149. let p1 = [points[idx % len][0] + __OP[0], points[idx % len][1] + __OP[1]];
  63150. let p2;
  63151. let p3;
  63152. if (!isLoop) {
  63153. p0 = [points[idx === 0 ? idx : idx - 1][0] + __OP[0], points[idx === 0 ? idx : idx - 1][1] + __OP[1]];
  63154. p2 = [points[idx > len - 2 ? len - 1 : idx + 1][0] + __OP[0], points[idx > len - 2 ? len - 1 : idx + 1][1] + __OP[1]];
  63155. p3 = [points[idx > len - 3 ? len - 1 : idx + 2][0] + __OP[0], points[idx > len - 3 ? len - 1 : idx + 2][1] + __OP[1]];
  63156. } else {
  63157. p0 = [points[(idx - 1 + len) % len][0] + __OP[0], points[(idx - 1 + len) % len][1] + __OP[1]];
  63158. p2 = [points[(idx + 1) % len][0] + __OP[0], points[(idx + 1) % len][1] + __OP[1]];
  63159. p3 = [points[(idx + 2) % len][0] + __OP[0], points[(idx + 2) % len][1] + __OP[1]];
  63160. }
  63161. let w2 = w * w;
  63162. let w3 = w * w2;
  63163. ret.push([
  63164. interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),
  63165. interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)
  63166. ]);
  63167. }
  63168. return ret;
  63169. // inner Function
  63170. function interpolate(p0, p1, p2, p3, t, t2, t3) {
  63171. var v0 = (p2 - p0) * 0.5;
  63172. var v1 = (p3 - p1) * 0.5;
  63173. return (2 * (p1 - p2) + v0 + v1) * t3
  63174. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  63175. + v0 * t + p1;
  63176. }
  63177. }
  63178. /**
  63179. * @function LevelRenderer.SUtil.SUtil_dashedLineTo
  63180. * @description 虚线 lineTo。
  63181. */
  63182. static SUtil_dashedLineTo(ctx, x1, y1, x2, y2, dashLength, customDashPattern) {
  63183. // http://msdn.microsoft.com/en-us/library/ie/dn265063(v=vs.85).aspx
  63184. var dashPattern = [5, 5];
  63185. dashLength = typeof dashLength != 'number'
  63186. ? 5
  63187. : dashLength;
  63188. if (ctx.setLineDash) {
  63189. dashPattern[0] = dashLength;
  63190. dashPattern[1] = dashLength;
  63191. if (customDashPattern && (customDashPattern instanceof Array)) {
  63192. ctx.setLineDash(customDashPattern);
  63193. } else {
  63194. ctx.setLineDash(dashPattern);
  63195. }
  63196. // ctx.setLineDash(dashPattern);
  63197. ctx.moveTo(x1, y1);
  63198. ctx.lineTo(x2, y2);
  63199. return;
  63200. }
  63201. var dx = x2 - x1;
  63202. var dy = y2 - y1;
  63203. var numDashes = Math.floor(
  63204. Math.sqrt(dx * dx + dy * dy) / dashLength
  63205. );
  63206. dx = dx / numDashes;
  63207. dy = dy / numDashes;
  63208. var flag = true;
  63209. for (var i = 0; i < numDashes; ++i) {
  63210. if (flag) {
  63211. ctx.moveTo(x1, y1);
  63212. } else {
  63213. ctx.lineTo(x1, y1);
  63214. }
  63215. flag = !flag;
  63216. x1 += dx;
  63217. y1 += dy;
  63218. }
  63219. ctx.lineTo(x2, y2);
  63220. }
  63221. }
  63222. // 把所有工具对象放到全局静态变量上,以便直接调用工具方法,
  63223. // 避免使用工具时频繁的创建工具对象带来的性能消耗。
  63224. SUtil_SUtil.Util_area = new Area();
  63225. SUtil_SUtil.Util_color = new Color();
  63226. SUtil_SUtil.Util_computeBoundingBox = new ComputeBoundingBox();
  63227. SUtil_SUtil.Util_curve = new Curve_Curve();
  63228. SUtil_SUtil.Util_env = new Env();
  63229. SUtil_SUtil.Util_event = new Event_Event();
  63230. SUtil_SUtil.Util_http = new Http();
  63231. SUtil_SUtil.Util_log = new Log();
  63232. SUtil_SUtil.Util_math = new MathTool();
  63233. SUtil_SUtil.Util_matrix = new Matrix();
  63234. SUtil_SUtil.Util = new levelRenderer_Util_Util();
  63235. SUtil_SUtil.Util_vector = new levelRenderer_Vector_Vector();
  63236. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Transformable.js
  63237. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63238. * This program are made available under the terms of the Apache License, Version 2.0
  63239. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63240. /**
  63241. * @private
  63242. * @class LevelRenderer.Transformable
  63243. * @category Visualization Theme
  63244. * @classdesc 可变换超类,所有支持 Canvas Transform 变换操作的类均是此类的子类。此类不可实例化。
  63245. */
  63246. class Transformable {
  63247. constructor() {
  63248. /**
  63249. * @member {Array.<number>} LevelRenderer.Transformable.prototype.position
  63250. * @description 平移,默认值:[0, 0]。
  63251. */
  63252. this.position = [0, 0];
  63253. /**
  63254. * @member {Array.<number>} LevelRenderer.Transformable.prototype.rotation
  63255. * @description 旋转,可以通过数组二三项指定旋转的原点,默认值:[0, 0, 0]。
  63256. */
  63257. this.rotation = [0, 0, 0];
  63258. /**
  63259. * @member {Array.<number>} LevelRenderer.Transformable.prototype.scale
  63260. * @description 缩放,可以通过数组三四项指定缩放的原点,默认值:[1, 1, 0, 0]。
  63261. */
  63262. this.scale = [1, 1, 0, 0];
  63263. /**
  63264. * @member {boolean} LevelRenderer.Transformable.prototype.needLocalTransform
  63265. * @description 是否变换。默认值:false。
  63266. */
  63267. this.needLocalTransform = false;
  63268. /**
  63269. * @member {boolean} LevelRenderer.Transformable.prototype.needTransform
  63270. * @description 是否有坐标变换。默认值:false。
  63271. */
  63272. this.needTransform = false;
  63273. this.CLASS_NAME = "SuperMap.LevelRenderer.Transformable";
  63274. /**
  63275. * @function LevelRenderer.Transformable.prototype.lookAt
  63276. * @description 设置图形的朝向。
  63277. */
  63278. this.lookAt = (function () {
  63279. var v = SUtil_SUtil.Util_vector.create();
  63280. // {Array.<Number>|Float32Array} target
  63281. return function (target) {
  63282. if (!this.transform) {
  63283. this.transform = SUtil_SUtil.Util_matrix.create();
  63284. }
  63285. var m = this.transform;
  63286. SUtil_SUtil.Util_vector.sub(v, target, this.position);
  63287. if (isAroundZero(v[0]) && isAroundZero(v[1])) {
  63288. return;
  63289. }
  63290. SUtil_SUtil.Util_vector.normalize(v, v);
  63291. // Y Axis
  63292. // TODO Scale origin ?
  63293. m[2] = v[0] * this.scale[1];
  63294. m[3] = v[1] * this.scale[1];
  63295. // X Axis
  63296. m[0] = v[1] * this.scale[0];
  63297. m[1] = -v[0] * this.scale[0];
  63298. // Position
  63299. m[4] = this.position[0];
  63300. m[5] = this.position[1];
  63301. this.decomposeTransform();
  63302. function isAroundZero(val) {
  63303. var EPSILON = 5e-5;
  63304. return val > -EPSILON && val < EPSILON;
  63305. }
  63306. };
  63307. })();
  63308. }
  63309. /**
  63310. * @function LevelRenderer.Transformable.prototype.destroy
  63311. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  63312. */
  63313. destroy() {
  63314. this.position = null;
  63315. this.rotation = null;
  63316. this.scale = null;
  63317. this.needLocalTransform = null;
  63318. this.needTransform = null;
  63319. }
  63320. /**
  63321. * @function LevelRenderer.Transformable.prototype.updateNeedTransform
  63322. * @description 更新 needLocalTransform
  63323. */
  63324. updateNeedTransform() {
  63325. this.needLocalTransform = isNotAroundZero(this.rotation[0])
  63326. || isNotAroundZero(this.position[0])
  63327. || isNotAroundZero(this.position[1])
  63328. || isNotAroundZero(this.scale[0] - 1)
  63329. || isNotAroundZero(this.scale[1] - 1);
  63330. function isNotAroundZero(val) {
  63331. var EPSILON = 5e-5;
  63332. return val > EPSILON || val < -EPSILON;
  63333. }
  63334. }
  63335. /**
  63336. * @function LevelRenderer.Transformable.prototype.updateTransform
  63337. * @description 判断是否需要有坐标变换,更新 needTransform 属性。如果有坐标变换,则从 position, rotation, scale 以及父节点的 transform 计算出自身的 transform 矩阵。
  63338. */
  63339. updateTransform() {
  63340. this.updateNeedTransform();
  63341. if (this.parent) {
  63342. this.needTransform = this.needLocalTransform || this.parent.needTransform;
  63343. } else {
  63344. this.needTransform = this.needLocalTransform;
  63345. }
  63346. if (!this.needTransform) {
  63347. return;
  63348. }
  63349. var origin = [0, 0];
  63350. var m = this.transform || SUtil_SUtil.Util_matrix.create();
  63351. SUtil_SUtil.Util_matrix.identity(m);
  63352. if (this.needLocalTransform) {
  63353. if (
  63354. isNotAroundZero(this.scale[0])
  63355. || isNotAroundZero(this.scale[1])
  63356. ) {
  63357. origin[0] = -this.scale[2] || 0;
  63358. origin[1] = -this.scale[3] || 0;
  63359. let haveOrigin = isNotAroundZero(origin[0])
  63360. || isNotAroundZero(origin[1]);
  63361. if (haveOrigin) {
  63362. SUtil_SUtil.Util_matrix.translate(
  63363. m, m, origin
  63364. );
  63365. }
  63366. SUtil_SUtil.Util_matrix.scale(m, m, this.scale);
  63367. if (haveOrigin) {
  63368. origin[0] = -origin[0];
  63369. origin[1] = -origin[1];
  63370. SUtil_SUtil.Util_matrix.translate(
  63371. m, m, origin
  63372. );
  63373. }
  63374. }
  63375. if (this.rotation instanceof Array) {
  63376. if (this.rotation[0] !== 0) {
  63377. origin[0] = -this.rotation[1] || 0;
  63378. origin[1] = -this.rotation[2] || 0;
  63379. let haveOrigin = isNotAroundZero(origin[0])
  63380. || isNotAroundZero(origin[1]);
  63381. if (haveOrigin) {
  63382. SUtil_SUtil.Util_matrix.translate(
  63383. m, m, origin
  63384. );
  63385. }
  63386. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation[0]);
  63387. if (haveOrigin) {
  63388. origin[0] = -origin[0];
  63389. origin[1] = -origin[1];
  63390. SUtil_SUtil.Util_matrix.translate(
  63391. m, m, origin
  63392. );
  63393. }
  63394. }
  63395. } else {
  63396. if (+this.rotation !== 0) {
  63397. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation);
  63398. }
  63399. }
  63400. if (
  63401. isNotAroundZero(this.position[0]) || isNotAroundZero(this.position[1])
  63402. ) {
  63403. SUtil_SUtil.Util_matrix.translate(m, m, this.position);
  63404. }
  63405. }
  63406. // 保存这个变换矩阵
  63407. this.transform = m;
  63408. // 应用父节点变换
  63409. if (this.parent && this.parent.needTransform) {
  63410. if (this.needLocalTransform) {
  63411. SUtil_SUtil.Util_matrix.mul(this.transform, this.parent.transform, this.transform);
  63412. } else {
  63413. SUtil_SUtil.Util_matrix.copy(this.transform, this.parent.transform);
  63414. }
  63415. }
  63416. function isNotAroundZero(val) {
  63417. var EPSILON = 5e-5;
  63418. return val > EPSILON || val < -EPSILON;
  63419. }
  63420. }
  63421. /**
  63422. * @function LevelRenderer.Transformable.prototype.setTransform
  63423. * @description 将自己的 transform 应用到 context 上。
  63424. *
  63425. * @param {Context2D} ctx - Context2D 上下文。
  63426. */
  63427. setTransform(ctx) {
  63428. if (this.needTransform) {
  63429. var m = this.transform;
  63430. ctx.transform(
  63431. m[0], m[1],
  63432. m[2], m[3],
  63433. m[4], m[5]
  63434. );
  63435. }
  63436. }
  63437. /**
  63438. * @function LevelRenderer.Transformable.prototype.decomposeTransform
  63439. * @description 分解`transform`矩阵到`position`, `rotation`, `scale` 。
  63440. */
  63441. decomposeTransform() {
  63442. if (!this.transform) {
  63443. return;
  63444. }
  63445. var m = this.transform;
  63446. var sx = m[0] * m[0] + m[1] * m[1];
  63447. var position = this.position;
  63448. var scale = this.scale;
  63449. var rotation = this.rotation;
  63450. if (isNotAroundZero(sx - 1)) {
  63451. sx = Math.sqrt(sx);
  63452. }
  63453. var sy = m[2] * m[2] + m[3] * m[3];
  63454. if (isNotAroundZero(sy - 1)) {
  63455. sy = Math.sqrt(sy);
  63456. }
  63457. position[0] = m[4];
  63458. position[1] = m[5];
  63459. scale[0] = sx;
  63460. scale[1] = sy;
  63461. scale[2] = scale[3] = 0;
  63462. rotation[0] = Math.atan2(-m[1] / sy, m[0] / sx);
  63463. rotation[1] = rotation[2] = 0;
  63464. function isNotAroundZero(val) {
  63465. var EPSILON = 5e-5;
  63466. return val > EPSILON || val < -EPSILON;
  63467. }
  63468. }
  63469. }
  63470. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Shape.js
  63471. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  63472. * This program are made available under the terms of the Apache License, Version 2.0
  63473. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63474. /**
  63475. * @private
  63476. * @class LevelRenderer.Shape
  63477. * @category Visualization Theme
  63478. * @classdesc 图形(shape)基类。
  63479. * @extends LevelRenderer.Eventful
  63480. * @extends LevelRenderer.Transformable
  63481. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  63482. */
  63483. class Shape_Shape extends mixinExt(Eventful, Transformable) {
  63484. constructor(options) {
  63485. super(options);
  63486. options = options || {};
  63487. /**
  63488. * @member {string} LevelRenderer.Shape.prototype.id
  63489. * @description 唯一标识。
  63490. */
  63491. this.id = null;
  63492. /**
  63493. * @member {Object} LevelRenderer.Shape.prototype.style
  63494. * @description 基础绘制样式。
  63495. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  63496. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  63497. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  63498. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  63499. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  63500. * @param {number} style.opacity - 绘制透明度。默认值:1。
  63501. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  63502. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  63503. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  63504. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  63505. * @param {string} style.text - 图形中的附加文本。默认值:""。
  63506. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  63507. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  63508. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  63509. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  63510. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  63511. *
  63512. */
  63513. this.style = {};
  63514. /**
  63515. * @member {Object} LevelRenderer.Shape.prototype.style.__rect
  63516. * @description 包围图形的最小矩形盒子。
  63517. *
  63518. * @param {number} x - 左上角顶点x轴坐标。
  63519. * @param {number} y - 左上角顶点y轴坐标。
  63520. * @param {number} width - 包围盒矩形宽度。
  63521. * @param {number} height - 包围盒矩形高度。
  63522. */
  63523. /**
  63524. * @member {Object} LevelRenderer.Shape.prototype.highlightStyle
  63525. * @description 高亮样式。
  63526. *
  63527. * @param {string} highlightStyle.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  63528. * @param {string} highlightStyle.color - 填充颜色。默认值:"#000000'"。
  63529. * @param {string} highlightStyle.strokeColor - 描边颜色。默认值:"#000000'"。
  63530. * @param {string} highlightStyle.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  63531. * @param {number} highlightStyle.lineWidth - 描边宽度。默认值:1。
  63532. * @param {number} highlightStyle.opacity - 绘制透明度。默认值:1。
  63533. * @param {number} highlightStyle.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  63534. * @param {number} highlightStyle.shadowColor - 阴影颜色。默认值:"#000000'"。
  63535. * @param {number} highlightStyle.shadowOffsetX - 阴影横向偏移。默认值:0。
  63536. * @param {number} highlightStyle.shadowOffsetY - 阴影纵向偏移。默认值:0。
  63537. * @param {string} highlightStyle.text - 图形中的附加文本。默认值:""。
  63538. * @param {string} highlightStyle.textColor - 文本颜色。默认值:"#000000'"。
  63539. * @param {string} highlightStyle.textFont - 附加文本样式。示例:'bold 18px verdana'。
  63540. * @param {string} highlightStyle.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  63541. * @param {string} highlightStyle.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  63542. * @param {string} highlightStyle.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  63543. */
  63544. this.highlightStyle = null;
  63545. /**
  63546. * @member {Object} LevelRenderer.Shape.prototype.parent
  63547. * @description 父节点,只读属性。<LevelRenderer.Group>
  63548. */
  63549. this.parent = null;
  63550. /**
  63551. * @member {boolean} LevelRenderer.Shape.prototype.__dirty
  63552. * @description {boolean}
  63553. */
  63554. this.__dirty = true;
  63555. /**
  63556. * @member {Array} LevelRenderer.Shape.prototype.__clipShapes
  63557. * @description {Array}
  63558. *
  63559. */
  63560. this.__clipShapes = [];
  63561. /**
  63562. * @member {boolean} LevelRenderer.Shape.prototype.invisible
  63563. * @description 图形是否可见,为 true 时不绘制图形,但是仍能触发鼠标事件。默认值:false。
  63564. */
  63565. this.invisible = false;
  63566. /**
  63567. * @member {boolean} LevelRenderer.Shape.prototype.ignore
  63568. * @description 图形是否忽略,为 true 时忽略图形的绘制以及事件触发。默认值:false。
  63569. */
  63570. this.ignore = false;
  63571. /**
  63572. * @member {boolean} LevelRenderer.Shape.prototype.zlevel
  63573. * @description z 层 level,决定绘画在哪层 canvas 中。默认值:0。
  63574. */
  63575. this.zlevel = 0;
  63576. /**
  63577. * @member {boolean} LevelRenderer.Shape.prototype.draggable
  63578. * @description 是否可拖拽。默认值:false。
  63579. */
  63580. this.draggable = false;
  63581. /**
  63582. * @member {boolean} LevelRenderer.Shape.prototype.clickable
  63583. * @description 是否可点击。默认值:false。
  63584. */
  63585. this.clickable = false;
  63586. /**
  63587. * @member {boolean} LevelRenderer.Shape.prototype.hoverable
  63588. * @description 是否可以 hover。默认值:true。
  63589. */
  63590. this.hoverable = true;
  63591. /**
  63592. * @member {number} LevelRenderer.Shape.prototype.z
  63593. * @description z值,跟zlevel一样影响shape绘制的前后顺序,z值大的shape会覆盖在z值小的上面,但是并不会创建新的canvas,所以优先级低于zlevel,而且频繁改动的开销比zlevel小很多。默认值:0。
  63594. */
  63595. this.z = 0;
  63596. //地理扩展
  63597. /**
  63598. * @member {Array.<number>} LevelRenderer.Shape.prototype.refOriginalPosition
  63599. * @description 图形参考原点位置,图形的参考中心位置。
  63600. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  63601. *
  63602. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  63603. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  63604. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  63605. *
  63606. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  63607. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  63608. * refOriginalPosition 的值为 [0, 0] 时,形的位置信息才是 canvas 绝对位置。
  63609. *
  63610. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  63611. *
  63612. * refOriginalPosition。默认值是: [0, 0]。
  63613. */
  63614. this.refOriginalPosition = [0, 0];
  63615. /**
  63616. * @member {string} LevelRenderer.Shape.prototype.refDataID
  63617. * @description 图形所关联数据的 ID。
  63618. *
  63619. */
  63620. this.refDataID = null;
  63621. /**
  63622. * @member {boolean} LevelRenderer.Shape.prototype.isHoverByRefDataID
  63623. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  63624. *
  63625. */
  63626. this.isHoverByRefDataID = false;
  63627. /**
  63628. * @member {string} LevelRenderer.Shape.prototype.refDataHoverGroup
  63629. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  63630. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  63631. *
  63632. */
  63633. this.refDataHoverGroup = null;
  63634. /**
  63635. * @member {Object} LevelRenderer.Shape.prototype.dataInfo
  63636. * @description 图形的数据信息。
  63637. *
  63638. */
  63639. this.dataInfo = null;
  63640. Util_Util.extend(this, options);
  63641. this.id = this.id || Util_Util.createUniqueID("smShape_");
  63642. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape";
  63643. /**
  63644. * @function LevelRenderer.Shape.prototype.getTansform
  63645. * @description 变换鼠标位置到 shape 的局部坐标空间
  63646. *
  63647. */
  63648. this.getTansform = (function () {
  63649. var invTransform = [];
  63650. return function (x, y) {
  63651. var originPos = [x, y];
  63652. // 对鼠标的坐标也做相同的变换
  63653. if (this.needTransform && this.transform) {
  63654. SUtil_SUtil.Util_matrix.invert(invTransform, this.transform);
  63655. SUtil_SUtil.Util_matrix.mulVector(originPos, invTransform, [x, y, 1]);
  63656. if (x == originPos[0] && y == originPos[1]) {
  63657. // 避免外部修改导致的 needTransform 不准确
  63658. this.updateNeedTransform();
  63659. }
  63660. }
  63661. return originPos;
  63662. };
  63663. })();
  63664. }
  63665. /**
  63666. * @function LevelRenderer.Shape.prototype.destroy
  63667. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  63668. */
  63669. destroy() {
  63670. this.id = null;
  63671. this.style = null;
  63672. this.highlightStyle = null;
  63673. this.parent = null;
  63674. this.__dirty = null;
  63675. this.__clipShapes = null;
  63676. this.invisible = null;
  63677. this.ignore = null;
  63678. this.zlevel = null;
  63679. this.draggable = null;
  63680. this.clickable = null;
  63681. this.hoverable = null;
  63682. this.z = null;
  63683. this.refOriginalPosition = null;
  63684. this.refDataID = null;
  63685. this.refDataHoverGroup = null;
  63686. this.isHoverByRefDataID = null;
  63687. this.dataInfo = null;
  63688. super.destroy();
  63689. }
  63690. /**
  63691. * @function LevelRenderer.Shape.prototype.brush
  63692. * @description 绘制图形。
  63693. *
  63694. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63695. * @param {boolean} isHighlight - 是否使用高亮属性。
  63696. * @param {function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
  63697. */
  63698. brush(ctx, isHighlight) {
  63699. var style = this.beforeBrush(ctx, isHighlight);
  63700. ctx.beginPath();
  63701. this.buildPath(ctx, style);
  63702. switch (style.brushType) {
  63703. /* jshint ignore:start */
  63704. case 'both':
  63705. this.setCtxGlobalAlpha(ctx, "fill", style);
  63706. ctx.fill();
  63707. if (style.lineWidth > 0) {
  63708. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63709. ctx.stroke();
  63710. }
  63711. this.setCtxGlobalAlpha(ctx, "reset", style);
  63712. break;
  63713. case 'stroke':
  63714. this.setCtxGlobalAlpha(ctx, "stroke", style);
  63715. style.lineWidth > 0 && ctx.stroke();
  63716. this.setCtxGlobalAlpha(ctx, "reset", style);
  63717. break;
  63718. /* jshint ignore:end */
  63719. default:
  63720. this.setCtxGlobalAlpha(ctx, "fill", style);
  63721. ctx.fill();
  63722. this.setCtxGlobalAlpha(ctx, "reset", style);
  63723. break;
  63724. }
  63725. this.drawText(ctx, style, this.style);
  63726. this.afterBrush(ctx);
  63727. }
  63728. /**
  63729. * @function LevelRenderer.Shape.prototype.beforeBrush
  63730. * @description 具体绘制操作前的一些公共操作。
  63731. *
  63732. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63733. * @param {boolean} isHighlight - 是否使用高亮属性。
  63734. * @return {Object} 处理后的样式。
  63735. */
  63736. beforeBrush(ctx, isHighlight) {
  63737. var style = this.style;
  63738. if (this.brushTypeOnly) {
  63739. style.brushType = this.brushTypeOnly;
  63740. }
  63741. if (isHighlight) {
  63742. // 根据style扩展默认高亮样式
  63743. style = this.getHighlightStyle(
  63744. style,
  63745. this.highlightStyle || {},
  63746. this.brushTypeOnly
  63747. );
  63748. }
  63749. if (this.brushTypeOnly == 'stroke') {
  63750. style.strokeColor = style.strokeColor || style.color;
  63751. }
  63752. ctx.save();
  63753. this.doClip(ctx);
  63754. this.setContext(ctx, style);
  63755. // 设置transform
  63756. this.setTransform(ctx);
  63757. return style;
  63758. }
  63759. /**
  63760. * @function LevelRenderer.Shape.prototype.afterBrush
  63761. * @description 绘制后的处理。
  63762. *
  63763. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63764. *
  63765. */
  63766. afterBrush(ctx) {
  63767. ctx.restore();
  63768. }
  63769. /**
  63770. * @function LevelRenderer.Shape.prototype.setContext
  63771. * @description 设置 fillStyle, strokeStyle, shadow 等通用绘制样式。
  63772. *
  63773. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63774. * @param {Object} style - 样式。
  63775. *
  63776. */
  63777. setContext(ctx, style) {
  63778. var STYLE_CTX_MAP = [
  63779. ['color', 'fillStyle'],
  63780. ['strokeColor', 'strokeStyle'],
  63781. ['opacity', 'globalAlpha'],
  63782. ['lineCap', 'lineCap'],
  63783. ['lineJoin', 'lineJoin'],
  63784. ['miterLimit', 'miterLimit'],
  63785. ['lineWidth', 'lineWidth'],
  63786. ['shadowBlur', 'shadowBlur'],
  63787. ['shadowColor', 'shadowColor'],
  63788. ['shadowOffsetX', 'shadowOffsetX'],
  63789. ['shadowOffsetY', 'shadowOffsetY']
  63790. ];
  63791. for (var i = 0, len = STYLE_CTX_MAP.length; i < len; i++) {
  63792. var styleProp = STYLE_CTX_MAP[i][0];
  63793. var styleValue = style[styleProp];
  63794. var ctxProp = STYLE_CTX_MAP[i][1];
  63795. if (typeof styleValue != 'undefined') {
  63796. ctx[ctxProp] = styleValue;
  63797. }
  63798. }
  63799. }
  63800. /**
  63801. * @function LevelRenderer.Shape.prototype.doClip
  63802. *
  63803. */
  63804. doClip(ctx) {
  63805. var clipShapeInvTransform = SUtil_SUtil.Util_matrix.create();
  63806. if (this.__clipShapes) {
  63807. for (var i = 0; i < this.__clipShapes.length; i++) {
  63808. var clipShape = this.__clipShapes[i];
  63809. if (clipShape.needTransform) {
  63810. let m = clipShape.transform;
  63811. SUtil_SUtil.Util_matrix.invert(clipShapeInvTransform, m);
  63812. ctx.transform(
  63813. m[0], m[1],
  63814. m[2], m[3],
  63815. m[4], m[5]
  63816. );
  63817. }
  63818. ctx.beginPath();
  63819. clipShape.buildPath(ctx, clipShape.style);
  63820. ctx.clip();
  63821. // Transform back
  63822. if (clipShape.needTransform) {
  63823. let m = clipShapeInvTransform;
  63824. ctx.transform(
  63825. m[0], m[1],
  63826. m[2], m[3],
  63827. m[4], m[5]
  63828. );
  63829. }
  63830. }
  63831. }
  63832. }
  63833. /**
  63834. * @function LevelRenderer.Shape.prototype.getHighlightStyle
  63835. * @description 根据默认样式扩展高亮样式
  63836. *
  63837. * @param {Object} style - 样式。
  63838. * @param {Object} highlightStyle - 高亮样式。
  63839. * @param {string} brushTypeOnly - brushTypeOnly。
  63840. *
  63841. */
  63842. getHighlightStyle(style, highlightStyle, brushTypeOnly) {
  63843. var newStyle = {};
  63844. for (let k in style) {
  63845. newStyle[k] = style[k];
  63846. }
  63847. var highlightColor = SUtil_SUtil.Util_color.getHighlightColor();
  63848. // 根据highlightStyle扩展
  63849. if (style.brushType != 'stroke') {
  63850. // 带填充则用高亮色加粗边线
  63851. newStyle.strokeColor = highlightColor;
  63852. // SMIC-方法修改 - start
  63853. newStyle.lineWidth = (style.lineWidth || 1);
  63854. // 原始代码
  63855. // newStyle.lineWidth = (style.lineWidth || 1)
  63856. // + this.getHighlightZoom();
  63857. // 修改代码1
  63858. // if(!style.lineType || style.lineType === "solid"){
  63859. // newStyle.lineWidth = (style.lineWidth || 1)
  63860. // + this.getHighlightZoom();
  63861. // }
  63862. // else{
  63863. // newStyle.lineWidth = (style.lineWidth || 1);
  63864. // }
  63865. // SMIC-方法修改 - end
  63866. newStyle.brushType = 'both';
  63867. } else {
  63868. if (brushTypeOnly != 'stroke') {
  63869. // 描边型的则用原色加工高亮
  63870. newStyle.strokeColor = highlightColor;
  63871. // SMIC-方法修改 - start
  63872. newStyle.lineWidth = (style.lineWidth || 1);
  63873. // 原始代码
  63874. // newStyle.lineWidth = (style.lineWidth || 1)
  63875. // + this.getHighlightZoom();
  63876. // 修改代码1
  63877. // if(!style.lineType || style.lineType === "solid"){
  63878. // newStyle.lineWidth = (style.lineWidth || 1)
  63879. // + this.getHighlightZoom();
  63880. // }
  63881. // else{
  63882. // newStyle.lineWidth = (style.lineWidth || 1);
  63883. // }
  63884. // SMIC-方法修改 - end
  63885. } else {
  63886. // 线型的则用原色加工高亮
  63887. newStyle.strokeColor = highlightStyle.strokeColor
  63888. || SUtil_SUtil.Util_color.mix(
  63889. style.strokeColor,
  63890. SUtil_SUtil.Util_color.toRGB(highlightColor)
  63891. );
  63892. }
  63893. }
  63894. // 可自定义覆盖默认值
  63895. for (let k in highlightStyle) {
  63896. if (typeof highlightStyle[k] != 'undefined') {
  63897. newStyle[k] = highlightStyle[k];
  63898. }
  63899. }
  63900. return newStyle;
  63901. }
  63902. /**
  63903. * @function LevelRenderer.Shape.prototype.getHighlightZoom
  63904. * @description 高亮放大效果参数,当前统一设置为6,如有需要差异设置,通过 this.type 判断实例类型
  63905. *
  63906. */
  63907. getHighlightZoom() {
  63908. return this.type != 'text' ? 6 : 2;
  63909. }
  63910. /**
  63911. * @function LevelRenderer.Shape.prototype.drift
  63912. * @description 移动位置
  63913. *
  63914. * @param {Object} dx - 横坐标变化。
  63915. * @param {Object} dy - 纵坐标变化。
  63916. *
  63917. */
  63918. drift(dx, dy) {
  63919. this.position[0] += dx;
  63920. this.position[1] += dy;
  63921. }
  63922. /**
  63923. * @function LevelRenderer.Shape.prototype.buildPath
  63924. * @description 构建绘制的Path。子类必须重新实现此方法。
  63925. *
  63926. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63927. * @param {Object} style - 样式。
  63928. */
  63929. buildPath(ctx, style) { // eslint-disable-line no-unused-vars
  63930. SUtil_SUtil.Util_log('buildPath not implemented in ' + this.type);
  63931. }
  63932. /**
  63933. * @function LevelRenderer.Shape.prototype.getRect
  63934. * @description 计算返回包围盒矩形。子类必须重新实现此方法。
  63935. *
  63936. * @param {Object} style - 样式。
  63937. */
  63938. getRect(style) { // eslint-disable-line no-unused-vars
  63939. SUtil_SUtil.Util_log('getRect not implemented in ' + this.type);
  63940. }
  63941. /**
  63942. * @function LevelRenderer.Shape.prototype.isCover
  63943. * @description 判断鼠标位置是否在图形内。
  63944. *
  63945. * @param {number} x - x。
  63946. * @param {number} y - y。
  63947. */
  63948. isCover(x, y) {
  63949. var originPos = this.getTansform(x, y);
  63950. x = originPos[0];
  63951. y = originPos[1];
  63952. // 快速预判并保留判断矩形
  63953. var rect = this.style.__rect;
  63954. if (!rect) {
  63955. rect = this.style.__rect = this.getRect(this.style);
  63956. }
  63957. if (x >= rect.x
  63958. && x <= (rect.x + rect.width)
  63959. && y >= rect.y
  63960. && y <= (rect.y + rect.height)
  63961. ) {
  63962. // 矩形内
  63963. return SUtil_SUtil.Util_area.isInside(this, this.style, x, y);
  63964. }
  63965. return false;
  63966. }
  63967. /**
  63968. * @function LevelRenderer.Shape.prototype.drawText
  63969. * @description 绘制附加文本。
  63970. *
  63971. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  63972. * @param {string} style - 样式。
  63973. * @param {string} normalStyle - normalStyle 默认样式,用于定位文字显示。
  63974. */
  63975. drawText(ctx, style, normalStyle) {
  63976. if (typeof(style.text) == 'undefined' || style.text === false) {
  63977. return;
  63978. }
  63979. // 字体颜色策略
  63980. var textColor = style.textColor || style.color || style.strokeColor;
  63981. ctx.fillStyle = textColor;
  63982. // 文本与图形间空白间隙
  63983. var dd = 10;
  63984. var al; // 文本水平对齐
  63985. var bl; // 文本垂直对齐
  63986. var tx; // 文本横坐标
  63987. var ty; // 文本纵坐标
  63988. var textPosition = style.textPosition // 用户定义
  63989. || this.textPosition // shape默认
  63990. || 'top'; // 全局默认
  63991. // Smic 方法修改 -start
  63992. var __OP = [];
  63993. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  63994. __OP = [0, 0];
  63995. } else {
  63996. __OP = this.refOriginalPosition;
  63997. }
  63998. //原代码:
  63999. // Smic 方法修改 -end
  64000. switch (textPosition) {
  64001. case 'inside':
  64002. case 'top':
  64003. case 'bottom':
  64004. case 'left':
  64005. case 'right':
  64006. if (this.getRect) {
  64007. var rect = (normalStyle || style).__rect
  64008. || this.getRect(normalStyle || style);
  64009. switch (textPosition) {
  64010. case 'inside':
  64011. tx = rect.x + rect.width / 2;
  64012. ty = rect.y + rect.height / 2;
  64013. al = 'center';
  64014. bl = 'middle';
  64015. if (style.brushType != 'stroke'
  64016. && textColor == style.color
  64017. ) {
  64018. ctx.fillStyle = '#fff';
  64019. }
  64020. break;
  64021. case 'left':
  64022. tx = rect.x - dd;
  64023. ty = rect.y + rect.height / 2;
  64024. al = 'end';
  64025. bl = 'middle';
  64026. break;
  64027. case 'right':
  64028. tx = rect.x + rect.width + dd;
  64029. ty = rect.y + rect.height / 2;
  64030. al = 'start';
  64031. bl = 'middle';
  64032. break;
  64033. case 'top':
  64034. tx = rect.x + rect.width / 2;
  64035. ty = rect.y - dd;
  64036. al = 'center';
  64037. bl = 'bottom';
  64038. break;
  64039. case 'bottom':
  64040. tx = rect.x + rect.width / 2;
  64041. ty = rect.y + rect.height + dd;
  64042. al = 'center';
  64043. bl = 'top';
  64044. break;
  64045. }
  64046. }
  64047. break;
  64048. case 'start':
  64049. case 'end':
  64050. var xStart = 0;
  64051. var xEnd = 0;
  64052. var yStart = 0;
  64053. var yEnd = 0;
  64054. if (typeof style.pointList != 'undefined') {
  64055. var pointList = style.pointList;
  64056. if (pointList.length < 2) {
  64057. // 少于2个点就不画了~
  64058. return;
  64059. }
  64060. var length = pointList.length;
  64061. switch (textPosition) {
  64062. // Smic 方法修改 -start
  64063. case 'start':
  64064. xStart = pointList[0][0] + __OP[0];
  64065. xEnd = pointList[1][0] + __OP[0];
  64066. yStart = pointList[0][1] + __OP[1];
  64067. yEnd = pointList[1][1] + __OP[1];
  64068. break;
  64069. case 'end':
  64070. xStart = pointList[length - 2][0] + __OP[0];
  64071. xEnd = pointList[length - 1][0] + __OP[0];
  64072. yStart = pointList[length - 2][1] + __OP[1];
  64073. yEnd = pointList[length - 1][1] + __OP[1];
  64074. break;
  64075. //原代码:
  64076. /*
  64077. case 'start':
  64078. xStart = pointList[0][0];
  64079. xEnd = pointList[1][0];
  64080. yStart = pointList[0][1];
  64081. yEnd = pointList[1][1];
  64082. break;
  64083. case 'end':
  64084. xStart = pointList[length - 2][0];
  64085. xEnd = pointList[length - 1][0];
  64086. yStart = pointList[length - 2][1];
  64087. yEnd = pointList[length - 1][1];
  64088. break;
  64089. */
  64090. // Smic 方法修改 -end
  64091. }
  64092. } else {
  64093. // Smic 方法修改 -start
  64094. xStart = (style.xStart + __OP[0]) || 0;
  64095. xEnd = (style.xEnd + __OP[0]) || 0;
  64096. yStart = (style.yStart + __OP[1]) || 0;
  64097. yEnd = (style.yEnd + __OP[1]) || 0;
  64098. //原代码:
  64099. /*
  64100. xStart = style.xStart || 0;
  64101. xEnd = style.xEnd || 0;
  64102. yStart = style.yStart || 0;
  64103. yEnd = style.yEnd || 0;
  64104. */
  64105. // Smic 方法修改 -end
  64106. }
  64107. switch (textPosition) {
  64108. case 'start':
  64109. al = xStart < xEnd ? 'end' : 'start';
  64110. bl = yStart < yEnd ? 'bottom' : 'top';
  64111. tx = xStart;
  64112. ty = yStart;
  64113. break;
  64114. case 'end':
  64115. al = xStart < xEnd ? 'start' : 'end';
  64116. bl = yStart < yEnd ? 'top' : 'bottom';
  64117. tx = xEnd;
  64118. ty = yEnd;
  64119. break;
  64120. }
  64121. dd -= 4;
  64122. if (xStart && xEnd && xStart != xEnd) {
  64123. tx -= (al == 'end' ? dd : -dd);
  64124. } else {
  64125. al = 'center';
  64126. }
  64127. if (yStart != yEnd) {
  64128. ty -= (bl == 'bottom' ? dd : -dd);
  64129. } else {
  64130. bl = 'middle';
  64131. }
  64132. break;
  64133. case 'specific':
  64134. tx = style.textX || 0;
  64135. ty = style.textY || 0;
  64136. al = 'start';
  64137. bl = 'middle';
  64138. break;
  64139. }
  64140. // Smic 方法修改 -start
  64141. if (style.labelXOffset && !isNaN(style.labelXOffset)) {
  64142. tx += style.labelXOffset;
  64143. }
  64144. if (style.labelYOffset && !isNaN(style.labelYOffset)) {
  64145. ty += style.labelYOffset;
  64146. }
  64147. //原代码:
  64148. // Smic 方法修改 -end
  64149. if (tx != null && ty != null) {
  64150. Shape_Shape._fillText(
  64151. ctx,
  64152. style.text,
  64153. tx, ty,
  64154. style.textFont,
  64155. style.textAlign || al,
  64156. style.textBaseline || bl
  64157. );
  64158. }
  64159. }
  64160. /**
  64161. * @function LevelRenderer.Shape.prototype.modSelf
  64162. * @description 图形发生改变
  64163. */
  64164. modSelf() {
  64165. this.__dirty = true;
  64166. if (this.style) {
  64167. this.style.__rect = null;
  64168. }
  64169. if (this.highlightStyle) {
  64170. this.highlightStyle.__rect = null;
  64171. }
  64172. }
  64173. /**
  64174. * @function LevelRenderer.Shape.prototype.isSilent
  64175. * @description 图形是否会触发事件,通过 bind 绑定的事件
  64176. */
  64177. isSilent() {
  64178. return !(
  64179. this.hoverable || this.draggable || this.clickable
  64180. || this.onmousemove || this.onmouseover || this.onmouseout
  64181. || this.onmousedown || this.onmouseup || this.onclick
  64182. || this.ondragenter || this.ondragover || this.ondragleave
  64183. || this.ondrop
  64184. );
  64185. }
  64186. /**
  64187. * @function LevelRenderer.Shape.prototype.setCtxGlobalAlpha
  64188. * @description 设置 Cavans 上下文全局透明度
  64189. *
  64190. * @param {Object} _ctx - Cavans 上下文
  64191. * @param {string} type - one of 'stroke', 'fill', or 'reset'
  64192. * @param {Object} style - Symbolizer hash
  64193. */
  64194. setCtxGlobalAlpha(_ctx, type, style) {
  64195. if (type === "fill") {
  64196. _ctx.globalAlpha = typeof(style["fillOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['fillOpacity'];
  64197. } else if (type === "stroke") {
  64198. _ctx.globalAlpha = typeof(style["strokeOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['strokeOpacity'];
  64199. } else {
  64200. _ctx.globalAlpha = typeof(style["opacity"]) === "undefined" ? 1 : style['opacity'];
  64201. }
  64202. }
  64203. /**
  64204. * @function LevelRenderer.Shape.prototype._fillText
  64205. * @description 填充文本
  64206. */
  64207. static _fillText(ctx, text, x, y, textFont, textAlign, textBaseline) {
  64208. if (textFont) {
  64209. ctx.font = textFont;
  64210. }
  64211. ctx.textAlign = textAlign;
  64212. ctx.textBaseline = textBaseline;
  64213. var rect = Shape_Shape._getTextRect(
  64214. text, x, y, textFont, textAlign, textBaseline
  64215. );
  64216. text = (text + '').split('\n');
  64217. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  64218. switch (textBaseline) {
  64219. case 'top':
  64220. y = rect.y;
  64221. break;
  64222. case 'bottom':
  64223. y = rect.y + lineHeight;
  64224. break;
  64225. default:
  64226. y = rect.y + lineHeight / 2;
  64227. }
  64228. for (var i = 0, l = text.length; i < l; i++) {
  64229. ctx.fillText(text[i], x, y);
  64230. y += lineHeight;
  64231. }
  64232. }
  64233. /**
  64234. * @function LevelRenderer.Shape._getTextRect
  64235. * @description 返回矩形区域,用于局部刷新和文字定位
  64236. *
  64237. * @param {string} text - text。
  64238. * @param {number} x - x。
  64239. * @param {number} y - y。
  64240. * @param {string} textFont - textFont。
  64241. * @param {string} textAlign - textAlign。
  64242. * @param {string} textBaseline - textBaseline。
  64243. * @return {Object} 矩形区域。
  64244. */
  64245. static _getTextRect(text, x, y, textFont, textAlign, textBaseline) {
  64246. var width = SUtil_SUtil.Util_area.getTextWidth(text, textFont);
  64247. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  64248. text = (text + '').split('\n');
  64249. switch (textAlign) {
  64250. case 'end':
  64251. case 'right':
  64252. x -= width;
  64253. break;
  64254. case 'center':
  64255. x -= (width / 2);
  64256. break;
  64257. }
  64258. switch (textBaseline) {
  64259. case 'top':
  64260. break;
  64261. case 'bottom':
  64262. y -= lineHeight * text.length;
  64263. break;
  64264. default:
  64265. y -= lineHeight * text.length / 2;
  64266. }
  64267. return {
  64268. x: x,
  64269. y: y,
  64270. width: width,
  64271. height: lineHeight * text.length
  64272. };
  64273. }
  64274. }
  64275. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPoint.js
  64276. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64277. * This program are made available under the terms of the Apache License, Version 2.0
  64278. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64279. /**
  64280. * @private
  64281. * @class LevelRenderer.Shape.SmicPoint
  64282. * @category Visualization Theme
  64283. * @classdesc 点。
  64284. * @extends LevelRenderer.Shape
  64285. * @example
  64286. * var shape = new LevelRenderer.Shape.SmicPoint({
  64287. * style: {
  64288. * x: 100,
  64289. * y: 100,
  64290. * r: 40,
  64291. * brushType: 'both',
  64292. * color: 'blue',
  64293. * strokeColor: 'red',
  64294. * lineWidth: 3,
  64295. * text: 'point'
  64296. * }
  64297. * });
  64298. * levelRenderer.addShape(shape);
  64299. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  64300. *
  64301. */
  64302. class SmicPoint extends Shape_Shape {
  64303. constructor(options) {
  64304. super(options);
  64305. /**
  64306. * @member {string} LevelRenderer.Shape.SmicPoint.prototype.type
  64307. * @description 图形类型。
  64308. */
  64309. this.type = 'smicpoint';
  64310. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64311. this.refOriginalPosition = [0, 0];
  64312. }
  64313. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPoint";
  64314. }
  64315. /**
  64316. * @function cdestroy
  64317. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  64318. */
  64319. destroy() {
  64320. this.type = null;
  64321. super.destroy();
  64322. }
  64323. /**
  64324. * @function LevelRenderer.Shape.SmicPoint.prototype.buildPath
  64325. * @description 创建点触。
  64326. *
  64327. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  64328. * @param {Object} style - style。
  64329. *
  64330. */
  64331. buildPath(ctx, style) {
  64332. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64333. this.refOriginalPosition = [0, 0];
  64334. }
  64335. var __OP = this.refOriginalPosition;
  64336. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, true);
  64337. return;
  64338. }
  64339. /**
  64340. * @function LevelRenderer.Shape.SmicPoint.prototype.getRect
  64341. * @description 计算返回点的包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  64342. *
  64343. * @param {Object} style - style
  64344. * @return {Object} 边框对象。包含属性:x,y,width,height。
  64345. */
  64346. getRect(style) {
  64347. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64348. this.refOriginalPosition = [0, 0];
  64349. }
  64350. var __OP = this.refOriginalPosition;
  64351. if (style.__rect) {
  64352. return style.__rect;
  64353. }
  64354. var lineWidth;
  64355. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  64356. lineWidth = style.lineWidth || 1;
  64357. } else {
  64358. lineWidth = 0;
  64359. }
  64360. style.__rect = {
  64361. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  64362. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  64363. width: style.r * 2 + lineWidth,
  64364. height: style.r * 2 + lineWidth
  64365. };
  64366. return style.__rect;
  64367. }
  64368. }
  64369. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicText.js
  64370. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64371. * This program are made available under the terms of the Apache License, Version 2.0
  64372. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64373. /**
  64374. * @private
  64375. * @class LevelRenderer.Shape.SmicText
  64376. * @category Visualization Theme
  64377. * @extends {LevelRenderer.Shape}
  64378. * @example
  64379. * var shape = new LevelRenderer.Shape.SmicText({
  64380. * style: {
  64381. * text: 'Label',
  64382. * x: 100,
  64383. * y: 100,
  64384. * textFont: '14px Arial'
  64385. * }
  64386. * });
  64387. * levelRenderer.addShape(shape);
  64388. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  64389. */
  64390. class SmicText extends Shape_Shape {
  64391. constructor(options) {
  64392. super(options);
  64393. /**
  64394. * @member {string} LevelRenderer.Shape.SmicText.prototype.type
  64395. * @description 图形类型.
  64396. */
  64397. this.type = 'smictext';
  64398. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64399. this.refOriginalPosition = [0, 0];
  64400. }
  64401. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicText";
  64402. }
  64403. /**
  64404. * @function LevelRenderer.Shape.SmicText.prototype.destroy
  64405. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  64406. */
  64407. destroy() {
  64408. this.type = null;
  64409. super.destroy();
  64410. }
  64411. /**
  64412. * @function LevelRenderer.Shape.SmicText.prototype.brush
  64413. * @description 笔触。
  64414. *
  64415. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  64416. * @param {boolean} isHighlight - 是否使用高亮属性。
  64417. *
  64418. */
  64419. brush(ctx, isHighlight) {
  64420. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64421. this.refOriginalPosition = [0, 0];
  64422. }
  64423. var __OP = this.refOriginalPosition;
  64424. var style = this.style;
  64425. if (isHighlight) {
  64426. // 根据style扩展默认高亮样式
  64427. style = this.getHighlightStyle(
  64428. style, this.highlightStyle || {}
  64429. );
  64430. }
  64431. if (typeof(style.text) == 'undefined' || style.text === false) {
  64432. return;
  64433. }
  64434. ctx.save();
  64435. this.doClip(ctx);
  64436. this.setContext(ctx, style);
  64437. // 设置transform
  64438. this.setTransform(ctx);
  64439. if (style.textFont) {
  64440. ctx.font = style.textFont;
  64441. }
  64442. ctx.textAlign = style.textAlign || 'start';
  64443. ctx.textBaseline = style.textBaseline || 'middle';
  64444. var text = (style.text + '').split('\n');
  64445. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  64446. var rect = this.getRectNoRotation(style);
  64447. // var x = style.x;
  64448. var x = style.x + __OP[0];
  64449. var y;
  64450. if (style.textBaseline == 'top') {
  64451. y = rect.y;
  64452. } else if (style.textBaseline == 'bottom') {
  64453. y = rect.y + lineHeight;
  64454. } else {
  64455. y = rect.y + lineHeight / 2;
  64456. }
  64457. var ox = style.x + __OP[0];
  64458. var oy = style.y + __OP[1];
  64459. //文本绘制
  64460. for (var i = 0, l = text.length; i < l; i++) {
  64461. //是否渲染矩形背景及颜色
  64462. if (style.labelRect) {
  64463. //+4,-2是为了让文字距边框左右边缘有点间隔
  64464. ctx.fillRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  64465. ctx.fillStyle = style.strokeColor;
  64466. ctx.strokeRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  64467. ctx.fillStyle = style.textColor;
  64468. }
  64469. switch (style.brushType) {
  64470. case 'stroke':
  64471. this.setCtxGlobalAlpha(ctx, "stroke", style);
  64472. if (style.textRotation && style.textRotation !== 0) {
  64473. ctx.save();
  64474. ctx.translate(ox, oy);
  64475. ctx.rotate(style.textRotation * Math.PI / 180);
  64476. if (style.textBaseline == 'top') {
  64477. if (style.maxWidth) {
  64478. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  64479. } else {
  64480. ctx.strokeText(text[i], 0, lineHeight * i);
  64481. }
  64482. } else if (style.textBaseline == 'bottom') {
  64483. if (style.maxWidth) {
  64484. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  64485. } else {
  64486. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  64487. }
  64488. } else {
  64489. if (style.maxWidth) {
  64490. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  64491. } else {
  64492. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  64493. }
  64494. }
  64495. ctx.restore();
  64496. } else {
  64497. if (style.maxWidth) {
  64498. ctx.strokeText(text[i], x, y, style.maxWidth);
  64499. } else {
  64500. ctx.strokeText(text[i], x, y);
  64501. }
  64502. }
  64503. this.setCtxGlobalAlpha(ctx, "reset", style);
  64504. break;
  64505. case 'both':
  64506. if (style.textRotation && style.textRotation !== 0) {
  64507. ctx.save();
  64508. ctx.translate(ox, oy);
  64509. ctx.rotate(style.textRotation * Math.PI / 180);
  64510. if (style.textBaseline == 'top') {
  64511. if (style.maxWidth) {
  64512. this.setCtxGlobalAlpha(ctx, "fill", style);
  64513. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  64514. this.setCtxGlobalAlpha(ctx, "reset", style);
  64515. this.setCtxGlobalAlpha(ctx, "stroke", style);
  64516. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  64517. this.setCtxGlobalAlpha(ctx, "reset", style);
  64518. } else {
  64519. this.setCtxGlobalAlpha(ctx, "fill", style);
  64520. ctx.fillText(text[i], 0, lineHeight * i);
  64521. this.setCtxGlobalAlpha(ctx, "reset", style);
  64522. this.setCtxGlobalAlpha(ctx, "stroke", style);
  64523. ctx.strokeText(text[i], 0, lineHeight * i);
  64524. this.setCtxGlobalAlpha(ctx, "reset", style);
  64525. }
  64526. } else if (style.textBaseline == 'bottom') {
  64527. if (style.maxWidth) {
  64528. this.setCtxGlobalAlpha(ctx, "fill", style);
  64529. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  64530. this.setCtxGlobalAlpha(ctx, "reset", style);
  64531. this.setCtxGlobalAlpha(ctx, "stroke", style);
  64532. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  64533. this.setCtxGlobalAlpha(ctx, "reset", style);
  64534. } else {
  64535. this.setCtxGlobalAlpha(ctx, "fill", style);
  64536. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  64537. this.setCtxGlobalAlpha(ctx, "reset", style);
  64538. this.setCtxGlobalAlpha(ctx, "stroke", style);
  64539. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  64540. this.setCtxGlobalAlpha(ctx, "reset", style);
  64541. }
  64542. } else {
  64543. if (style.maxWidth) {
  64544. this.setCtxGlobalAlpha(ctx, "fill", style);
  64545. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  64546. this.setCtxGlobalAlpha(ctx, "reset", style);
  64547. this.setCtxGlobalAlpha(ctx, "stroke", style);
  64548. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  64549. this.setCtxGlobalAlpha(ctx, "reset", style);
  64550. } else {
  64551. this.setCtxGlobalAlpha(ctx, "fill", style);
  64552. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  64553. this.setCtxGlobalAlpha(ctx, "reset", style);
  64554. this.setCtxGlobalAlpha(ctx, "stroke", style);
  64555. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  64556. this.setCtxGlobalAlpha(ctx, "reset", style);
  64557. }
  64558. }
  64559. ctx.restore();
  64560. } else {
  64561. if (style.maxWidth) {
  64562. this.setCtxGlobalAlpha(ctx, "fill", style);
  64563. ctx.fillText(text[i], x, y, style.maxWidth);
  64564. this.setCtxGlobalAlpha(ctx, "reset", style);
  64565. this.setCtxGlobalAlpha(ctx, "stroke", style);
  64566. ctx.strokeText(text[i], x, y, style.maxWidth);
  64567. this.setCtxGlobalAlpha(ctx, "reset", style);
  64568. } else {
  64569. this.setCtxGlobalAlpha(ctx, "fill", style);
  64570. ctx.fillText(text[i], x, y);
  64571. this.setCtxGlobalAlpha(ctx, "reset", style);
  64572. this.setCtxGlobalAlpha(ctx, "stroke", style);
  64573. ctx.strokeText(text[i], x, y);
  64574. this.setCtxGlobalAlpha(ctx, "reset", style);
  64575. }
  64576. }
  64577. break;
  64578. default:
  64579. //fill or others
  64580. this.setCtxGlobalAlpha(ctx, "fill", style);
  64581. if (style.textRotation && style.textRotation !== 0) {
  64582. ctx.save();
  64583. ctx.translate(ox, oy);
  64584. ctx.rotate(style.textRotation * Math.PI / 180);
  64585. if (style.textBaseline == 'top') {
  64586. if (style.maxWidth) {
  64587. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  64588. } else {
  64589. ctx.fillText(text[i], 0, lineHeight * i);
  64590. }
  64591. } else if (style.textBaseline == 'bottom') {
  64592. if (style.maxWidth) {
  64593. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  64594. } else {
  64595. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  64596. }
  64597. } else {
  64598. if (style.maxWidth) {
  64599. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  64600. } else {
  64601. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  64602. }
  64603. }
  64604. ctx.restore();
  64605. } else {
  64606. if (style.maxWidth) {
  64607. ctx.fillText(text[i], x, y, style.maxWidth);
  64608. } else {
  64609. ctx.fillText(text[i], x, y);
  64610. }
  64611. }
  64612. this.setCtxGlobalAlpha(ctx, "reset", style);
  64613. }
  64614. y += lineHeight;
  64615. }
  64616. ctx.restore();
  64617. return;
  64618. }
  64619. /**
  64620. * @function LevelRenderer.Shape.SmicText.prototype.getRect
  64621. * @description 返回文字包围盒矩形
  64622. */
  64623. getRect(style) {
  64624. if (style.__rect) {
  64625. return style.__rect;
  64626. }
  64627. var left, top, right, bottom
  64628. var tbg = this.getTextBackground(style, true);
  64629. for (var i = 0, len = tbg.length; i < len; i++) {
  64630. var poi = tbg[i];
  64631. //用第一个点初始化
  64632. if (i == 0) {
  64633. left = poi[0];
  64634. right = poi[0];
  64635. top = poi[1];
  64636. bottom = poi[1];
  64637. } else {
  64638. if (poi[0] < left) {
  64639. left = poi[0]
  64640. }
  64641. if (poi[0] > right) {
  64642. right = poi[0]
  64643. }
  64644. if (poi[1] < top) {
  64645. top = poi[1]
  64646. }
  64647. if (poi[1] > bottom) {
  64648. bottom = poi[1]
  64649. }
  64650. }
  64651. }
  64652. style.__rect = {
  64653. x: left,
  64654. y: top,
  64655. width: right - left,
  64656. height: bottom - top
  64657. };
  64658. return style.__rect;
  64659. }
  64660. /**
  64661. * @function LevelRenderer.Shape.SmicText.prototype.getRectNoRotation
  64662. * @description 返回忽略旋转和maxWidth时文字包围盒矩形
  64663. */
  64664. getRectNoRotation(style) {
  64665. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64666. this.refOriginalPosition = [0, 0];
  64667. }
  64668. var __OP = this.refOriginalPosition;
  64669. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  64670. var width = SUtil_SUtil.Util_area.getTextWidth(style.text, style.textFont);
  64671. var height = SUtil_SUtil.Util_area.getTextHeight(style.text, style.textFont);
  64672. //处理文字位置,注:文本的绘制是由此 rect 决定
  64673. var textX = style.x + __OP[0]; // 默认start == left
  64674. if (style.textAlign == 'end' || style.textAlign == 'right') {
  64675. textX -= width;
  64676. } else if (style.textAlign == 'center') {
  64677. textX -= (width / 2);
  64678. }
  64679. var textY;
  64680. if (style.textBaseline == 'top') {
  64681. // textY = style.y;
  64682. textY = style.y + __OP[1];
  64683. } else if (style.textBaseline == 'bottom') {
  64684. textY = (style.y + __OP[1]) - height;
  64685. } else {
  64686. // middle
  64687. textY = (style.y + __OP[1]) - height / 2;
  64688. }
  64689. var isWidthChangeByMaxWidth = false;
  64690. var widthBeforeChangeByMaxWidth;
  64691. //处理 maxWidth
  64692. if (style.maxWidth) {
  64693. var maxWidth = parseInt(style.maxWidth);
  64694. if (maxWidth < width) {
  64695. widthBeforeChangeByMaxWidth = width;
  64696. isWidthChangeByMaxWidth = true;
  64697. width = maxWidth;
  64698. }
  64699. textX = style.x + __OP[0];
  64700. if (style.textAlign == 'end' || style.textAlign == 'right') {
  64701. textX -= width;
  64702. } else if (style.textAlign == 'center') {
  64703. textX -= (width / 2);
  64704. }
  64705. }
  64706. //处理斜体字
  64707. if (style.textFont) {
  64708. var textFont = style.textFont;
  64709. var textFontStr = textFont.toLowerCase()
  64710. if (textFontStr.indexOf("italic") > -1) {
  64711. if (isWidthChangeByMaxWidth === true) {
  64712. width += (lineHeight / 3) * (width / widthBeforeChangeByMaxWidth);
  64713. } else {
  64714. width += lineHeight / 3;
  64715. }
  64716. }
  64717. }
  64718. var rect = {
  64719. x: textX,
  64720. y: textY,
  64721. width: width,
  64722. height: height
  64723. };
  64724. return rect;
  64725. }
  64726. /**
  64727. * @function LevelRenderer.Shape.SmicText.prototype.getTextBackground
  64728. * @description 获取文本背景框范围
  64729. *
  64730. * @param {Object} style - 样式。
  64731. * @param {boolean} redo - 是否强制重新计算 textBackground。
  64732. */
  64733. getTextBackground(style, redo) {
  64734. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64735. this.refOriginalPosition = [0, 0];
  64736. }
  64737. var __OP = this.refOriginalPosition;
  64738. if ((!redo) && style.__textBackground) {
  64739. return style.__textBackground;
  64740. }
  64741. //不旋转时矩形框
  64742. var rect = this.getRectNoRotation(style);
  64743. //旋转中心点
  64744. var ox = style.x + __OP[0];
  64745. var oy = style.y + __OP[1];
  64746. //背景框
  64747. var background = [];
  64748. if (style.textRotation && style.textRotation !== 0) {
  64749. let textRotation = style.textRotation;
  64750. let ltPoi = this.getRotatedLocation(rect.x, rect.y, ox, oy, textRotation);
  64751. let rtPoi = this.getRotatedLocation(rect.x + rect.width, rect.y, ox, oy, textRotation);
  64752. let rbPoi = this.getRotatedLocation(rect.x + rect.width, rect.y + rect.height, ox, oy, textRotation);
  64753. let lbPoi = this.getRotatedLocation(rect.x, rect.y + rect.height, ox, oy, textRotation);
  64754. background.push(ltPoi);
  64755. background.push(rtPoi);
  64756. background.push(rbPoi);
  64757. background.push(lbPoi);
  64758. } else {
  64759. let ltPoi = [rect.x, rect.y];
  64760. let rtPoi = [rect.x + rect.width, rect.y];
  64761. let rbPoi = [rect.x + rect.width, rect.y + rect.height];
  64762. let lbPoi = [rect.x, rect.y + rect.height];
  64763. background.push(ltPoi);
  64764. background.push(rtPoi);
  64765. background.push(rbPoi);
  64766. background.push(lbPoi);
  64767. }
  64768. style.__textBackground = background;
  64769. return style.__textBackground;
  64770. }
  64771. /**
  64772. * @function LevelRenderer.Shape.SmicText.prototype.getRotatedLocation
  64773. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)
  64774. *
  64775. * @param {number} x - 旋转点横坐标。
  64776. * @param {number} y - 旋转点纵坐标。
  64777. * @param {number} rx - 旋转中心点横坐标。
  64778. * @param {number} ry - 旋转中心点纵坐标。
  64779. * @param {number} angle - 旋转角度(度)。
  64780. * @return {Array.<number>} 旋转后的坐标位置,长度为 2 的一维数组,数组第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  64781. */
  64782. getRotatedLocation(x, y, rx, ry, angle) {
  64783. var loc = new Array(), x0, y0;
  64784. y = -y;
  64785. ry = -ry;
  64786. angle = -angle;//顺时针旋转
  64787. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  64788. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  64789. loc[0] = x0;
  64790. loc[1] = -y0;
  64791. return loc;
  64792. }
  64793. }
  64794. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicCircle.js
  64795. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64796. * This program are made available under the terms of the Apache License, Version 2.0
  64797. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64798. /**
  64799. * @private
  64800. * @class LevelRenderer.Shape.SmicCircle
  64801. * @category Visualization Theme
  64802. * @classdesc 圆形
  64803. * @extends LevelRenderer.Shape
  64804. * @example
  64805. * var shape = new LevelRenderer.Shape.SmicCircle({
  64806. * style: {
  64807. * x: 100,
  64808. * y: 100,
  64809. * r: 60,
  64810. * brushType: "both",
  64811. * color: "blue",
  64812. * strokeColor: "red",
  64813. * lineWidth: 3,
  64814. * text: "Circle"
  64815. * }
  64816. * });
  64817. * levelRenderer.addShape(shape);
  64818. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  64819. *
  64820. */
  64821. class SmicCircle extends Shape_Shape {
  64822. constructor(options) {
  64823. super(options);
  64824. /**
  64825. * @member {string} LevelRenderer.Shape.SmicCircle.prototype.type
  64826. * @description 图形类型。
  64827. */
  64828. this.type = 'smiccircle';
  64829. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64830. this.refOriginalPosition = [0, 0];
  64831. }
  64832. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicCircle";
  64833. }
  64834. /**
  64835. * @function LevelRenderer.Shape.SmicCircle.prototype.destroy
  64836. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  64837. */
  64838. destroy() {
  64839. this.type = null;
  64840. super.destroy();
  64841. }
  64842. /**
  64843. * @function LevelRenderer.Shape.SmicCircle.prototype.buildPath
  64844. * @description 创建图形路径。
  64845. *
  64846. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  64847. * @param {Object} style - style。
  64848. *
  64849. */
  64850. buildPath(ctx, style) {
  64851. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64852. this.refOriginalPosition = [0, 0];
  64853. }
  64854. var __OP = this.refOriginalPosition;
  64855. var x = style.x + __OP[0]; // 圆心x
  64856. var y = style.y + __OP[1]; // 圆心y
  64857. ctx.moveTo(x + style.r, y);
  64858. ctx.arc(x, y, style.r, 0, Math.PI * 2, true);
  64859. return true;
  64860. }
  64861. /**
  64862. * @function LevelRenderer.Shape.SmicCircle.prototype.getRect
  64863. * @description 返回圆形包围盒矩形
  64864. *
  64865. * @param {Object} style - style
  64866. * @return {Object} 边框对象。包含属性:x,y,width,height。
  64867. *
  64868. */
  64869. getRect(style) {
  64870. if (style.__rect) {
  64871. return style.__rect;
  64872. }
  64873. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64874. this.refOriginalPosition = [0, 0];
  64875. }
  64876. var __OP = this.refOriginalPosition;
  64877. var x = style.x + __OP[0]; // 圆心x
  64878. var y = style.y + __OP[1]; // 圆心y
  64879. var r = style.r; // 圆r
  64880. var lineWidth;
  64881. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  64882. lineWidth = style.lineWidth || 1;
  64883. } else {
  64884. lineWidth = 0;
  64885. }
  64886. style.__rect = {
  64887. x: Math.round(x - r - lineWidth / 2),
  64888. y: Math.round(y - r - lineWidth / 2),
  64889. width: r * 2 + lineWidth,
  64890. height: r * 2 + lineWidth
  64891. };
  64892. return style.__rect;
  64893. }
  64894. }
  64895. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPolygon.js
  64896. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  64897. * This program are made available under the terms of the Apache License, Version 2.0
  64898. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64899. /**
  64900. * @private
  64901. * @class LevelRenderer.Shape.SmicPolygon
  64902. * @category Visualization Theme
  64903. * @classdesc 多边形。
  64904. * @extends LevelRenderer.Shape
  64905. * @example
  64906. * var shape = new LevelRenderer.Shape.SmicPolygon({
  64907. * style: {
  64908. * // 100x100 的正方形
  64909. * pointList: [[0, 0], [100, 0], [100, 100], [0, 100]],
  64910. * color: 'blue'
  64911. * }
  64912. * });
  64913. * levelRenderer.addShape(shape);
  64914. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  64915. */
  64916. class SmicPolygon extends Shape_Shape {
  64917. constructor(options) {
  64918. super(options);
  64919. /**
  64920. * @member {string} LevelRenderer.Shape.SmicPolygon.prototype.type
  64921. * @description 图形类型.
  64922. */
  64923. this.type = 'smicpolygon';
  64924. /**
  64925. * @member {Array} LevelRenderer.Shape.SmicPolygon.prototype._holePolygonPointList
  64926. * @description 岛洞面多边形顶点数组(三维数组)
  64927. *
  64928. */
  64929. this.holePolygonPointLists = null;
  64930. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64931. this.refOriginalPosition = [0, 0];
  64932. }
  64933. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPolygon";
  64934. }
  64935. /**
  64936. * @function LevelRenderer.Shape.SmicPolygon.prototype.destroy
  64937. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  64938. */
  64939. destroy() {
  64940. this.type = null;
  64941. this.holePolygonPointLists = null;
  64942. super.destroy();
  64943. }
  64944. /**
  64945. * @function LevelRenderer.Shape.SmicPolygon.prototype.brush
  64946. * @description 笔触。
  64947. *
  64948. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  64949. * @param {boolean} isHighlight - 是否使用高亮属性。
  64950. *
  64951. */
  64952. brush(ctx, isHighlight) {
  64953. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  64954. this.refOriginalPosition = [0, 0];
  64955. }
  64956. var style = this.style;
  64957. if (isHighlight) {
  64958. // 根据style扩展默认高亮样式
  64959. style = this.getHighlightStyle(
  64960. style,
  64961. this.highlightStyle || {}
  64962. );
  64963. }
  64964. ctx.save();
  64965. this.setContext(ctx, style);
  64966. // 设置 transform
  64967. this.setTransform(ctx);
  64968. // 先 fill 再stroke
  64969. var hasPath = false;
  64970. if (style.brushType == 'fill' || style.brushType == 'both' || typeof style.brushType == 'undefined') { // 默认为fill
  64971. ctx.beginPath();
  64972. if (style.lineType == 'dashed'
  64973. || style.lineType == 'dotted'
  64974. || style.lineType == 'dot'
  64975. || style.lineType == 'dash'
  64976. || style.lineType == 'dashdot'
  64977. || style.lineType == 'longdash'
  64978. || style.lineType == 'longdashdot'
  64979. ) {
  64980. // 特殊处理,虚线围不成path,实线再build一次
  64981. this.buildPath(ctx, {
  64982. lineType: 'solid',
  64983. lineWidth: style.lineWidth,
  64984. pointList: style.pointList
  64985. }
  64986. );
  64987. } else {
  64988. this.buildPath(ctx, style);
  64989. hasPath = true; // 这个path能用
  64990. }
  64991. ctx.closePath();
  64992. this.setCtxGlobalAlpha(ctx, "fill", style);
  64993. ctx.fill();
  64994. this.setCtxGlobalAlpha(ctx, "reset", style);
  64995. }
  64996. if (style.lineWidth > 0 && (style.brushType == 'stroke' || style.brushType == 'both')) {
  64997. if (!hasPath) {
  64998. ctx.beginPath();
  64999. this.buildPath(ctx, style);
  65000. }
  65001. this.setCtxGlobalAlpha(ctx, "stroke", style);
  65002. ctx.stroke();
  65003. this.setCtxGlobalAlpha(ctx, "reset", style);
  65004. }
  65005. this.drawText(ctx, style, this.style);
  65006. //岛洞
  65007. var hpStyle = Util_Util.cloneObject(style);
  65008. if (hpStyle.pointList) {
  65009. if (this.holePolygonPointLists && this.holePolygonPointLists.length > 0) {
  65010. var holePLS = this.holePolygonPointLists;
  65011. var holePLSen = holePLS.length;
  65012. for (var i = 0; i < holePLSen; i++) {
  65013. var holePL = holePLS[i];
  65014. //岛洞面
  65015. hpStyle.pointList = holePL;
  65016. ctx.globalCompositeOperation = "destination-out";
  65017. // 先 fill 再stroke
  65018. hasPath = false;
  65019. if (hpStyle.brushType == 'fill' || hpStyle.brushType == 'both' || typeof hpStyle.brushType == 'undefined') { // 默认为fill
  65020. ctx.beginPath();
  65021. if (hpStyle.lineType == 'dashed'
  65022. || hpStyle.lineType == 'dotted'
  65023. || hpStyle.lineType == 'dot'
  65024. || hpStyle.lineType == 'dash'
  65025. || hpStyle.lineType == 'dashdot'
  65026. || hpStyle.lineType == 'longdash'
  65027. || hpStyle.lineType == 'longdashdot'
  65028. ) {
  65029. // 特殊处理,虚线围不成path,实线再build一次
  65030. this.buildPath(ctx, {
  65031. lineType: 'solid',
  65032. lineWidth: hpStyle.lineWidth,
  65033. pointList: hpStyle.pointList
  65034. }
  65035. );
  65036. } else {
  65037. this.buildPath(ctx, hpStyle);
  65038. hasPath = true; // 这个path能用
  65039. }
  65040. ctx.closePath();
  65041. this.setCtxGlobalAlpha(ctx, "fill", hpStyle);
  65042. ctx.fill();
  65043. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  65044. }
  65045. if (hpStyle.lineWidth > 0 && (hpStyle.brushType == 'stroke' || hpStyle.brushType == 'both')) {
  65046. if (!hasPath) {
  65047. ctx.beginPath();
  65048. this.buildPath(ctx, hpStyle);
  65049. }
  65050. //如果描边,先回复 globalCompositeOperation 默认值再描边。
  65051. ctx.globalCompositeOperation = "source-over";
  65052. this.setCtxGlobalAlpha(ctx, "stroke", hpStyle);
  65053. ctx.stroke();
  65054. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  65055. } else {
  65056. ctx.globalCompositeOperation = "source-over";
  65057. }
  65058. }
  65059. }
  65060. }
  65061. ctx.restore();
  65062. return;
  65063. }
  65064. /**
  65065. * @function LevelRenderer.Shape.SmicPolygon.prototype.buildPath
  65066. * @description 创建多边形路径。
  65067. *
  65068. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  65069. * @param {Object} style - style。
  65070. *
  65071. */
  65072. buildPath(ctx, style) {
  65073. if (style.showShadow) {
  65074. ctx.shadowBlur = style.shadowBlur;
  65075. ctx.shadowColor = style.shadowColor;
  65076. ctx.shadowOffsetX = style.shadowOffsetX;
  65077. ctx.shadowOffsetY = style.shadowOffsetY;
  65078. }
  65079. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65080. this.refOriginalPosition = [0, 0];
  65081. }
  65082. var __OP = this.refOriginalPosition;
  65083. // 虽然能重用 brokenLine,但底层图形基于性能考虑,重复代码减少调用吧
  65084. var pointList = style.pointList;
  65085. if (pointList.length < 2) {
  65086. // 少于2个点就不画了~
  65087. return;
  65088. }
  65089. if (style.smooth && style.smooth !== 'spline') {
  65090. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, true, style.smoothConstraint, __OP);
  65091. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  65092. var cp1;
  65093. var cp2;
  65094. var p;
  65095. var len = pointList.length;
  65096. for (var i = 0; i < len; i++) {
  65097. cp1 = controlPoints[i * 2];
  65098. cp2 = controlPoints[i * 2 + 1];
  65099. p = [pointList[(i + 1) % len][0] + __OP[0], pointList[(i + 1) % len][1] + __OP[1]];
  65100. ctx.bezierCurveTo(
  65101. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  65102. );
  65103. }
  65104. } else {
  65105. if (style.smooth === 'spline') {
  65106. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, true, null, __OP);
  65107. }
  65108. if (!style.lineType || style.lineType == 'solid') {
  65109. // 默认为实线
  65110. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  65111. for (let i = 1; i < pointList.length; i++) {
  65112. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  65113. }
  65114. ctx.lineTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  65115. } else if (style.lineType === 'dashed'
  65116. || style.lineType === 'dotted'
  65117. || style.lineType === 'dot'
  65118. || style.lineType === 'dash'
  65119. || style.lineType === 'longdash'
  65120. ) {
  65121. // SMIC-方法修改 - start
  65122. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  65123. style._dashLength = dashLengthForStyle;
  65124. let dashLength = (style.lineWidth || 1);
  65125. let pattern1 = dashLength;
  65126. let pattern2 = dashLength;
  65127. //dashed
  65128. if (style.lineType === 'dashed') {
  65129. pattern1 *= 5;
  65130. pattern2 *= 5;
  65131. if (style.lineCap && style.lineCap !== "butt") {
  65132. pattern1 -= dashLength;
  65133. pattern2 += dashLength;
  65134. }
  65135. }
  65136. //dotted
  65137. if (style.lineType === 'dotted') {
  65138. if (style.lineCap && style.lineCap !== "butt") {
  65139. pattern1 = 1;
  65140. pattern2 += dashLength;
  65141. }
  65142. }
  65143. //dot
  65144. if (style.lineType === 'dot') {
  65145. pattern2 *= 4;
  65146. if (style.lineCap && style.lineCap !== "butt") {
  65147. pattern1 = 1;
  65148. pattern2 += dashLength;
  65149. }
  65150. }
  65151. //dash
  65152. if (style.lineType === 'dash') {
  65153. pattern1 *= 4;
  65154. pattern2 *= 4;
  65155. if (style.lineCap && style.lineCap !== "butt") {
  65156. pattern1 -= dashLength;
  65157. pattern2 += dashLength;
  65158. }
  65159. }
  65160. //longdash
  65161. if (style.lineType === 'longdash') {
  65162. pattern1 *= 8;
  65163. pattern2 *= 4;
  65164. if (style.lineCap && style.lineCap !== "butt") {
  65165. pattern1 -= dashLength;
  65166. pattern2 += dashLength;
  65167. }
  65168. }
  65169. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  65170. for (let i = 1; i < pointList.length; i++) {
  65171. SUtil_SUtil.SUtil_dashedLineTo(
  65172. ctx,
  65173. pointList[i - 1][0] + __OP[0],
  65174. pointList[i - 1][1] + __OP[1],
  65175. pointList[i][0] + __OP[0],
  65176. pointList[i][1] + __OP[1],
  65177. dashLength,
  65178. [pattern1, pattern2]
  65179. );
  65180. }
  65181. SUtil_SUtil.SUtil_dashedLineTo(
  65182. ctx,
  65183. pointList[pointList.length - 1][0] + __OP[0],
  65184. pointList[pointList.length - 1][1] + __OP[1],
  65185. pointList[0][0] + __OP[0],
  65186. pointList[0][1] + __OP[1],
  65187. dashLength,
  65188. [pattern1, pattern2]
  65189. );
  65190. } else if (style.lineType === 'dashdot'
  65191. || style.lineType === 'longdashdot'
  65192. ) {
  65193. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  65194. style._dashLength = dashLengthForStyle;
  65195. let dashLength = (style.lineWidth || 1);
  65196. let pattern1 = dashLength;
  65197. let pattern2 = dashLength;
  65198. let pattern3 = dashLength;
  65199. let pattern4 = dashLength;
  65200. //dashdot
  65201. if (style.lineType === 'dashdot') {
  65202. pattern1 *= 4;
  65203. pattern2 *= 4;
  65204. pattern4 *= 4;
  65205. if (style.lineCap && style.lineCap !== "butt") {
  65206. pattern1 -= dashLength;
  65207. pattern2 += dashLength;
  65208. pattern3 = 1;
  65209. pattern4 += dashLength;
  65210. }
  65211. }
  65212. //longdashdot
  65213. if (style.lineType === 'longdashdot') {
  65214. pattern1 *= 8;
  65215. pattern2 *= 4;
  65216. pattern4 *= 4;
  65217. if (style.lineCap && style.lineCap !== "butt") {
  65218. pattern1 -= dashLength;
  65219. pattern2 += dashLength;
  65220. pattern3 = 1;
  65221. pattern4 += dashLength;
  65222. }
  65223. }
  65224. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  65225. for (let i = 1; i < pointList.length; i++) {
  65226. SUtil_SUtil.SUtil_dashedLineTo(
  65227. ctx,
  65228. pointList[i - 1][0] + __OP[0],
  65229. pointList[i - 1][1] + __OP[1],
  65230. pointList[i][0] + __OP[0],
  65231. pointList[i][1] + __OP[1],
  65232. dashLength,
  65233. [pattern1, pattern2, pattern3, pattern4]
  65234. );
  65235. }
  65236. SUtil_SUtil.SUtil_dashedLineTo(
  65237. ctx,
  65238. pointList[pointList.length - 1][0] + __OP[0],
  65239. pointList[pointList.length - 1][1] + __OP[1],
  65240. pointList[0][0] + __OP[0],
  65241. pointList[0][1] + __OP[1],
  65242. dashLength,
  65243. [pattern1, pattern2, pattern3, pattern4]
  65244. );
  65245. }
  65246. }
  65247. return;
  65248. }
  65249. /**
  65250. * @function LevelRenderer.Shape.SmicPolygon.prototype.getRect
  65251. * @description 计算返回多边形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  65252. *
  65253. * @param {Object} style - style
  65254. * @return {Object} 边框对象。包含属性:x,y,width,height。
  65255. *
  65256. */
  65257. getRect(style, refOriginalPosition) {
  65258. var __OP;
  65259. if (!refOriginalPosition) {
  65260. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65261. this.refOriginalPosition = [0, 0];
  65262. }
  65263. __OP = this.refOriginalPosition;
  65264. } else {
  65265. __OP = refOriginalPosition;
  65266. }
  65267. if (style.__rect) {
  65268. return style.__rect;
  65269. }
  65270. var minX = Number.MAX_VALUE;
  65271. var maxX = Number.MIN_VALUE;
  65272. var minY = Number.MAX_VALUE;
  65273. var maxY = Number.MIN_VALUE;
  65274. var pointList = style.pointList;
  65275. for (var i = 0, l = pointList.length; i < l; i++) {
  65276. if (pointList[i][0] + __OP[0] < minX) {
  65277. minX = pointList[i][0] + __OP[0];
  65278. }
  65279. if (pointList[i][0] + __OP[0] > maxX) {
  65280. maxX = pointList[i][0] + __OP[0];
  65281. }
  65282. if (pointList[i][1] + __OP[1] < minY) {
  65283. minY = pointList[i][1] + __OP[1];
  65284. }
  65285. if (pointList[i][1] + __OP[1] > maxY) {
  65286. maxY = pointList[i][1] + __OP[1];
  65287. }
  65288. }
  65289. var lineWidth;
  65290. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  65291. lineWidth = style.lineWidth || 1;
  65292. } else {
  65293. lineWidth = 0;
  65294. }
  65295. style.__rect = {
  65296. x: Math.round(minX - lineWidth / 2),
  65297. y: Math.round(minY - lineWidth / 2),
  65298. width: maxX - minX + lineWidth,
  65299. height: maxY - minY + lineWidth
  65300. };
  65301. return style.__rect;
  65302. }
  65303. }
  65304. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicBrokenLine.js
  65305. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65306. * This program are made available under the terms of the Apache License, Version 2.0
  65307. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65308. /**
  65309. * @private
  65310. * @class LevelRenderer.Shape.SmicBrokenLine
  65311. * @category Visualization Theme
  65312. * @classdesc 折线(ic)。
  65313. * @extends LevelRenderer.Shape
  65314. * @example
  65315. * var shape = new LevelRenderer.Shape.SmicBrokenLine({
  65316. * style: {
  65317. * pointList: [[0, 0], [100, 100], [100, 0]],
  65318. * smooth: 'bezier',
  65319. * strokeColor: 'purple'
  65320. * }
  65321. * });
  65322. * levelRenderer.addShape(shape);
  65323. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  65324. *
  65325. */
  65326. class SmicBrokenLine extends Shape_Shape {
  65327. constructor(options) {
  65328. super(options);
  65329. /**
  65330. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.brushTypeOnly
  65331. * @description 线条只能描边。
  65332. */
  65333. this.brushTypeOnly = 'stroke';
  65334. /**
  65335. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.textPosition
  65336. * @description 文本位置。
  65337. */
  65338. this.textPosition = 'end';
  65339. /**
  65340. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.type
  65341. * @description 图形类型.
  65342. */
  65343. this.type = 'smicbroken-line';
  65344. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65345. this.refOriginalPosition = [0, 0];
  65346. }
  65347. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicBrokenLine";
  65348. }
  65349. /**
  65350. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.destroy
  65351. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  65352. */
  65353. destroy() {
  65354. this.brushTypeOnly = null;
  65355. this.textPosition = null;
  65356. this.type = null;
  65357. super.destroy();
  65358. }
  65359. /**
  65360. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.buildPath
  65361. * @description 创建折线路径。
  65362. *
  65363. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  65364. * @param {Object} style - style。
  65365. *
  65366. */
  65367. buildPath(ctx, style) {
  65368. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65369. this.refOriginalPosition = [0, 0];
  65370. }
  65371. var __OP = this.refOriginalPosition;
  65372. var pointList = style.pointList;
  65373. if (pointList.length < 2) {
  65374. // 少于2个点就不画了~
  65375. return;
  65376. }
  65377. var len = Math.min(style.pointList.length, Math.round(style.pointListLength || style.pointList.length));
  65378. if (style.smooth && style.smooth !== 'spline') {
  65379. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, false, style.smoothConstraint, __OP);
  65380. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  65381. var cp1;
  65382. var cp2;
  65383. var p;
  65384. for (let i = 0; i < len - 1; i++) {
  65385. cp1 = controlPoints[i * 2];
  65386. cp2 = controlPoints[i * 2 + 1];
  65387. p = [pointList[i + 1][0] + __OP[0], pointList[i + 1][1] + __OP[1]];
  65388. ctx.bezierCurveTo(
  65389. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  65390. );
  65391. }
  65392. } else {
  65393. if (style.smooth === 'spline') {
  65394. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, null, null, __OP);
  65395. len = pointList.length;
  65396. }
  65397. if (!style.lineType || style.lineType === 'solid') {
  65398. // 默认为实线
  65399. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  65400. for (let i = 1; i < len; i++) {
  65401. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  65402. }
  65403. } else if (style.lineType === 'dashed'
  65404. || style.lineType === 'dotted'
  65405. || style.lineType === 'dot'
  65406. || style.lineType === 'dash'
  65407. || style.lineType === 'longdash'
  65408. ) {
  65409. let dashLength = (style.lineWidth || 1);
  65410. let pattern1 = dashLength;
  65411. let pattern2 = dashLength;
  65412. //dashed
  65413. if (style.lineType === 'dashed') {
  65414. pattern1 *= 5;
  65415. pattern2 *= 5;
  65416. if (style.lineCap && style.lineCap !== "butt") {
  65417. pattern1 -= dashLength;
  65418. pattern2 += dashLength;
  65419. }
  65420. }
  65421. //dotted
  65422. if (style.lineType === 'dotted') {
  65423. if (style.lineCap && style.lineCap !== "butt") {
  65424. pattern1 = 1;
  65425. pattern2 += dashLength;
  65426. }
  65427. }
  65428. //dot
  65429. if (style.lineType === 'dot') {
  65430. pattern2 *= 4;
  65431. if (style.lineCap && style.lineCap !== "butt") {
  65432. pattern1 = 1;
  65433. pattern2 += dashLength;
  65434. }
  65435. }
  65436. //dash
  65437. if (style.lineType === 'dash') {
  65438. pattern1 *= 4;
  65439. pattern2 *= 4;
  65440. if (style.lineCap && style.lineCap !== "butt") {
  65441. pattern1 -= dashLength;
  65442. pattern2 += dashLength;
  65443. }
  65444. }
  65445. //longdash
  65446. if (style.lineType === 'longdash') {
  65447. pattern1 *= 8;
  65448. pattern2 *= 4;
  65449. if (style.lineCap && style.lineCap !== "butt") {
  65450. pattern1 -= dashLength;
  65451. pattern2 += dashLength;
  65452. }
  65453. }
  65454. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  65455. for (var i = 1; i < len; i++) {
  65456. SUtil_SUtil.SUtil_dashedLineTo(
  65457. ctx,
  65458. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  65459. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  65460. dashLength,
  65461. [pattern1, pattern2]
  65462. );
  65463. }
  65464. } else if (style.lineType === 'dashdot'
  65465. || style.lineType === 'longdashdot'
  65466. ) {
  65467. let dashLength = (style.lineWidth || 1);
  65468. let pattern1 = dashLength;
  65469. let pattern2 = dashLength;
  65470. let pattern3 = dashLength;
  65471. let pattern4 = dashLength;
  65472. //dashdot
  65473. if (style.lineType === 'dashdot') {
  65474. pattern1 *= 4;
  65475. pattern2 *= 4;
  65476. pattern4 *= 4;
  65477. if (style.lineCap && style.lineCap !== "butt") {
  65478. pattern1 -= dashLength;
  65479. pattern2 += dashLength;
  65480. pattern3 = 1;
  65481. pattern4 += dashLength;
  65482. }
  65483. }
  65484. //longdashdot
  65485. if (style.lineType === 'longdashdot') {
  65486. pattern1 *= 8;
  65487. pattern2 *= 4;
  65488. pattern4 *= 4;
  65489. if (style.lineCap && style.lineCap !== "butt") {
  65490. pattern1 -= dashLength;
  65491. pattern2 += dashLength;
  65492. pattern3 = 1;
  65493. pattern4 += dashLength;
  65494. }
  65495. }
  65496. dashLength = (style.lineWidth || 1)
  65497. * (style.lineType === 'dashed' ? 5 : 1);
  65498. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  65499. for (let i = 1; i < len; i++) {
  65500. SUtil_SUtil.SUtil_dashedLineTo(
  65501. ctx,
  65502. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  65503. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  65504. dashLength,
  65505. [pattern1, pattern2, pattern3, pattern4]
  65506. );
  65507. }
  65508. }
  65509. }
  65510. return;
  65511. }
  65512. /**
  65513. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.getRect
  65514. * @description 计算返回折线包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  65515. *
  65516. * @param {Object} style - style
  65517. * @return {Object} 边框对象。包含属性:x,y,width,height。
  65518. */
  65519. getRect(style) {
  65520. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65521. this.refOriginalPosition = [0, 0];
  65522. }
  65523. var __OP = this.refOriginalPosition;
  65524. return SmicPolygon.prototype.getRect.apply(this, [style, __OP]);
  65525. }
  65526. }
  65527. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicImage.js
  65528. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65529. * This program are made available under the terms of the Apache License, Version 2.0
  65530. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65531. /**
  65532. * @private
  65533. * @class LevelRenderer.Shape.SmicImage
  65534. * @category Visualization Theme
  65535. * @classdesc 图片绘制。
  65536. * @extends LevelRenderer.Shape
  65537. * @example
  65538. * var shape = new LevelRenderer.Shape.SmicImage({
  65539. * style: {
  65540. * image: 'test.jpg',
  65541. * x: 100,
  65542. * y: 100
  65543. * }
  65544. * });
  65545. * levelRenderer.addShape(shape);
  65546. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  65547. *
  65548. */
  65549. class SmicImage extends Shape_Shape {
  65550. constructor(options) {
  65551. super(options);
  65552. /**
  65553. * @member {string} LevelRenderer.Shape.SmicImage.prototype.type
  65554. * @description 图形类型。
  65555. */
  65556. this.type = 'smicimage';
  65557. /**
  65558. * @member {string} LevelRenderer.Shape.SmicImage.prototype._imageCache
  65559. * @description 图片缓存。
  65560. */
  65561. this._imageCache = {};
  65562. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65563. this.refOriginalPosition = [0, 0];
  65564. }
  65565. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicImage";
  65566. }
  65567. /**
  65568. * @function LevelRenderer.Shape.SmicImage.prototype.destroy
  65569. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  65570. */
  65571. destroy() {
  65572. this.type = null;
  65573. this._imageCache = null;
  65574. super.destroy();
  65575. }
  65576. /**
  65577. * @function LevelRenderer.Shape.SmicImage.prototype.buildPath
  65578. * @description 创建图片。
  65579. *
  65580. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  65581. * @param {Object} style - style。
  65582. *
  65583. */
  65584. brush(ctx, isHighlight, refresh) {
  65585. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65586. this.refOriginalPosition = [0, 0];
  65587. }
  65588. var __OP = this.refOriginalPosition;
  65589. var style = this.style || {};
  65590. if (isHighlight) {
  65591. // 根据style扩展默认高亮样式
  65592. style = this.getHighlightStyle(
  65593. style, this.highlightStyle || {}
  65594. );
  65595. }
  65596. var image = style.image;
  65597. var me = this;
  65598. if (typeof(image) === 'string') {
  65599. var src = image;
  65600. if (this._imageCache[src]) {
  65601. image = this._imageCache[src];
  65602. } else {
  65603. image = new Image();
  65604. image.onload = function () {
  65605. image.onload = null;
  65606. clearTimeout(SmicImage._refreshTimeout);
  65607. SmicImage._needsRefresh.push(me);
  65608. // 防止因为缓存短时间内触发多次onload事件
  65609. SmicImage._refreshTimeout = setTimeout(function () {
  65610. refresh && refresh(SmicImage._needsRefresh);
  65611. // 清空 needsRefresh
  65612. SmicImage._needsRefresh = [];
  65613. }, 10);
  65614. };
  65615. image.src = src;
  65616. this._imageCache[src] = image;
  65617. }
  65618. }
  65619. if (image) {
  65620. // 图片已经加载完成
  65621. if (image.nodeName.toUpperCase() == 'IMG') {
  65622. if (window.ActiveXObject) {
  65623. if (image.readyState != 'complete') {
  65624. return;
  65625. }
  65626. } else {
  65627. if (!image.complete) {
  65628. return;
  65629. }
  65630. }
  65631. }
  65632. // Else is canvas
  65633. var width = style.width || image.width;
  65634. var height = style.height || image.height;
  65635. var x = style.x + __OP[0];
  65636. var y = style.y + __OP[1];
  65637. // 图片加载失败
  65638. if (!image.width || !image.height) {
  65639. return;
  65640. }
  65641. ctx.save();
  65642. this.doClip(ctx);
  65643. this.setContext(ctx, style);
  65644. // 设置transform
  65645. this.setTransform(ctx);
  65646. if (style.sWidth && style.sHeight) {
  65647. let sx = (style.sx + __OP[0]) || 0;
  65648. let sy = (style.sy + __OP[1]) || 0;
  65649. ctx.drawImage(
  65650. image,
  65651. sx, sy, style.sWidth, style.sHeight,
  65652. x, y, width, height
  65653. );
  65654. } else if (style.sx && style.sy) {
  65655. let sx = style.sx + __OP[0];
  65656. let sy = style.sy + __OP[1];
  65657. var sWidth = width - sx;
  65658. var sHeight = height - sy;
  65659. ctx.drawImage(
  65660. image,
  65661. sx, sy, sWidth, sHeight,
  65662. x, y, width, height
  65663. );
  65664. } else {
  65665. ctx.drawImage(image, x, y, width, height);
  65666. }
  65667. // 如果没设置宽和高的话自动根据图片宽高设置
  65668. if (!style.width) {
  65669. style.width = width;
  65670. }
  65671. if (!style.height) {
  65672. style.height = height;
  65673. }
  65674. if (!this.style.width) {
  65675. this.style.width = width;
  65676. }
  65677. if (!this.style.height) {
  65678. this.style.height = height;
  65679. }
  65680. this.drawText(ctx, style, this.style);
  65681. ctx.restore();
  65682. }
  65683. }
  65684. /**
  65685. * @function LevelRenderer.Shape.SmicImage.prototype.getRect
  65686. * @description 计算返回图片的包围盒矩形。
  65687. *
  65688. * @param {Object} style - style
  65689. * @return {Object} 边框对象。包含属性:x,y,width,height。
  65690. */
  65691. getRect(style) {
  65692. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65693. this.refOriginalPosition = [0, 0];
  65694. }
  65695. var __OP = this.refOriginalPosition;
  65696. return {
  65697. x: style.x + __OP[0],
  65698. y: style.y + __OP[1],
  65699. width: style.width,
  65700. height: style.height
  65701. };
  65702. }
  65703. /**
  65704. * @function LevelRenderer.Shape.SmicImage.prototype.clearCache
  65705. * @description 清除图片缓存。
  65706. *
  65707. * @param {Object} style - style
  65708. * @return {Object} 边框对象。包含属性:x,y,width,height。
  65709. *
  65710. */
  65711. clearCache() {
  65712. this._imageCache = {};
  65713. }
  65714. }
  65715. SmicImage._needsRefresh = [];
  65716. SmicImage._refreshTimeout = null;
  65717. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRectangle.js
  65718. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65719. * This program are made available under the terms of the Apache License, Version 2.0
  65720. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65721. /**
  65722. * @private
  65723. * @class LevelRenderer.Shape.SmicRectangle
  65724. * @category Visualization Theme
  65725. * @classdesc 矩形。
  65726. * @extends LevelRenderer.Shape
  65727. * @example
  65728. * var shape = new LevelRenderer.Shape.SmicRectangle({
  65729. * style: {
  65730. * x: 0,
  65731. * y: 0,
  65732. * width: 100,
  65733. * height: 100,
  65734. * radius: 20
  65735. * }
  65736. * });
  65737. * levelRenderer.addShape(shape);
  65738. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  65739. */
  65740. class SmicRectangle extends Shape_Shape {
  65741. constructor(options) {
  65742. super(options);
  65743. /**
  65744. * @member {string} LevelRenderer.Shape.SmicRectangle.prototype.type
  65745. * @description 图形类型.
  65746. */
  65747. this.type = 'smicrectangle';
  65748. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65749. this.refOriginalPosition = [0, 0];
  65750. }
  65751. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRectangle";
  65752. }
  65753. /**
  65754. * @function LevelRenderer.Shape.SmicRectangle.prototype.destroy
  65755. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  65756. */
  65757. destroy() {
  65758. this.type = null;
  65759. super.destroy();
  65760. }
  65761. /**
  65762. * APIMethod: _buildRadiusPath
  65763. * 创建矩形的圆角路径。
  65764. *
  65765. * Parameters:
  65766. * ctx - {CanvasRenderingContext2D} Context2D 上下文。
  65767. * style - {Object} style。
  65768. *
  65769. */
  65770. _buildRadiusPath(ctx, style) {
  65771. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65772. this.refOriginalPosition = [0, 0];
  65773. }
  65774. var __OP = this.refOriginalPosition;
  65775. // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4
  65776. // r缩写为1 相当于 [1, 1, 1, 1]
  65777. // r缩写为[1] 相当于 [1, 1, 1, 1]
  65778. // r缩写为[1, 2] 相当于 [1, 2, 1, 2]
  65779. // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]
  65780. var x = style.x + __OP[0];
  65781. var y = style.y + __OP[1];
  65782. var width = style.width;
  65783. var height = style.height;
  65784. var r = style.radius;
  65785. var r1;
  65786. var r2;
  65787. var r3;
  65788. var r4;
  65789. if (typeof r === 'number') {
  65790. r1 = r2 = r3 = r4 = r;
  65791. } else if (r instanceof Array) {
  65792. if (r.length === 1) {
  65793. r1 = r2 = r3 = r4 = r[0];
  65794. } else if (r.length === 2) {
  65795. r1 = r3 = r[0];
  65796. r2 = r4 = r[1];
  65797. } else if (r.length === 3) {
  65798. r1 = r[0];
  65799. r2 = r4 = r[1];
  65800. r3 = r[2];
  65801. } else {
  65802. r1 = r[0];
  65803. r2 = r[1];
  65804. r3 = r[2];
  65805. r4 = r[3];
  65806. }
  65807. } else {
  65808. r1 = r2 = r3 = r4 = 0;
  65809. }
  65810. var total;
  65811. if (r1 + r2 > width) {
  65812. total = r1 + r2;
  65813. r1 *= width / total;
  65814. r2 *= width / total;
  65815. }
  65816. if (r3 + r4 > width) {
  65817. total = r3 + r4;
  65818. r3 *= width / total;
  65819. r4 *= width / total;
  65820. }
  65821. if (r2 + r3 > height) {
  65822. total = r2 + r3;
  65823. r2 *= height / total;
  65824. r3 *= height / total;
  65825. }
  65826. if (r1 + r4 > height) {
  65827. total = r1 + r4;
  65828. r1 *= height / total;
  65829. r4 *= height / total;
  65830. }
  65831. ctx.moveTo(x + r1, y);
  65832. ctx.lineTo(x + width - r2, y);
  65833. r2 !== 0 && ctx.quadraticCurveTo(
  65834. x + width, y, x + width, y + r2
  65835. );
  65836. ctx.lineTo(x + width, y + height - r3);
  65837. r3 !== 0 && ctx.quadraticCurveTo(
  65838. x + width, y + height, x + width - r3, y + height
  65839. );
  65840. ctx.lineTo(x + r4, y + height);
  65841. r4 !== 0 && ctx.quadraticCurveTo(
  65842. x, y + height, x, y + height - r4
  65843. );
  65844. ctx.lineTo(x, y + r1);
  65845. r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
  65846. }
  65847. /**
  65848. * @function LevelRenderer.Shape.SmicRectangle.prototype.buildPath
  65849. * @description 创建矩形路径。
  65850. *
  65851. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  65852. * @param {Object} style - style。
  65853. *
  65854. */
  65855. buildPath(ctx, style) {
  65856. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65857. this.refOriginalPosition = [0, 0];
  65858. }
  65859. var __OP = this.refOriginalPosition;
  65860. if (!style.radius) {
  65861. ctx.moveTo(style.x + __OP[0], style.y + __OP[1]);
  65862. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]));
  65863. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]) + style.height);
  65864. ctx.lineTo((style.x + __OP[0]), (style.y + __OP[1]) + style.height);
  65865. ctx.lineTo(style.x + __OP[0], style.y + __OP[1]);
  65866. // ctx.rect(style.x, style.y, style.width, style.height);
  65867. } else {
  65868. this._buildRadiusPath(ctx, style);
  65869. }
  65870. ctx.closePath();
  65871. return;
  65872. }
  65873. /**
  65874. * @function LevelRenderer.Shape.SmicRectangle.prototype.getRect
  65875. * @description 计算返回矩形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  65876. *
  65877. * @param {Object} style - style
  65878. * @return {Object} 边框对象。包含属性:x,y,width,height。
  65879. */
  65880. getRect(style) {
  65881. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65882. this.refOriginalPosition = [0, 0];
  65883. }
  65884. var __OP = this.refOriginalPosition;
  65885. if (style.__rect) {
  65886. return style.__rect;
  65887. }
  65888. var lineWidth;
  65889. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  65890. lineWidth = style.lineWidth || 1;
  65891. } else {
  65892. lineWidth = 0;
  65893. }
  65894. style.__rect = {
  65895. x: Math.round((style.x + __OP[0]) - lineWidth / 2),
  65896. y: Math.round((style.y + __OP[1]) - lineWidth / 2),
  65897. width: style.width + lineWidth,
  65898. height: style.height + lineWidth
  65899. };
  65900. return style.__rect;
  65901. }
  65902. }
  65903. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicSector.js
  65904. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65905. * This program are made available under the terms of the Apache License, Version 2.0
  65906. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65907. /**
  65908. * @private
  65909. * @class LevelRenderer.Shape.SmicSector
  65910. * @category Visualization Theme
  65911. * @classdesc 扇形。
  65912. * @extends LevelRenderer.Shape
  65913. * @example
  65914. * var shape = new LevelRenderer.Shape.SmicSector({
  65915. * style: {
  65916. * x: 100,
  65917. * y: 100,
  65918. * r: 60,
  65919. * r0: 30,
  65920. * startAngle: 0,
  65921. * endEngle: 180
  65922. * }
  65923. * });
  65924. * levelRenderer.addShape(shape);
  65925. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  65926. *
  65927. */
  65928. class SmicSector extends Shape_Shape {
  65929. constructor(options) {
  65930. super(options);
  65931. /**
  65932. * @member {string} LevelRenderer.Shape.SmicSector.protptype.type
  65933. * @description 图形类型。
  65934. */
  65935. this.type = 'smicsector';
  65936. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65937. this.refOriginalPosition = [0, 0];
  65938. }
  65939. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicSector";
  65940. }
  65941. /**
  65942. * @function LevelRenderer.Shape.SmicSector.prototype.destroy
  65943. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  65944. */
  65945. destroy() {
  65946. this.type = null;
  65947. super.destroy();
  65948. }
  65949. /**
  65950. * @function LevelRenderer.Shape.SmicSector.prototype.buildPath
  65951. * @description 创建扇形路径。
  65952. *
  65953. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  65954. * @param {Object} style - style。
  65955. *
  65956. */
  65957. buildPath(ctx, style) {
  65958. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  65959. this.refOriginalPosition = [0, 0];
  65960. }
  65961. var __OP = this.refOriginalPosition;
  65962. var x = style.x + __OP[0]; // 圆心x
  65963. var y = style.y + __OP[1]; // 圆心y
  65964. var r0 = style.r0 || 0; // 形内半径[0,r)
  65965. var r = style.r; // 扇形外半径(0,r]
  65966. var startAngle = style.startAngle; // 起始角度[0,360)
  65967. var endAngle = style.endAngle; // 结束角度(0,360]
  65968. var clockWise = style.clockWise || false;
  65969. startAngle = SUtil_SUtil.Util_math.degreeToRadian(startAngle);
  65970. endAngle = SUtil_SUtil.Util_math.degreeToRadian(endAngle);
  65971. if (!clockWise) {
  65972. // 扇形默认是逆时针方向,Y轴向上
  65973. // 这个跟arc的标准不一样,为了兼容echarts
  65974. startAngle = -startAngle;
  65975. endAngle = -endAngle;
  65976. }
  65977. var unitX = SUtil_SUtil.Util_math.cos(startAngle);
  65978. var unitY = SUtil_SUtil.Util_math.sin(startAngle);
  65979. ctx.moveTo(
  65980. unitX * r0 + x,
  65981. unitY * r0 + y
  65982. );
  65983. ctx.lineTo(
  65984. unitX * r + x,
  65985. unitY * r + y
  65986. );
  65987. ctx.arc(x, y, r, startAngle, endAngle, !clockWise);
  65988. ctx.lineTo(
  65989. SUtil_SUtil.Util_math.cos(endAngle) * r0 + x,
  65990. SUtil_SUtil.Util_math.sin(endAngle) * r0 + y
  65991. );
  65992. if (r0 !== 0) {
  65993. ctx.arc(x, y, r0, endAngle, startAngle, clockWise);
  65994. }
  65995. ctx.closePath();
  65996. return;
  65997. }
  65998. /**
  65999. * @function LevelRenderer.Shape.SmicSector.prototype.getRect
  66000. * @description 返回扇形包围盒矩形
  66001. *
  66002. * @param {Object} style - style
  66003. * @return {Object} 边框对象。包含属性:x,y,width,height。
  66004. *
  66005. */
  66006. getRect(style) {
  66007. if (style.__rect) {
  66008. return style.__rect;
  66009. }
  66010. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  66011. this.refOriginalPosition = [0, 0];
  66012. }
  66013. var __OP = this.refOriginalPosition;
  66014. var min0 = SUtil_SUtil.Util_vector.create();
  66015. var min1 = SUtil_SUtil.Util_vector.create();
  66016. var max0 = SUtil_SUtil.Util_vector.create();
  66017. var max1 = SUtil_SUtil.Util_vector.create();
  66018. var x = style.x + __OP[0]; // 圆心x
  66019. var y = style.y + __OP[1]; // 圆心y
  66020. var r0 = style.r0 || 0; // 形内半径[0,r)
  66021. var r = style.r; // 扇形外半径(0,r]
  66022. var startAngle = SUtil_SUtil.Util_math.degreeToRadian(style.startAngle);
  66023. var endAngle = SUtil_SUtil.Util_math.degreeToRadian(style.endAngle);
  66024. var clockWise = style.clockWise;
  66025. if (!clockWise) {
  66026. startAngle = -startAngle;
  66027. endAngle = -endAngle;
  66028. }
  66029. if (r0 > 1) {
  66030. SUtil_SUtil.Util_computeBoundingBox.arc(
  66031. x, y, r0, startAngle, endAngle, !clockWise, min0, max0
  66032. );
  66033. } else {
  66034. min0[0] = max0[0] = x;
  66035. min0[1] = max0[1] = y;
  66036. }
  66037. SUtil_SUtil.Util_computeBoundingBox.arc(
  66038. x, y, r, startAngle, endAngle, !clockWise, min1, max1
  66039. );
  66040. SUtil_SUtil.Util_vector.min(min0, min0, min1);
  66041. SUtil_SUtil.Util_vector.max(max0, max0, max1);
  66042. style.__rect = {
  66043. x: min0[0],
  66044. y: min0[1],
  66045. width: max0[0] - min0[0],
  66046. height: max0[1] - min0[1]
  66047. };
  66048. return style.__rect;
  66049. }
  66050. }
  66051. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeFactory.js
  66052. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66053. * This program are made available under the terms of the Apache License, Version 2.0
  66054. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66055. /**
  66056. * @class FeatureShapeFactory
  66057. * @aliasclass Feature.ShapeFactory
  66058. * @deprecatedclass SuperMap.Feature.ShapeFactory
  66059. * @category Visualization Theme
  66060. * @classdesc 图形工厂类。
  66061. * 目前支持创建的图形有:<br>
  66062. * 用于统计专题图:<br>
  66063. * 点 - 参数对象 <{@link ShapeParametersPoint}> <br>
  66064. * 线 - 参数对象 <{@link ShapeParametersLine}> <br>
  66065. * 面 - 参数对象 <{@link ShapeParametersPolygon}> <br>
  66066. * 矩形 - 参数对象 <{@link ShapeParametersPolygon}> <br>
  66067. * 扇形 - 参数对象 <{@link ShapeParametersSector}> <br>
  66068. * 标签 - 参数对象 <{@link ShapeParametersLabel}> <br>
  66069. * 图片 - 参数对象 <{@link ShapeParametersImage}> <br>
  66070. * 用于符号专题图:<br>
  66071. * 圆形 - 参数对象:<{@link ShapeParametersCircle}>
  66072. * @param {Object} [shapeParameters] - 图形参数对象,<{@link ShapeParameters}> 子类对象。
  66073. * @usage
  66074. */
  66075. class ShapeFactory {
  66076. constructor(shapeParameters) {
  66077. /**
  66078. * @member {Object} FeatureShapeFactory.prototype.shapeParameters
  66079. * @description 图形参数对象,<{@link ShapeParameters}> 子类对象。必设参数,默认值 null。
  66080. */
  66081. this.shapeParameters = shapeParameters;
  66082. this.CLASS_NAME = "SuperMap.Feature.ShapeFactory";
  66083. }
  66084. /**
  66085. * @function FeatureShapeFactory.prototype.destroy
  66086. * @description 销毁图形工厂类对象。
  66087. */
  66088. destroy() {
  66089. this.shapeParameters = null;
  66090. }
  66091. /**
  66092. * @function FeatureShapeFactory.prototype.createShape
  66093. * @description 创建一个图形。具体图形由 shapeParameters 决定。
  66094. * @param {Object} shapeParameters - 图形参数对象,<{@link ShapeParameters}> 子类对象。
  66095. * 此参数可选,如果使用此参数(不为 null),shapeParameters 属性值将被修改为参数的值,然后再使用 shapeParameters 属性值创建图形;
  66096. * 如果不使用此参数,createShape 方法将直接使用 shapeParameters 属性创建图形。
  66097. * @returns {Object} 图形对象(或 null - 图形创建失败)。
  66098. */
  66099. createShape(shapeParameters) {
  66100. if (shapeParameters) {
  66101. this.shapeParameters = shapeParameters;
  66102. }
  66103. if (!this.shapeParameters) {
  66104. return null;
  66105. }
  66106. var sps = this.shapeParameters;
  66107. if (sps instanceof Point_Point) { // 点
  66108. //设置style
  66109. let style = new Object();
  66110. style["x"] = sps.x;
  66111. style["y"] = sps.y;
  66112. style["r"] = sps.r;
  66113. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y']);
  66114. //创建图形
  66115. let shape = new SmicPoint();
  66116. shape.style = ShapeFactory.transformStyle(style);
  66117. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  66118. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'style', 'highlightStyle']);
  66119. return shape;
  66120. } else if (sps instanceof Line_Line) { // 线
  66121. //检查参数 pointList 是否存在
  66122. if (!sps.pointList) {
  66123. return null;
  66124. }
  66125. // 设置style
  66126. let style = new Object();
  66127. style["pointList"] = sps.pointList;
  66128. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  66129. // 创建图形
  66130. let shape = new SmicBrokenLine();
  66131. shape.style = ShapeFactory.transformStyle(style);
  66132. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  66133. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', 'highlightStyle']);
  66134. return shape;
  66135. } else if (sps instanceof feature_Polygon_Polygon) { // 面
  66136. //检查参数 pointList 是否存在
  66137. if (!sps.pointList) {
  66138. return null;
  66139. }
  66140. //设置style
  66141. let style = new Object();
  66142. style["pointList"] = sps.pointList;
  66143. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  66144. //创建图形
  66145. let shape = new SmicPolygon();
  66146. shape.style = ShapeFactory.transformStyle(style);
  66147. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  66148. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', "highlightStyle"]);
  66149. return shape;
  66150. } else if (sps instanceof Rectangle_Rectangle) { // 矩形
  66151. //检查参数 pointList 是否存在
  66152. if (!sps.x && !sps.y & !sps.width & !sps.height) {
  66153. return null;
  66154. }
  66155. //设置style
  66156. let style = new Object();
  66157. style["x"] = sps.x;
  66158. style["y"] = sps.y;
  66159. style["width"] = sps.width;
  66160. style["height"] = sps.height;
  66161. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'width', 'height']);
  66162. //创建图形
  66163. let shape = new SmicRectangle();
  66164. shape.style = ShapeFactory.transformStyle(style);
  66165. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  66166. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'width', 'height', 'style', 'highlightStyle']);
  66167. return shape;
  66168. } else if (sps instanceof Sector) { // 扇形
  66169. //设置style
  66170. let style = new Object();
  66171. style["x"] = sps.x;
  66172. style["y"] = sps.y;
  66173. style["r"] = sps.r;
  66174. style["startAngle"] = sps.startAngle;
  66175. style["endAngle"] = sps.endAngle;
  66176. if (sps["r0"]) {
  66177. style["r0"] = sps.r0
  66178. }
  66179. if (sps["clockWise"]) {
  66180. style["clockWise"] = sps.clockWise
  66181. }
  66182. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle']);
  66183. //创建图形
  66184. let shape = new SmicSector();
  66185. shape.style = ShapeFactory.transformStyle(style);
  66186. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  66187. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle', 'style', 'highlightStyle']);
  66188. return shape;
  66189. } else if (sps instanceof Label) { // 标签
  66190. //设置style
  66191. let style = new Object();
  66192. style["x"] = sps.x;
  66193. style["y"] = sps.y;
  66194. style["text"] = sps.text;
  66195. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'text']);
  66196. //创建图形
  66197. let shape = new SmicText();
  66198. shape.style = ShapeFactory.transformStyle(style);
  66199. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  66200. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'text', 'style', 'highlightStyle']);
  66201. return shape;
  66202. } else if (sps instanceof Image_Image) { // 图片
  66203. //设置style
  66204. let style = new Object();
  66205. style["x"] = sps.x;
  66206. style["y"] = sps.y;
  66207. if (sps["image"]) {
  66208. style["image"] = sps.image;
  66209. }
  66210. if (sps["width"]) {
  66211. style["width"] = sps.width;
  66212. }
  66213. if (sps["height"]) {
  66214. style["height"] = sps.height;
  66215. }
  66216. if (sps["sx"]) {
  66217. style["sx"] = sps.sx;
  66218. }
  66219. if (sps["sy"]) {
  66220. style["sy"] = sps.sy;
  66221. }
  66222. if (sps["sWidth"]) {
  66223. style["sWidth"] = sps.sWidth
  66224. }
  66225. if (sps["sHeight"]) {
  66226. style["sHeight"] = sps.sHeight
  66227. }
  66228. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'image', 'width', 'height', 'sx', 'sy', 'sWidth', 'sHeight']);
  66229. //创建图形
  66230. let shape = new SmicImage();
  66231. shape.style = ShapeFactory.transformStyle(style);
  66232. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  66233. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'image', 'width', 'height', 'style', 'highlightStyle']);
  66234. return shape;
  66235. } else if (sps instanceof Circle_Circle) { //圆形 用于符号专题图
  66236. //设置stytle
  66237. let style = new Object();
  66238. style["x"] = sps.x;
  66239. style["r"] = sps.r;
  66240. style["y"] = sps.y;
  66241. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r']);
  66242. //创建图形
  66243. let shape = new SmicCircle();
  66244. shape.style = ShapeFactory.transformStyle(style);
  66245. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  66246. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'style', 'highlightStyle', 'lineWidth', 'text', 'textPosition']);
  66247. return shape;
  66248. }
  66249. return null
  66250. }
  66251. /**
  66252. * @function FeatureShapeFactory.prototype.transformStyle
  66253. * @description 将用户 feature.style (类 Svg style 标准) 的样式,转换为 levelRenderer 的样式标准(类 CSS-Canvas 样式)
  66254. * @param {Object} style - 用户 style。
  66255. * @returns {Object} 符合 levelRenderer 的 style。
  66256. */
  66257. static transformStyle(style) {
  66258. var newStyle = {};
  66259. //字体 ["font-style", "font-variant", "font-weight", "font-size / line-height", "font-family"];
  66260. var fontStr = ["normal", "normal", "normal", "12", "arial,sans-serif"];
  66261. //画笔类型 ["fill", "stroke"];
  66262. var brushType = [true, false];
  66263. for (var ss in style) {
  66264. switch (ss) {
  66265. case "fill":
  66266. brushType[0] = style[ss];
  66267. break;
  66268. case "fillColor":
  66269. newStyle["color"] = style[ss];
  66270. break;
  66271. case "stroke":
  66272. brushType[1] = style[ss];
  66273. break;
  66274. case "strokeWidth":
  66275. newStyle["lineWidth"] = style[ss];
  66276. break;
  66277. case "strokeLinecap":
  66278. newStyle["lineCap"] = style[ss];
  66279. break;
  66280. case "strokeLineJoin":
  66281. newStyle["lineJoin"] = style[ss];
  66282. break;
  66283. case "strokeDashstyle":
  66284. newStyle["lineType"] = style[ss];
  66285. break;
  66286. case "pointRadius":
  66287. newStyle["r"] = style[ss];
  66288. break;
  66289. case "label":
  66290. newStyle["text"] = style[ss];
  66291. break;
  66292. case "labelRect":
  66293. newStyle["labelRect"] = style[ss];
  66294. break;
  66295. case "fontColor":
  66296. newStyle["textColor"] = style[ss];
  66297. break;
  66298. case "fontStyle":
  66299. fontStr[0] = style[ss];
  66300. break;
  66301. case "fontVariant":
  66302. fontStr[1] = style[ss];
  66303. break;
  66304. case "fontWeight":
  66305. fontStr[2] = style[ss];
  66306. break;
  66307. case "fontSize":
  66308. var unit = "";
  66309. if (style[ss] && style[ss].toString().indexOf("px") < 0) {
  66310. unit = "px";
  66311. }
  66312. fontStr[3] = style[ss] + unit;
  66313. break;
  66314. case "fontFamily":
  66315. fontStr[4] = style[ss];
  66316. break;
  66317. case "fontOpacity":
  66318. newStyle["opacity"] = style[ss];
  66319. break;
  66320. case "labelPosition":
  66321. newStyle["textPosition"] = style[ss];
  66322. break;
  66323. case "labelAlign":
  66324. newStyle["textAlign"] = style[ss];
  66325. break;
  66326. case "labelBaseline":
  66327. newStyle["textBaseline"] = style[ss];
  66328. break;
  66329. case "labelRotation":
  66330. newStyle["textRotation"] = style[ss];
  66331. break;
  66332. default:
  66333. newStyle[ss] = style[ss];
  66334. break;
  66335. }
  66336. }
  66337. //拼接字体字符串
  66338. newStyle["textFont"] = fontStr.join(" ");
  66339. //画笔类型
  66340. if (brushType[0] === true && brushType[1] === false) {
  66341. newStyle["brushType"] = "fill";
  66342. } else if (brushType[0] === false && brushType[1] === true) {
  66343. newStyle["brushType"] = "stroke";
  66344. } else if (brushType[0] === true && brushType[1] === true) {
  66345. newStyle["brushType"] = "both";
  66346. } else {
  66347. newStyle["brushType"] = "fill";
  66348. }
  66349. //默认线宽 1
  66350. if (newStyle["lineWidth"] == null) {
  66351. newStyle["lineWidth"] = 1;
  66352. }
  66353. return newStyle;
  66354. }
  66355. /**
  66356. * @function FeatureShapeFactory.prototype.Background
  66357. * @description 创建一个矩形背景框图形对象。
  66358. * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
  66359. * @param {Array.<number>} box - 框区域,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
  66360. * @param {Object} setting - 图表配置参数。本函数中图形配置对象 setting 可设属性:
  66361. * @param {Object} setting.backgroundStyle - 背景样式,此样式对象对象可设属性:<ShapeParametersRectangle#style>。
  66362. * @param {Array.<number>} [setting.backgroundRadius=[0,0,0,0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  66363. * @returns {Object} 背景框图形,一个可视化图形(矩形)对象。
  66364. */
  66365. static Background(shapeFactory, box, setting) {
  66366. var sets = setting ? setting : {};
  66367. // 背景框图形参数对象
  66368. var bgSP = new Rectangle_Rectangle(box[0], box[3], Math.abs(box[2] - box[0]), Math.abs(box[3] - box[1]));
  66369. // 默认样式
  66370. bgSP.style = {
  66371. fillColor: "#f3f3f3"
  66372. };
  66373. // 设置用户 style
  66374. if (sets.backgroundStyle) {
  66375. Util_Util.copyAttributesWithClip(bgSP.style, sets.backgroundStyle);
  66376. }
  66377. // 设置背景框圆角参数
  66378. if (sets.backgroundRadius) {
  66379. bgSP.style["radius"] = sets.backgroundRadius;
  66380. }
  66381. // 禁止背景框响应事件
  66382. bgSP.clickable = false;
  66383. bgSP.hoverable = false;
  66384. return shapeFactory.createShape(bgSP);
  66385. }
  66386. /**
  66387. * @function FeatureShapeFactory.prototype.GraphAxis
  66388. * @description 创建一个统计图表坐标轴图形对象组。
  66389. * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
  66390. * @param {Array.<number>} dataViewBox - 统计图表模型的数据视图框,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
  66391. * @param {Object} setting - 图表配置参数。
  66392. * @param {Object} setting.axisStyle - 坐标轴样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
  66393. * @param {boolean} [setting.axisUseArrow=false] - 坐标轴是否使用箭头。
  66394. * @param {number} [setting.axisYTick=0] - y 轴刻度数量,0表示不使用箭头。
  66395. * @param {Array.<string>} setting.axisYLabels - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  66396. * @param {Object} setting.axisYLabelsStyle - y 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
  66397. * @param {Array.<number>} [setting.axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正,默认值:0。
  66398. * @param {Array.<string>} setting.axisXLabels - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  66399. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xPositions 数量相同(即标签个数与数据个数相等时), 按照 xPositions 提供的位置在水平方向上排布标签,否则沿数据视图框下面条边等距排布标签。
  66400. * @param {Object} setting.axisXLabelsStyle - x 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
  66401. * @param {Array.<number>} [setting.axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:0。
  66402. * @param {boolean} setting.useXReferenceLine - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  66403. * @param {Object} setting.xReferenceLineStyle - 水平参考线样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
  66404. * @param {number} [setting.axis3DParameter=0] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  66405. * @param {Object} xShapeInfo - X 方向上的图形信息对象,包含两个属性。
  66406. * @param {Array.<number>} xShapeInfo.xPositions - 图形在 x 轴方向上的像素坐标值,是一个一维数组,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  66407. * @param {number} xShapeInfo.width - 图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  66408. * @returns {Array.<Object>} 统计图表坐标轴图形对象数组。
  66409. */
  66410. static GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo) {
  66411. var dvb = dataViewBox;
  66412. var sets = setting ? setting : {};
  66413. // 参考线图形对象组
  66414. var refLines = [];
  66415. //坐标轴箭头对象组
  66416. var arrows = [];
  66417. // 是否使用参水平考线,默认不使用
  66418. var isAddRefLine = sets.useXReferenceLine ? sets.useXReferenceLine : false;
  66419. // y 轴上的刻度
  66420. var axisytick = (sets.axisYTick && !isNaN(sets.axisYTick)) ? sets.axisYTick : 0;
  66421. // 坐标轴节点数组
  66422. var pois = [];
  66423. //z 轴箭头数组
  66424. var zArrowPois = [];
  66425. // x,y 轴主干节点数组
  66426. var xMainPois = [];
  66427. if (axisytick == 0) {
  66428. xMainPois.push([dvb[0], dvb[3] - 5]);
  66429. xMainPois.push([dvb[0], dvb[1]]);
  66430. // 3D 坐标轴 第三象限平分线
  66431. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  66432. let axis3DParameter = parseInt(sets.axis3DParameter);
  66433. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  66434. // 添加 3D 轴节点
  66435. if (sets.axisUseArrow) { // 添加 3D 轴箭头节点坐标
  66436. //箭头坐标
  66437. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  66438. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  66439. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  66440. //3D轴
  66441. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  66442. } else {
  66443. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  66444. }
  66445. xMainPois.push([dvb[0], dvb[1]]);
  66446. }
  66447. xMainPois.push([dvb[2] + 5, dvb[1]]);
  66448. } else {
  66449. // 单位刻度长度
  66450. var unitTick = Math.abs(dvb[1] - dvb[3]) / axisytick;
  66451. // 刻度 y 坐标
  66452. var thckY = dvb[3];
  66453. xMainPois.push([dvb[0], thckY - 5]);
  66454. for (var i = 0; i < axisytick; i++) {
  66455. xMainPois.push([dvb[0], thckY]);
  66456. xMainPois.push([dvb[0] - 5, thckY]);
  66457. xMainPois.push([dvb[0], thckY]);
  66458. // 参考线
  66459. if (isAddRefLine) {
  66460. // 参考线参数对象
  66461. var refLineSP = new Line_Line([
  66462. [dvb[0], thckY],
  66463. [dvb[2], thckY]
  66464. ]);
  66465. // 参考线默认样式对象
  66466. refLineSP.style = {
  66467. strokeColor: "#cfcfcf",
  66468. strokeLinecap: "butt",
  66469. strokeLineJoin: "round",
  66470. strokeWidth: 1
  66471. };
  66472. // 禁止事件
  66473. refLineSP.clickable = false;
  66474. refLineSP.hoverable = false;
  66475. // 用户style
  66476. if (sets.xReferenceLineStyle) {
  66477. Util_Util.copyAttributesWithClip(refLineSP.style, sets.xReferenceLineStyle);
  66478. }
  66479. // 生成参考线图形对象
  66480. refLines.push(shapeFactory.createShape(refLineSP))
  66481. }
  66482. // y 刻度增量
  66483. thckY += unitTick;
  66484. }
  66485. xMainPois.push([dvb[0], dvb[1]]);
  66486. // 3D 坐标轴 第三象限平分线
  66487. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  66488. let axis3DParameter = parseInt(sets.axis3DParameter);
  66489. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  66490. /*
  66491. // 箭头计算过程
  66492. var axis3DPoiRef = [axis3DPoi[0] + 7, axis3DPoi[1] - 7]; // 7 是 10 为斜边 cos(45度)时邻边的值
  66493. var axis3DPoiLT = [axis3DPoiRef[0] - 4, axis3DPoiRef[1] - 4];
  66494. var axis3DPoiRB = [axis3DPoiRef[0] + 4, axis3DPoiRef[1] + 4];
  66495. if(sets.axisUseArrow){
  66496. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  66497. xMainPois.push([axis3DPoiLT[0], axis3DPoiLT[1]]);
  66498. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  66499. xMainPois.push([axis3DPoiRB[0], axis3DPoiRB[1]]);
  66500. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  66501. }
  66502. else{
  66503. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  66504. }
  66505. */
  66506. // 添加 3D 轴节点
  66507. if (sets.axisUseArrow) { // 添加 3D 轴和箭头坐标
  66508. //箭头坐标
  66509. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  66510. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  66511. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  66512. //3D轴
  66513. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  66514. } else {
  66515. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  66516. }
  66517. xMainPois.push([dvb[0], dvb[1]]);
  66518. }
  66519. xMainPois.push([dvb[2] + 5, dvb[1]]);
  66520. }
  66521. // 坐标轴箭头
  66522. if (sets.axisUseArrow) {
  66523. // x 轴箭头节点数组
  66524. var xArrowPois = [
  66525. [dvb[2] + 5, dvb[1] + 4],
  66526. [dvb[2] + 13, dvb[1]],
  66527. [dvb[2] + 5, dvb[1] - 4]
  66528. ];
  66529. // y 轴箭头节点数组
  66530. var yArrowPois = [
  66531. [dvb[0] - 4, dvb[3] - 5],
  66532. [dvb[0], dvb[3] - 13],
  66533. [dvb[0] + 4, dvb[3] - 5]
  66534. ];
  66535. //x轴箭头
  66536. var xSP = new feature_Polygon_Polygon(xArrowPois);
  66537. xSP.style = {fillColor: "#008acd"};
  66538. Util_Util.copyAttributesWithClip(xSP.style, sets.axisStyle);
  66539. arrows.push(shapeFactory.createShape(xSP));
  66540. //y轴箭头
  66541. var ySP = new feature_Polygon_Polygon(yArrowPois);
  66542. ySP.style = {fillColor: "#008acd"};
  66543. Util_Util.copyAttributesWithClip(ySP.style, sets.axisStyle);
  66544. arrows.push(shapeFactory.createShape(ySP));
  66545. // z轴箭头 坐标轴箭头是否要使用
  66546. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  66547. var zSP = new feature_Polygon_Polygon(zArrowPois);
  66548. zSP.style = {fillColor: "#008acd"};
  66549. Util_Util.copyAttributesWithClip(zSP.style, sets.axisStyle);
  66550. arrows.push(shapeFactory.createShape(zSP));
  66551. }
  66552. }
  66553. //不带箭头的坐标轴
  66554. pois = xMainPois;
  66555. // 坐标轴参数对象
  66556. var axisSP = new Line_Line(pois);
  66557. // 坐标轴默认style
  66558. axisSP.style = {
  66559. strokeLinecap: "butt",
  66560. strokeLineJoin: "round",
  66561. strokeColor: "#008acd",
  66562. strokeWidth: 1
  66563. };
  66564. // 用户 style
  66565. if (sets.axisStyle) {
  66566. Util_Util.copyAttributesWithClip(axisSP.style, sets.axisStyle);
  66567. }
  66568. // 禁止事件
  66569. axisSP.clickable = false;
  66570. axisSP.hoverable = false;
  66571. // 创建坐标轴图形对象
  66572. var axisMain = [shapeFactory.createShape(axisSP)];
  66573. // Y 轴标签
  66574. var yLabels = [];
  66575. if (sets.axisYLabels && sets.axisYLabels.length && sets.axisYLabels.length > 0) {
  66576. var axisYLabels = sets.axisYLabels;
  66577. let len = axisYLabels.length;
  66578. // 标签偏移量
  66579. var ylOffset = [0, 0];
  66580. if (sets.axisYLabelsOffset && sets.axisYLabelsOffset.length) {
  66581. ylOffset = sets.axisYLabelsOffset;
  66582. }
  66583. if (len == 1) {
  66584. // 标签参数对象
  66585. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], dvb[3] + ylOffset[1], axisYLabels[0]);
  66586. labelYSP.style = {
  66587. labelAlign: "right"
  66588. };
  66589. // 用户 style
  66590. if (sets.axisYLabelsStyle) {
  66591. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  66592. }
  66593. // 禁止事件
  66594. labelYSP.clickable = false;
  66595. labelYSP.hoverable = false;
  66596. // 制作标签
  66597. yLabels.push(shapeFactory.createShape(labelYSP));
  66598. } else {
  66599. var labelY = dvb[3];
  66600. // y 轴标签单位距离
  66601. var yUnit = Math.abs(dvb[1] - dvb[3]) / (len - 1);
  66602. for (var j = 0; j < len; j++) {
  66603. // 标签参数对象
  66604. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], labelY + ylOffset[1], axisYLabels[j]);
  66605. labelYSP.style = {
  66606. labelAlign: "right"
  66607. };
  66608. // 用户 style
  66609. if (sets.axisYLabelsStyle) {
  66610. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  66611. }
  66612. // 禁止事件
  66613. labelYSP.clickable = false;
  66614. labelYSP.hoverable = false;
  66615. // 制作标签
  66616. yLabels.push(shapeFactory.createShape(labelYSP));
  66617. // y 轴标签 y 方向增量
  66618. labelY += yUnit;
  66619. }
  66620. }
  66621. }
  66622. // X 轴标签
  66623. var xLabels = [];
  66624. if (sets.axisXLabels && sets.axisXLabels.length && sets.axisXLabels.length > 0) {
  66625. let axisXLabels = sets.axisXLabels;
  66626. let len = axisXLabels.length;
  66627. // 标签偏移量
  66628. let xlOffset = [0, 0];
  66629. if (sets.axisXLabelsOffset && sets.axisXLabelsOffset.length) {
  66630. xlOffset = sets.axisXLabelsOffset;
  66631. }
  66632. // 标签个数与数据字段个数相等等时,标签在 x 轴均匀排列
  66633. if (xShapeInfo && xShapeInfo.xPositions && xShapeInfo.xPositions.length && xShapeInfo.xPositions.length == len) {
  66634. let xsCenter = xShapeInfo.xPositions;
  66635. for (let K = 0; K < len; K++) {
  66636. // 标签参数对象
  66637. let labelXSP = new Label(xsCenter[K] + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[K]);
  66638. // 默认 style
  66639. labelXSP.style = {
  66640. labelAlign: "center",
  66641. labelBaseline: "top"
  66642. };
  66643. // 用户 style
  66644. if (sets.axisXLabelsStyle) {
  66645. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  66646. }
  66647. // 禁止事件
  66648. labelXSP.clickable = false;
  66649. labelXSP.hoverable = false;
  66650. // 创建标签对象
  66651. xLabels.push(shapeFactory.createShape(labelXSP));
  66652. }
  66653. } else {
  66654. if (len == 1) {
  66655. // 标签参数对象
  66656. let labelXSP = new Label(dvb[0] - 5 + xlOffset[0], dvb[1] + xlOffset[0], axisXLabels[0]);
  66657. // 默认 style
  66658. labelXSP.style = {
  66659. labelAlign: "center",
  66660. labelBaseline: "top"
  66661. };
  66662. // 用户 style
  66663. if (sets.axisXLabelsStyle) {
  66664. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  66665. }
  66666. // 禁止事件
  66667. labelXSP.clickable = false;
  66668. labelXSP.hoverable = false;
  66669. // 创建标签对象
  66670. xLabels.push(shapeFactory.createShape(labelXSP));
  66671. } else {
  66672. let labelX = dvb[0];
  66673. // x 轴标签单位距离
  66674. let xUnit = Math.abs(dvb[2] - dvb[0]) / (len - 1);
  66675. for (let m = 0; m < len; m++) {
  66676. // 标签参数对象
  66677. let labelXSP = new Label(labelX + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[m]);
  66678. // 默认 style
  66679. labelXSP.style = {
  66680. labelAlign: "center",
  66681. labelBaseline: "top"
  66682. };
  66683. // 用户 style
  66684. if (sets.axisXLabelsStyle) {
  66685. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  66686. }
  66687. // 禁止事件
  66688. labelXSP.clickable = false;
  66689. labelXSP.hoverable = false;
  66690. // 创建标签对象
  66691. xLabels.push(shapeFactory.createShape(labelXSP));
  66692. // x 轴标签 x 方向增量
  66693. labelX += xUnit;
  66694. }
  66695. }
  66696. }
  66697. }
  66698. // 组装并返回构成坐标轴的图形
  66699. return ((refLines.concat(axisMain)).concat(yLabels)).concat(xLabels).concat(arrows);
  66700. }
  66701. /**
  66702. * @function FeatureShapeFactory.prototype.ShapeStyleTool
  66703. * @description 一个图形 style 处理工具。此工具将指定的默认 style,通用 style,按 styleGroup 取得的 style 和按数据值 value 范围取得的 style 进行合并,得到图形最终的 style。
  66704. * @param {Object} defaultStyle - 默认style,此样式对象可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。
  66705. * @param {Object} style - 图形对象基础 style,此参数控制图形的基础样式,可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。优先级低于 styleGroup,styleByCodomain。
  66706. * @param {Array.<Object>} styleGroup - 一个 style 数组,优先级低于 styleByCodomain,高于 style。此数组每个元素是样式对象,
  66707. * 其可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。通过 index 参数从 styleGroup 中取 style。
  66708. * @param {Array.<Object>} styleByCodomain - 按数据(参数 value)所在值域范围控制数据的可视化对象样式。
  66709. * (start code)
  66710. * // styleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  66711. * // start: 值域值下限(包含);
  66712. * // end: 值域值上限(不包含);
  66713. * // style: 数据可视化图形的 style,其可设属性根据图形类型参考 <ShapeParameters> 子类对象的 style 属性。
  66714. * // dataStyleByCodomain 数组形如:
  66715. * [
  66716. * {
  66717. * start:0,
  66718. * end:250,
  66719. * style:{
  66720. * fillColor:"#00CD00"
  66721. * }
  66722. * },
  66723. * {
  66724. * start:250,
  66725. * end:500,
  66726. * style:{
  66727. * fillColor:"#00EE00"
  66728. * }
  66729. * },
  66730. * {
  66731. * start:500,
  66732. * end:750,
  66733. * style:{
  66734. * fillColor:"#00FF7F"
  66735. * }
  66736. * },
  66737. * {
  66738. * start:750,
  66739. * end:1500,
  66740. * style:{
  66741. * fillColor:"#00FF00"
  66742. * }
  66743. * }
  66744. * ]
  66745. * (end)
  66746. * @param {number} index - styleGroup 的索引值,用于取出 styleGroup 指定的 style。
  66747. * @param {number} value - 数据值,用于取出 styleByCodomain 指定的 style。
  66748. * @returns {Object} 合并后的样式 (style) 对象。
  66749. */
  66750. static ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value) {
  66751. // 用 defaultStyle 初始化 style 对象
  66752. var finalStyle = defaultStyle ? defaultStyle : {};
  66753. // 基础 style
  66754. if (style) {
  66755. Util_Util.copyAttributesWithClip(finalStyle, style);
  66756. }
  66757. // 按索引赋 style
  66758. if (styleGroup && styleGroup.length && typeof(index) !== "undefined" && !isNaN(index) && index >= 0) {
  66759. if (styleGroup[index]) {
  66760. Util_Util.copyAttributesWithClip(finalStyle, styleGroup[index]);
  66761. }
  66762. }
  66763. // 按值域赋 style
  66764. if (styleByCodomain && styleByCodomain.length && typeof(value) !== "undefined") {
  66765. var dsc = styleByCodomain;
  66766. var dscLen = dsc.length;
  66767. var v = parseFloat(value);
  66768. for (var i = 0; i < dscLen; i++) {
  66769. if (dsc[i].start <= v && v < dsc[i].end) {
  66770. Util_Util.copyAttributesWithClip(finalStyle, dsc[i].style);
  66771. break;
  66772. }
  66773. }
  66774. }
  66775. return finalStyle;
  66776. }
  66777. }
  66778. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Theme.js
  66779. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66780. * This program are made available under the terms of the Apache License, Version 2.0
  66781. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66782. /**
  66783. * @class FeatureTheme
  66784. * @aliasclass Feature.Theme
  66785. * @deprecatedclass SuperMap.Feature.Theme
  66786. * @category Visualization Theme
  66787. * @classdesc 专题要素基类。
  66788. * @param {Object} data - 用户数据,用于生成可视化 shape。
  66789. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  66790. * @usage
  66791. */
  66792. class Theme_Theme {
  66793. constructor(data, layer) {
  66794. if (!data) {
  66795. return;
  66796. }
  66797. // layer 必须已经添加到地图, 且已初始化渲染器
  66798. if (!layer || !layer.map || !layer.renderer) {
  66799. return;
  66800. }
  66801. /**
  66802. * @member {string} FeatureTheme.prototype.id
  66803. * @description 专题要素唯一标识。
  66804. */
  66805. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  66806. /**
  66807. * @member {LonLat} FeatureTheme.prototype.lonlat
  66808. * @description 专题要素地理参考位置。子类中必须根据用户数据(或地理位置参数)对其赋值。
  66809. */
  66810. this.lonlat = null;
  66811. /**
  66812. * @member {Array.<number>} FeatureTheme.prototype.location
  66813. * @description 专题要素像素参考位置。通常由地理参考位置决定。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  66814. */
  66815. this.location = [];
  66816. /**
  66817. * @readonly
  66818. * @member {Object} FeatureTheme.prototype.data
  66819. * @description 用户数据,用于生成可视化 shape,可在子类中规定数据格式或类型,如:<{@link FeatureVector}>。
  66820. */
  66821. this.data = data;
  66822. /**
  66823. * @readonly
  66824. * @member {Array.<Object>} FeatureTheme.prototype.shapes
  66825. * @description 构成此专题要素的可视化图形对象数组,数组顺序控制渲染。
  66826. */
  66827. this.shapes = [];
  66828. /**
  66829. * @readonly
  66830. * @member {SuperMap.Layer.Theme} FeatureTheme.prototype.layer
  66831. * @description 此专题要素所在专题图层。
  66832. */
  66833. this.layer = layer;
  66834. this.CLASS_NAME = "SuperMap.Feature.Theme";
  66835. }
  66836. /**
  66837. * @function FeatureTheme.prototype.destroy
  66838. * @description 销毁专题要素。
  66839. */
  66840. destroy() {
  66841. this.data = null;
  66842. this.id = null;
  66843. this.lonlat = null;
  66844. this.location = null;
  66845. this.shapes = null;
  66846. this.layer = null;
  66847. }
  66848. /**
  66849. * @function FeatureTheme.prototype.getLocalXY
  66850. * @description 地理坐标转为像素坐标。
  66851. * @param {GeometryPoint|GeometryGeoText|LonLat} coordinate - 地理坐标点。
  66852. * @returns {Array.<number>} 长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  66853. */
  66854. getLocalXY(coordinate) {
  66855. var resolution = this.layer.map.getResolution();
  66856. var extent = this.layer.map.getExtent();
  66857. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  66858. let x = (coordinate.x / resolution + (-extent.left / resolution));
  66859. let y = ((extent.top / resolution) - coordinate.y / resolution);
  66860. return [x, y];
  66861. } else if (coordinate instanceof LonLat) {
  66862. let x = (coordinate.lon / resolution + (-extent.left / resolution));
  66863. let y = ((extent.top / resolution) - coordinate.lat / resolution);
  66864. return [x, y];
  66865. } else {
  66866. return null;
  66867. }
  66868. }
  66869. }
  66870. ;// CONCATENATED MODULE: ./src/common/overlay/Graph.js
  66871. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66872. * This program are made available under the terms of the Apache License, Version 2.0
  66873. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66874. /**
  66875. * @class FeatureThemeGraph
  66876. * @aliasclass Feature.Theme.Graph
  66877. * @deprecatedclass SuperMap.Feature.Theme.Graph
  66878. * @category Visualization Theme
  66879. * @classdesc 统计专题要素基类。
  66880. * 此类定义了统计专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  66881. * 统计专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeGraph.setting> 的基础属性只有 7 个,
  66882. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  66883. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  66884. * @extends FeatureTheme
  66885. * @param {FeatureVector} data - 用户数据。
  66886. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  66887. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  66888. * @param {Object} setting - 图表配置对象。
  66889. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  66890. * @usage
  66891. */
  66892. class Graph extends Theme_Theme {
  66893. constructor(data, layer, fields, setting, lonlat, options) {
  66894. super(data, layer, fields, setting, lonlat, options);
  66895. /**
  66896. * @member {FeatureShapeFactory} FeatureThemeGraph.prototype.shapeFactory
  66897. * @description 内置的图形工厂对象,调用其 createShape 方法创建图形。
  66898. */
  66899. this.shapeFactory = new ShapeFactory();
  66900. /**
  66901. * @member {Object} FeatureThemeGraph.prototype.shapeParameters
  66902. * @description 当前图形参数对象,<{@link ShapeParameters}> 的子类对象。
  66903. */
  66904. this.shapeParameters = null;
  66905. /**
  66906. * @member {boolean} [FeatureThemeGraph.prototype.RelativeCoordinate]
  66907. * @description 图形是否已经计算了相对坐标。
  66908. */
  66909. this.RelativeCoordinate = false;
  66910. /**
  66911. * @member {Object} FeatureThemeGraph.prototype.setting
  66912. * @description 图表配置对象,该对象控制着图表的可视化显示。
  66913. * @param {number} width - 专题要素(图表)宽度。
  66914. * @param {number} height - 专题要素(图表)高度。
  66915. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  66916. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  66917. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  66918. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox
  66919. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  66920. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。
  66921. * 如果不设置此参数,在取数据值时不对数据做小数位处理。
  66922. *
  66923. */
  66924. this.setting = null;
  66925. /**
  66926. * @readonly
  66927. * @member {Array.<number>} FeatureThemeGraph.prototype.origonPoint
  66928. * @description 专题要素(图表)原点,图表左上角点像素坐标,是长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  66929. */
  66930. this.origonPoint = null;
  66931. /**
  66932. * @readonly
  66933. * @member {Array.<number>} FeatureThemeGraph.prototype.chartBox
  66934. * @description 专题要素(图表)区域,即图表框,长度为 4 的一维数组,数组的 4 个元素依次表示图表框左端 x 坐标值、
  66935. * 下端 y坐标值、右端 x坐标值、上端 y 坐标值;[left, bottom, right, top]。
  66936. */
  66937. this.chartBox = null;
  66938. /**
  66939. * @readonly
  66940. * @member {Bounds} FeatureThemeGraph.prototype.chartBounds
  66941. * @description 图表 Bounds 随着 lonlat、XOffset、YOffset 更新,注意 chartBounds 是图表像素范围,不是地理范围。
  66942. */
  66943. this.chartBounds = null;
  66944. /**
  66945. * @readonly
  66946. * @member {number} FeatureThemeGraph.prototype.width
  66947. * @description 专题要素(图表)宽度 。
  66948. */
  66949. this.width = null;
  66950. /**
  66951. * @readonly
  66952. * @member {number} FeatureThemeGraph.prototype.height
  66953. * @description 专题要素(图表)高度 。
  66954. */
  66955. this.height = null;
  66956. /**
  66957. * @readonly
  66958. * @member {number} FeatureThemeGraph.prototype.XOffset
  66959. * @description 专题要素(图表)在 X 方向上的偏移值,单位像素。
  66960. */
  66961. this.XOffset = 0;
  66962. /**
  66963. * @readonly
  66964. * @member {number} FeatureThemeGraph.prototype.YOffset
  66965. * @description 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  66966. */
  66967. this.YOffset = 0;
  66968. /**
  66969. * @readonly
  66970. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBParameter
  66971. * @description 数据视图框参数,长度为 4 的一维数组(数组元素值 >= 0),[leftOffset, bottomOffset, rightOffset, topOffset],chartBox 内偏距值。
  66972. * 此属性用于指定数据视图框 dataViewBox 的范围。
  66973. */
  66974. this.DVBParameter = null;
  66975. /**
  66976. * @readonly
  66977. * @member {Array.<number>} FeatureThemeGraph.prototype.dataViewBox
  66978. * @description 数据视图框,长度为 4 的一维数组,[left, bottom, right, top]。
  66979. * dataViewBox 是统计专题要素最核心的内容,它负责解释数据在一个像素区域里的数据可视化含义,
  66980. * 这种含义用可视化图形表达出来,这些表示数据的图形和一些辅助图形组合在一起构成统计专题图表。
  66981. */
  66982. this.dataViewBox = null;
  66983. /**
  66984. * @readonly
  66985. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCodomain
  66986. * @description 数据视图框的内允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  66987. * dataViewBox 中允许的数据范围,对数据溢出值域范围情况的处理需要在 assembleShapes 中进行。
  66988. */
  66989. this.DVBCodomain = null;
  66990. /**
  66991. * @readonly
  66992. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCenterPoint
  66993. * @description 数据视图框中心点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  66994. */
  66995. this.DVBCenterPoint = null;
  66996. /**
  66997. * @readonly
  66998. * @member {string} FeatureThemeGraph.prototype.DVBUnitValue
  66999. * @description 单位值。在 assembleShapes() 中初始化其具体意义,例如:饼图的 DVBUnitValue 可以定义为"360/数据总和",
  67000. * 折线图的 DVBUnitValue 可以定义为 "DVBCodomain/DVBHeight"。
  67001. */
  67002. this.DVBUnitValue = null;
  67003. /**
  67004. * @readonly
  67005. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBOrigonPoint
  67006. * @description 数据视图框原点,数据视图框左上角点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  67007. */
  67008. this.DVBOrigonPoint = null;
  67009. /**
  67010. * @readonly
  67011. * @member {number} FeatureThemeGraph.prototype.DVBWidth
  67012. * @description 数据视图框宽度。
  67013. */
  67014. this.DVBWidth = null;
  67015. /**
  67016. * @readonly
  67017. * @member {number} FeatureThemeGraph.prototype.DVBHeight
  67018. * @description 数据视图框高度。
  67019. */
  67020. this.DVBHeight = null;
  67021. /**
  67022. * @readonly
  67023. * @member {Array.<number>} FeatureThemeGraph.prototype.origonPointOffset
  67024. * @description 数据视图框原点相对于图表框的原点偏移量,长度为 2 的一维数组,第一个元素表示 x 偏移量,第二个元素表示 y 偏移量。
  67025. */
  67026. this.origonPointOffset = null;
  67027. /**
  67028. * @readonly
  67029. * @member {Array.<string>} FeatureThemeGraph.prototype.fields
  67030. * @description 数据{FeatureVector}属性字段。
  67031. */
  67032. this.fields = fields || [];
  67033. /**
  67034. * @readonly
  67035. * @member {Array.<number>} FeatureThemeGraph.prototype.dataValues
  67036. * @description 图表展示的数据值,通过 fields 从数据 feature 属性中获得。
  67037. */
  67038. this.dataValues = null;
  67039. // 图表位置
  67040. if (lonlat) {
  67041. this.lonlat = lonlat;
  67042. } else {
  67043. // 默认使用 bounds 中心
  67044. this.lonlat = this.data.geometry.getBounds().getCenterLonLat();
  67045. }
  67046. // 配置项检测与赋值
  67047. if (setting && setting.width && setting.height && setting.codomain) {
  67048. this.setting = setting;
  67049. }
  67050. this.CLASS_NAME = "SuperMap.Feature.Theme.Graph";
  67051. }
  67052. /**
  67053. * @function FeatureThemeGraph.prototype.destroy
  67054. * @description 销毁专题要素。
  67055. */
  67056. destroy() {
  67057. this.shapeFactory = null;
  67058. this.shapeParameters = null;
  67059. this.width = null;
  67060. this.height = null;
  67061. this.origonPoint = null;
  67062. this.chartBox = null;
  67063. this.dataViewBox = null;
  67064. this.chartBounds = null;
  67065. this.DVBParameter = null;
  67066. this.DVBOrigonPoint = null;
  67067. this.DVBCenterPoint = null;
  67068. this.DVBWidth = null;
  67069. this.DVBHeight = null;
  67070. this.DVBCodomain = null;
  67071. this.DVBUnitValue = null;
  67072. this.origonPointOffset = null;
  67073. this.XOffset = null;
  67074. this.YOffset = null;
  67075. this.fields = null;
  67076. this.dataValues = null;
  67077. this.setting = null;
  67078. super.destroy();
  67079. }
  67080. /**
  67081. * @function FeatureThemeGraph.prototype.initBaseParameter
  67082. * @description 初始化专题要素(图表)基础参数。在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  67083. * 调用此函数关系到 setting 对象的以下属性。
  67084. * @param {number} width - 专题要素(图表)宽度。
  67085. * @param {number} height - 专题要素(图表)高度。
  67086. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  67087. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  67088. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  67089. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox。
  67090. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  67091. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  67092. * @returns {boolean} 初始化参数是否成功。
  67093. */
  67094. initBaseParameter() {
  67095. // 参数初始化是否成功
  67096. var isSuccess = true;
  67097. // setting 属性是否已成功赋值
  67098. if (!this.setting) {
  67099. return false;
  67100. }
  67101. var sets = this.setting;
  67102. // 检测 setting 的必设参数
  67103. if (!(sets.width && sets.height && sets.codomain)) {
  67104. return false;
  67105. }
  67106. // 数据
  67107. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  67108. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  67109. this.dataValues = dataEffective ? dataEffective : [];
  67110. // 基础参数 width, height, codomain
  67111. this.width = parseFloat(sets.width);
  67112. this.height = parseFloat(sets.height);
  67113. this.DVBCodomain = sets.codomain;
  67114. // 图表偏移
  67115. // if(sets.XOffset) {this.XOffset = sets.XOffset};
  67116. // if(sets.YOffset) {this.YOffset = sets.YOffset};
  67117. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  67118. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  67119. // 其他默认值
  67120. this.origonPoint = [];
  67121. this.chartBox = [];
  67122. this.dataViewBox = [];
  67123. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  67124. this.DVBOrigonPoint = [];
  67125. this.DVBCenterPoint = [];
  67126. this.origonPointOffset = [];
  67127. // 图表位置
  67128. this.resetLocation();
  67129. // 专题要素宽度 w
  67130. var w = this.width;
  67131. // 专题要素高度 h
  67132. var h = this.height;
  67133. // 专题要素像素位置 loc
  67134. var loc = this.location;
  67135. // 专题要素像素位置 loc
  67136. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  67137. // 专题要素原点(左上角)
  67138. var op = this.origonPoint;
  67139. // 图表框([left, bottom, right, top])
  67140. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  67141. // 图表框
  67142. var cb = this.chartBox;
  67143. // 数据视图框参数,它是图表框各方向对应的内偏距
  67144. var dbbP = this.DVBParameter;
  67145. // 数据视图框 ([left, bottom, right, top])
  67146. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  67147. // 数据视图框
  67148. var dvb = this.dataViewBox;
  67149. //检查数据视图框是否合法
  67150. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  67151. return false;
  67152. }
  67153. // 数据视图框原点
  67154. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  67155. // 数据视图框宽度
  67156. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  67157. // 数据视图框高度
  67158. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  67159. // 数据视图框中心点
  67160. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2]
  67161. // 数据视图框原点与图表框的原点偏移量
  67162. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  67163. return isSuccess;
  67164. }
  67165. /**
  67166. * @function FeatureThemeGraph.prototype.resetLocation
  67167. * @description 根据地理位置 lonlat 重置专题要素(图表)位置。
  67168. * @param {LonLat} lonlat - 专题要素新的像素中心位置。
  67169. * @returns {Array.<number>} 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  67170. */
  67171. resetLocation(lonlat) {
  67172. if (lonlat) {
  67173. this.lonlat = lonlat;
  67174. }
  67175. // 获取地理位置对应的像素坐标 newLocalLX
  67176. var newLocalLX = this.getLocalXY(this.lonlat);
  67177. // 处理偏移量 XOffset, YOffset
  67178. newLocalLX[0] += this.XOffset;
  67179. newLocalLX[1] += this.YOffset;
  67180. // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
  67181. this.location = newLocalLX;
  67182. // 更新图表像素 Bounds
  67183. var w = this.width;
  67184. var h = this.height;
  67185. var loc = this.location;
  67186. this.chartBounds = new Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
  67187. //重新计算当前渐变色
  67188. this.resetLinearGradient();
  67189. return loc;
  67190. }
  67191. /**
  67192. * @function FeatureThemeGraph.prototype.resetLinearGradient
  67193. * @description resetLocation 中调用 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图渐变色 所以子类实现此方法)。
  67194. */
  67195. resetLinearGradient() {
  67196. //子类实现此方法
  67197. }
  67198. /**
  67199. * @function FeatureThemeGraph.prototype.shapesConvertToRelativeCoordinate
  67200. * @description 将(构成图表)图形的节点转为相对坐标表示,此函数必须且只能在 assembleShapes() 结束时调用。
  67201. */
  67202. shapesConvertToRelativeCoordinate() {
  67203. var shapes = this.shapes;
  67204. var shapeROP = this.location;
  67205. for (var i = 0, len = shapes.length; i < len; i++) {
  67206. shapes[i].refOriginalPosition = shapeROP;
  67207. var style = shapes[i].style;
  67208. for (var sty in style) {
  67209. switch (sty) {
  67210. case "pointList":
  67211. var pl = style[sty];
  67212. for (var j = 0, len2 = pl.length; j < len2; j++) {
  67213. pl[j][0] -= shapeROP[0];
  67214. pl[j][1] -= shapeROP[1];
  67215. }
  67216. break;
  67217. case "x":
  67218. style[sty] -= shapeROP[0];
  67219. break;
  67220. case "y":
  67221. style[sty] -= shapeROP[1];
  67222. break;
  67223. default:
  67224. break;
  67225. }
  67226. }
  67227. }
  67228. this.RelativeCoordinate = true;
  67229. }
  67230. /**
  67231. * @function FeatureThemeGraph.prototype.assembleShapes
  67232. * @description 图形装配函数。抽象方法,可视化子类必须实现此方法。<br>
  67233. * 重写此方法的步骤:<br>
  67234. * 1. 图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。<br>
  67235. * 2. 调用 initBaseParameter() 方法初始化模型属性值,此步骤必须执行,只有当 initBaseParameter 返回 true 时才可以允许进行后续步骤。<br>
  67236. * 3. 计算图形参数,制作图形,图形组合。在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。<br>
  67237. * 4. 调用 shapesConvertToRelativeCoordinate() 方法,将图形的坐标值转为相对坐标,此步骤必须执行。
  67238. * @example
  67239. * //子类实现 assembleShapes() 接口的步骤示例:
  67240. * assembleShapes: function(){
  67241. * // 第一步:图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。此步骤是非必须过程。
  67242. *
  67243. * // 图表配置对象
  67244. * var sets = this.setting;
  67245. * // 默认数据视图框,这里展示在使用坐标轴和不使用坐标轴情况下对数据视图框参数赋予不同的默认值
  67246. * if(!sets.dataViewBoxParameter){
  67247. * if(typeof(sets.useAxis) === "undefined" || sets.useAxis){
  67248. * sets.dataViewBoxParameter = [45, 15, 15, 15];
  67249. * }
  67250. * else{
  67251. * sets.dataViewBoxParameter = [5, 5, 5, 5];
  67252. * }
  67253. * }
  67254. *
  67255. * // 第二步:初始化图表模型基本参数,只有在图表模型基本参数初始化成功时才可模型相关属性,如 this.dataViewBox、 this.DVBCodomain等。此步骤是必须过程。
  67256. * if(!this.initBaseParameter()) return;
  67257. *
  67258. * // 第三步:用图形组装图表,在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。
  67259. * // 定义图表数据视图框中单位值的含义,下面行代码表示将数据视图框单位值定义为数据视图框高度上每像素代表的数据值
  67260. * this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight;
  67261. * var uv = this.DVBUnitValue;
  67262. *
  67263. * // 图形参数计算代码......
  67264. *
  67265. * // 关于图形装配,实际上就是利用图形工程对象 this.shapeFactory 的 createShape() 方法通过图形参数对象创建可视化的图形对象,并把这些图形对象按序添加到模型的图形库(his.shapes)中。下面的代码演示创建一个面图形参数对象,并允许通过图形配置对象设置图形的 style 和 highlightStyle,
  67266. * var barParams = new ShapeParametersPolygon(poiLists);
  67267. * barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"};
  67268. * barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"};
  67269. * // 图形携带数据ID信息
  67270. * barParams.refDataID = this.data.id;
  67271. * // 创建图形并添加到图表图形数组中
  67272. * this.shapes.push(this.shapeFactory.createShape(barParams));
  67273. *
  67274. * // 第四步:调用 shapesConvertToRelativeCoordinate() 方法,将图形库(his.shapes)中的图形转为由相对坐标表示的图形,客户端统计专题图模块从结构上要求可视化图形使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数。此步骤是必须过程。
  67275. * this.shapesConvertToRelativeCoordinate();
  67276. * },
  67277. */
  67278. assembleShapes() {
  67279. //子类必须实现此方法
  67280. }
  67281. /**
  67282. * @function FeatureThemeGraph.prototype.getLocalXY
  67283. * @description 地理坐标转为像素坐标。
  67284. * @param {LonLat} lonlat - 带转换的地理坐标。
  67285. * @returns 屏幕像素坐标。
  67286. */
  67287. getLocalXY(lonlat) {
  67288. return this.layer.getLocalXY(lonlat);
  67289. }
  67290. }
  67291. /**
  67292. * @function FeatureTheme.getDataValues
  67293. * @description 根据字段名数组获取指定数据(feature)的属性值数组。属性值类型必须为 Number。
  67294. * @param {FeatureVector} data - 数据。
  67295. * @param {Array.<string>} [fields] - 字段名数组。
  67296. * @param {number} [decimalNumber] - 小数位处理参数,对获取到的属性数据值进行小数位处理。
  67297. * @returns {Array.<string>} 字段名数组对应的属性数据值数组。
  67298. */
  67299. Theme_Theme.getDataValues = function (data, fields, decimalNumber) {
  67300. if (!data.attributes) {
  67301. return false;
  67302. }
  67303. var fieldsValue = [];
  67304. var attrs = data.attributes;
  67305. for (var i = 0; i < fields.length; i++) {
  67306. for (var field in attrs) {
  67307. if (field !== fields[i]) {
  67308. continue
  67309. }
  67310. // 数字转换判断
  67311. try {
  67312. if (!isNaN(decimalNumber) && decimalNumber >= 0) {
  67313. fieldsValue.push(parseFloat(attrs[field].toString()).toFixed(decimalNumber));
  67314. } else {
  67315. fieldsValue.push(parseFloat(attrs[field].toString()));
  67316. }
  67317. } catch (e) {
  67318. throw new Error("not a number")
  67319. }
  67320. }
  67321. }
  67322. if (fieldsValue.length === fields.length) {
  67323. return fieldsValue;
  67324. } else {
  67325. return false;
  67326. }
  67327. };
  67328. ;// CONCATENATED MODULE: ./src/common/overlay/Bar.js
  67329. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67330. * This program are made available under the terms of the Apache License, Version 2.0
  67331. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67332. /**
  67333. * @class FeatureThemeBar
  67334. * @aliasclass Feature.Theme.Bar
  67335. * @deprecatedclass SuperMap.Feature.Theme.Bar
  67336. * @classdesc 柱状图 。
  67337. * @category Visualization Theme
  67338. * @example
  67339. * // barStyleByCodomain参数用法如下:
  67340. * // barStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  67341. * // start: 值域值下限(包含);
  67342. * // end: 值域值上限(不包含);
  67343. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  67344. * // barStyleByCodomain 数组形如:
  67345. * [
  67346. * {
  67347. * start:0,
  67348. * end:250,
  67349. * style:{
  67350. * fillColor:"#00CD00"
  67351. * }
  67352. * },
  67353. * {
  67354. * start:250,
  67355. * end:500,
  67356. * style:{
  67357. * fillColor:"#00EE00"
  67358. * }
  67359. * },
  67360. * {
  67361. * start:500,
  67362. * end:750,
  67363. * style:{
  67364. * fillColor:"#00FF7F"
  67365. * }
  67366. * },
  67367. * {
  67368. * start:750,
  67369. * end:1500,
  67370. * style:{
  67371. * fillColor:"#00FF00"
  67372. * }
  67373. * }
  67374. * ]
  67375. * @extends FeatureThemeGraph
  67376. * @param {FeatureVector} data - 用户数据。
  67377. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  67378. * @param {Array.<string>} fields - data 属性中的参与此图表生成的属性字段名称。
  67379. * @param {FeatureThemeBar.setting} setting - 图表配置对象。
  67380. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  67381. * @usage
  67382. * @private
  67383. */
  67384. class Bar extends Graph {
  67385. constructor(data, layer, fields, setting, lonlat) {
  67386. super(data, layer, fields, setting, lonlat);
  67387. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar";
  67388. }
  67389. /**
  67390. * @function FeatureThemeBar.prototype.destroy
  67391. * @override
  67392. */
  67393. destroy() {
  67394. super.destroy();
  67395. }
  67396. /**
  67397. * @function FeatureThemeBar.prototype.assembleShapes
  67398. * @description 图表图形装配函数。
  67399. */
  67400. assembleShapes() {
  67401. //默认渐变颜色数组
  67402. var deafaultColors = [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]];
  67403. //默认阴影
  67404. var deafaultShawdow = {
  67405. showShadow: true,
  67406. shadowBlur: 8,
  67407. shadowColor: "rgba(100,100,100,0.8)",
  67408. shadowOffsetX: 2,
  67409. shadowOffsetY: 2
  67410. };
  67411. // 图表配置对象
  67412. var sets = this.setting;
  67413. if (!sets.barLinearGradient) {
  67414. sets.barLinearGradient = deafaultColors;
  67415. }
  67416. // 默认数据视图框
  67417. if (!sets.dataViewBoxParameter) {
  67418. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  67419. sets.dataViewBoxParameter = [45, 15, 15, 15];
  67420. } else {
  67421. sets.dataViewBoxParameter = [5, 5, 5, 5];
  67422. }
  67423. }
  67424. // 重要步骤:初始化参数
  67425. if (!this.initBaseParameter()) {
  67426. return;
  67427. }
  67428. // 值域
  67429. var codomain = this.DVBCodomain;
  67430. // 重要步骤:定义图表 BaFeatureThemeBarr 数据视图框中单位值的含义
  67431. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  67432. // 数据视图域
  67433. var dvb = this.dataViewBox;
  67434. // 用户数据值
  67435. var fv = this.dataValues;
  67436. if (fv.length < 1) {
  67437. return;
  67438. } // 没有数据
  67439. // 数据溢出值域范围处理
  67440. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  67441. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  67442. return;
  67443. }
  67444. }
  67445. // 获取 x 轴上的图形信息
  67446. var xShapeInfo = this.calculateXShapeInfo();
  67447. if (!xShapeInfo) {
  67448. return;
  67449. }
  67450. // 每个柱条 x 位置
  67451. var xsLoc = xShapeInfo.xPositions;
  67452. // 柱条宽度
  67453. var xsWdith = xShapeInfo.width;
  67454. // 背景框,默认启用
  67455. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  67456. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  67457. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  67458. }
  67459. // 坐标轴, 默认启用
  67460. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  67461. // 添加坐标轴图形数组
  67462. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  67463. }
  67464. for (var i = 0; i < fv.length; i++) {
  67465. // 计算柱条 top 边的 y 轴坐标值
  67466. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  67467. // 柱条节点数组
  67468. var poiLists = [
  67469. [xsLoc[i] - xsWdith / 2, dvb[1] - 1],
  67470. [xsLoc[i] + xsWdith / 2, dvb[1] - 1],
  67471. [xsLoc[i] + xsWdith / 2, yPx],
  67472. [xsLoc[i] - xsWdith / 2, yPx]
  67473. ];
  67474. // 柱条参数对象(一个面参数对象)
  67475. var barParams = new feature_Polygon_Polygon(poiLists);
  67476. // 柱条 阴影 style
  67477. if (typeof(sets.showShadow) === "undefined" || sets.showShadow) {
  67478. if (sets.barShadowStyle) {
  67479. var sss = sets.barShadowStyle;
  67480. if (sss.shadowBlur) {
  67481. deafaultShawdow.shadowBlur = sss.shadowBlur;
  67482. }
  67483. if (sss.shadowColor) {
  67484. deafaultShawdow.shadowColor = sss.shadowColor;
  67485. }
  67486. if (sss.shadowOffsetX) {
  67487. deafaultShawdow.shadowOffsetX = sss.shadowOffsetX;
  67488. }
  67489. if (sss.shadowOffsetY) {
  67490. deafaultShawdow.shadowOffsetY = sss.shadowOffsetY;
  67491. }
  67492. }
  67493. barParams.style = {};
  67494. Util_Util.copyAttributesWithClip(barParams.style, deafaultShawdow);
  67495. }
  67496. // 图形携带的数据信息
  67497. barParams.refDataID = this.data.id;
  67498. barParams.dataInfo = {
  67499. field: this.fields[i],
  67500. value: fv[i]
  67501. };
  67502. // 柱条 hover click
  67503. if (typeof(sets.barHoverAble) !== "undefined") {
  67504. barParams.hoverable = sets.barHoverAble;
  67505. }
  67506. if (typeof(sets.barClickAble) !== "undefined") {
  67507. barParams.clickable = sets.barClickAble;
  67508. }
  67509. // 创建柱条并添加到图表图形数组中
  67510. this.shapes.push(this.shapeFactory.createShape(barParams));
  67511. }
  67512. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  67513. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  67514. this.shapesConvertToRelativeCoordinate();
  67515. }
  67516. /**
  67517. * @function FeatureThemeBar.prototype.calculateXShapeInfo
  67518. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  67519. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  67520. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  67521. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  67522. * 本函数中图形配置对象 setting 可设属性:
  67523. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  67524. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  67525. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  67526. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  67527. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  67528. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  67529. *
  67530. */
  67531. calculateXShapeInfo() {
  67532. var dvb = this.dataViewBox; // 数据视图框
  67533. var sets = this.setting; // 图表配置对象
  67534. var fvc = this.dataValues.length; // 数组值个数
  67535. if (fvc < 1) {
  67536. return null;
  67537. }
  67538. var xBlank; // x 轴空白间隔参数
  67539. var xShapePositions = []; // x 轴上图形的位置
  67540. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  67541. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  67542. // x 轴空白间隔参数处理
  67543. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  67544. xBlank = sets.xShapeBlank;
  67545. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1]);
  67546. if (xsLen <= fvc) {
  67547. return null;
  67548. }
  67549. xShapeWidth = xsLen / fvc
  67550. } else {
  67551. // 默认使用等距离空白间隔,空白间隔为图形宽度
  67552. xShapeWidth = dvbWidth / (2 * fvc + 1);
  67553. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  67554. }
  67555. // 图形 x 轴上的位置计算
  67556. var xOffset = 0
  67557. for (var i = 0; i < fvc; i++) {
  67558. if (i == 0) {
  67559. xOffset = xBlank[0] + xShapeWidth / 2;
  67560. } else {
  67561. xOffset += (xShapeWidth + xBlank[1]);
  67562. }
  67563. xShapePositions.push(dvb[0] + xOffset);
  67564. }
  67565. return {
  67566. "xPositions": xShapePositions,
  67567. "width": xShapeWidth
  67568. };
  67569. }
  67570. /**
  67571. * @function FeatureThemeBar.prototype.resetLinearGradient
  67572. * @description 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图 所以子类实现此方法)。
  67573. */
  67574. resetLinearGradient() {
  67575. if (this.RelativeCoordinate) {
  67576. var shpelength = this.shapes.length;
  67577. var barLinearGradient = this.setting.barLinearGradient;
  67578. var index = -1;
  67579. for (var i = 0; i < shpelength; i++) {
  67580. var shape = this.shapes[i];
  67581. if (shape.CLASS_NAME === "SuperMap.LevelRenderer.Shape.SmicPolygon") {
  67582. var style = shape.style;
  67583. //计算出当前的绝对 x y
  67584. var x1 = this.location[0] + style.pointList[0][0];
  67585. var x2 = this.location[0] + style.pointList[1][0];
  67586. //渐变颜色
  67587. index++;
  67588. //以防定义的颜色数组不够用
  67589. if (index >= barLinearGradient.length) {
  67590. index = index % barLinearGradient.length;
  67591. }
  67592. var color1 = barLinearGradient[index][0];
  67593. var color2 = barLinearGradient[index][1];
  67594. //颜色
  67595. var zcolor = new Color();
  67596. var linearGradient = zcolor.getLinearGradient(x1, 0, x2, 0,
  67597. [[0, color1], [1, color2]]);
  67598. //赋值
  67599. shape.style.color = linearGradient;
  67600. }
  67601. }
  67602. }
  67603. }
  67604. }
  67605. ;// CONCATENATED MODULE: ./src/common/overlay/Bar3D.js
  67606. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67607. * This program are made available under the terms of the Apache License, Version 2.0
  67608. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67609. /**
  67610. * @class FeatureThemeBar3D
  67611. * @aliasclass Feature.Theme.Bar3D
  67612. * @deprecatedclass SuperMap.Feature.Theme.Bar3D
  67613. * @classdesc 三维柱状图 。
  67614. * @category Visualization Theme
  67615. * @extends FeatureThemeGraph
  67616. * @param {FeatureVector} data - 用户数据。
  67617. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  67618. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  67619. * @param {FeatureThemeBar3D.setting} setting - 图表配置对象。
  67620. * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  67621. *
  67622. *
  67623. * @example
  67624. * // barFaceStyleByCodomain 用法示例如下:
  67625. * // barFaceStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  67626. * // start: 值域值下限(包含);
  67627. * // end: 值域值上限(不包含);
  67628. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  67629. * // barFaceStyleByCodomain 数组形如:
  67630. * [
  67631. * {
  67632. * start:0,
  67633. * end:250,
  67634. * style:{
  67635. * fillColor:"#00CD00"
  67636. * }
  67637. * },
  67638. * {
  67639. * start:250,
  67640. * end:500,
  67641. * style:{
  67642. * fillColor:"#00EE00"
  67643. * }
  67644. * },
  67645. * {
  67646. * start:500,
  67647. * end:750,
  67648. * style:{
  67649. * fillColor:"#00FF7F"
  67650. * }
  67651. * },
  67652. * {
  67653. * start:750,
  67654. * end:1500,
  67655. * style:{
  67656. * fillColor:"#00FF00"
  67657. * }
  67658. * }
  67659. * ]
  67660. *
  67661. * @example
  67662. * // barSideStyleByCodomain 用法示例如下:
  67663. * // barSideStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  67664. * // start: 值域值下限(包含);
  67665. * // end: 值域值上限(不包含);
  67666. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  67667. * // barSideStyleByCodomain 数组形如:
  67668. * [
  67669. * {
  67670. * start:0,
  67671. * end:250,
  67672. * style:{
  67673. * fillColor:"#00CD00"
  67674. * }
  67675. * },
  67676. * {
  67677. * start:250,
  67678. * end:500,
  67679. * style:{
  67680. * fillColor:"#00EE00"
  67681. * }
  67682. * },
  67683. * {
  67684. * start:500,
  67685. * end:750,
  67686. * style:{
  67687. * fillColor:"#00FF7F"
  67688. * }
  67689. * },
  67690. * {
  67691. * start:750,
  67692. * end:1500,
  67693. * style:{
  67694. * fillColor:"#00FF00"
  67695. * }
  67696. * }
  67697. * ]
  67698. *
  67699. * @example
  67700. * // barTopStyleByCodomain 用法示例如下:
  67701. * // barTopStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  67702. * // start: 值域值下限(包含);
  67703. * // end: 值域值上限(不包含);
  67704. * // style: 数据可视化图形的 style,这个样式对象的可设属性:<ShapeParametersPolygon.style> 。
  67705. * // barTopStyleByCodomain 数组形如:
  67706. * [
  67707. * {
  67708. * start:0,
  67709. * end:250,
  67710. * style:{
  67711. * fillColor:"#00CD00"
  67712. * }
  67713. * },
  67714. * {
  67715. * start:250,
  67716. * end:500,
  67717. * style:{
  67718. * fillColor:"#00EE00"
  67719. * }
  67720. * },
  67721. * {
  67722. * start:500,
  67723. * end:750,
  67724. * style:{
  67725. * fillColor:"#00FF7F"
  67726. * }
  67727. * },
  67728. * {
  67729. * start:750,
  67730. * end:1500,
  67731. * style:{
  67732. * fillColor:"#00FF00"
  67733. * }
  67734. * }
  67735. * ]
  67736. * @usage
  67737. * @private
  67738. */
  67739. class Bar3D extends Graph {
  67740. constructor(data, layer, fields, setting, lonlat) {
  67741. super(data, layer, fields, setting, lonlat);
  67742. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar3D";
  67743. }
  67744. /**
  67745. * @function FeatureThemeBar3D.prototype.destroy
  67746. * @override
  67747. */
  67748. destroy() {
  67749. super.destroy();
  67750. }
  67751. /**
  67752. * @function FeatureThemeBar3D.prototype.assembleShapes
  67753. * @description 图形装配实现(扩展接口)。
  67754. */
  67755. assembleShapes() {
  67756. // 图表配置对象
  67757. var sets = this.setting;
  67758. // 默认数据视图框
  67759. if (!sets.dataViewBoxParameter) {
  67760. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  67761. sets.dataViewBoxParameter = [45, 25, 20, 20];
  67762. } else {
  67763. sets.dataViewBoxParameter = [5, 5, 5, 5];
  67764. }
  67765. }
  67766. // 3d 柱图的坐标轴默认使用坐标轴箭头
  67767. sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
  67768. sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
  67769. // 重要步骤:初始化参数
  67770. if (!this.initBaseParameter()) {
  67771. return;
  67772. }
  67773. // 值域
  67774. var codomain = this.DVBCodomain;
  67775. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  67776. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  67777. // 数据视图域
  67778. var dvb = this.dataViewBox;
  67779. // 用户数据值
  67780. var fv = this.dataValues;
  67781. if (fv.length < 1) {
  67782. return;
  67783. } // 没有数据
  67784. // 数据溢出值域范围处理
  67785. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  67786. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  67787. return;
  67788. }
  67789. }
  67790. // 获取 x 轴上的图形信息
  67791. var xShapeInfo = this.calculateXShapeInfo();
  67792. if (!xShapeInfo) {
  67793. return;
  67794. }
  67795. // 每个柱条 x 位置
  67796. var xsLoc = xShapeInfo.xPositions;
  67797. // 柱条宽度
  67798. var xsWdith = xShapeInfo.width;
  67799. // 坐标轴, 默认启用
  67800. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  67801. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  67802. }
  67803. // 坐标轴
  67804. if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {
  67805. sets.axis3DParameter = 20;
  67806. }
  67807. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  67808. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  67809. }
  67810. // 3d 偏移量, 默认值 10;
  67811. var offset3d = (sets.bar3DParameter && !isNaN(sets.bar3DParameter)) ? sets.bar3DParameter : 10;
  67812. for (let i = 0; i < fv.length; i++) {
  67813. // 无 3d 偏移量时的柱面顶部 y 坐标
  67814. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  67815. // 无 3d 偏移量时的柱面的左、右端 x 坐标
  67816. var iPoiL = xsLoc[i] - xsWdith / 2;
  67817. var iPoiR = xsLoc[i] + xsWdith / 2;
  67818. // 3d 柱顶面节点
  67819. var bar3DTopPois = [
  67820. [iPoiL, yPx],
  67821. [iPoiR, yPx],
  67822. [iPoiR - offset3d, yPx + offset3d],
  67823. [iPoiL - offset3d, yPx + offset3d]
  67824. ];
  67825. // 3d 柱侧面节点
  67826. var bar3DSidePois = [
  67827. [iPoiR, yPx],
  67828. [iPoiR - offset3d, yPx + offset3d],
  67829. [iPoiR - offset3d, dvb[1] + offset3d],
  67830. [iPoiR, dvb[1]]
  67831. ];
  67832. // 3d 柱正面节点
  67833. var bar3DFacePois = [
  67834. [iPoiL - offset3d, dvb[1] + offset3d],
  67835. [iPoiR - offset3d, dvb[1] + offset3d],
  67836. [iPoiR - offset3d, yPx + offset3d],
  67837. [iPoiL - offset3d, yPx + offset3d]
  67838. ];
  67839. if (offset3d <= 0) { // offset3d <= 0 时正面不偏移
  67840. bar3DFacePois = [
  67841. [iPoiL, dvb[1]],
  67842. [iPoiR, dvb[1]],
  67843. [iPoiR, yPx],
  67844. [iPoiL, yPx]
  67845. ];
  67846. }
  67847. // 新建 3d 柱面顶面、侧面、正面图形参数对象
  67848. var polyTopSP = new feature_Polygon_Polygon(bar3DTopPois);
  67849. var polySideSP = new feature_Polygon_Polygon(bar3DSidePois);
  67850. var polyFaceSP = new feature_Polygon_Polygon(bar3DFacePois);
  67851. // 侧面、正面图形 style 默认值
  67852. sets.barSideStyle = sets.barSideStyle ? sets.barSideStyle : sets.barFaceStyle;
  67853. sets.barSideStyleByFields = sets.barSideStyleByFields ? sets.barSideStyleByFields : sets.barFaceStyleByFields;
  67854. sets.barSideStyleByCodomain = sets.barSideStyleByCodomain ? sets.barSideStyleByCodomain : sets.barFaceStyleByCodomain;
  67855. sets.barTopStyle = sets.barTopStyle ? sets.barTopStyle : sets.barFaceStyle;
  67856. sets.barTopStyleByFields = sets.barTopStyleByFields ? sets.barTopStyleByFields : sets.barFaceStyleByFields;
  67857. sets.barTopStyleByCodomain = sets.barTopStyleByCodomain ? sets.barTopStyleByCodomain : sets.barFaceStyleByCodomain;
  67858. // 顶面、侧面、正面图形 style
  67859. polyFaceSP.style = ShapeFactory.ShapeStyleTool({
  67860. stroke: true,
  67861. strokeColor: "#ffffff",
  67862. fillColor: "#ee9900"
  67863. },
  67864. sets.barFaceStyle, sets.barFaceStyleByFields, sets.barFaceStyleByCodomain, i, fv[i]);
  67865. polySideSP.style = ShapeFactory.ShapeStyleTool({
  67866. stroke: true,
  67867. strokeColor: "#ffffff",
  67868. fillColor: "#ee9900"
  67869. },
  67870. sets.barSideStyle, sets.barSideStyleByFields, sets.barSideStyleByCodomain, i, fv[i]);
  67871. polyTopSP.style = ShapeFactory.ShapeStyleTool({
  67872. stroke: true,
  67873. strokeColor: "#ffffff",
  67874. fillColor: "#ee9900"
  67875. },
  67876. sets.barTopStyle, sets.barTopStyleByFields, sets.barTopStyleByCodomain, i, fv[i]);
  67877. // 3d 柱条高亮样式
  67878. sets.barSideHoverStyle = sets.barSideHoverStyle ? sets.barSideHoverStyle : sets.barFaceHoverStyle;
  67879. sets.barTopHoverStyle = sets.barTopHoverStyle ? sets.barTopHoverStyle : sets.barFaceHoverStyle;
  67880. polyFaceSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barFaceHoverStyle);
  67881. polySideSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barSideHoverStyle);
  67882. polyTopSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barTopHoverStyle);
  67883. // 图形携带的数据 id 信息 & 高亮模式
  67884. polyTopSP.refDataID = polySideSP.refDataID = polyFaceSP.refDataID = this.data.id;
  67885. // hover 模式(组合)
  67886. polyTopSP.isHoverByRefDataID = polySideSP.isHoverByRefDataID = polyFaceSP.isHoverByRefDataID = true;
  67887. // 高亮组(当鼠标 hover 到组内任何一个图形,整个组的图形都会高亮。refDataHoverGroup 在 isHoverByRefDataID 为 true 时有效)
  67888. polyTopSP.refDataHoverGroup = polySideSP.refDataHoverGroup = polyFaceSP.refDataHoverGroup = Util_Util.createUniqueID("lr_shg");
  67889. // 图形携带的数据信息
  67890. polyTopSP.dataInfo = polySideSP.dataInfo = polyFaceSP.dataInfo = {
  67891. field: this.fields[i],
  67892. value: fv[i]
  67893. };
  67894. // 3d 柱条顶面、侧面、正面图形 hover click 设置
  67895. if (typeof(sets.barHoverAble) !== "undefined") {
  67896. polyTopSP.hoverable = polySideSP.hoverable = polyFaceSP.hoverable = sets.barHoverAble;
  67897. }
  67898. if (typeof(sets.barClickAble) !== "undefined") {
  67899. polyTopSP.clickable = polySideSP.clickable = polyFaceSP.clickable = sets.barClickAble;
  67900. }
  67901. // 创建3d 柱条的顶面、侧面、正面图形并添加到图表的图形列表数组
  67902. this.shapes.push(this.shapeFactory.createShape(polySideSP));
  67903. this.shapes.push(this.shapeFactory.createShape(polyTopSP));
  67904. this.shapes.push(this.shapeFactory.createShape(polyFaceSP));
  67905. }
  67906. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  67907. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  67908. this.shapesConvertToRelativeCoordinate();
  67909. }
  67910. /**
  67911. * @function FeatureThemeBar3D.prototype.calculateXShapeInfo
  67912. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  67913. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  67914. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  67915. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  67916. * 本函数中图形配置对象 setting 可设属性:
  67917. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  67918. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  67919. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  67920. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  67921. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  67922. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  67923. */
  67924. calculateXShapeInfo() {
  67925. var dvb = this.dataViewBox; // 数据视图框
  67926. var sets = this.setting; // 图表配置对象
  67927. var fvc = this.dataValues.length; // 数组值个数
  67928. if (fvc < 1) {
  67929. return null;
  67930. }
  67931. var xBlank; // x 轴空白间隔参数
  67932. var xShapePositions = []; // x 轴上图形的位置
  67933. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  67934. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  67935. // x 轴空白间隔参数处理
  67936. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  67937. xBlank = sets.xShapeBlank;
  67938. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1])
  67939. if (xsLen <= fvc) {
  67940. return null;
  67941. }
  67942. xShapeWidth = xsLen / fvc
  67943. } else {
  67944. // 默认使用等距离空白间隔,空白间隔为图形宽度
  67945. xShapeWidth = dvbWidth / (2 * fvc + 1);
  67946. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  67947. }
  67948. // 图形 x 轴上的位置计算
  67949. var xOffset = 0
  67950. for (var i = 0; i < fvc; i++) {
  67951. if (i == 0) {
  67952. xOffset = xBlank[0] + xShapeWidth / 2;
  67953. } else {
  67954. xOffset += (xShapeWidth + xBlank[1]);
  67955. }
  67956. xShapePositions.push(dvb[0] + xOffset);
  67957. }
  67958. return {
  67959. "xPositions": xShapePositions,
  67960. "width": xShapeWidth
  67961. };
  67962. }
  67963. }
  67964. ;// CONCATENATED MODULE: ./src/common/overlay/RankSymbol.js
  67965. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67966. * This program are made available under the terms of the Apache License, Version 2.0
  67967. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67968. /**
  67969. * @class FeatureThemeRankSymbol
  67970. * @aliasclass Feature.Theme.RankSymbol
  67971. * @deprecatedclass SuperMap.Feature.Theme.RankSymbol
  67972. * @category Visualization Theme
  67973. * @classdesc 符号专题要素基类。此类定义了符号专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  67974. * 符号专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeRankSymbol.setting> 的基础属性只有 5 个,
  67975. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  67976. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  67977. * @param {FeatureVector} data - 用户数据。
  67978. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  67979. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  67980. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  67981. * @param {Object} setting - 图表配置对象。除了以下 5 个基础属性,此对象的可设属性在不同子类中有较大差异,不同子类中对同一属性的解释也可能不同,请在此类的子类中查看 setting 对象的可设属性和属性含义。
  67982. * @param {Array.<number>} setting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  67983. * @param {number} [setting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  67984. * @param {number} [setting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  67985. * @param {Array.<number>} [setting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  67986. * @param {number} [setting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  67987. * @extends FeatureThemeGraph
  67988. * @usage
  67989. */
  67990. class RankSymbol extends Graph {
  67991. constructor(data, layer, fields, setting, lonlat, options) {
  67992. super(data, layer, fields, setting, lonlat, options);
  67993. /**
  67994. * @member {Object} FeatureThemeRankSymbol.prototype.setting
  67995. * @description 符号配置对象,该对象控制着图表的可视化显示。
  67996. */
  67997. this.setting = null;
  67998. // 配置项检测与赋值
  67999. if (setting && setting.codomain) {
  68000. this.setting = setting;
  68001. this.DVBCodomain = this.setting.codomain;
  68002. }
  68003. this.CLASS_NAME = "SuperMap.Feature.Theme.RankSymbol";
  68004. }
  68005. /**
  68006. * @function FeatureThemeRankSymbol.prototype.destroy
  68007. * @description 销毁专题要素。
  68008. */
  68009. destroy() {
  68010. this.setting = null;
  68011. super.destroy();
  68012. }
  68013. /**
  68014. * @function FeatureThemeRankSymbol.prototype.initBaseParameter
  68015. * @description 初始化专题要素(图形)基础参数。
  68016. * 在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  68017. * 调用此函数关系到 setting 对象的以下属性。
  68018. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  68019. * @param {number} [XOffset] - 专题要素(图形)在 X 方向上的偏移值,单位像素。
  68020. * @param {number} [YOffset] - 专题要素(图形)在 Y 方向上的偏移值,单位像素。
  68021. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图形框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  68022. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  68023. * @returns {boolean} 初始化参数是否成功。
  68024. */
  68025. initBaseParameter() {
  68026. // 参数初始化是否成功
  68027. var isSuccess = true;
  68028. // setting 属性是否已成功赋值
  68029. if (!this.setting) {
  68030. return false;
  68031. }
  68032. var sets = this.setting;
  68033. // 图表偏移
  68034. if (sets.XOffset) {
  68035. this.XOffset = sets.XOffset;
  68036. }
  68037. if (sets.YOffset) {
  68038. this.YOffset = sets.YOffset;
  68039. }
  68040. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  68041. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  68042. // 其他默认值
  68043. this.origonPoint = [];
  68044. this.chartBox = [];
  68045. this.dataViewBox = [];
  68046. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  68047. this.DVBOrigonPoint = [];
  68048. this.DVBCenterPoint = [];
  68049. this.origonPointOffset = [];
  68050. // 图表位置
  68051. this.resetLocation();
  68052. // 专题要素宽度 w
  68053. var w = this.width;
  68054. // 专题要素高度 h
  68055. var h = this.height;
  68056. // 专题要素像素位置 loc
  68057. var loc = this.location;
  68058. // 专题要素像素位置 loc
  68059. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  68060. // 专题要素原点(左上角)
  68061. var op = this.origonPoint;
  68062. // 图表框([left, bottom, right, top])
  68063. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  68064. // 图表框
  68065. var cb = this.chartBox;
  68066. // 数据视图框参数,它是图表框各方向对应的内偏距
  68067. var dbbP = this.DVBParameter;
  68068. // 数据视图框 ([left, bottom, right, top])
  68069. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  68070. // 数据视图框
  68071. var dvb = this.dataViewBox;
  68072. //检查数据视图框是否合法
  68073. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  68074. return false;
  68075. }
  68076. // 数据视图框原点
  68077. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  68078. // 数据视图框宽度
  68079. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  68080. // 数据视图框高度
  68081. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  68082. // 数据视图框中心点
  68083. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2];
  68084. // 数据视图框原点与图表框的原点偏移量
  68085. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  68086. return isSuccess;
  68087. }
  68088. }
  68089. ;// CONCATENATED MODULE: ./src/common/overlay/Circle.js
  68090. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68091. * This program are made available under the terms of the Apache License, Version 2.0
  68092. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68093. /**
  68094. * @class FeatureThemeCircle
  68095. * @aliasclass Feature.Theme.Circle
  68096. * @deprecatedclass SuperMap.Feature.Theme.Circle
  68097. * @classdesc 圆类。
  68098. * @category Visualization Theme
  68099. * @extends FeatureThemeRankSymbol
  68100. * @param {FeatureVector} data - 用户数据。
  68101. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  68102. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  68103. * @param {FeatureThemeCircle.setting} setting - 图表配置对象。
  68104. * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  68105. * @usage
  68106. * @private
  68107. */
  68108. class Circle extends RankSymbol {
  68109. constructor(data, layer, fields, setting, lonlat) {
  68110. super(data, layer, fields, setting, lonlat);
  68111. this.CLASS_NAME = "SuperMap.Feature.Theme.Circle";
  68112. }
  68113. /**
  68114. * @function FeatureThemeCircle.prototype.destroy
  68115. * @override
  68116. */
  68117. destroy() {
  68118. super.destroy();
  68119. }
  68120. /**
  68121. * @function FeatureThemeCircle.prototype.assembleShapes
  68122. * @description 装配图形(扩展接口)。
  68123. */
  68124. assembleShapes() {
  68125. //默认填充颜色
  68126. var defaultFillColor = "#ff9277";
  68127. // setting 属性是否已成功赋值
  68128. if (!this.setting) {
  68129. return false;
  68130. }
  68131. var sets = this.setting;
  68132. // 检测 setting 的必设参数
  68133. if (!(sets.codomain)) {
  68134. return false;
  68135. }
  68136. // 数据
  68137. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  68138. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  68139. this.dataValues = dataEffective ? dataEffective : [];
  68140. // 数据值数组
  68141. var fv = this.dataValues;
  68142. //if(fv.length != 1) return; // 没有数据 或者数据不唯一
  68143. //if(fv[0] < 0) return; //数据为负值
  68144. //用户应该定义最大 最小半径 默认最大半径MaxR:100 最小半径MinR:0;
  68145. if (!sets.maxR) {
  68146. sets.maxR = 100;
  68147. }
  68148. if (!sets.minR) {
  68149. sets.minR = 0;
  68150. }
  68151. // 值域范围
  68152. var codomain = this.DVBCodomain;
  68153. // 重要步骤:定义Circle数据视图框中单位值的含义,单位值:1所代表的长度
  68154. // 用户定义了值域范围
  68155. if (codomain && codomain[1] - codomain[0] > 0) {
  68156. this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
  68157. } else {
  68158. //this.DVBUnitValue = sets.maxR / maxValue;
  68159. this.DVBUnitValue = sets.maxR;
  68160. }
  68161. var uv = this.DVBUnitValue;
  68162. //圆半径
  68163. var r = fv[0] * uv + sets.minR;
  68164. this.width = 2 * r;
  68165. this.height = 2 * r;
  68166. // 重要步骤:初始化参数
  68167. if (!this.initBaseParameter()) {
  68168. return;
  68169. }
  68170. //假如用户设置了值域范围 没有在值域范围直接返回
  68171. if (codomain) {
  68172. if (fv[0] < codomain[0] || fv[0] > codomain[1]) {
  68173. return;
  68174. }
  68175. }
  68176. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为圆心
  68177. //圆形对象参数
  68178. var circleSP = new Circle_Circle(dvbCenter[0], dvbCenter[1], r);
  68179. //circleSP.sytle 初始化
  68180. circleSP.style = ShapeFactory.ShapeStyleTool(null, sets.circleStyle, null, null, 0);
  68181. //图形的填充颜色
  68182. if (typeof (sets.fillColor) !== "undefined") {
  68183. //用户自定义
  68184. circleSP.style.fillColor = sets.fillColor;
  68185. } else {
  68186. //当前默认
  68187. circleSP.style.fillColor = defaultFillColor;
  68188. }
  68189. //圆形 Hover样式
  68190. circleSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.circleHoverStyle);
  68191. //圆形 Hover 与 click 设置
  68192. if (typeof(sets.circleHoverAble) !== "undefined") {
  68193. circleSP.hoverable = sets.circleHoverAble;
  68194. }
  68195. if (typeof(sets.circleClickAble) !== "undefined") {
  68196. circleSP.clickable = sets.circleClickAble;
  68197. }
  68198. //图形携带的数据信息
  68199. circleSP.refDataID = this.data.id;
  68200. circleSP.dataInfo = {
  68201. field: this.fields[0],
  68202. r: r,
  68203. value: fv[0]
  68204. };
  68205. // 创建扇形并把此扇形添加到图表图形数组
  68206. this.shapes.push(this.shapeFactory.createShape(circleSP));
  68207. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  68208. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  68209. this.shapesConvertToRelativeCoordinate();
  68210. }
  68211. }
  68212. ;// CONCATENATED MODULE: ./src/common/overlay/Line.js
  68213. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68214. * This program are made available under the terms of the Apache License, Version 2.0
  68215. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68216. /**
  68217. * @class FeatureThemeLine
  68218. * @aliasclass Feature.Theme.Line
  68219. * @deprecatedclass SuperMap.Feature.Theme.Line
  68220. * @classdesc 折线图。
  68221. * @category Visualization Theme
  68222. * @example
  68223. * // pointStyleByCodomain 参数用法示例
  68224. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  68225. * // start: 值域值下限(包含);
  68226. * // end: 值域值上限(不包含);
  68227. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
  68228. * // pointStyleByCodomain 数组形如:
  68229. * [
  68230. * {
  68231. * start:0,
  68232. * end:250,
  68233. * style:{
  68234. * fillColor:"#00CD00"
  68235. * }
  68236. * },
  68237. * {
  68238. * start:250,
  68239. * end:500,
  68240. * style:{
  68241. * fillColor:"#00EE00"
  68242. * }
  68243. * },
  68244. * {
  68245. * start:500,
  68246. * end:750,
  68247. * style:{
  68248. * fillColor:"#00FF7F"
  68249. * }
  68250. * },
  68251. * {
  68252. * start:750,
  68253. * end:1500,
  68254. * style:{
  68255. * fillColor:"#00FF00"
  68256. * }
  68257. * }
  68258. * ]
  68259. *
  68260. * @extends FeatureThemeGraph
  68261. * @param {FeatureVector} data - 用户数据。
  68262. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  68263. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  68264. * @param {FeatureThemeLine.setting} setting - 图表配置对象。
  68265. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  68266. * @usage
  68267. * @private
  68268. */
  68269. class Line extends Graph {
  68270. constructor(data, layer, fields, setting, lonlat, options) {
  68271. super(data, layer, fields, setting, lonlat, options);
  68272. this.CLASS_NAME = "SuperMap.Feature.Theme.Line";
  68273. }
  68274. /**
  68275. * @function FeatureThemeLine.prototype.destroy
  68276. * @override
  68277. */
  68278. destroy() {
  68279. super.destroy();
  68280. }
  68281. /**
  68282. * @function FeatureThemeLine.prototype.assembleShapes
  68283. * @description 装配图形(扩展接口)。
  68284. */
  68285. assembleShapes() {
  68286. // 图表配置对象
  68287. var sets = this.setting;
  68288. // 默认数据视图框
  68289. if (!sets.dataViewBoxParameter) {
  68290. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  68291. sets.dataViewBoxParameter = [45, 15, 15, 15];
  68292. } else {
  68293. sets.dataViewBoxParameter = [5, 5, 5, 5];
  68294. }
  68295. }
  68296. // 重要步骤:初始化参数
  68297. if (!this.initBaseParameter()) {
  68298. return;
  68299. }
  68300. var dvb = this.dataViewBox;
  68301. // 值域
  68302. var codomain = this.DVBCodomain;
  68303. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  68304. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  68305. var uv = this.DVBUnitValue;
  68306. // 数据值数组
  68307. var fv = this.dataValues;
  68308. if (fv.length < 1) {
  68309. return;
  68310. } // 没有数据
  68311. // 获取 x 轴上的图形信息
  68312. var xShapeInfo = this.calculateXShapeInfo();
  68313. if (!xShapeInfo) {
  68314. return;
  68315. }
  68316. // 折线每个节点的 x 位置
  68317. var xsLoc = xShapeInfo.xPositions;
  68318. // 背景框,默认启用
  68319. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  68320. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  68321. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  68322. }
  68323. // 折线图必须使用坐标轴
  68324. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  68325. // var isDataEffective = true;
  68326. var xPx; // 折线节点 x 坐标
  68327. var yPx; // 折线节点 y 坐标
  68328. var poiLists = []; // 折线节点数组
  68329. var shapePois = []; // 折线节点图形数组
  68330. for (var i = 0, len = fv.length; i < len; i++) {
  68331. // 数据溢出值域检查
  68332. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  68333. // isDataEffective = false;
  68334. return null;
  68335. }
  68336. xPx = xsLoc[i];
  68337. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  68338. // 折线节点参数对象
  68339. var poiSP = new Point_Point(xPx, yPx);
  68340. // 折线节点 style
  68341. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  68342. // 折线节点 hover 样式
  68343. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  68344. // 折线节点 hover click
  68345. if (typeof(sets.pointHoverAble) !== "undefined") {
  68346. poiSP.hoverable = sets.pointHoverAble;
  68347. }
  68348. if (typeof(sets.pointClickAble) !== "undefined") {
  68349. poiSP.clickable = sets.pointClickAble;
  68350. }
  68351. // 图形携带的数据信息
  68352. poiSP.refDataID = this.data.id;
  68353. poiSP.dataInfo = {
  68354. field: this.fields[i],
  68355. value: fv[i]
  68356. };
  68357. // 创建图形并把此图形添加到折线节点图形数组
  68358. shapePois.push(this.shapeFactory.createShape(poiSP));
  68359. // 添加折线节点到折线节点数组
  68360. var poi = [xPx, yPx];
  68361. poiLists.push(poi);
  68362. }
  68363. // 折线参数对象
  68364. var lineSP = new Line_Line(poiLists);
  68365. lineSP.style = ShapeFactory.ShapeStyleTool({strokeColor: "#ee9900"}, sets.lineStyle);
  68366. // 禁止事件响应
  68367. lineSP.clickable = false;
  68368. lineSP.hoverable = false;
  68369. var shapeLine = this.shapeFactory.createShape(lineSP);
  68370. this.shapes.push(shapeLine);
  68371. // 添加节点到图表图形数组
  68372. this.shapes = this.shapes.concat(shapePois);
  68373. // // 数据范围检测未通过,清空图形
  68374. // if (isDataEffective === false) {
  68375. // this.shapes = [];
  68376. // }
  68377. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  68378. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  68379. this.shapesConvertToRelativeCoordinate();
  68380. }
  68381. /**
  68382. * @function FeatureThemeLine.prototype.calculateXShapeInfo
  68383. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  68384. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  68385. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  68386. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  68387. * 本函数中图形配置对象 setting 可设属性:<br>
  68388. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  68389. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  68390. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  68391. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。<br>
  68392. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  68393. */
  68394. calculateXShapeInfo() {
  68395. var dvb = this.dataViewBox; // 数据视图框
  68396. var sets = this.setting; // 图表配置对象
  68397. var fvc = this.dataValues.length; // 数组值个数
  68398. if (fvc < 1) {
  68399. return null;
  68400. }
  68401. var xBlank; // x 轴空白间隔参数
  68402. var xShapePositions = []; // x 轴上图形的位置
  68403. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  68404. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  68405. var unitOffset = 0; // 单位偏移量
  68406. // x 轴空白间隔参数处理
  68407. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  68408. xBlank = sets.xShapeBlank;
  68409. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  68410. if (xsLen <= fvc) {
  68411. return null;
  68412. }
  68413. unitOffset = xsLen / (fvc - 1);
  68414. } else {
  68415. // 默认使用等距离空白间隔,空白间隔为图形宽度
  68416. unitOffset = dvbWidth / (fvc + 1);
  68417. xBlank = [unitOffset, unitOffset, unitOffset];
  68418. }
  68419. // 图形 x 轴上的位置计算
  68420. var xOffset = 0
  68421. for (var i = 0; i < fvc; i++) {
  68422. if (i == 0) {
  68423. xOffset = xBlank[0];
  68424. } else {
  68425. xOffset += unitOffset;
  68426. }
  68427. xShapePositions.push(dvb[0] + xOffset);
  68428. }
  68429. return {
  68430. "xPositions": xShapePositions,
  68431. "width": xShapeWidth
  68432. };
  68433. }
  68434. }
  68435. ;// CONCATENATED MODULE: ./src/common/overlay/Pie.js
  68436. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68437. * This program are made available under the terms of the Apache License, Version 2.0
  68438. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68439. /**
  68440. * @class FeatureThemePie
  68441. * @aliasclass Feature.Theme.Pie
  68442. * @deprecatedclass SuperMap.Feature.Theme.Pie
  68443. * @classdesc 饼图。
  68444. * @category Visualization Theme
  68445. * @param {FeatureVector} data - 用户数据。
  68446. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  68447. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  68448. * @param {FeatureThemePoint.setting} setting - 图表配置对象。
  68449. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  68450. * @extends FeatureThemeGraph
  68451. * @example
  68452. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  68453. * // start: 值域值下限(包含);
  68454. * // end: 值域值上限(不包含);
  68455. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
  68456. * // sectorStyleByCodomain 数组形如:
  68457. * [
  68458. * {
  68459. * start:0,
  68460. * end:250,
  68461. * style:{
  68462. * fillColor:"#00CD00"
  68463. * }
  68464. * },
  68465. * {
  68466. * start:250,
  68467. * end:500,
  68468. * style:{
  68469. * fillColor:"#00EE00"
  68470. * }
  68471. * },
  68472. * {
  68473. * start:500,
  68474. * end:750,
  68475. * style:{
  68476. * fillColor:"#00FF7F"
  68477. * }
  68478. * },
  68479. * {
  68480. * start:750,
  68481. * end:1500,
  68482. * style:{
  68483. * fillColor:"#00FF00"
  68484. * }
  68485. * }
  68486. * ]
  68487. * @usage
  68488. * @private
  68489. */
  68490. class Pie extends Graph {
  68491. constructor(data, layer, fields, setting, lonlat) {
  68492. super(data, layer, fields, setting, lonlat);
  68493. this.CLASS_NAME = "SuperMap.Feature.Theme.Pie";
  68494. }
  68495. /**
  68496. * @function FeatureThemePie.prototype.destroy
  68497. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  68498. */
  68499. destroy() {
  68500. super.destroy();
  68501. }
  68502. /**
  68503. * @function FeatureThemePie.prototype.assembleShapes
  68504. * @description 装配图形(扩展接口)。
  68505. */
  68506. assembleShapes() {
  68507. // 图表配置对象
  68508. var sets = this.setting;
  68509. // 一个默认 style 组
  68510. var defaultStyleGroup = [
  68511. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  68512. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  68513. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  68514. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  68515. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  68516. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  68517. ];
  68518. // 重要步骤:初始化参数
  68519. if (!this.initBaseParameter()) {
  68520. return;
  68521. }
  68522. // 背景框,默认不启用
  68523. if (sets.useBackground) {
  68524. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  68525. }
  68526. // 数据值数组
  68527. var fv = this.dataValues;
  68528. if (fv.length < 1) {
  68529. return;
  68530. } // 没有数据
  68531. // 值域范围
  68532. var codomain = this.DVBCodomain;
  68533. // 值域范围检测
  68534. for (let i = 0; i < fv.length; i++) {
  68535. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  68536. return;
  68537. }
  68538. }
  68539. // 值的绝对值总和
  68540. var valueSum = 0;
  68541. for (let i = 0; i < fv.length; i++) {
  68542. valueSum += Math.abs(fv[i]);
  68543. }
  68544. // 重要步骤:定义图表 FeatureThemePie 数据视图框中单位值的含义,单位值:每度代表的数值
  68545. this.DVBUnitValue = 360 / valueSum;
  68546. var uv = this.DVBUnitValue;
  68547. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  68548. var startAngle = 0; // 扇形起始边角度
  68549. var endAngle = 0; // 扇形终止边角度
  68550. var startAngleTmp = startAngle; // 扇形临时起始边角度
  68551. // 扇形(自适应)半径
  68552. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  68553. for (var i = 0; i < fv.length; i++) {
  68554. var fvi = Math.abs(fv[i]);
  68555. //计算终止角
  68556. if (i === 0) {
  68557. endAngle = startAngle + fvi * uv;
  68558. } else if (i === fvi.length - 1) {
  68559. endAngle = startAngleTmp;
  68560. } else {
  68561. endAngle = startAngle + fvi * uv;
  68562. }
  68563. //矫正误差计算
  68564. if ((endAngle - startAngle) >= 360) {
  68565. endAngle = 359.9999999;
  68566. }
  68567. // 扇形参数对象
  68568. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle);
  68569. // 扇形样式
  68570. if (typeof(sets.sectorStyleByFields) === "undefined") {
  68571. // 使用默认 style 组
  68572. var colorIndex = i % defaultStyleGroup.length;
  68573. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  68574. } else {
  68575. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  68576. }
  68577. // 扇形 hover 样式
  68578. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  68579. // 扇形 hover 与 click 设置
  68580. if (typeof(sets.sectorHoverAble) !== "undefined") {
  68581. sectorSP.hoverable = sets.sectorHoverAble;
  68582. }
  68583. if (typeof(sets.sectorClickAble) !== "undefined") {
  68584. sectorSP.clickable = sets.sectorClickAble;
  68585. }
  68586. // 图形携带的数据信息
  68587. sectorSP.refDataID = this.data.id;
  68588. sectorSP.dataInfo = {
  68589. field: this.fields[i],
  68590. value: fv[i]
  68591. };
  68592. // 创建扇形并把此扇形添加到图表图形数组
  68593. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  68594. // 把上一次的结束角度作为下一次的起始角度
  68595. startAngle = endAngle;
  68596. }
  68597. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  68598. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  68599. this.shapesConvertToRelativeCoordinate();
  68600. }
  68601. }
  68602. ;// CONCATENATED MODULE: ./src/common/overlay/Point.js
  68603. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68604. * This program are made available under the terms of the Apache License, Version 2.0
  68605. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68606. /**
  68607. * @class FeatureThemePoint
  68608. * @aliasclass Feature.Theme.Point
  68609. * @deprecatedclass SuperMap.Feature.Theme.Point
  68610. * @classdesc 点状图。
  68611. * @category Visualization Theme
  68612. * @param {FeatureVector} data - 用户数据。
  68613. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  68614. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  68615. * @param {FeatureThemePoint.setting} setting - 图表配置对象。
  68616. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  68617. * @example
  68618. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  68619. * // start: 值域值下限(包含);
  68620. * // end: 值域值上限(不包含);
  68621. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
  68622. * // pointStyleByCodomain 数组形如:
  68623. * [
  68624. * {
  68625. * start:0,
  68626. * end:250,
  68627. * style:{
  68628. * fillColor:"#00CD00"
  68629. * }
  68630. * },
  68631. * {
  68632. * start:250,
  68633. * end:500,
  68634. * style:{
  68635. * fillColor:"#00EE00"
  68636. * }
  68637. * },
  68638. * {
  68639. * start:500,
  68640. * end:750,
  68641. * style:{
  68642. * fillColor:"#00FF7F"
  68643. * }
  68644. * },
  68645. * {
  68646. * start:750,
  68647. * end:1500,
  68648. * style:{
  68649. * fillColor:"#00FF00"
  68650. * }
  68651. * }
  68652. * ]
  68653. * @extends FeatureThemeGraph
  68654. * @usage
  68655. * @private
  68656. */
  68657. class overlay_Point_Point extends Graph {
  68658. constructor(data, layer, fields, setting, lonlat, options) {
  68659. super(data, layer, fields, setting, lonlat, options);
  68660. this.CLASS_NAME = "SuperMap.Feature.Theme.Point";
  68661. }
  68662. /**
  68663. * @function FeatureThemePoint.prototype.destroy
  68664. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  68665. */
  68666. destroy() {
  68667. super.destroy();
  68668. }
  68669. /**
  68670. * @function FeatureThemePoint.prototype.Point.assembleShapes
  68671. * @description 装配图形(扩展接口)。
  68672. */
  68673. assembleShapes() {
  68674. // 图表配置对象
  68675. var sets = this.setting;
  68676. // 默认数据视图框
  68677. if (!sets.dataViewBoxParameter) {
  68678. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  68679. sets.dataViewBoxParameter = [45, 15, 15, 15];
  68680. } else {
  68681. sets.dataViewBoxParameter = [5, 5, 5, 5];
  68682. }
  68683. }
  68684. // 重要步骤:初始化参数
  68685. if (!this.initBaseParameter()) {
  68686. return;
  68687. }
  68688. var dvb = this.dataViewBox;
  68689. // 值域
  68690. var codomain = this.DVBCodomain;
  68691. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  68692. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  68693. var uv = this.DVBUnitValue;
  68694. var fv = this.dataValues;
  68695. // 获取 x 轴上的图形信息
  68696. var xShapeInfo = this.calculateXShapeInfo();
  68697. if (!xShapeInfo) {
  68698. return;
  68699. }
  68700. // 折线每个节点的 x 位置
  68701. var xsLoc = xShapeInfo.xPositions;
  68702. // 背景框,默认启用
  68703. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  68704. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  68705. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  68706. }
  68707. // 点状图必须使用坐标轴
  68708. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  68709. var xPx; // 图形点 x 坐标
  68710. var yPx; // 图形点 y 坐标
  68711. for (var i = 0, len = fv.length; i < len; i++) {
  68712. // 数据溢出值域检查
  68713. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  68714. //isDataEffective = false;
  68715. return null;
  68716. }
  68717. xPx = xsLoc[i];
  68718. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  68719. // 图形点参数对象
  68720. var poiSP = new Point_Point(xPx, yPx);
  68721. // 图形点 style
  68722. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  68723. // 图形点 hover 样式
  68724. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  68725. // 图形点 hover click
  68726. if (typeof(sets.pointHoverAble) !== "undefined") {
  68727. poiSP.hoverable = sets.pointHoverAble;
  68728. }
  68729. if (typeof(sets.pointClickAble) !== "undefined") {
  68730. poiSP.clickable = sets.pointClickAble;
  68731. }
  68732. // 图形携带的数据信息
  68733. poiSP.refDataID = this.data.id;
  68734. poiSP.dataInfo = {
  68735. field: this.fields[i],
  68736. value: fv[i]
  68737. };
  68738. // 创建图形点并把此图形添加到图表图形数组
  68739. this.shapes.push(this.shapeFactory.createShape(poiSP));
  68740. }
  68741. // 数据范围检测未通过,清空图形
  68742. // if (isDataEffective === false) {
  68743. // this.shapes = [];
  68744. // }
  68745. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  68746. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  68747. this.shapesConvertToRelativeCoordinate();
  68748. }
  68749. /**
  68750. * @function FeatureThemePoint.prototype.calculateXShapeInfo
  68751. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  68752. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  68753. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  68754. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  68755. * 本函数中图形配置对象 setting 可设属性:<br>
  68756. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  68757. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  68758. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  68759. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  68760. * width - {number}表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  68761. */
  68762. calculateXShapeInfo() {
  68763. var dvb = this.dataViewBox; // 数据视图框
  68764. var sets = this.setting; // 图表配置对象
  68765. var fvc = this.dataValues.length; // 数组值个数
  68766. if (fvc < 1) {
  68767. return null;
  68768. }
  68769. var xBlank; // x 轴空白间隔参数
  68770. var xShapePositions = []; // x 轴上图形的位置
  68771. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  68772. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  68773. var unitOffset = 0; // 单位偏移量
  68774. // x 轴空白间隔参数处理
  68775. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  68776. xBlank = sets.xShapeBlank;
  68777. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  68778. if (xsLen <= fvc) {
  68779. return null;
  68780. }
  68781. unitOffset = xsLen / (fvc - 1);
  68782. } else {
  68783. // 默认使用等距离空白间隔,空白间隔为图形宽度
  68784. unitOffset = dvbWidth / (fvc + 1);
  68785. xBlank = [unitOffset, unitOffset, unitOffset];
  68786. }
  68787. // 图形 x 轴上的位置计算
  68788. var xOffset = 0
  68789. for (var i = 0; i < fvc; i++) {
  68790. if (i == 0) {
  68791. xOffset = xBlank[0];
  68792. } else {
  68793. xOffset += unitOffset;
  68794. }
  68795. xShapePositions.push(dvb[0] + xOffset);
  68796. }
  68797. return {
  68798. "xPositions": xShapePositions,
  68799. "width": xShapeWidth
  68800. };
  68801. }
  68802. }
  68803. ;// CONCATENATED MODULE: ./src/common/overlay/Ring.js
  68804. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68805. * This program are made available under the terms of the Apache License, Version 2.0
  68806. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68807. /**
  68808. * @class FeatureThemeRing
  68809. * @aliasclass Feature.Theme.Ring
  68810. * @deprecatedclass SuperMap.Feature.Theme.Ring
  68811. * @classdesc 环状图。
  68812. * @category Visualization Theme
  68813. * @description 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  68814. * @param {FeatureVector} data - 用户数据。
  68815. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  68816. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  68817. * @param {FeatureThemeRing.setting} setting - 图表配置对象。
  68818. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  68819. * @example
  68820. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  68821. * // start: 值域值下限(包含);
  68822. * // end: 值域值上限(不包含);
  68823. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
  68824. * // sectorStyleByCodomain 数组形如:
  68825. * [
  68826. * {
  68827. * start:0,
  68828. * end:250,
  68829. * style:{
  68830. * fillColor:"#00CD00"
  68831. * }
  68832. * },
  68833. * {
  68834. * start:250,
  68835. * end:500,
  68836. * style:{
  68837. * fillColor:"#00EE00"
  68838. * }
  68839. * },
  68840. * {
  68841. * start:500,
  68842. * end:750,
  68843. * style:{
  68844. * fillColor:"#00FF7F"
  68845. * }
  68846. * },
  68847. * {
  68848. * start:750,
  68849. * end:1500,
  68850. * style:{
  68851. * fillColor:"#00FF00"
  68852. * }
  68853. * }
  68854. * ]
  68855. * @param {Object} [sectorHoverStyle=true] - 环状图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  68856. * @param {boolean} [sectorHoverAble=true] - 是否允许环状图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  68857. * @param {boolean} [sectorClickAble=true] - 是否允许环状图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  68858. *
  68859. * @extends FeatureThemeGraph
  68860. * @usage
  68861. * @private
  68862. */
  68863. class Ring extends Graph {
  68864. constructor(data, layer, fields, setting, lonlat) {
  68865. super(data, layer, fields, setting, lonlat);
  68866. this.CLASS_NAME = "SuperMap.Feature.Theme.Ring";
  68867. }
  68868. /**
  68869. * @function FeatureThemeRing.prototype.destroy
  68870. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  68871. */
  68872. destroy() {
  68873. super.destroy();
  68874. }
  68875. /**
  68876. * @function FeatureThemeRing.prototype.assembleShapes
  68877. * @description 装配图形(扩展接口)。
  68878. */
  68879. assembleShapes() {
  68880. // 重要步骤:初始化参数
  68881. if (!this.initBaseParameter()) {
  68882. return;
  68883. }
  68884. // 一个默认 style 组
  68885. var defaultStyleGroup = [
  68886. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  68887. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  68888. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  68889. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  68890. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  68891. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  68892. ];
  68893. // 图表配置对象
  68894. var sets = this.setting;
  68895. // 背景框,默认不启用
  68896. if (sets.useBackground) {
  68897. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  68898. }
  68899. // 数据值数组
  68900. var fv = this.dataValues;
  68901. if (fv.length < 1) {
  68902. return;
  68903. } // 没有数据
  68904. // 值域范围
  68905. var codomain = this.DVBCodomain;
  68906. // 值域范围检测
  68907. for (let i = 0; i < fv.length; i++) {
  68908. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  68909. return;
  68910. }
  68911. }
  68912. // 值的绝对值总和
  68913. var valueSum = 0;
  68914. for (let i = 0; i < fv.length; i++) {
  68915. valueSum += Math.abs(fv[i]);
  68916. }
  68917. // 重要步骤:定义图表 FeatureThemeRing 数据视图框中单位值的含义,单位值:每度代表的数值
  68918. this.DVBUnitValue = 360 / valueSum;
  68919. var uv = this.DVBUnitValue;
  68920. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  68921. var startAngle = 0; // 扇形起始边角度
  68922. var endAngle = 0; // 扇形终止边角度
  68923. var startAngleTmp = startAngle; // 扇形临时起始边角度
  68924. // 扇形外环(自适应)半径
  68925. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  68926. // 扇形内环(自适应)半径
  68927. var isInRange = sets.innerRingRadius >= 0 && sets.innerRingRadius < r;
  68928. var r0 = (
  68929. typeof(sets.innerRingRadius) !== "undefined"
  68930. && !isNaN(sets.innerRingRadius)
  68931. && isInRange
  68932. ) ? sets.innerRingRadius : 0;
  68933. for (var i = 0; i < fv.length; i++) {
  68934. var fvi = Math.abs(fv[i]);
  68935. // 计算结束角度
  68936. if (i === 0) {
  68937. endAngle = startAngle + fvi * uv;
  68938. } else if (i === fvi.length - 1) {
  68939. endAngle = startAngleTmp;
  68940. } else {
  68941. endAngle = startAngle + fvi * uv;
  68942. }
  68943. // 扇形参数对象
  68944. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle, r0);
  68945. // 扇形样式
  68946. if (typeof(sets.sectorStyleByFields) === "undefined") {
  68947. // 使用默认 style 组
  68948. var colorIndex = i % defaultStyleGroup.length;
  68949. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  68950. } else {
  68951. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  68952. }
  68953. // 扇形 hover 样式
  68954. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  68955. // 扇形 hover 与 click 设置
  68956. if (typeof(sets.sectorHoverAble) !== "undefined") {
  68957. sectorSP.hoverable = sets.sectorHoverAble;
  68958. }
  68959. if (typeof(sets.sectorClickAble) !== "undefined") {
  68960. sectorSP.clickable = sets.sectorClickAble;
  68961. }
  68962. // 图形携带的数据信息
  68963. sectorSP.refDataID = this.data.id;
  68964. sectorSP.dataInfo = {
  68965. field: this.fields[i],
  68966. value: fv[i]
  68967. };
  68968. // 创建扇形并把此扇形添加到图表图形数组
  68969. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  68970. // 把上一次的结束角度作为下一次的起始角度
  68971. startAngle = endAngle;
  68972. }
  68973. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  68974. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  68975. this.shapesConvertToRelativeCoordinate();
  68976. }
  68977. }
  68978. ;// CONCATENATED MODULE: ./src/common/overlay/ThemeVector.js
  68979. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68980. * This program are made available under the terms of the Apache License, Version 2.0
  68981. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68982. /**
  68983. * @class FeatureThemeVector
  68984. * @aliasclass Feature.Theme.ThemeVector
  68985. * @deprecatedclass SuperMap.Feature.Theme.ThemeVector
  68986. * @classdesc 矢量专题要素类。
  68987. * @category Visualization Theme
  68988. * @extends FeatureTheme
  68989. * @param {FeatureVector} data - 用户数据,的类型为矢量数据 feature。
  68990. * @param {SuperMap.Layer} layer - 此专题要素所在图层。
  68991. * @param {Object} style - 样式。
  68992. * @param {Object} options - 创建专题要素时的可选参数。
  68993. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离,单位:像素。
  68994. * @param {boolean} [options.isHoverAble=true] - 图形是否可 hover。
  68995. * @param {boolean} [options.isMultiHover=true] - 是否使用多图形高亮,isHoverAble 为 true 时生效。
  68996. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  68997. * @param {Object} [options.highlightStyle] - 高亮样式。
  68998. * @usage
  68999. */
  69000. class ThemeVector extends Theme_Theme {
  69001. constructor(data, layer, style, options, shapeOptions) {
  69002. super(data, layer);
  69003. //数据的 geometry 属性必须存在且类型是 Geometry 或其子类的类型
  69004. if (!data.geometry) {
  69005. return;
  69006. }
  69007. if (!(data.geometry instanceof Geometry_Geometry)) {
  69008. return;
  69009. }
  69010. /**
  69011. * @member {Bounds} [FeatureThemeVector.prototype.dataBounds]
  69012. * @description 用户数据的(feature.geometry)地理范围。
  69013. */
  69014. this.dataBounds = data.geometry.getBounds();
  69015. /**
  69016. * @member {number} [FeatureThemeVector.prototype.nodesClipPixel=2]
  69017. * @description 节点抽稀像素距离。
  69018. */
  69019. this.nodesClipPixel = 2;
  69020. /**
  69021. * @member {boolean} [FeatureThemeVector.prototype.isHoverAble=true]
  69022. * @description 图形是否可 hover。
  69023. */
  69024. this.isHoverAble = true;
  69025. /**
  69026. * @member {boolean} [FeatureThemeVector.prototype.isMultiHover=true]
  69027. * @description 是否使用多图形高亮,isHoverAble 为 true 时生效。
  69028. */
  69029. this.isMultiHover = true;
  69030. /**
  69031. * @member {boolean} [FeatureThemeVector.prototype.isClickAble=true]
  69032. * @description 图形是否可点击。
  69033. */
  69034. this.isClickAble = true;
  69035. /**
  69036. * @member {Object} [FeatureThemeVector.prototype.highlightStyle]
  69037. * @description 高亮样式。
  69038. */
  69039. this.highlightStyle = null;
  69040. /**
  69041. * @member {Object} [FeatureThemeVector.prototype.shapeOptions]
  69042. * @description 添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做。
  69043. */
  69044. this.shapeOptions = {};
  69045. /**
  69046. * @member {Object} [FeatureThemeVector.prototype.style]
  69047. * @description 可视化图形的 style。在子类中规定其对象结构和默认属性值。
  69048. */
  69049. this.style = style || {};
  69050. this.CLASS_NAME = "SuperMap.Feature.Theme.Vector";
  69051. this.style = style ? style : {};
  69052. if (options) {
  69053. Util_Util.copyAttributesWithClip(this, options, ["shapeOptions", "dataBounds"])
  69054. }
  69055. if (shapeOptions) {
  69056. Util_Util.copyAttributesWithClip(this.shapeOptions, shapeOptions);
  69057. }
  69058. //设置基础参数 dataBounds、lonlat、location
  69059. var geometry = data.geometry;
  69060. this.lonlat = this.dataBounds.getCenterLonLat();
  69061. this.location = this.getLocalXY(this.lonlat);
  69062. //将地理要素转为专题要素
  69063. if (geometry instanceof LinearRing_LinearRing) {
  69064. this.lineToTF(geometry);
  69065. } else if (geometry instanceof LineString) {
  69066. this.lineToTF(geometry);
  69067. } else if (geometry instanceof Curve) {
  69068. //独立几何体
  69069. } else if (geometry instanceof MultiPoint) {
  69070. this.multiPointToTF(geometry);
  69071. } else if (geometry instanceof MultiLineString) {
  69072. this.multiLineStringToTF(geometry);
  69073. } else if (geometry instanceof MultiPolygon) {
  69074. this.multiPolygonToTF(geometry);
  69075. } else if (geometry instanceof Polygon_Polygon) {
  69076. this.polygonToTF(geometry);
  69077. } else if (geometry instanceof Collection) {
  69078. //独立几何体
  69079. } else if (geometry instanceof Point) {
  69080. this.pointToTF(geometry);
  69081. } else if (geometry instanceof Rectangle) {
  69082. this.rectangleToTF(geometry);
  69083. } else if (geometry instanceof GeoText) {
  69084. this.geoTextToTF(geometry);
  69085. }
  69086. }
  69087. /**
  69088. * @function FeatureThemeVector.prototype.destroy
  69089. * @override
  69090. */
  69091. destroy() {
  69092. this.style = null;
  69093. this.dataBounds = null;
  69094. this.nodesClipPixel = null;
  69095. this.isHoverAble = null;
  69096. this.isMultiHover = null;
  69097. this.isClickAble = null;
  69098. this.highlightStyle = null;
  69099. this.shapeOptions = null;
  69100. super.destroy();
  69101. }
  69102. /**
  69103. * @function FeatureThemeVector.prototype.lineToTF
  69104. * @description 转换线和线环要素。
  69105. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeometryLineString 或 GeometryLineRing。
  69106. */
  69107. lineToTF(geometry) {
  69108. var components = geometry.components;
  69109. //节点像素坐标
  69110. var localLX = [];
  69111. //参考位置,参考中心为
  69112. var refLocal = [];
  69113. var location = this.location;
  69114. var pointList = [];
  69115. //节点抽稀距离
  69116. var nCPx = this.nodesClipPixel;
  69117. for (var i = 0; i < components.length; i++) {
  69118. var components_i = components[i];
  69119. refLocal = [];
  69120. localLX = this.getLocalXY(components_i);
  69121. refLocal[0] = localLX[0] - location[0];
  69122. refLocal[1] = localLX[1] - location[1];
  69123. //抽稀 - 2 px
  69124. if (pointList.length > 0) {
  69125. var lastLocalXY = pointList[pointList.length - 1];
  69126. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  69127. continue;
  69128. }
  69129. }
  69130. //使用参考点
  69131. pointList.push(refLocal);
  69132. }
  69133. if (pointList.length < 2) {
  69134. return null;
  69135. }
  69136. //赋 style
  69137. var style = new Object();
  69138. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  69139. style.pointList = pointList;
  69140. //创建图形
  69141. var shape = new SmicBrokenLine({
  69142. style: style,
  69143. clickable: this.isClickAble,
  69144. hoverable: this.isHoverAble
  69145. });
  69146. //设置高亮样式
  69147. if (this.highlightStyle) {
  69148. shape.highlightStyle = this.highlightStyle;
  69149. }
  69150. //设置参考中心,指定图形位置
  69151. shape.refOriginalPosition = this.location;
  69152. //储存数据 id 属性,用于事件
  69153. shape.refDataID = this.data.id;
  69154. //储存数据 id 属性,用于事件-多图形同时高亮
  69155. shape.isHoverByRefDataID = this.isMultiHover;
  69156. //添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做
  69157. if (this.shapeOptions) {
  69158. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  69159. }
  69160. this.shapes.push(shape);
  69161. }
  69162. /**
  69163. * @function FeatureThemeVector.prototype.multiPointToTF
  69164. * @description 转多点要素。
  69165. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
  69166. */
  69167. multiPointToTF(geometry) {
  69168. /* //-- 不抽稀
  69169. var components = geometry.components;
  69170. for(var i = 0; i < components.length; i++){
  69171. var components_i = components[i];
  69172. this.pointToTF(components_i);
  69173. }
  69174. */
  69175. var components = geometry.components;
  69176. //节点像素坐标
  69177. var localLX = [];
  69178. //参考位置,参考中心为
  69179. var refLocal = [];
  69180. var location = this.location;
  69181. var pointList = [];
  69182. //节点抽稀距离
  69183. var nCPx = this.nodesClipPixel;
  69184. for (var i = 0; i < components.length; i++) {
  69185. var components_i = components[i];
  69186. refLocal = [];
  69187. localLX = this.getLocalXY(components_i);
  69188. refLocal[0] = localLX[0] - location[0];
  69189. refLocal[1] = localLX[1] - location[1];
  69190. //抽稀
  69191. if (pointList.length > 0) {
  69192. var lastLocalXY = pointList[pointList.length - 1];
  69193. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  69194. continue;
  69195. }
  69196. }
  69197. //使用参考点
  69198. pointList.push(refLocal);
  69199. //赋 style
  69200. var style = new Object();
  69201. style.r = 6; //防止漏设此参数,默认 6 像素
  69202. style = Util_Util.copyAttributesWithClip(style, this.style);
  69203. style.x = refLocal[0];
  69204. style.y = refLocal[1];
  69205. //创建图形
  69206. var shape = new SmicPoint({
  69207. style: style,
  69208. clickable: this.isClickAble,
  69209. hoverable: this.isHoverAble
  69210. });
  69211. //设置高亮样式
  69212. if (this.highlightStyle) {
  69213. shape.highlightStyle = this.highlightStyle;
  69214. }
  69215. //设置参考中心,指定图形位置
  69216. shape.refOriginalPosition = location;
  69217. //储存数据 id 属性,用于事件
  69218. shape.refDataID = this.data.id;
  69219. //储存数据 id 属性,用于事件-多图形同时高亮
  69220. shape.isHoverByRefDataID = this.isMultiHover;
  69221. //修改一些 shape 可选属性,通常不需要这么做
  69222. if (this.shapeOptions) {
  69223. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  69224. }
  69225. this.shapes.push(shape);
  69226. }
  69227. }
  69228. /**
  69229. * @function FeatureThemeVector.prototype.multiLineStringToTF
  69230. * @description 转换多线要素。
  69231. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiLineString。
  69232. */
  69233. multiLineStringToTF(geometry) {
  69234. var components = geometry.components;
  69235. for (var i = 0; i < components.length; i++) {
  69236. var components_i = components[i];
  69237. this.lineToTF(components_i);
  69238. }
  69239. }
  69240. /**
  69241. * @function FeatureThemeVector.prototype.multiPolygonToTF
  69242. * @description 转换多面要素。
  69243. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPolygon。
  69244. */
  69245. multiPolygonToTF(geometry) {
  69246. var components = geometry.components;
  69247. for (var i = 0; i < components.length; i++) {
  69248. var components_i = components[i];
  69249. this.polygonToTF(components_i);
  69250. }
  69251. }
  69252. /**
  69253. * @function FeatureThemeVector.prototype.pointToTF
  69254. * @description 转换点要素。
  69255. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
  69256. */
  69257. pointToTF(geometry) {
  69258. //参考位置,参考中心为
  69259. var location = this.location;
  69260. //geometry 像素坐标
  69261. var localLX = this.getLocalXY(geometry);
  69262. //赋 style
  69263. var style = new Object();
  69264. style.r = 6; //防止漏设此参数,默认 6 像素
  69265. style = Util_Util.copyAttributesWithClip(style, this.style);
  69266. style.x = localLX[0] - location[0];
  69267. style.y = localLX[1] - location[1];
  69268. //创建图形
  69269. var shape = new SmicPoint({
  69270. style: style,
  69271. clickable: this.isClickAble,
  69272. hoverable: this.isHoverAble
  69273. });
  69274. //设置高亮样式
  69275. if (this.highlightStyle) {
  69276. shape.highlightStyle = this.highlightStyle;
  69277. }
  69278. //设置参考中心,指定图形位置
  69279. shape.refOriginalPosition = location;
  69280. //储存数据 id 属性,用于事件
  69281. shape.refDataID = this.data.id;
  69282. //储存数据 id 属性,用于事件-多图形同时高亮
  69283. shape.isHoverByRefDataID = this.isMultiHover;
  69284. //修改一些 shape 可选属性,通常不需要这么做
  69285. if (this.shapeOptions) {
  69286. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  69287. }
  69288. this.shapes.push(shape);
  69289. }
  69290. /**
  69291. * @function FeatureThemeVector.prototype.polygonToThemeFeature
  69292. * @description 转换面要素。
  69293. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Polygon。
  69294. */
  69295. polygonToTF(geometry) {
  69296. var components = geometry.components;
  69297. //节点像素坐标
  69298. var localLX = [];
  69299. //参考位置,参考中心为
  69300. var refLocal = [];
  69301. var location = this.location;
  69302. var pointList = [];
  69303. //岛洞
  69304. var holePolygonPointList = [];
  69305. var holePolygonPointLists = [];
  69306. //节点抽稀距离
  69307. var nCPx = this.nodesClipPixel;
  69308. for (var i = 0; i < components.length; i++) {
  69309. var components_i = components[i].components;
  69310. if (i === 0) {
  69311. // 第一个 component 正常绘制
  69312. pointList = [];
  69313. for (var j = 0; j < components_i.length; j++) {
  69314. refLocal = [];
  69315. localLX = this.getLocalXY(components_i[j]);
  69316. refLocal[0] = localLX[0] - location[0];
  69317. refLocal[1] = localLX[1] - location[1];
  69318. //抽稀 - 2 px
  69319. if (pointList.length > 0) {
  69320. var lastLocalXY = pointList[pointList.length - 1];
  69321. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  69322. continue;
  69323. }
  69324. }
  69325. //使用参考点
  69326. pointList.push(refLocal);
  69327. }
  69328. } else {
  69329. // 其它 component 作为岛洞
  69330. holePolygonPointList = [];
  69331. for (var k = 0; k < components_i.length; k++) {
  69332. refLocal = [];
  69333. localLX = this.getLocalXY(components_i[k]);
  69334. refLocal[0] = localLX[0] - location[0];
  69335. refLocal[1] = localLX[1] - location[1];
  69336. //抽稀 - 2 px
  69337. if (holePolygonPointList.length > 0) {
  69338. var lastXY = holePolygonPointList[holePolygonPointList.length - 1];
  69339. if ((Math.abs(lastXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastXY[1] - refLocal[1]) <= nCPx)) {
  69340. continue;
  69341. }
  69342. }
  69343. //使用参考点
  69344. holePolygonPointList.push(refLocal);
  69345. }
  69346. }
  69347. if (holePolygonPointList.length < 2) {
  69348. continue;
  69349. }
  69350. holePolygonPointLists.push(holePolygonPointList);
  69351. }
  69352. if (pointList.length < 2) {
  69353. return;
  69354. }
  69355. //赋 style
  69356. var style = {};
  69357. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  69358. style.pointList = pointList;
  69359. //创建图形
  69360. var shape = new SmicPolygon({
  69361. style: style,
  69362. clickable: this.isClickAble,
  69363. hoverable: this.isHoverAble
  69364. });
  69365. //设置高亮样式
  69366. if (this.highlightStyle) {
  69367. shape.highlightStyle = this.highlightStyle;
  69368. }
  69369. //设置参考中心,指定图形位置
  69370. shape.refOriginalPosition = this.location;
  69371. //储存数据 id 属性,用于事件
  69372. shape.refDataID = this.data.id;
  69373. //储存数据 id 属性,用于事件-多图形同时高亮
  69374. shape.isHoverByRefDataID = this.isMultiHover;
  69375. //岛洞面
  69376. if (holePolygonPointLists.length > 0) {
  69377. shape.holePolygonPointLists = holePolygonPointLists;
  69378. }
  69379. //修改一些 shape 可选属性,通常不需要这么做
  69380. if (this.shapeOptions) {
  69381. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  69382. }
  69383. this.shapes.push(shape);
  69384. }
  69385. /**
  69386. * @function FeatureThemeVector.prototype.rectangleToTF
  69387. * @description 转换矩形要素。
  69388. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Rectangle。
  69389. */
  69390. rectangleToTF(geometry) {
  69391. //参考位置,参考中心为
  69392. var location = this.location;
  69393. var ll = new LonLat(geometry.x, geometry.y);
  69394. //地图分辨率
  69395. var res = this.layer.map.getResolution();
  69396. //geometry 像素坐标
  69397. var localLX = this.getLocalXY(ll);
  69398. //赋 style
  69399. var style = new Object();
  69400. style.r = 6; //防止漏设此参数,默认 6 像素
  69401. style = Util_Util.copyAttributesWithClip(style, this.style);
  69402. style.x = localLX[0] - location[0];
  69403. // Rectangle 使用左下角定位, SmicRectangle 使用左上角定位,需要转换
  69404. style.y = (localLX[1] - location[1]) - 2 * geometry.width / res;
  69405. style.width = geometry.width / res;
  69406. style.height = geometry.height / res;
  69407. //创建图形
  69408. var shape = new SmicRectangle({
  69409. style: style,
  69410. clickable: this.isClickAble,
  69411. hoverable: this.isHoverAble
  69412. });
  69413. //设置高亮样式
  69414. if (this.highlightStyle) {
  69415. shape.highlightStyle = this.highlightStyle;
  69416. }
  69417. //设置参考中心,指定图形位置
  69418. shape.refOriginalPosition = location;
  69419. //储存数据 id 属性,用于事件
  69420. shape.refDataID = this.data.id;
  69421. //储存数据 id 属性,用于事件-多图形同时高亮
  69422. shape.isHoverByRefDataID = this.isMultiHover;
  69423. //修改一些 shape 可选属性,通常不需要这么做
  69424. if (this.shapeOptions) {
  69425. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  69426. }
  69427. this.shapes.push(shape);
  69428. }
  69429. /**
  69430. * @function FeatureThemeVector.prototype.geoTextToTF
  69431. * @description 转换文本要素。
  69432. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeoText。
  69433. */
  69434. geoTextToTF(geometry) {
  69435. //参考位置,参考中心为
  69436. var location = this.location;
  69437. //geometry 像素坐标
  69438. var localLX = this.getLocalXY(geometry);
  69439. //赋 style
  69440. var style = new Object();
  69441. style.r = 6; //防止漏设此参数,默认 6 像素
  69442. style = Util_Util.copyAttributesWithClip(style, this.style, ["x", "y", "text"]);
  69443. style.x = localLX[0] - location[0];
  69444. style.y = localLX[1] - location[1];
  69445. style.text = geometry.text;
  69446. //创建图形
  69447. var shape = new SmicText({
  69448. style: style,
  69449. clickable: this.isClickAble,
  69450. hoverable: this.isHoverAble
  69451. });
  69452. //设置高亮样式
  69453. if (this.highlightStyle) {
  69454. shape.highlightStyle = this.highlightStyle;
  69455. }
  69456. //设置参考中心,指定图形位置
  69457. shape.refOriginalPosition = location;
  69458. //储存数据 id 属性,用于事件
  69459. shape.refDataID = this.data.id;
  69460. //储存数据 id 属性,用于事件-多图形同时高亮
  69461. shape.isHoverByRefDataID = this.isMultiHover;
  69462. //修改一些 shape 可选属性,通常不需要这么做
  69463. if (this.shapeOptions) {
  69464. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  69465. }
  69466. this.shapes.push(shape);
  69467. }
  69468. /**
  69469. * @function FeatureThemeVector.prototype.updateAndAddShapes
  69470. * @description 修改位置,针对地图平移操作,地图漫游操作后调用此函数。
  69471. */
  69472. updateAndAddShapes() {
  69473. var newLocalLX = this.getLocalXY(this.lonlat);
  69474. this.location = newLocalLX;
  69475. var render = this.layer.renderer;
  69476. for (var i = 0, len = this.shapes.length; i < len; i++) {
  69477. var shape = this.shapes[i];
  69478. //设置参考中心,指定图形位置
  69479. shape.refOriginalPosition = newLocalLX;
  69480. render.addShape(shape);
  69481. }
  69482. }
  69483. /**
  69484. * @function FeatureThemeVector.prototype.getShapesCount
  69485. * @description 获得专题要素中可视化图形的数量。
  69486. * @returns {number} 可视化图形的数量。
  69487. */
  69488. getShapesCount() {
  69489. return this.shapes.length;
  69490. }
  69491. /**
  69492. * @function FeatureThemeVector.prototype.getLocalXY
  69493. * @description 地理坐标转为像素坐标。
  69494. * @param {LonLat} lonlat - 专题要素地理位置。
  69495. */
  69496. getLocalXY(lonlat) {
  69497. return this.layer.getLocalXY(lonlat);
  69498. }
  69499. }
  69500. ;// CONCATENATED MODULE: ./src/common/overlay/feature/index.js
  69501. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69502. * This program are made available under the terms of the Apache License, Version 2.0
  69503. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69504. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Group.js
  69505. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69506. * This program are made available under the terms of the Apache License, Version 2.0
  69507. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69508. /**
  69509. * @class LevelRenderer.Group
  69510. * @category Visualization Theme
  69511. * @private
  69512. * @classdesc Group 是一个容器,可以插入子节点,Group 的变换也会被应用到子节点上。
  69513. * @extends {LevelRenderer.Transformable}
  69514. * (code)
  69515. * var g = new LevelRenderer.Group();
  69516. * var Circle = new LevelRenderer.Shape.Circle();
  69517. * g.position[0] = 100;
  69518. * g.position[1] = 100;
  69519. * g.addChild(new Circle({
  69520. * style: {
  69521. * x: 100,
  69522. * y: 100,
  69523. * r: 20,
  69524. * brushType: 'fill'
  69525. * }
  69526. * }));
  69527. * LR.addGroup(g);
  69528. * (end)
  69529. * @param {Array} options - Group 的配置(options)项,可以是 Group 的自有属性,也可以是自定义的属性。
  69530. */
  69531. class Group extends mixinExt(Eventful, Transformable) {
  69532. constructor(options) {
  69533. super(options)
  69534. options = options || {};
  69535. /**
  69536. * @member {string} LevelRenderer.Group.prototype.id
  69537. * @description Group 的唯一标识。
  69538. */
  69539. this.id = null;
  69540. /**
  69541. * @readonly
  69542. * @member {string} [LevelRenderer.Group.prototype.type='group']
  69543. * @description 类型。
  69544. */
  69545. this.type = 'group';
  69546. //http://www.w3.org/TR/2dcontext/#clipping-region
  69547. /**
  69548. * @member {string} LevelRenderer.Group.prototype.clipShape
  69549. * @description 用于裁剪的图形(shape),所有 Group 内的图形在绘制时都会被这个图形裁剪,该图形会继承 Group 的变换。
  69550. */
  69551. this.clipShape = null;
  69552. /**
  69553. * @member {Array} LevelRenderer.Group.prototype._children
  69554. * @description _children。
  69555. */
  69556. this._children = [];
  69557. /**
  69558. * @member {Array} LevelRenderer.Group.prototype._storage
  69559. * @description _storage。
  69560. */
  69561. this._storage = null;
  69562. /**
  69563. * @member {boolean} [LevelRenderer.Group.prototype.__dirty=true]
  69564. * @description __dirty。
  69565. */
  69566. this.__dirty = true;
  69567. /**
  69568. * @member {boolean} [LevelRenderer.Group.prototype.ignore=false]
  69569. * @description 是否忽略该 Group 及其所有子节点。
  69570. */
  69571. this.ignore = false;
  69572. Util_Util.extend(this, options);
  69573. this.id = this.id || Util_Util.createUniqueID("smShapeGroup_");
  69574. this.CLASS_NAME = "SuperMap.LevelRenderer.Group";
  69575. }
  69576. /**
  69577. * @function LevelRenderer.Group.prototype.destroy
  69578. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  69579. */
  69580. destroy() {
  69581. this.id = null;
  69582. this.type = null;
  69583. this.clipShape = null;
  69584. this._children = null;
  69585. this._storage = null;
  69586. this.__dirty = null;
  69587. this.ignore = null;
  69588. super.destroy();
  69589. }
  69590. /**
  69591. * @function LevelRenderer.Group.prototype.children
  69592. * @description 复制并返回一份新的包含所有儿子节点的数组。
  69593. * @returns {Array.<LevelRenderer.Shape>} 图形数组。
  69594. */
  69595. children() {
  69596. return this._children.slice();
  69597. }
  69598. /**
  69599. * @function LevelRenderer.Group.prototype.childAt
  69600. * @description 获取指定 index 的儿子节点
  69601. * @param {number} idx - 节点索引。
  69602. * @returns {LevelRenderer.Shape} 图形。
  69603. */
  69604. childAt(idx) {
  69605. return this._children[idx];
  69606. }
  69607. /**
  69608. * @function LevelRenderer.Group.prototype.addChild
  69609. * @description 添加子节点,可以是 Shape 或者 Group。
  69610. * @param {(LevelRenderer.Shape|LevelRenderer.Group)} child - 节点图形。
  69611. */
  69612. // TODO Type Check
  69613. addChild(child) {
  69614. if (child == this) {
  69615. return;
  69616. }
  69617. if (child.parent == this) {
  69618. return;
  69619. }
  69620. if (child.parent) {
  69621. child.parent.removeChild(child);
  69622. }
  69623. this._children.push(child);
  69624. child.parent = this;
  69625. if (this._storage && this._storage !== child._storage) {
  69626. this._storage.addToMap(child);
  69627. if (child instanceof Group) {
  69628. child.addChildrenToStorage(this._storage);
  69629. }
  69630. }
  69631. }
  69632. /**
  69633. * @function LevelRenderer.Group.prototype.removeChild
  69634. * @description 移除子节点。
  69635. * @param {LevelRenderer.Shape} child - 需要移除的子节点图形。
  69636. */
  69637. removeChild(child) {
  69638. var idx = Util_Util.indexOf(this._children, child);
  69639. this._children.splice(idx, 1);
  69640. child.parent = null;
  69641. if (this._storage) {
  69642. this._storage.delFromMap(child.id);
  69643. if (child instanceof Group) {
  69644. child.delChildrenFromStorage(this._storage);
  69645. }
  69646. }
  69647. }
  69648. /**
  69649. * @function LevelRenderer.Group.prototype.eachChild
  69650. * @description 遍历所有子节点。
  69651. * @param {function} cb - 回调函数。
  69652. * @param {Object} context - 上下文。
  69653. */
  69654. eachChild(cb, context) {
  69655. var haveContext = !!context;
  69656. for (var i = 0; i < this._children.length; i++) {
  69657. var child = this._children[i];
  69658. if (haveContext) {
  69659. cb.call(context, child);
  69660. } else {
  69661. cb(child);
  69662. }
  69663. }
  69664. }
  69665. /**
  69666. * @function LevelRenderer.Group.prototype.traverse
  69667. * @description 深度优先遍历所有子孙节点。
  69668. * @param {function} cb - 回调函数。
  69669. * @param {Object} context - 上下文。
  69670. */
  69671. traverse(cb, context) {
  69672. var haveContext = !!context;
  69673. for (var i = 0; i < this._children.length; i++) {
  69674. var child = this._children[i];
  69675. if (haveContext) {
  69676. cb.call(context, child);
  69677. } else {
  69678. cb(child);
  69679. }
  69680. if (child.type === 'group') {
  69681. child.traverse(cb, context);
  69682. }
  69683. }
  69684. }
  69685. /**
  69686. * @function LevelRenderer.Group.prototype.addChildrenToStorage
  69687. * @description 把子图形添加到仓库。
  69688. * @param {LevelRenderer.Storage} storage - 图形仓库。
  69689. */
  69690. addChildrenToStorage(storage) {
  69691. for (var i = 0; i < this._children.length; i++) {
  69692. var child = this._children[i];
  69693. storage.addToMap(child);
  69694. if (child.type === 'group') {
  69695. child.addChildrenToStorage(storage);
  69696. }
  69697. }
  69698. }
  69699. /**
  69700. * @function LevelRenderer.Group.prototype.delChildrenFromStorage
  69701. * @description 从仓库把子图形删除。
  69702. * @param {LevelRenderer.Storage} storage - 图形仓库。
  69703. */
  69704. delChildrenFromStorage(storage) {
  69705. for (var i = 0; i < this._children.length; i++) {
  69706. var child = this._children[i];
  69707. storage.delFromMap(child.id);
  69708. if (child.type === 'group') {
  69709. child.delChildrenFromStorage(storage);
  69710. }
  69711. }
  69712. }
  69713. /**
  69714. * @function LevelRenderer.Group.prototype.modSelf
  69715. * @description 是否修改。
  69716. */
  69717. modSelf() {
  69718. this.__dirty = true;
  69719. }
  69720. }
  69721. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Storage.js
  69722. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69723. * This program are made available under the terms of the Apache License, Version 2.0
  69724. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69725. /**
  69726. * @private
  69727. * @class LevelRenderer.Storage
  69728. * @category Visualization Theme
  69729. * @classdesc 内容(图像)仓库 (M) 。
  69730. */
  69731. class Storage {
  69732. constructor() {
  69733. /**
  69734. * @member {Object} LevelRenderer.Storage.prototype._elements
  69735. * @description 所有常规形状,id 索引的 map。
  69736. */
  69737. this._elements = {};
  69738. /**
  69739. * @member {Array} LevelRenderer.Storage.prototype._hoverElements
  69740. * @description 高亮层形状,不稳定,动态增删,数组位置也是 z 轴方向,靠前显示在下方。
  69741. *
  69742. */
  69743. this._hoverElements = [];
  69744. /**
  69745. * @member {Array} LevelRenderer.Storage.prototype._roots
  69746. * @description _roots。
  69747. *
  69748. */
  69749. this._roots = [];
  69750. /**
  69751. * @member {Array} LevelRenderer.Storage.prototype._shapeList
  69752. * @description _shapeList。
  69753. *
  69754. */
  69755. this._shapeList = [];
  69756. /**
  69757. * @member {number} LevelRenderer.Storage.prototype._shapeListOffset
  69758. * @description _shapeListOffset。默认值:0。
  69759. *
  69760. */
  69761. this._shapeListOffset = 0;
  69762. this.CLASS_NAME = "SuperMap.LevelRenderer.Storage";
  69763. }
  69764. /**
  69765. * @function LevelRenderer.Storage.prototype.destroy
  69766. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  69767. */
  69768. destroy() {
  69769. this.dispose();
  69770. this._shapeList = null;
  69771. this._shapeListOffset = null;
  69772. }
  69773. /**
  69774. * @function LevelRenderer.Storage.prototype.iterShape
  69775. * @description 遍历迭代器。
  69776. *
  69777. * @param {function} fun - 迭代回调函数,return true终止迭代。
  69778. * @param {Object} option - 迭代参数,缺省为仅降序遍历普通层图形。
  69779. * @param {boolean} [hover=true] - 是否是高亮层图形。
  69780. * @param {string} [normal='down'] - 是否是普通层图形,迭代时是否指定及z轴顺序。可设值:'down' ,'up'。
  69781. * @param {boolean} [update=false] - 是否在迭代前更新形状列表。
  69782. * @return {LevelRenderer.Storage} this。
  69783. */
  69784. iterShape(fun, option) {
  69785. if (!option) {
  69786. var defaultIterateOption = {
  69787. hover: false,
  69788. normal: 'down',
  69789. update: false
  69790. };
  69791. option = defaultIterateOption;
  69792. }
  69793. if (option.hover) {
  69794. // 高亮层数据遍历
  69795. for (var i = 0, l = this._hoverElements.length; i < l; i++) {
  69796. var el = this._hoverElements[i];
  69797. el.updateTransform();
  69798. if (fun(el)) {
  69799. return this;
  69800. }
  69801. }
  69802. }
  69803. if (option.update) {
  69804. this.updateShapeList();
  69805. }
  69806. // 遍历: 'down' | 'up'
  69807. switch (option.normal) {
  69808. case 'down':
  69809. {
  69810. // 降序遍历,高层优先
  69811. let l = this._shapeList.length;
  69812. while (l--) {
  69813. if (fun(this._shapeList[l])) {
  69814. return this;
  69815. }
  69816. }
  69817. break;
  69818. }
  69819. // case 'up':
  69820. default:
  69821. {
  69822. // 升序遍历,底层优先
  69823. for (let i = 0, l = this._shapeList.length; i < l; i++) {
  69824. if (fun(this._shapeList[i])) {
  69825. return this;
  69826. }
  69827. }
  69828. break;
  69829. }
  69830. }
  69831. return this;
  69832. }
  69833. /**
  69834. * @function LevelRenderer.Storage.prototype.getHoverShapes
  69835. * @param {boolean} [update=false] - 是否在返回前更新图形的变换。
  69836. * @return {Array.<LevelRenderer.Shape>} 图形数组。
  69837. */
  69838. getHoverShapes(update) {
  69839. // hoverConnect
  69840. var hoverElements = [], len = this._hoverElements.length;
  69841. for (let i = 0; i < len; i++) {
  69842. hoverElements.push(this._hoverElements[i]);
  69843. var target = this._hoverElements[i].hoverConnect;
  69844. if (target) {
  69845. var shape;
  69846. target = target instanceof Array ? target : [target];
  69847. for (var j = 0, k = target.length; j < k; j++) {
  69848. shape = target[j].id ? target[j] : this.get(target[j]);
  69849. if (shape) {
  69850. hoverElements.push(shape);
  69851. }
  69852. }
  69853. }
  69854. }
  69855. hoverElements.sort(Storage.shapeCompareFunc);
  69856. if (update) {
  69857. for (let i = 0, l = hoverElements.length; i < l; i++) {
  69858. hoverElements[i].updateTransform();
  69859. }
  69860. }
  69861. return hoverElements;
  69862. }
  69863. /**
  69864. * @function LevelRenderer.Storage.prototype.getShapeList
  69865. * @description 返回所有图形的绘制队列。
  69866. *
  69867. * @param {boolean} [update=false] - 是否在返回前更新该数组。详见:<LevelRenderer.Shape> updateShapeList。
  69868. * @return {LevelRenderer.Shape} 图形。
  69869. */
  69870. getShapeList(update) {
  69871. if (update) {
  69872. this.updateShapeList();
  69873. }
  69874. return this._shapeList;
  69875. }
  69876. /**
  69877. * @function LevelRenderer.Storage.prototype.updateShapeList
  69878. * @description 更新图形的绘制队列。每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列。
  69879. */
  69880. updateShapeList() {
  69881. this._shapeListOffset = 0;
  69882. var rootsLen = this._roots.length;
  69883. for (let i = 0; i < rootsLen; i++) {
  69884. let root = this._roots[i];
  69885. this._updateAndAddShape(root);
  69886. }
  69887. this._shapeList.length = this._shapeListOffset;
  69888. var shapeListLen = this._shapeList.length;
  69889. for (let i = 0; i < shapeListLen; i++) {
  69890. this._shapeList[i].__renderidx = i;
  69891. }
  69892. this._shapeList.sort(Storage.shapeCompareFunc);
  69893. }
  69894. /**
  69895. * @function LevelRenderer.Storage.prototype._updateAndAddShape
  69896. * @description 更新并添加图形。
  69897. *
  69898. */
  69899. _updateAndAddShape(el, clipShapes) {
  69900. if (el.ignore) {
  69901. return;
  69902. }
  69903. el.updateTransform();
  69904. if (el.type == 'group') {
  69905. if (el.clipShape) {
  69906. // clipShape 的变换是基于 group 的变换
  69907. el.clipShape.parent = el;
  69908. el.clipShape.updateTransform();
  69909. // PENDING 效率影响
  69910. if (clipShapes) {
  69911. clipShapes = clipShapes.slice();
  69912. clipShapes.push(el.clipShape);
  69913. } else {
  69914. clipShapes = [el.clipShape];
  69915. }
  69916. }
  69917. for (var i = 0; i < el._children.length; i++) {
  69918. var child = el._children[i];
  69919. // Force to mark as dirty if group is dirty
  69920. child.__dirty = el.__dirty || child.__dirty;
  69921. this._updateAndAddShape(child, clipShapes);
  69922. }
  69923. // Mark group clean here
  69924. el.__dirty = false;
  69925. } else {
  69926. el.__clipShapes = clipShapes;
  69927. this._shapeList[this._shapeListOffset++] = el;
  69928. }
  69929. }
  69930. /**
  69931. * @function LevelRenderer.Storage.prototype.mod
  69932. * @description 修改图形(Shape)或者组(Group)。
  69933. *
  69934. * @param {string} elId - 唯一标识。
  69935. * @param {Object} params - 参数。
  69936. * @return {LevelRenderer.Storage} this。
  69937. */
  69938. mod(elId, params) {
  69939. var el = this._elements[elId];
  69940. if (el) {
  69941. el.modSelf();
  69942. if (params) {
  69943. // 如果第二个参数直接使用 shape
  69944. // parent, _storage, __startClip 三个属性会有循环引用
  69945. // 主要为了向 1.x 版本兼容,2.x 版本不建议使用第二个参数
  69946. if (params.parent || params._storage || params.__startClip) {
  69947. var target = {};
  69948. for (var name in params) {
  69949. if (
  69950. name == 'parent'
  69951. || name == '_storage'
  69952. || name == '__startClip'
  69953. ) {
  69954. continue;
  69955. }
  69956. if (params.hasOwnProperty(name)) {
  69957. target[name] = params[name];
  69958. }
  69959. }
  69960. new levelRenderer_Util_Util().merge(el, target, true);
  69961. } else {
  69962. new levelRenderer_Util_Util().merge(el, params, true);
  69963. }
  69964. }
  69965. }
  69966. return this;
  69967. }
  69968. /**
  69969. * @function LevelRenderer.Storage.prototype.drift
  69970. * @description 移动指定的图形(Shape)的位置。
  69971. * @param {string} shapeId - 唯一标识。
  69972. * @param {number} dx
  69973. * @param {number} dy
  69974. * @return {LevelRenderer.Storage} this。
  69975. */
  69976. drift(shapeId, dx, dy) {
  69977. var shape = this._elements[shapeId];
  69978. if (shape) {
  69979. shape.needTransform = true;
  69980. if (shape.draggable === 'horizontal') {
  69981. dy = 0;
  69982. } else if (shape.draggable === 'vertical') {
  69983. dx = 0;
  69984. }
  69985. if (!shape.ondrift // ondrift
  69986. // 有onbrush并且调用执行返回false或undefined则继续
  69987. || (shape.ondrift && !shape.ondrift(dx, dy))
  69988. ) {
  69989. shape.drift(dx, dy);
  69990. }
  69991. }
  69992. return this;
  69993. }
  69994. /**
  69995. * @function LevelRenderer.Storage.prototype.addHover
  69996. * @description 添加高亮层数据。
  69997. * @param {LevelRenderer.Shape} shape - 图形。
  69998. * @return {LevelRenderer.Storage} this。
  69999. */
  70000. addHover(shape) {
  70001. shape.updateNeedTransform();
  70002. this._hoverElements.push(shape);
  70003. return this;
  70004. }
  70005. /**
  70006. * @function LevelRenderer.Storage.prototype.delHover
  70007. * @description 清空高亮层数据。
  70008. * @return {LevelRenderer.Storage} this。
  70009. */
  70010. delHover() {
  70011. this._hoverElements = [];
  70012. return this;
  70013. }
  70014. /**
  70015. * @function LevelRenderer.Storage.prototype.hasHoverShape
  70016. * @description 是否有图形在高亮层里。
  70017. * @return {boolean} 是否有图形在高亮层里。
  70018. */
  70019. hasHoverShape() {
  70020. return this._hoverElements.length > 0;
  70021. }
  70022. /**
  70023. * @function LevelRenderer.Storage.prototype.addRoot
  70024. * @description 添加图形(Shape)或者组(Group)到根节点。
  70025. *
  70026. * @param {(LevelRenderer.Shape/LevelRenderer.Group)} el - 图形。
  70027. *
  70028. */
  70029. addRoot(el) {
  70030. if (el instanceof Group) {
  70031. el.addChildrenToStorage(this);
  70032. }
  70033. this.addToMap(el);
  70034. this._roots.push(el);
  70035. }
  70036. /**
  70037. * @function LevelRenderer.Storage.prototype.delRoot
  70038. * @description 删除指定的图形(Shape)或者组(Group)。
  70039. *
  70040. * @param {Array.<string>} elId - 删除图形(Shape)或者组(Group)的 ID 数组。如果为空清空整个Storage。
  70041. *
  70042. */
  70043. delRoot(elId) {
  70044. if (typeof(elId) == 'undefined') {
  70045. // 不指定elId清空
  70046. for (var i = 0; i < this._roots.length; i++) {
  70047. var root = this._roots[i];
  70048. if (root instanceof Group) {
  70049. root.delChildrenFromStorage(this);
  70050. }
  70051. }
  70052. this._elements = {};
  70053. this._hoverElements = [];
  70054. this._roots = [];
  70055. return;
  70056. }
  70057. if (elId instanceof Array) {
  70058. var elIdLen = elId.length;
  70059. for (let i = 0; i < elIdLen; i++) {
  70060. this.delRoot(elId[i]);
  70061. }
  70062. return;
  70063. }
  70064. var el;
  70065. if (typeof(elId) == 'string') {
  70066. el = this._elements[elId];
  70067. } else {
  70068. el = elId;
  70069. }
  70070. var idx = new levelRenderer_Util_Util().indexOf(this._roots, el);
  70071. if (idx >= 0) {
  70072. this.delFromMap(el.id);
  70073. this._roots.splice(idx, 1);
  70074. if (el instanceof Group) {
  70075. el.delChildrenFromStorage(this);
  70076. }
  70077. }
  70078. }
  70079. /**
  70080. * @function LevelRenderer.Storage.prototype.addToMap
  70081. * @description 添加图形到 map。
  70082. *
  70083. * @param {LevelRenderer.Shape} el - 图形。
  70084. * @return {LevelRenderer.Storage} this。
  70085. */
  70086. addToMap(el) {
  70087. if (el instanceof Group) {
  70088. el._storage = this;
  70089. }
  70090. el.modSelf();
  70091. this._elements[el.id] = el;
  70092. return this;
  70093. }
  70094. /**
  70095. * @function LevelRenderer.Storage.prototype.get
  70096. * @description 获取指定图形。
  70097. *
  70098. * @param {string} elId - 图形 id。
  70099. * @return {LevelRenderer.Shape} 图形。
  70100. */
  70101. get(elId) {
  70102. return this._elements[elId];
  70103. }
  70104. /**
  70105. * @function LevelRenderer.Storage.prototype.delFromMap
  70106. * @description 从 map 中删除指定图形。
  70107. *
  70108. * @param {string} elId - 图形id。
  70109. * @return {LevelRenderer.Storage} this。
  70110. */
  70111. delFromMap(elId) {
  70112. var el = this._elements[elId];
  70113. if (el) {
  70114. delete this._elements[elId];
  70115. if (el instanceof Group) {
  70116. el._storage = null;
  70117. }
  70118. }
  70119. return this;
  70120. }
  70121. /**
  70122. * @function LevelRenderer.Storage.prototype.dispose
  70123. * @description 清空并且释放 Storage。
  70124. */
  70125. dispose() {
  70126. this._elements = null;
  70127. // this._renderList = null;
  70128. this._roots = null;
  70129. this._hoverElements = null;
  70130. }
  70131. static shapeCompareFunc(a, b) {
  70132. if (a.zlevel == b.zlevel) {
  70133. if (a.z == b.z) {
  70134. return a.__renderidx - b.__renderidx;
  70135. }
  70136. return a.z - b.z;
  70137. }
  70138. return a.zlevel - b.zlevel;
  70139. }
  70140. }
  70141. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Painter.js
  70142. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70143. * This program are made available under the terms of the Apache License, Version 2.0
  70144. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70145. /**
  70146. * @private
  70147. * @class LevelRenderer.Painter
  70148. * @category Visualization Theme
  70149. * @classdesc Painter 绘图模块。
  70150. * @param {HTMLElement} root - 绘图区域(DIV)。
  70151. * @param {LevelRenderer.Storage} storage - Storage 实例。
  70152. */
  70153. class Painter {
  70154. constructor(root, storage) {
  70155. /**
  70156. * @member {HTMLElement} LevelRenderer.Painter.prototype.root
  70157. * @description 绘图容器。
  70158. *
  70159. */
  70160. this.root = root;
  70161. /**
  70162. * @member {Array} LevelRenderer.Painter.prototype.storage
  70163. * @description 图形仓库。
  70164. *
  70165. */
  70166. this.storage = storage;
  70167. /**
  70168. * @member {HTMLElement} LevelRenderer.Painter.prototype._domRoot
  70169. * @description 容器根 dom 对象。
  70170. *
  70171. */
  70172. this._domRoot = null;
  70173. /**
  70174. * @member {Object} LevelRenderer.Painter.prototype._layers
  70175. * @description 绘制层对象。
  70176. *
  70177. */
  70178. this._layers = {};
  70179. /**
  70180. * @member {Array} LevelRenderer.Painter.prototype._zlevelList
  70181. * @description 层列表。
  70182. *
  70183. */
  70184. this._zlevelList = [];
  70185. /**
  70186. * @member {Object} LevelRenderer.Painter.prototype._layerConfig
  70187. * @description 绘制层配置对象。
  70188. *
  70189. */
  70190. this._layerConfig = {};
  70191. /**
  70192. * @member {Object} LevelRenderer.Painter.prototype._bgDom
  70193. * @description 背景层 Canvas (Dom)。
  70194. *
  70195. */
  70196. this._bgDom = null;
  70197. /**
  70198. * @member {function} LevelRenderer.Painter.prototype.shapeToImage
  70199. * @description 形状转图像函数。
  70200. *
  70201. */
  70202. this.shapeToImage = null;
  70203. // retina 屏幕优化
  70204. Painter.devicePixelRatio = Math.max((window.devicePixelRatio || 1), 1);
  70205. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter";
  70206. this.root.innerHTML = '';
  70207. this._width = this._getWidth(); // 宽,缓存记录
  70208. this._height = this._getHeight(); // 高,缓存记录
  70209. var domRoot = document.createElement('div');
  70210. this._domRoot = domRoot;
  70211. // domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
  70212. domRoot.style.position = 'relative';
  70213. domRoot.style.overflow = 'hidden';
  70214. domRoot.style.width = this._width + 'px';
  70215. domRoot.style.height = this._height + 'px';
  70216. this.root.appendChild(domRoot);
  70217. this.shapeToImage = this._createShapeToImageProcessor();
  70218. // 创建各层canvas
  70219. // 背景
  70220. //this._bgDom = Painter.createDom('bg', 'div', this);
  70221. this._bgDom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme_background_"), 'div', this);
  70222. domRoot.appendChild(this._bgDom);
  70223. this._bgDom.onselectstart = returnFalse;
  70224. this._bgDom.style['-webkit-user-select'] = 'none';
  70225. this._bgDom.style['user-select'] = 'none';
  70226. this._bgDom.style['-webkit-touch-callout'] = 'none';
  70227. // 高亮
  70228. //var hoverLayer = new PaintLayer('_hoverLayer_', this);
  70229. var hoverLayer = new PaintLayer(Util_Util.createUniqueID("_highLightLayer_"), this);
  70230. this._layers['hover'] = hoverLayer;
  70231. domRoot.appendChild(hoverLayer.dom);
  70232. hoverLayer.initContext();
  70233. hoverLayer.dom.onselectstart = returnFalse;
  70234. hoverLayer.dom.style['-webkit-user-select'] = 'none';
  70235. hoverLayer.dom.style['user-select'] = 'none';
  70236. hoverLayer.dom.style['-webkit-touch-callout'] = 'none';
  70237. var me = this;
  70238. this.updatePainter = function (shapeList, callback) {
  70239. me.refreshShapes(shapeList, callback);
  70240. };
  70241. // 返回false的方法,用于避免页面被选中
  70242. function returnFalse() {
  70243. return false;
  70244. }
  70245. /* eslint-disable */
  70246. // 什么都不干的空方法
  70247. function doNothing() { //NOSONAR
  70248. }
  70249. /* eslint-enable */
  70250. }
  70251. /**
  70252. * @function LevelRenderer.Painter.prototype.destroy
  70253. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  70254. */
  70255. destroy() {
  70256. this.dispose();
  70257. this._zlevelList = null;
  70258. this._layerConfig = null;
  70259. this._bgDom = null;
  70260. this.shapeToImage = null;
  70261. }
  70262. /**
  70263. * @function LevelRenderer.Painter.prototype.render
  70264. * @description 渲染。首次绘图,创建各种 dom 和 context。
  70265. *
  70266. * @param {function} callback - 绘画结束后的回调函数。
  70267. * @return {LevelRenderer.Painter} this。
  70268. */
  70269. render(callback) {
  70270. // TODO
  70271. this.refresh(callback, true);
  70272. return this;
  70273. }
  70274. /**
  70275. * @function LevelRenderer.Painter.prototype.refresh
  70276. * @description 刷新。
  70277. *
  70278. * @param {function} callback - 刷新结束后的回调函数。
  70279. * @param {boolean} paintAll - 强制绘制所有 shape。
  70280. * @return {LevelRenderer.Painter} this。
  70281. */
  70282. refresh(callback, paintAll) {
  70283. var list = this.storage.getShapeList(true);
  70284. this._paintList(list, paintAll);
  70285. if (typeof callback == 'function') {
  70286. callback();
  70287. }
  70288. return this;
  70289. }
  70290. /**
  70291. * Method: _paintList
  70292. * 按列表绘制图形。
  70293. */
  70294. _paintList(list, paintAll) {
  70295. if (typeof(paintAll) == 'undefined') {
  70296. paintAll = false;
  70297. }
  70298. this._updateLayerStatus(list);
  70299. var currentLayer;
  70300. var currentZLevel;
  70301. var ctx;
  70302. for (var id in this._layers) {
  70303. if (id !== 'hover') {
  70304. this._layers[id].unusedCount++;
  70305. this._layers[id].updateTransform();
  70306. }
  70307. }
  70308. var invTransform = [];
  70309. for (var i = 0, l = list.length; i < l; i++) {
  70310. var shape = list[i];
  70311. if (currentZLevel !== shape.zlevel) {
  70312. if (currentLayer && currentLayer.needTransform) {
  70313. ctx.restore();
  70314. }
  70315. currentLayer = this.getLayer(shape.zlevel);
  70316. ctx = currentLayer.ctx;
  70317. currentZLevel = shape.zlevel;
  70318. // Reset the count
  70319. currentLayer.unusedCount = 0;
  70320. if (currentLayer.dirty || paintAll) {
  70321. currentLayer.clear();
  70322. }
  70323. if (currentLayer.needTransform) {
  70324. ctx.save();
  70325. currentLayer.setTransform(ctx);
  70326. }
  70327. }
  70328. // Start group clipping
  70329. if (ctx && shape.__startClip) {
  70330. var clipShape = shape.__startClip;
  70331. ctx.save();
  70332. // Set transform
  70333. if (clipShape.needTransform) {
  70334. let m = clipShape.transform;
  70335. SUtil_SUtil.Util_matrix.invert(invTransform, m);
  70336. ctx.transform(
  70337. m[0], m[1],
  70338. m[2], m[3],
  70339. m[4], m[5]
  70340. );
  70341. }
  70342. ctx.beginPath();
  70343. clipShape.buildPath(ctx, clipShape.style);
  70344. ctx.clip();
  70345. // Transform back
  70346. if (clipShape.needTransform) {
  70347. let m = invTransform;
  70348. ctx.transform(
  70349. m[0], m[1],
  70350. m[2], m[3],
  70351. m[4], m[5]
  70352. );
  70353. }
  70354. }
  70355. if (((currentLayer && currentLayer.dirty) || paintAll) && !shape.invisible) {
  70356. if (
  70357. !shape.onbrush
  70358. || (shape.onbrush && !shape.onbrush(ctx, false))
  70359. ) {
  70360. if (Config.catchBrushException) {
  70361. try {
  70362. shape.brush(ctx, false, this.updatePainter);
  70363. } catch (error) {
  70364. SUtil_SUtil.Util_log(
  70365. error,
  70366. 'brush error of ' + shape.type,
  70367. shape
  70368. );
  70369. }
  70370. } else {
  70371. shape.brush(ctx, false, this.updatePainter);
  70372. }
  70373. }
  70374. }
  70375. // Stop group clipping
  70376. if (ctx && shape.__stopClip) {
  70377. ctx.restore();
  70378. }
  70379. shape.__dirty = false;
  70380. }
  70381. if (ctx && currentLayer && currentLayer.needTransform) {
  70382. ctx.restore();
  70383. }
  70384. for (let id in this._layers) {
  70385. if (id !== 'hover') {
  70386. var layer = this._layers[id];
  70387. layer.dirty = false;
  70388. // 删除过期的层
  70389. // PENDING
  70390. // if (layer.unusedCount >= 500) {
  70391. // this.delLayer(id);
  70392. // }
  70393. if (layer.unusedCount == 1) {
  70394. layer.clear();
  70395. }
  70396. }
  70397. }
  70398. }
  70399. /**
  70400. * @function LevelRenderer.Painter.prototype.getLayer
  70401. * @description 获取 zlevel 所在层,如果不存在则会创建一个新的层。
  70402. *
  70403. * @param {number} zlevel - zlevel。
  70404. * @return {LevelRenderer.Painter} this。
  70405. */
  70406. getLayer(zlevel) {
  70407. // Change draw layer
  70408. var currentLayer = this._layers[zlevel];
  70409. if (!currentLayer) {
  70410. var len = this._zlevelList.length;
  70411. var prevLayer = null;
  70412. var i = -1;
  70413. if (len > 0 && zlevel > this._zlevelList[0]) {
  70414. for (i = 0; i < len - 1; i++) {
  70415. if (
  70416. this._zlevelList[i] < zlevel
  70417. && this._zlevelList[i + 1] > zlevel
  70418. ) {
  70419. break;
  70420. }
  70421. }
  70422. prevLayer = this._layers[this._zlevelList[i]];
  70423. }
  70424. this._zlevelList.splice(i + 1, 0, zlevel);
  70425. // Create a new layer
  70426. //currentLayer = new PaintLayer(zlevel, this);
  70427. currentLayer = new PaintLayer(Util_Util.createUniqueID("_levelLayer_" + zlevel), this);
  70428. var prevDom = prevLayer ? prevLayer.dom : this._bgDom;
  70429. if (prevDom.nextSibling) {
  70430. prevDom.parentNode.insertBefore(
  70431. currentLayer.dom,
  70432. prevDom.nextSibling
  70433. );
  70434. } else {
  70435. prevDom.parentNode.appendChild(
  70436. currentLayer.dom
  70437. );
  70438. }
  70439. currentLayer.initContext();
  70440. this._layers[zlevel] = currentLayer;
  70441. if (this._layerConfig[zlevel]) {
  70442. new levelRenderer_Util_Util().merge(currentLayer, this._layerConfig[zlevel], true);
  70443. }
  70444. currentLayer.updateTransform();
  70445. }
  70446. return currentLayer;
  70447. }
  70448. /**
  70449. * @function LevelRenderer.Painter.prototype.getLayers
  70450. * @description 获取所有已创建的层。
  70451. * @return {Array.<Painter.Layer>} 已创建的层
  70452. */
  70453. getLayers() {
  70454. return this._layers;
  70455. }
  70456. /**
  70457. * Method: _updateLayerStatus
  70458. * 更新绘制层状态。
  70459. */
  70460. _updateLayerStatus(list) {
  70461. var layers = this._layers;
  70462. var elCounts = {};
  70463. for (let z in layers) {
  70464. if (z !== 'hover') {
  70465. elCounts[z] = layers[z].elCount;
  70466. layers[z].elCount = 0;
  70467. }
  70468. }
  70469. for (let i = 0; i < list.length; i++) {
  70470. var shape = list[i];
  70471. var zlevel = shape.zlevel;
  70472. var layer = layers[zlevel];
  70473. if (layer) {
  70474. layer.elCount++;
  70475. // 已经被标记为需要刷新
  70476. if (layer.dirty) {
  70477. continue;
  70478. }
  70479. layer.dirty = shape.__dirty;
  70480. }
  70481. }
  70482. // 层中的元素数量有发生变化
  70483. for (let z in layers) {
  70484. if (z !== 'hover') {
  70485. if (elCounts[z] !== layers[z].elCount) {
  70486. layers[z].dirty = true;
  70487. }
  70488. }
  70489. }
  70490. }
  70491. /**
  70492. * @function LevelRenderer.Painter.prototype.refreshShapes
  70493. * @description 更新的图形元素列表。
  70494. *
  70495. * @param {number} shapeList - 需要更新的图形元素列表。
  70496. * @param {number} callback - 视图更新后回调函数。
  70497. * @return {LevelRenderer.Painter} this。
  70498. */
  70499. refreshShapes(shapeList, callback) {
  70500. for (var i = 0, l = shapeList.length; i < l; i++) {
  70501. var shape = shapeList[i];
  70502. this.storage.mod(shape.id);
  70503. }
  70504. this.refresh(callback);
  70505. return this;
  70506. }
  70507. /**
  70508. * @function LevelRenderer.Painter.prototype.clear
  70509. * @description 清除 hover 层外所有内容。
  70510. * @return {LevelRenderer.Painter} this。
  70511. */
  70512. clear() {
  70513. for (var k in this._layers) {
  70514. if (k == 'hover') {
  70515. continue;
  70516. }
  70517. this._layers[k].clear();
  70518. }
  70519. return this;
  70520. }
  70521. /**
  70522. * @function LevelRenderer.Painter.prototype.modLayer
  70523. * @description 修改指定 zlevel 的绘制参数。
  70524. *
  70525. * @param {string} zlevel - zlevel。
  70526. * @param {Object} config - 配置对象。
  70527. * @param {string} [config.clearColor=0] - 每次清空画布的颜色。
  70528. * @param {boolean} [config.motionBlur=false] - 是否开启动态模糊。
  70529. * @param {number} [config.lastFrameAlpha=0.7] - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  70530. * @param {Array.<number>} config.position - 层的平移。
  70531. * @param {Array.<number>} config.rotation - 层的旋转。
  70532. * @param {Array.<number>} config.scale - 层的缩放。
  70533. * @param {boolean} config.zoomable - 层是否支持鼠标缩放操作。默认值:false。
  70534. * @param {boolean} config.panable - 层是否支持鼠标平移操作。默认值:false。
  70535. *
  70536. */
  70537. modLayer(zlevel, config) {
  70538. if (config) {
  70539. if (!this._layerConfig[zlevel]) {
  70540. this._layerConfig[zlevel] = config;
  70541. } else {
  70542. new levelRenderer_Util_Util().merge(this._layerConfig[zlevel], config, true);
  70543. }
  70544. var layer = this._layers[zlevel];
  70545. if (layer) {
  70546. new levelRenderer_Util_Util().merge(layer, this._layerConfig[zlevel], true);
  70547. }
  70548. }
  70549. }
  70550. /**
  70551. * @function LevelRenderer.Painter.prototype.delLayer
  70552. * @description 删除指定层。
  70553. *
  70554. * @param {string} zlevel - 层所在的 zlevel。
  70555. */
  70556. delLayer(zlevel) {
  70557. var layer = this._layers[zlevel];
  70558. if (!layer) {
  70559. return;
  70560. }
  70561. // Save config
  70562. this.modLayer(zlevel, {
  70563. position: layer.position,
  70564. rotation: layer.rotation,
  70565. scale: layer.scale
  70566. });
  70567. layer.dom.parentNode.removeChild(layer.dom);
  70568. delete this._layers[zlevel];
  70569. this._zlevelList.splice(new levelRenderer_Util_Util().indexOf(this._zlevelList, zlevel), 1);
  70570. }
  70571. /**
  70572. * @function LevelRenderer.Painter.prototype.refreshHover
  70573. * @description 刷新 hover 层。
  70574. * @return {LevelRenderer.Painter} this。
  70575. */
  70576. refreshHover() {
  70577. this.clearHover();
  70578. var list = this.storage.getHoverShapes(true);
  70579. for (var i = 0, l = list.length; i < l; i++) {
  70580. this._brushHover(list[i]);
  70581. }
  70582. this.storage.delHover();
  70583. return this;
  70584. }
  70585. /**
  70586. * @function LevelRenderer.Painter.prototype.clearHover
  70587. * @description 清除 hover 层所有内容。
  70588. * @return {LevelRenderer.Painter} this。
  70589. */
  70590. clearHover() {
  70591. var hover = this._layers.hover;
  70592. hover && hover.clear();
  70593. return this;
  70594. }
  70595. /**
  70596. * @function LevelRenderer.Painter.prototype.resize
  70597. * @description 区域大小变化后重绘。
  70598. * @return {LevelRenderer.Painter} this。
  70599. */
  70600. resize() {
  70601. var domRoot = this._domRoot;
  70602. domRoot.style.display = 'none';
  70603. var width = this._getWidth();
  70604. var height = this._getHeight();
  70605. domRoot.style.display = '';
  70606. // 优化没有实际改变的resize
  70607. if (this._width != width || height != this._height) {
  70608. this._width = width;
  70609. this._height = height;
  70610. domRoot.style.width = width + 'px';
  70611. domRoot.style.height = height + 'px';
  70612. for (var id in this._layers) {
  70613. this._layers[id].resize(width, height);
  70614. }
  70615. this.refresh(null, true);
  70616. }
  70617. return this;
  70618. }
  70619. /**
  70620. * @function LevelRenderer.Painter.prototype.clearLayer
  70621. * @description 清除指定的一个层。
  70622. * @param {number} zLevel - 层。
  70623. */
  70624. clearLayer(zLevel) {
  70625. var layer = this._layers[zLevel];
  70626. if (layer) {
  70627. layer.clear();
  70628. }
  70629. }
  70630. /**
  70631. * @function LevelRenderer.Painter.prototype.dispose
  70632. * @description 释放。
  70633. *
  70634. */
  70635. dispose() {
  70636. this.root.innerHTML = '';
  70637. this.root = null;
  70638. this.storage = null;
  70639. this._domRoot = null;
  70640. this._layers = null;
  70641. }
  70642. /**
  70643. * @function LevelRenderer.Painter.prototype.getDomHover
  70644. * @description 获取 Hover 层的 Dom。
  70645. */
  70646. getDomHover() {
  70647. return this._layers.hover.dom;
  70648. }
  70649. /**
  70650. * @function LevelRenderer.Painter.prototype.toDataURL
  70651. * @description 图像导出。
  70652. * @param {string} type - 图片类型。
  70653. * @param {string} backgroundColor - 背景色。默认值:'#fff'。
  70654. * @param {Object} args
  70655. * @return {string} 图片的Base64 url。
  70656. */
  70657. toDataURL(type, backgroundColor, args) {
  70658. //var imageDom = Painter.createDom('image', 'canvas', this);
  70659. var imageDom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.image_"), 'canvas', this);
  70660. this._bgDom.appendChild(imageDom);
  70661. var ctx = imageDom.getContext('2d');
  70662. Painter.devicePixelRatio != 1
  70663. && ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  70664. ctx.fillStyle = backgroundColor || '#fff';
  70665. ctx.rect(
  70666. 0, 0,
  70667. this._width * Painter.devicePixelRatio,
  70668. this._height * Painter.devicePixelRatio
  70669. );
  70670. ctx.fill();
  70671. var self = this;
  70672. // 升序遍历,shape上的zlevel指定绘画图层的z轴层叠
  70673. this.storage.iterShape(
  70674. function (shape) {
  70675. if (!shape.invisible) {
  70676. if (!shape.onbrush // 没有onbrush
  70677. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  70678. || (shape.onbrush && !shape.onbrush(ctx, false))
  70679. ) {
  70680. if (Config.catchBrushException) {
  70681. try {
  70682. shape.brush(ctx, false, self.updatePainter);
  70683. } catch (error) {
  70684. SUtil_SUtil.Util_log(
  70685. error,
  70686. 'brush error of ' + shape.type,
  70687. shape
  70688. );
  70689. }
  70690. } else {
  70691. shape.brush(ctx, false, self.updatePainter);
  70692. }
  70693. }
  70694. }
  70695. },
  70696. {normal: 'up', update: true}
  70697. );
  70698. var image = imageDom.toDataURL(type, args);
  70699. ctx = null;
  70700. this._bgDom.removeChild(imageDom);
  70701. return image;
  70702. }
  70703. /**
  70704. * @function LevelRenderer.Painter.prototype.getWidth
  70705. * @description 获取绘图区域宽度。
  70706. * @return {number} 绘图区域宽度。
  70707. */
  70708. getWidth() {
  70709. return this._width;
  70710. }
  70711. /**
  70712. * @function LevelRenderer.Painter.prototype.getHeight
  70713. * @description 获取绘图区域高度。
  70714. * @return {number} 绘图区域高度。
  70715. */
  70716. getHeight() {
  70717. return this._height;
  70718. }
  70719. /**
  70720. * Method: _getWidth
  70721. *
  70722. */
  70723. _getWidth() {
  70724. var root = this.root;
  70725. var stl = root.currentStyle
  70726. || document.defaultView.getComputedStyle(root);
  70727. return ((root.clientWidth || parseInt(stl.width, 10))
  70728. - parseInt(stl.paddingLeft, 10) // 请原谅我这比较粗暴
  70729. - parseInt(stl.paddingRight, 10)).toFixed(0) - 0;
  70730. }
  70731. /**
  70732. * Method: _getHeight
  70733. *
  70734. */
  70735. _getHeight() {
  70736. var root = this.root;
  70737. var stl = root.currentStyle
  70738. || document.defaultView.getComputedStyle(root);
  70739. return ((root.clientHeight || parseInt(stl.height, 10))
  70740. - parseInt(stl.paddingTop, 10) // 请原谅我这比较粗暴
  70741. - parseInt(stl.paddingBottom, 10)).toFixed(0) - 0;
  70742. }
  70743. /**
  70744. * Method: _brushHover
  70745. *
  70746. */
  70747. _brushHover(shape) {
  70748. var ctx = this._layers.hover.ctx;
  70749. if (!shape.onbrush // 没有onbrush
  70750. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  70751. || (shape.onbrush && !shape.onbrush(ctx, true))
  70752. ) {
  70753. var layer = this.getLayer(shape.zlevel);
  70754. if (layer.needTransform) {
  70755. ctx.save();
  70756. layer.setTransform(ctx);
  70757. }
  70758. // Retina 优化
  70759. if (Config.catchBrushException) {
  70760. try {
  70761. shape.brush(ctx, true, this.updatePainter);
  70762. } catch (error) {
  70763. SUtil_SUtil.Util_log(
  70764. error, 'hoverBrush error of ' + shape.type, shape
  70765. );
  70766. }
  70767. } else {
  70768. shape.brush(ctx, true, this.updatePainter);
  70769. }
  70770. if (layer.needTransform) {
  70771. ctx.restore();
  70772. }
  70773. }
  70774. }
  70775. /**
  70776. * Method: _shapeToImage
  70777. *
  70778. */
  70779. _shapeToImage(id, shape, width, height, devicePixelRatio) {
  70780. var canvas = document.createElement('canvas');
  70781. var ctx = canvas.getContext('2d');
  70782. var _devicePixelRatio = devicePixelRatio || window.devicePixelRatio || 1;
  70783. canvas.style.width = width + 'px';
  70784. canvas.style.height = height + 'px';
  70785. canvas.setAttribute('width', width * _devicePixelRatio);
  70786. canvas.setAttribute('height', height * _devicePixelRatio);
  70787. ctx.clearRect(0, 0, width * _devicePixelRatio, height * _devicePixelRatio);
  70788. var shapeTransform = {
  70789. position: shape.position,
  70790. rotation: shape.rotation,
  70791. scale: shape.scale
  70792. };
  70793. shape.position = [0, 0, 0];
  70794. shape.rotation = 0;
  70795. shape.scale = [1, 1];
  70796. if (shape) {
  70797. shape.brush(ctx, false);
  70798. }
  70799. var imgShape = new SmicImage({
  70800. id: id,
  70801. style: {
  70802. x: 0,
  70803. y: 0,
  70804. image: canvas
  70805. }
  70806. });
  70807. if (shapeTransform.position != null) {
  70808. imgShape.position = shape.position = shapeTransform.position;
  70809. }
  70810. if (shapeTransform.rotation != null) {
  70811. imgShape.rotation = shape.rotation = shapeTransform.rotation;
  70812. }
  70813. if (shapeTransform.scale != null) {
  70814. imgShape.scale = shape.scale = shapeTransform.scale;
  70815. }
  70816. return imgShape;
  70817. }
  70818. /**
  70819. * Method: _createShapeToImageProcessor
  70820. *
  70821. */
  70822. _createShapeToImageProcessor() {
  70823. var me = this;
  70824. return function (id, e, width, height) {
  70825. return me._shapeToImage(
  70826. id, e, width, height, Painter.devicePixelRatio
  70827. );
  70828. };
  70829. }
  70830. // SMIC-方法扩展 - start
  70831. /**
  70832. * @function LevelRenderer.Painter.prototype.updateHoverLayer
  70833. * @description 更新设置显示高亮图层。
  70834. * @param {Array} shapes - 图形数组。
  70835. */
  70836. updateHoverLayer(shapes) {
  70837. if (!(shapes instanceof Array)) {
  70838. return this;
  70839. }
  70840. //清除高亮
  70841. this.clearHover();
  70842. this.storage.delHover();
  70843. for (var i = 0; i < shapes.length; i++) {
  70844. this.storage.addHover(shapes[i]);
  70845. this._brushHover(shapes[i]);
  70846. }
  70847. }
  70848. /**
  70849. * @function LevelRenderer.Painter.prototype.createDom
  70850. * @description 创建 Dom。
  70851. *
  70852. * @param {string} id - Dom id
  70853. * @param {string} type - Dom type
  70854. * @param {LevelRenderer.Painter} painter - Painter 实例。
  70855. * @return {Object} Dom
  70856. */
  70857. static createDom(id, type, painter) {
  70858. var newDom = document.createElement(type);
  70859. var width = painter._width;
  70860. var height = painter._height;
  70861. // 没append呢,请原谅我这样写,清晰~
  70862. newDom.style.position = 'absolute';
  70863. newDom.style.left = 0;
  70864. newDom.style.top = 0;
  70865. newDom.style.width = width + 'px';
  70866. newDom.style.height = height + 'px';
  70867. newDom.setAttribute('width', width * Painter.devicePixelRatio);
  70868. newDom.setAttribute('height', height * Painter.devicePixelRatio);
  70869. // id不作为索引用,避免可能造成的重名,定义为私有属性
  70870. //newDom.setAttribute('data-zr-dom-id', id);
  70871. newDom.setAttribute('id', id);
  70872. return newDom;
  70873. }
  70874. }
  70875. /**
  70876. * @private
  70877. * @class Painter.Layer
  70878. * @classdesc 绘制层类。
  70879. * @extends LevelRenderer.Transformable
  70880. */
  70881. class PaintLayer extends Transformable {
  70882. /**
  70883. * @function Painter.Layer.constructor
  70884. * @description 构造函数。
  70885. *
  70886. * @param {string} id - id。
  70887. * @param {LevelRenderer.Painter} painter - Painter 实例。
  70888. *
  70889. */
  70890. constructor(id, painter) {
  70891. super(id, painter);
  70892. /**
  70893. * @member {Object} Painter.Layer.prototype.dom
  70894. * @description dom。
  70895. */
  70896. this.dom = null;
  70897. /**
  70898. * @member {Object} Painter.Layer.prototype.domBack
  70899. * @description domBack。
  70900. */
  70901. this.domBack = null;
  70902. /**
  70903. * @member {Object} Painter.Layer.prototype.ctxBack
  70904. * @description ctxBack。
  70905. */
  70906. this.ctxBack = null;
  70907. /**
  70908. * @member {LevelRenderer.Painter} Painter.Layer.prototype.painter
  70909. * @description painter。
  70910. */
  70911. this.painter = painter;
  70912. /**
  70913. * @member {number} Painter.Layer.prototype.unusedCount
  70914. * @description unusedCount。
  70915. */
  70916. this.unusedCount = 0;
  70917. /**
  70918. * @member {Object} Painter.Layer.prototype.config
  70919. * @description config。
  70920. */
  70921. this.config = null;
  70922. /**
  70923. * @member {boolean} Painter.Layer.prototype.dirty
  70924. * @description dirty。
  70925. */
  70926. this.dirty = true;
  70927. /**
  70928. * @member {number} Painter.Layer.prototype.elCount
  70929. * @description elCount。
  70930. */
  70931. this.elCount = 0;
  70932. // Configs
  70933. /**
  70934. * @member {string} Painter.Layer.prototype.clearColor
  70935. * @description 每次清空画布的颜色。默认值:0;
  70936. */
  70937. this.clearColor = 0;
  70938. /**
  70939. * @member {boolean} Painter.Layer.prototype.motionBlur
  70940. * @description 是否开启动态模糊。默认值:false;
  70941. */
  70942. this.motionBlur = false;
  70943. /**
  70944. * @member {number} Painter.Layer.prototype.lastFrameAlpha
  70945. * @description 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
  70946. */
  70947. this.lastFrameAlpha = 0.7;
  70948. /**
  70949. * @member {boolean} Painter.Layer.prototype.zoomable
  70950. * @description 层是否支持鼠标平移操作。默认值:false;
  70951. */
  70952. this.zoomable = false;
  70953. /**
  70954. * @member {boolean} Painter.Layer.prototype.panable
  70955. * @description 层是否支持鼠标缩放操作。默认值:false;
  70956. */
  70957. this.panable = false;
  70958. /**
  70959. * @member {number} Painter.Layer.prototype.maxZoom
  70960. * @description maxZoom。默认值:Infinity。
  70961. */
  70962. this.maxZoom = Infinity;
  70963. /**
  70964. * @member {number} Painter.Layer.prototype.minZoom
  70965. * @description minZoom。默认值:0。
  70966. */
  70967. this.minZoom = 0;
  70968. /**
  70969. * @member {number} Painter.Layer.prototype.ctx
  70970. * @description Canvas 上下文。
  70971. */
  70972. this.ctx = null;
  70973. this.dom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme" + id), 'canvas', painter);
  70974. this.dom.onselectstart = returnFalse; // 避免页面选中的尴尬
  70975. this.dom.style['-webkit-user-select'] = 'none';
  70976. this.dom.style['user-select'] = 'none';
  70977. this.dom.style['-webkit-touch-callout'] = 'none';
  70978. // Function
  70979. // 返回false的方法,用于避免页面被选中
  70980. function returnFalse() {
  70981. return false;
  70982. }
  70983. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter.Layer";
  70984. }
  70985. /**
  70986. * @function Painter.Layer.prototype.destroy
  70987. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  70988. */
  70989. destroy() {
  70990. this.dom = null;
  70991. this.domBack = null;
  70992. this.ctxBack = null;
  70993. this.painter = null;
  70994. this.unusedCount = null;
  70995. this.config = null;
  70996. this.dirty = null;
  70997. this.elCount = null;
  70998. this.clearColor = null;
  70999. this.motionBlur = null;
  71000. this.lastFrameAlpha = null;
  71001. this.zoomable = null;
  71002. this.panable = null;
  71003. this.maxZoom = null;
  71004. this.minZoom = null;
  71005. this.ctx = null;
  71006. Transformable.destroy.apply(this, arguments);
  71007. }
  71008. /**
  71009. * @function Painter.Layer.prototype.initContext
  71010. * @description 初始化 Canvan 2D 上下文。
  71011. */
  71012. initContext() {
  71013. this.ctx = this.dom.getContext('2d');
  71014. if (Painter.devicePixelRatio != 1) {
  71015. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  71016. }
  71017. }
  71018. /**
  71019. * @function Painter.Layer.prototype.createBackBuffer
  71020. * @description 创建备份缓冲。
  71021. */
  71022. createBackBuffer() {
  71023. this.domBack = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.back-" + this.id), 'canvas', this.painter);
  71024. this.ctxBack = this.domBack.getContext('2d');
  71025. if (Painter.devicePixelRatio != 1) {
  71026. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  71027. }
  71028. }
  71029. /**
  71030. * @function Painter.Layer.prototype.resize
  71031. * @description 改变大小。
  71032. *
  71033. * @param {number} width - 宽。
  71034. * @param {number} height - 高。
  71035. */
  71036. resize(width, height) {
  71037. this.dom.style.width = width + 'px';
  71038. this.dom.style.height = height + 'px';
  71039. this.dom.setAttribute('width', width * Painter.devicePixelRatio);
  71040. this.dom.setAttribute('height', height * Painter.devicePixelRatio);
  71041. if (Painter.devicePixelRatio != 1) {
  71042. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  71043. }
  71044. if (this.domBack) {
  71045. this.domBack.setAttribute('width', width * Painter.devicePixelRatio);
  71046. this.domBack.setAttribute('height', height * Painter.devicePixelRatio);
  71047. if (Painter.devicePixelRatio != 1) {
  71048. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  71049. }
  71050. }
  71051. }
  71052. /**
  71053. * @function Painter.Layer.prototype.clear
  71054. * @description 清空该层画布。
  71055. */
  71056. clear() {
  71057. var dom = this.dom;
  71058. var ctx = this.ctx;
  71059. var width = dom.width;
  71060. var height = dom.height;
  71061. var haveClearColor = this.clearColor;
  71062. var haveMotionBLur = this.motionBlur;
  71063. var lastFrameAlpha = this.lastFrameAlpha;
  71064. if (haveMotionBLur) {
  71065. if (!this.domBack) {
  71066. this.createBackBuffer();
  71067. }
  71068. this.ctxBack.globalCompositeOperation = 'copy';
  71069. this.ctxBack.drawImage(
  71070. dom, 0, 0,
  71071. width / Painter.devicePixelRatio,
  71072. height / Painter.devicePixelRatio
  71073. );
  71074. }
  71075. if (haveClearColor) {
  71076. ctx.save();
  71077. ctx.fillStyle = this.config.clearColor;
  71078. ctx.fillRect(
  71079. 0, 0,
  71080. width / Painter.devicePixelRatio,
  71081. height / Painter.devicePixelRatio
  71082. );
  71083. ctx.restore();
  71084. } else {
  71085. ctx.clearRect(
  71086. 0, 0,
  71087. width / Painter.devicePixelRatio,
  71088. height / Painter.devicePixelRatio
  71089. );
  71090. }
  71091. if (haveMotionBLur) {
  71092. var domBack = this.domBack;
  71093. ctx.save();
  71094. ctx.globalAlpha = lastFrameAlpha;
  71095. ctx.drawImage(
  71096. domBack, 0, 0,
  71097. width / Painter.devicePixelRatio,
  71098. height / Painter.devicePixelRatio
  71099. );
  71100. ctx.restore();
  71101. }
  71102. }
  71103. }
  71104. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Handler.js
  71105. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71106. * This program are made available under the terms of the Apache License, Version 2.0
  71107. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71108. /**
  71109. * @private
  71110. * @class LevelRenderer.Handler
  71111. * @category Visualization Theme
  71112. * @classdesc Handler控制模块。
  71113. * @extends {LevelRenderer.Eventful}
  71114. * @param {HTMLElement} root - 绘图区域。
  71115. * @param {LevelRenderer.Storage} storage - Storage 实例。
  71116. * @param {LevelRenderer.Painter} painter - Painter 实例。
  71117. */
  71118. class Handler extends Eventful {
  71119. constructor(root, storage, painter) {
  71120. super(root, storage, painter);
  71121. /**
  71122. * @member {HTMLElement} LevelRenderer.Handler.prototype.root
  71123. * @description 绘图区域
  71124. */
  71125. this.root = root;
  71126. /**
  71127. * @member {LevelRenderer.Storage} LevelRenderer.Handler.prototype.storage
  71128. * @description Storage 实例
  71129. */
  71130. this.storage = storage;
  71131. /**
  71132. * @member {LevelRenderer.Painter} LevelRenderer.Handler.prototype.Painter
  71133. * @description Painter 实例
  71134. */
  71135. this.painter = painter;
  71136. /**
  71137. * @member {number} [LevelRenderer.Handler.prototype._lastX=0]
  71138. * @description 上一次鼠标位置x坐标值
  71139. */
  71140. this._lastX = 0;
  71141. /**
  71142. * @member {number} [LevelRenderer.Handler.prototype._lastY=0]
  71143. * @description 上一次鼠标位置y坐标值
  71144. */
  71145. this._lastY = 0;
  71146. /**
  71147. * @member {number} [LevelRenderer.Handler.prototype._mouseX=0]
  71148. * @description 当前鼠标位置x坐标值
  71149. */
  71150. this._mouseX = 0;
  71151. /**
  71152. * @member {number} [LevelRenderer.Handler.prototype._mouseY=0]
  71153. * @description 当前鼠标位置y坐标值
  71154. */
  71155. this._mouseY = 0;
  71156. /**
  71157. * @member {function} LevelRenderer.Handler.prototype._findHover
  71158. * @description 查找 Hover 图形
  71159. */
  71160. this._findHover = null;
  71161. /**
  71162. * @member {Object} LevelRenderer.Handler.prototype._domHover
  71163. * @description 高亮 DOM
  71164. */
  71165. this._domHover = null;
  71166. // 各种事件标识的私有变量
  71167. // this._hasfound = false; // 是否找到 hover 图形元素
  71168. // this._lastHover = null; // 最后一个 hover 图形元素
  71169. // this._mouseDownTarget = null;
  71170. // this._draggingTarget = null; // 当前被拖拽的图形元素
  71171. // this._isMouseDown = false;
  71172. // this._isDragging = false;
  71173. // this._lastMouseDownMoment;
  71174. // this._lastTouchMoment;
  71175. // this._lastDownButton;
  71176. this._findHover = bind3Arg(findHover, this);
  71177. this._domHover = painter.getDomHover();
  71178. this.CLASS_NAME = "SuperMap.LevelRenderer.Handler";
  71179. var domHandlers = {
  71180. /**
  71181. * Method: resize
  71182. * 窗口大小改变响应函数。
  71183. *
  71184. * Parameters:
  71185. * event - {Event} event。
  71186. *
  71187. */
  71188. resize: function (event) {
  71189. event = event || window.event;
  71190. this._lastHover = null;
  71191. this._isMouseDown = 0;
  71192. // 分发SuperMap.LevelRenderer.Config.EVENT.RESIZE事件,global
  71193. this.dispatch(Config.EVENT.RESIZE, event);
  71194. },
  71195. /**
  71196. * Method: click
  71197. * 点击响应函数。
  71198. *
  71199. * Parameters:
  71200. * event - {Event} event。
  71201. *
  71202. */
  71203. click: function (event) {
  71204. event = this._zrenderEventFixed(event);
  71205. // 分发SuperMap.LevelRenderer.Config.EVENT.CLICK事件
  71206. var _lastHover = this._lastHover;
  71207. if ((_lastHover && _lastHover.clickable)
  71208. || !_lastHover
  71209. ) {
  71210. // 判断没有发生拖拽才触发click事件
  71211. if (this._clickThreshold < 10) {
  71212. this._dispatchAgency(_lastHover, Config.EVENT.CLICK, event);
  71213. }
  71214. }
  71215. this._mousemoveHandler(event);
  71216. },
  71217. /**
  71218. * Method: dblclick
  71219. * 双击响应函数。
  71220. *
  71221. * Parameters:
  71222. * event - {Event} event。
  71223. *
  71224. */
  71225. dblclick: function (event) {
  71226. event = event || window.event;
  71227. event = this._zrenderEventFixed(event);
  71228. // 分发SuperMap.LevelRenderer.Config.EVENT.DBLCLICK事件
  71229. var _lastHover = this._lastHover;
  71230. if ((_lastHover && _lastHover.clickable)
  71231. || !_lastHover
  71232. ) {
  71233. // 判断没有发生拖拽才触发dblclick事件
  71234. if (this._clickThreshold < 5) {
  71235. this._dispatchAgency(_lastHover, Config.EVENT.DBLCLICK, event);
  71236. }
  71237. }
  71238. this._mousemoveHandler(event);
  71239. },
  71240. /**
  71241. * Method: mousewheel
  71242. * 鼠标滚轮响应函数。
  71243. *
  71244. * Parameters:
  71245. * event - {Event} event。
  71246. *
  71247. */
  71248. mousewheel: function (event) {
  71249. event = this._zrenderEventFixed(event);
  71250. // http://www.sitepoint.com/html5-javascript-mouse-wheel/
  71251. // https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel
  71252. var delta = event.wheelDelta // Webkit
  71253. || -event.detail; // Firefox
  71254. var scale = delta > 0 ? 1.1 : 1 / 1.1;
  71255. var layers = this.painter.getLayers();
  71256. var needsRefresh = false;
  71257. for (var z in layers) {
  71258. if (z !== 'hover') {
  71259. var layer = layers[z];
  71260. var pos = layer.position;
  71261. if (layer.zoomable) {
  71262. layer.__zoom = layer.__zoom || 1;
  71263. var newZoom = layer.__zoom;
  71264. newZoom *= scale;
  71265. newZoom = Math.max(
  71266. Math.min(layer.maxZoom, newZoom),
  71267. layer.minZoom
  71268. );
  71269. scale = newZoom / layer.__zoom;
  71270. layer.__zoom = newZoom;
  71271. // Keep the mouse center when scaling
  71272. pos[0] -= (this._mouseX - pos[0]) * (scale - 1);
  71273. pos[1] -= (this._mouseY - pos[1]) * (scale - 1);
  71274. layer.scale[0] *= scale;
  71275. layer.scale[1] *= scale;
  71276. layer.dirty = true;
  71277. needsRefresh = true;
  71278. }
  71279. }
  71280. }
  71281. if (needsRefresh) {
  71282. this.painter.refresh();
  71283. }
  71284. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEWHEEL事件
  71285. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEWHEEL, event);
  71286. this._mousemoveHandler(event);
  71287. },
  71288. /**
  71289. * Method: mousemove
  71290. * 鼠标(手指)移动响应函数。
  71291. *
  71292. * Parameters:
  71293. * event - {Event} event。
  71294. *
  71295. */
  71296. mousemove: function (event) {
  71297. // 拖拽不触发click事件
  71298. this._clickThreshold++;
  71299. event = this._zrenderEventFixed(event);
  71300. this._lastX = this._mouseX;
  71301. this._lastY = this._mouseY;
  71302. this._mouseX = SUtil_SUtil.Util_event.getX(event);
  71303. this._mouseY = SUtil_SUtil.Util_event.getY(event);
  71304. var dx = this._mouseX - this._lastX;
  71305. var dy = this._mouseY - this._lastY;
  71306. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGSTART事件
  71307. // 避免手抖点击误认为拖拽
  71308. // if (this._mouseX - this._lastX > 1 || this._mouseY - this._lastY > 1) {
  71309. this._processDragStart(event);
  71310. // }
  71311. this._hasfound = 0;
  71312. this._event = event;
  71313. this._iterateAndFindHover();
  71314. // 找到的在迭代函数里做了处理,没找到得在迭代完后处理
  71315. if (!this._hasfound) {
  71316. // 过滤首次拖拽产生的mouseout和dragLeave
  71317. if (!this._draggingTarget
  71318. || (this._lastHover && this._lastHover != this._draggingTarget)
  71319. ) {
  71320. // 可能出现SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  71321. this._processOutShape(event);
  71322. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  71323. this._processDragLeave(event);
  71324. }
  71325. this._lastHover = null;
  71326. this.storage.delHover();
  71327. this.painter.clearHover();
  71328. }
  71329. // set cursor for root element
  71330. var cursor = '';
  71331. // 如果存在拖拽中元素,被拖拽的图形元素最后addHover
  71332. if (this._draggingTarget) {
  71333. this.storage.drift(this._draggingTarget.id, dx, dy);
  71334. this._draggingTarget.modSelf();
  71335. this.storage.addHover(this._draggingTarget);
  71336. } else if (this._isMouseDown) {
  71337. // Layer dragging
  71338. var layers = this.painter.getLayers();
  71339. var needsRefresh = false;
  71340. for (var z in layers) {
  71341. if (z !== 'hover') {
  71342. var layer = layers[z];
  71343. if (layer.panable) {
  71344. // PENDING
  71345. cursor = 'move';
  71346. // Keep the mouse center when scaling
  71347. layer.position[0] += dx;
  71348. layer.position[1] += dy;
  71349. needsRefresh = true;
  71350. layer.dirty = true;
  71351. }
  71352. }
  71353. }
  71354. if (needsRefresh) {
  71355. this.painter.refresh();
  71356. }
  71357. }
  71358. if (this._draggingTarget || (this._hasfound && this._lastHover.draggable)) {
  71359. cursor = 'move';
  71360. } else if (this._hasfound && this._lastHover.clickable) {
  71361. cursor = 'pointer';
  71362. }
  71363. this.root.style.cursor = cursor;
  71364. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEMOVE事件
  71365. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEMOVE, event);
  71366. if (this._draggingTarget || this._hasfound || this.storage.hasHoverShape()) {
  71367. this.painter.refreshHover();
  71368. }
  71369. },
  71370. /**
  71371. * Method: mouseout
  71372. * 鼠标(手指)离开响应函数。
  71373. *
  71374. * Parameters:
  71375. * event - {Event} event。
  71376. *
  71377. */
  71378. mouseout: function (event) {
  71379. event = this._zrenderEventFixed(event);
  71380. var element = event.toElement || event.relatedTarget;
  71381. if (element != this.root) {
  71382. while (element && element.nodeType != 9) {
  71383. // 忽略包含在root中的dom引起的mouseOut
  71384. if (element == this.root) {
  71385. this._mousemoveHandler(event);
  71386. return;
  71387. }
  71388. element = element.parentNode;
  71389. }
  71390. }
  71391. event.zrenderX = this._lastX;
  71392. event.zrenderY = this._lastY;
  71393. this.root.style.cursor = '';
  71394. this._isMouseDown = 0;
  71395. this._processOutShape(event);
  71396. this._processDrop(event);
  71397. this._processDragEnd(event);
  71398. this.painter.refreshHover();
  71399. this.dispatch(Config.EVENT.GLOBALOUT, event);
  71400. },
  71401. /**
  71402. * Method: mousedown
  71403. * 鼠标(手指)按下响应函数。
  71404. *
  71405. * Parameters:
  71406. * event - {Event} event。
  71407. *
  71408. */
  71409. mousedown: function (event) {
  71410. // 重置 clickThreshold
  71411. this._clickThreshold = 0;
  71412. if (this._lastDownButton == 2) {
  71413. this._lastDownButton = event.button;
  71414. this._mouseDownTarget = null;
  71415. // 仅作为关闭右键菜单使用
  71416. return;
  71417. }
  71418. this._lastMouseDownMoment = new Date();
  71419. event = this._zrenderEventFixed(event);
  71420. this._isMouseDown = 1;
  71421. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEDOWN事件
  71422. this._mouseDownTarget = this._lastHover;
  71423. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEDOWN, event);
  71424. this._lastDownButton = event.button;
  71425. },
  71426. /**
  71427. * Method: mouseup
  71428. * 鼠标(手指)抬起响应函数。
  71429. *
  71430. * Parameters:
  71431. * event - {Event} event。
  71432. *
  71433. */
  71434. mouseup: function (event) {
  71435. event = this._zrenderEventFixed(event);
  71436. this.root.style.cursor = '';
  71437. this._isMouseDown = 0;
  71438. this._mouseDownTarget = null;
  71439. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEUP事件
  71440. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEUP, event);
  71441. this._processDrop(event);
  71442. this._processDragEnd(event);
  71443. },
  71444. /**
  71445. * Method: touchstart
  71446. * Touch 开始响应函数。
  71447. *
  71448. * Parameters:
  71449. * event - {Event} event。
  71450. *
  71451. */
  71452. touchstart: function (event) {
  71453. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  71454. event = this._zrenderEventFixed(event, true);
  71455. this._lastTouchMoment = new Date();
  71456. // 平板补充一次findHover
  71457. this._mobildFindFixed(event);
  71458. this._mousedownHandler(event);
  71459. },
  71460. /**
  71461. * Method: touchmove
  71462. * Touch 移动响应函数。
  71463. *
  71464. * Parameters:
  71465. * event - {Event} event。
  71466. *
  71467. */
  71468. touchmove: function (event) {
  71469. event = this._zrenderEventFixed(event, true);
  71470. this._mousemoveHandler(event);
  71471. if (this._isDragging) {
  71472. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  71473. }
  71474. },
  71475. /**
  71476. * Method: touchend
  71477. * Touch 结束响应函数。
  71478. *
  71479. * Parameters:
  71480. * event - {Event} event。
  71481. *
  71482. */
  71483. touchend: function (event) {
  71484. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  71485. event = this._zrenderEventFixed(event, true);
  71486. this._mouseupHandler(event);
  71487. var now = new Date();
  71488. if (now - this._lastTouchMoment < Config.EVENT.touchClickDelay) {
  71489. this._mobildFindFixed(event);
  71490. this._clickHandler(event);
  71491. if (now - this._lastClickMoment < Config.EVENT.touchClickDelay / 2) {
  71492. this._dblclickHandler(event);
  71493. if (this._lastHover && this._lastHover.clickable) {
  71494. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  71495. }
  71496. }
  71497. this._lastClickMoment = now;
  71498. }
  71499. this.painter.clearHover();
  71500. }
  71501. };
  71502. initDomHandler(this);
  71503. // 初始化,事件绑定,支持的所有事件都由如下原生事件计算得来
  71504. if (window.addEventListener) {
  71505. window.addEventListener('resize', this._resizeHandler);
  71506. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  71507. // mobile支持
  71508. root.addEventListener('touchstart', this._touchstartHandler);
  71509. root.addEventListener('touchmove', this._touchmoveHandler);
  71510. root.addEventListener('touchend', this._touchendHandler);
  71511. } else {
  71512. // mobile的click/move/up/down自己模拟
  71513. root.addEventListener('click', this._clickHandler);
  71514. root.addEventListener('dblclick', this._dblclickHandler);
  71515. root.addEventListener('mousewheel', this._mousewheelHandler);
  71516. root.addEventListener('mousemove', this._mousemoveHandler);
  71517. root.addEventListener('mousedown', this._mousedownHandler);
  71518. root.addEventListener('mouseup', this._mouseupHandler);
  71519. }
  71520. root.addEventListener('DOMMouseScroll', this._mousewheelHandler);
  71521. root.addEventListener('mouseout', this._mouseoutHandler);
  71522. } else {
  71523. window.attachEvent('onresize', this._resizeHandler);
  71524. root.attachEvent('onclick', this._clickHandler);
  71525. //root.attachEvent('ondblclick ', this._dblclickHandler);
  71526. root.ondblclick = this._dblclickHandler;
  71527. root.attachEvent('onmousewheel', this._mousewheelHandler);
  71528. root.attachEvent('onmousemove', this._mousemoveHandler);
  71529. root.attachEvent('onmouseout', this._mouseoutHandler);
  71530. root.attachEvent('onmousedown', this._mousedownHandler);
  71531. root.attachEvent('onmouseup', this._mouseupHandler);
  71532. }
  71533. // 辅助函数 start
  71534. /**
  71535. * Method: bind1Arg
  71536. * bind 一个参数的 function。
  71537. *
  71538. * Parameters:
  71539. * handler - {function} 要 bind 的 function。
  71540. * context - {Object} 运行时 this 环境。
  71541. *
  71542. * Returns:
  71543. * {function}
  71544. */
  71545. function bind1Arg(handler, context) {
  71546. return function (e) {
  71547. return handler.call(context, e);
  71548. };
  71549. }
  71550. /*
  71551. // bind 两个参数的 function
  71552. function bind2Arg(handler, context) {
  71553. return function (arg1, arg2) {
  71554. return handler.call(context, arg1, arg2);
  71555. };
  71556. }
  71557. */
  71558. // bind 三个参数的 function
  71559. function bind3Arg(handler, context) {
  71560. return function (arg1, arg2, arg3) {
  71561. return handler.call(context, arg1, arg2, arg3);
  71562. };
  71563. }
  71564. /**
  71565. * Method: initDomHandler
  71566. * 为控制类实例初始化 dom 事件处理函数。
  71567. *
  71568. * Parameters:
  71569. * instance - {<LevelRenderer.Handler>} 控制类实例 。
  71570. *
  71571. * Returns:
  71572. * {function}
  71573. */
  71574. function initDomHandler(instance) {
  71575. var domHandlerNames = [
  71576. 'resize', 'click', 'dblclick',
  71577. 'mousewheel', 'mousemove', 'mouseout', 'mouseup', 'mousedown',
  71578. 'touchstart', 'touchend', 'touchmove'
  71579. ];
  71580. var len = domHandlerNames.length;
  71581. while (len--) {
  71582. var name = domHandlerNames[len];
  71583. instance['_' + name + 'Handler'] = bind1Arg(domHandlers[name], instance);
  71584. }
  71585. }
  71586. /**
  71587. * Method: findHover
  71588. * 迭代函数,查找 hover 到的图形元素并即时做些事件分发。
  71589. *
  71590. * Parameters:
  71591. * shape - {Object} 图形。
  71592. * x - {number} 鼠标 x。
  71593. * y - {number} 鼠标 y。
  71594. *
  71595. * Returns:
  71596. * {boolean} 是否找到图形。
  71597. *
  71598. */
  71599. function findHover(shape, x, y) {
  71600. var me = this;
  71601. if (
  71602. (me._draggingTarget && me._draggingTarget.id == shape.id) // 迭代到当前拖拽的图形上
  71603. || shape.isSilent() // 打酱油的路过,啥都不响应的shape~
  71604. ) {
  71605. return false;
  71606. }
  71607. var event = me._event;
  71608. if (shape.isCover(x, y)) {
  71609. if (shape.hoverable) {
  71610. // SMIC-修改 - start
  71611. if (shape.isHoverByRefDataID && shape.isHoverByRefDataID === true) {
  71612. if (shape.refDataID) {
  71613. var fid = shape.refDataID;
  71614. //me.painter.clearHover();
  71615. //me.storage.delHover();
  71616. var hoverGroup = null;
  71617. if (shape.refDataHoverGroup) {
  71618. hoverGroup = shape.refDataHoverGroup;
  71619. }
  71620. //查找同一个用户数据 feature 的所有图形
  71621. var shapeList = me.storage._shapeList;
  71622. for (var i = 0, len = shapeList.length; i < len; i++) {
  71623. var si = shapeList[i];
  71624. if (si.refDataID && fid === si.refDataID) {
  71625. if (hoverGroup) {
  71626. if (si.refDataHoverGroup && hoverGroup === si.refDataHoverGroup) {
  71627. me.storage.addHover(si);
  71628. }
  71629. } else {
  71630. me.storage.addHover(si);
  71631. }
  71632. }
  71633. }
  71634. }
  71635. } else {
  71636. me.storage.addHover(shape);
  71637. }
  71638. //初始代码:
  71639. // me.storage.addHover(shape);
  71640. // SMIC-修改 - end
  71641. }
  71642. // 查找是否在 clipShape 中
  71643. var p = shape.parent;
  71644. while (p) {
  71645. if (p.clipShape && !p.clipShape.isCover(me._mouseX, me._mouseY)) {
  71646. // 已经被祖先 clip 掉了
  71647. return false;
  71648. }
  71649. p = p.parent;
  71650. }
  71651. if (me._lastHover != shape) {
  71652. me._processOutShape(event);
  71653. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  71654. me._processDragLeave(event);
  71655. me._lastHover = shape;
  71656. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  71657. me._processDragEnter(event);
  71658. }
  71659. me._processOverShape(event);
  71660. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGOVER
  71661. me._processDragOver(event);
  71662. me._hasfound = 1;
  71663. return true; // 找到则中断迭代查找
  71664. }
  71665. return false;
  71666. }
  71667. // 辅助函数 end
  71668. }
  71669. /**
  71670. * @function LevelRenderer.Handler.prototype.destroy
  71671. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  71672. */
  71673. destroy() {
  71674. this.dispose();
  71675. this._lastX = null;
  71676. this._lastY = null;
  71677. this._mouseX = null;
  71678. this._mouseY = null;
  71679. this._findHover = null;
  71680. Eventful.prototype.destroy.apply(this, arguments);
  71681. }
  71682. /**
  71683. * @function LevelRenderer.Handler.prototype.on
  71684. * @description 自定义事件绑定。
  71685. * @param {string} eventName - 事件名称,resize、hover、drag等。
  71686. * @param {function} handler - 响应函数。
  71687. * @returns {LevelRenderer.Handler} this。
  71688. */
  71689. on(eventName, handler) {
  71690. this.bind(eventName, handler);
  71691. return this;
  71692. }
  71693. /**
  71694. * @function LevelRenderer.Handler.prototype.un
  71695. * @description 自定义事件解除绑定。
  71696. * @param {string} eventName - 事件名称,resize、hover、drag等。
  71697. * @param {function} handler - 响应函数。
  71698. * @returns {LevelRenderer.Handler} this。
  71699. */
  71700. un(eventName, handler) {
  71701. this.unbind(eventName, handler);
  71702. return this;
  71703. }
  71704. /**
  71705. * @function LevelRenderer.Handler.prototype.trigger
  71706. * @description 事件触发。
  71707. * @param {string} eventName - 事件名称,resize、hover、drag等。
  71708. * @param {event} eventArgs - dom事件对象。
  71709. */
  71710. trigger(eventName, eventArgs) {
  71711. var EVENT = Config.EVENT;
  71712. switch (eventName) {
  71713. case EVENT.RESIZE:
  71714. case EVENT.CLICK:
  71715. case EVENT.DBLCLICK:
  71716. case EVENT.MOUSEWHEEL:
  71717. case EVENT.MOUSEMOVE:
  71718. case EVENT.MOUSEDOWN:
  71719. case EVENT.MOUSEUP:
  71720. case EVENT.MOUSEOUT:
  71721. this['_' + eventName + 'Handler'](eventArgs);
  71722. break;
  71723. }
  71724. }
  71725. /**
  71726. * @function LevelRenderer.Handler.prototype.dispose
  71727. * @description 释放,解绑所有事件。
  71728. */
  71729. dispose() {
  71730. var root = this.root;
  71731. if (window.removeEventListener) {
  71732. window.removeEventListener('resize', this._resizeHandler);
  71733. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  71734. // mobile支持
  71735. root.removeEventListener('touchstart', this._touchstartHandler);
  71736. root.removeEventListener('touchmove', this._touchmoveHandler);
  71737. root.removeEventListener('touchend', this._touchendHandler);
  71738. } else {
  71739. // mobile的click自己模拟
  71740. root.removeEventListener('click', this._clickHandler);
  71741. root.removeEventListener('dblclick', this._dblclickHandler);
  71742. root.removeEventListener('mousewheel', this._mousewheelHandler);
  71743. root.removeEventListener('mousemove', this._mousemoveHandler);
  71744. root.removeEventListener('mousedown', this._mousedownHandler);
  71745. root.removeEventListener('mouseup', this._mouseupHandler);
  71746. }
  71747. root.removeEventListener('DOMMouseScroll', this._mousewheelHandler);
  71748. root.removeEventListener('mouseout', this._mouseoutHandler);
  71749. } else {
  71750. window.detachEvent('onresize', this._resizeHandler);
  71751. root.detachEvent('onclick', this._clickHandler);
  71752. root.detachEvent('dblclick', this._dblclickHandler);
  71753. root.detachEvent('onmousewheel', this._mousewheelHandler);
  71754. root.detachEvent('onmousemove', this._mousemoveHandler);
  71755. root.detachEvent('onmouseout', this._mouseoutHandler);
  71756. root.detachEvent('onmousedown', this._mousedownHandler);
  71757. root.detachEvent('onmouseup', this._mouseupHandler);
  71758. }
  71759. this.root = null;
  71760. this._domHover = null;
  71761. this.storage = null;
  71762. this.painter = null;
  71763. this.un();
  71764. }
  71765. /**
  71766. * Method: _processDragStart
  71767. * 拖拽开始。
  71768. *
  71769. * Parameters:
  71770. * event - {Object} 事件对象。
  71771. *
  71772. */
  71773. _processDragStart(event) {
  71774. var _lastHover = this._lastHover;
  71775. if (this._isMouseDown
  71776. && _lastHover
  71777. && _lastHover.draggable
  71778. && !this._draggingTarget
  71779. && this._mouseDownTarget == _lastHover
  71780. ) {
  71781. // 拖拽点击生效时长阀门,某些场景需要降低拖拽敏感度
  71782. if (_lastHover.dragEnableTime &&
  71783. new Date() - this._lastMouseDownMoment < _lastHover.dragEnableTime
  71784. ) {
  71785. return;
  71786. }
  71787. var _draggingTarget = _lastHover;
  71788. this._draggingTarget = _draggingTarget;
  71789. this._isDragging = 1;
  71790. _draggingTarget.invisible = true;
  71791. this.storage.mod(_draggingTarget.id);
  71792. // 分发 Config.EVENT.DRAGSTART事件
  71793. this._dispatchAgency(
  71794. _draggingTarget,
  71795. Config.EVENT.DRAGSTART,
  71796. event
  71797. );
  71798. this.painter.refresh();
  71799. }
  71800. }
  71801. /**
  71802. * Method: _processDragEnter
  71803. * 拖拽进入目标元素。
  71804. *
  71805. * Parameters:
  71806. * event - {Object} 事件对象。
  71807. *
  71808. */
  71809. _processDragEnter(event) {
  71810. if (this._draggingTarget) {
  71811. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  71812. this._dispatchAgency(
  71813. this._lastHover,
  71814. Config.EVENT.DRAGENTER,
  71815. event,
  71816. this._draggingTarget
  71817. );
  71818. }
  71819. }
  71820. /**
  71821. * Method: _processDragOver
  71822. * 拖拽在目标元素上移动。
  71823. *
  71824. * Parameters:
  71825. * event - {Object} 事件对象。
  71826. *
  71827. */
  71828. _processDragOver(event) {
  71829. if (this._draggingTarget) {
  71830. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGOVER事件
  71831. this._dispatchAgency(
  71832. this._lastHover,
  71833. Config.EVENT.DRAGOVER,
  71834. event,
  71835. this._draggingTarget
  71836. );
  71837. }
  71838. }
  71839. /**
  71840. * Method: _processDragLeave
  71841. * 拖拽离开目标元素。
  71842. *
  71843. * Parameters:
  71844. * event - {Object} 事件对象。
  71845. *
  71846. */
  71847. _processDragLeave(event) {
  71848. if (this._draggingTarget) {
  71849. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  71850. this._dispatchAgency(
  71851. this._lastHover,
  71852. Config.EVENT.DRAGLEAVE,
  71853. event,
  71854. this._draggingTarget
  71855. );
  71856. }
  71857. }
  71858. /**
  71859. * Method: _processDrop
  71860. * 拖拽在目标元素上完成。
  71861. *
  71862. * Parameters:
  71863. * event - {Object} 事件对象。
  71864. *
  71865. */
  71866. _processDrop(event) {
  71867. if (this._draggingTarget) {
  71868. this._draggingTarget.invisible = false;
  71869. this.storage.mod(this._draggingTarget.id);
  71870. this.painter.refresh();
  71871. // 分发SuperMap.LevelRenderer.Config.EVENT.DROP事件
  71872. this._dispatchAgency(
  71873. this._lastHover,
  71874. Config.EVENT.DROP,
  71875. event,
  71876. this._draggingTarget
  71877. );
  71878. }
  71879. }
  71880. /**
  71881. * Method: _processDragEnd
  71882. * 拖拽结束。
  71883. *
  71884. * Parameters:
  71885. * event - {Object} 事件对象。
  71886. *
  71887. */
  71888. _processDragEnd(event) {
  71889. if (this._draggingTarget) {
  71890. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGEND事件
  71891. this._dispatchAgency(
  71892. this._draggingTarget,
  71893. Config.EVENT.DRAGEND,
  71894. event
  71895. );
  71896. this._lastHover = null;
  71897. }
  71898. this._isDragging = 0;
  71899. this._draggingTarget = null;
  71900. }
  71901. /**
  71902. * Method: _processOverShape
  71903. * 鼠标在某个图形元素上移动。
  71904. *
  71905. * Parameters:
  71906. * event - {Object} 事件对象。
  71907. *
  71908. */
  71909. _processOverShape(event) {
  71910. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOVER事件
  71911. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOVER, event);
  71912. }
  71913. /**
  71914. * Method: _processOutShape
  71915. * 鼠标离开某个图形元素。
  71916. *
  71917. * Parameters:
  71918. * event - {Object} 事件对象。
  71919. *
  71920. */
  71921. _processOutShape(event) {
  71922. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  71923. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOUT, event);
  71924. }
  71925. /**
  71926. * Method: _dispatchAgency
  71927. * 鼠标离开某个图形元素。
  71928. *
  71929. * Parameters:
  71930. * targetShape - {Object} 目标图形元素。
  71931. * eventName - {Object} 事件名称。
  71932. * event - {Object} 事件对象。
  71933. * draggedShape - {Object} 拖拽事件特有,当前被拖拽图形元素。
  71934. *
  71935. */
  71936. _dispatchAgency(targetShape, eventName, event, draggedShape) {
  71937. var eventHandler = 'on' + eventName;
  71938. var eventPacket = {
  71939. type: eventName,
  71940. event: event,
  71941. target: targetShape,
  71942. cancelBubble: false
  71943. };
  71944. var el = targetShape;
  71945. if (draggedShape) {
  71946. eventPacket.dragged = draggedShape;
  71947. }
  71948. while (el) {
  71949. el[eventHandler]
  71950. && (eventPacket.cancelBubble = el[eventHandler](eventPacket));
  71951. el.dispatch(eventName, eventPacket);
  71952. el = el.parent;
  71953. if (eventPacket.cancelBubble) {
  71954. break;
  71955. }
  71956. }
  71957. if (targetShape) {
  71958. // 冒泡到顶级 zrender 对象
  71959. if (!eventPacket.cancelBubble) {
  71960. this.dispatch(eventName, eventPacket);
  71961. }
  71962. } else if (!draggedShape) {
  71963. // 无hover目标,无拖拽对象,原生事件分发
  71964. this.dispatch(eventName, {
  71965. type: eventName,
  71966. event: event
  71967. });
  71968. }
  71969. }
  71970. /**
  71971. * Method: _iterateAndFindHover
  71972. * 迭代寻找 hover shape。
  71973. *
  71974. */
  71975. _iterateAndFindHover() {
  71976. var invTransform = SUtil_SUtil.Util_matrix.create();
  71977. var list = this.storage.getShapeList();
  71978. var currentZLevel;
  71979. var currentLayer;
  71980. var tmp = [0, 0];
  71981. for (var i = list.length - 1; i >= 0; i--) {
  71982. var shape = list[i];
  71983. if (currentZLevel !== shape.zlevel) {
  71984. currentLayer = this.painter.getLayer(shape.zlevel, currentLayer);
  71985. tmp[0] = this._mouseX;
  71986. tmp[1] = this._mouseY;
  71987. if (currentLayer.needTransform) {
  71988. SUtil_SUtil.Util_matrix.invert(invTransform, currentLayer.transform);
  71989. SUtil_SUtil.Util_vector.applyTransform(tmp, tmp, invTransform);
  71990. }
  71991. }
  71992. if (this._findHover(shape, tmp[0], tmp[1])) {
  71993. break;
  71994. }
  71995. }
  71996. }
  71997. /**
  71998. * Method: _mobildFindFixed
  71999. * touch 有指尖错觉,四向尝试,让touch上的点击更好触发事件。
  72000. *
  72001. * Parameters:
  72002. * event - {Object} 事件对象。
  72003. *
  72004. */
  72005. _mobildFindFixed(event) {
  72006. // touch指尖错觉的尝试偏移量配置
  72007. var MOBILE_TOUCH_OFFSETS = [
  72008. {x: 10},
  72009. {x: -20},
  72010. {x: 10, y: 10},
  72011. {y: -20}
  72012. ];
  72013. this._lastHover = null;
  72014. this._mouseX = event.zrenderX;
  72015. this._mouseY = event.zrenderY;
  72016. this._event = event;
  72017. this._iterateAndFindHover();
  72018. for (var i = 0; !this._lastHover && i < MOBILE_TOUCH_OFFSETS.length; i++) {
  72019. var offset = MOBILE_TOUCH_OFFSETS[i];
  72020. offset.x && (this._mouseX += offset.x);
  72021. offset.y && (this._mouseX += offset.y);
  72022. this._iterateAndFindHover();
  72023. }
  72024. if (this._lastHover) {
  72025. event.zrenderX = this._mouseX;
  72026. event.zrenderY = this._mouseY;
  72027. }
  72028. }
  72029. /**
  72030. * Method: _zrenderEventFixed
  72031. * 如果存在第三方嵌入的一些dom触发的事件,或touch事件,需要转换一下事件坐标 。
  72032. *
  72033. * Parameters:
  72034. * event - {Object} 事件。
  72035. * isTouch - {boolean} 是否触摸。
  72036. *
  72037. */
  72038. _zrenderEventFixed(event, isTouch) {
  72039. if (event.zrenderFixed) {
  72040. return event;
  72041. }
  72042. if (!isTouch) {
  72043. event = event || window.event;
  72044. // 进入对象优先~
  72045. var target = event.toElement
  72046. || event.relatedTarget
  72047. || event.srcElement
  72048. || event.target;
  72049. if (target && target != this._domHover) {
  72050. event.zrenderX = (typeof event.offsetX != 'undefined'
  72051. ? event.offsetX
  72052. : event.layerX)
  72053. + target.offsetLeft;
  72054. event.zrenderY = (typeof event.offsetY != 'undefined'
  72055. ? event.offsetY
  72056. : event.layerY)
  72057. + target.offsetTop;
  72058. }
  72059. } else {
  72060. var touch = event.type != 'touchend'
  72061. ? event.targetTouches[0]
  72062. : event.changedTouches[0];
  72063. if (touch) {
  72064. var rBounding = this.root.getBoundingClientRect();
  72065. // touch事件坐标是全屏的~
  72066. event.zrenderX = touch.clientX - rBounding.left;
  72067. event.zrenderY = touch.clientY - rBounding.top;
  72068. }
  72069. }
  72070. event.zrenderFixed = 1;
  72071. return event;
  72072. }
  72073. // SMIC-方法扩展 - start
  72074. /**
  72075. * @function LevelRenderer.Handler.prototype.getLastHoverOne
  72076. * @description 获取单个高亮图形
  72077. */
  72078. getLastHoverOne() {
  72079. if (this._lastHover) {
  72080. return this._lastHover;
  72081. }
  72082. return null;
  72083. }
  72084. // SMIC-方法扩展 - end
  72085. }
  72086. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Easing.js
  72087. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72088. * This program are made available under the terms of the Apache License, Version 2.0
  72089. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72090. /**
  72091. * @class LevelRenderer.Animation.easing
  72092. * @category Visualization Theme
  72093. * @classdesc 缓动
  72094. * @private
  72095. */
  72096. // 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js
  72097. // http://sole.github.io/tween.js/examples/03_graphs.html
  72098. class Easing {
  72099. constructor() {
  72100. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.easing";
  72101. }
  72102. /**
  72103. * @function LevelRenderer.Animation.easing.destroy
  72104. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  72105. */
  72106. destroy() {
  72107. }
  72108. /**
  72109. * @function LevelRenderer.Animation.easing.Linear
  72110. * @description 线性缓动
  72111. * @param {number} k - 参数
  72112. * @return {number} 输入值
  72113. */
  72114. Linear(k) {
  72115. return k;
  72116. }
  72117. /**
  72118. * @function LevelRenderer.Animation.easing.QuadraticIn
  72119. * @description 二次方的缓动(t^2)
  72120. * @param {number} k - 参数
  72121. * @return {number} 二次方的缓动的值
  72122. */
  72123. QuadraticIn(k) {
  72124. return k * k;
  72125. }
  72126. /**
  72127. * @function LevelRenderer.Animation.easing.QuadraticOut
  72128. * @description 返回按二次方缓动退出的值
  72129. * @param {number} k - 参数
  72130. * @return {number} 按二次方缓动退出的值
  72131. */
  72132. QuadraticOut(k) {
  72133. return k * (2 - k);
  72134. }
  72135. /**
  72136. * @function LevelRenderer.Animation.easing.QuadraticInOut
  72137. * @description 返回按二次方缓动进入和退出的值
  72138. * @param {number} k - 参数
  72139. * @return {number} 按二次方缓动进入和退出的值
  72140. */
  72141. QuadraticInOut(k) {
  72142. if ((k *= 2) < 1) {
  72143. return 0.5 * k * k;
  72144. }
  72145. return -0.5 * (--k * (k - 2) - 1);
  72146. }
  72147. /**
  72148. * @function LevelRenderer.Animation.easing.CubicIn
  72149. * @description 三次方的缓动(t^3)
  72150. * @param {number} k - 参数
  72151. * @return {number} 按三次方缓动的值
  72152. */
  72153. CubicIn(k) {
  72154. return k * k * k;
  72155. }
  72156. /**
  72157. * @function LevelRenderer.Animation.easing.CubicOut
  72158. * @description 返回按三次方缓动退出的值
  72159. * @param {number} k - 参数
  72160. * @return {number} 按三次方缓动退出的值
  72161. */
  72162. CubicOut(k) {
  72163. return --k * k * k + 1;
  72164. }
  72165. /**
  72166. * @function LevelRenderer.Animation.easing.CubicInOut
  72167. * @description 返回按三次方缓动进入退出的值
  72168. * @param {number} k - 参数
  72169. * @return {number} 按三次方缓动进入退出的值
  72170. */
  72171. CubicInOut(k) {
  72172. if ((k *= 2) < 1) {
  72173. return 0.5 * k * k * k;
  72174. }
  72175. return 0.5 * ((k -= 2) * k * k + 2);
  72176. }
  72177. /**
  72178. * @function LevelRenderer.Animation.easing.QuarticIn
  72179. * @description 返回按四次方缓动进入的值
  72180. * @param {number} k - 参数
  72181. * @return {number} 按四次方缓动进入的值
  72182. */
  72183. QuarticIn(k) {
  72184. return k * k * k * k;
  72185. }
  72186. /**
  72187. * @function LevelRenderer.Animation.easing.QuarticOut
  72188. * @description 返回按四次方缓动退出的值
  72189. * @param {number} k - 参数
  72190. * @return {number} 按四次方缓动退出的值
  72191. */
  72192. QuarticOut(k) {
  72193. return 1 - (--k * k * k * k);
  72194. }
  72195. /**
  72196. * @function LevelRenderer.Animation.easing.QuarticInOut
  72197. * @description 返回按四次方缓动进入退出的值
  72198. * @param {number} k - 参数
  72199. * @return {number} 按四次方缓动进入退出的值
  72200. */
  72201. QuarticInOut(k) {
  72202. if ((k *= 2) < 1) {
  72203. return 0.5 * k * k * k * k;
  72204. }
  72205. return -0.5 * ((k -= 2) * k * k * k - 2);
  72206. }
  72207. // 五次方的缓动(t^5)
  72208. /**
  72209. * @function LevelRenderer.Animation.easing.QuinticIn
  72210. * @description 返回按五次方缓动的值
  72211. * @param {number} k - 参数
  72212. * @return {number} 按五次方缓动的值
  72213. */
  72214. QuinticIn(k) {
  72215. return k * k * k * k * k;
  72216. }
  72217. /**
  72218. * @function LevelRenderer.Animation.easing.QuinticOut
  72219. * @description 返回按五次方缓动退出的值
  72220. * @param {number} k - 参数
  72221. * @return {number} 按五次方缓动退出的值
  72222. */
  72223. QuinticOut(k) {
  72224. return --k * k * k * k * k + 1;
  72225. }
  72226. /**
  72227. * @function LevelRenderer.Animation.easing.QuinticInOut
  72228. * @description 返回按五次方缓动进入退出的值
  72229. * @param {number} k - 参数
  72230. * @return {number} 按五次方缓动进入退出的值
  72231. */
  72232. QuinticInOut(k) {
  72233. if ((k *= 2) < 1) {
  72234. return 0.5 * k * k * k * k * k;
  72235. }
  72236. return 0.5 * ((k -= 2) * k * k * k * k + 2);
  72237. }
  72238. // 正弦曲线的缓动(sin(t))
  72239. /**
  72240. * @function LevelRenderer.Animation.easing.SinusoidalIn
  72241. * @description 返回按正弦曲线的缓动进入的值
  72242. * @param {number} k - 参数
  72243. * @return {number} 按正弦曲线的缓动进入的值
  72244. */
  72245. SinusoidalIn(k) {
  72246. return 1 - Math.cos(k * Math.PI / 2);
  72247. }
  72248. /**
  72249. * @function LevelRenderer.Animation.easing.SinusoidalOut
  72250. * @description 返回按正弦曲线的缓动退出的值
  72251. * @param {number} k - 参数
  72252. * @return {number} 按正弦曲线的缓动退出的值
  72253. */
  72254. SinusoidalOut(k) {
  72255. return Math.sin(k * Math.PI / 2);
  72256. }
  72257. /**
  72258. * @function LevelRenderer.Animation.easing.SinusoidalInOut
  72259. * @description 返回按正弦曲线的缓动进入退出的值
  72260. * @param {number} k - 参数
  72261. * @return {number} 按正弦曲线的缓动进入退出的值
  72262. */
  72263. SinusoidalInOut(k) {
  72264. return 0.5 * (1 - Math.cos(Math.PI * k));
  72265. }
  72266. // 指数曲线的缓动(2^t)
  72267. /**
  72268. * @function LevelRenderer.Animation.easing.ExponentialIn
  72269. * @description 返回按指数曲线的缓动进入的值
  72270. * @param {number} k - 参数
  72271. * @return {number} 按指数曲线的缓动进入的值
  72272. */
  72273. ExponentialIn(k) {
  72274. return k === 0 ? 0 : Math.pow(1024, k - 1);
  72275. }
  72276. /**
  72277. * @function LevelRenderer.Animation.easing.ExponentialOut
  72278. * @description 返回按指数曲线的缓动退出的值
  72279. * @param {number} k - 参数
  72280. * @return {number} 按指数曲线的缓动退出的值
  72281. */
  72282. ExponentialOut(k) {
  72283. return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  72284. }
  72285. /**
  72286. * @function LevelRenderer.Animation.easing.ExponentialInOut
  72287. * @description 返回按指数曲线的缓动进入退出的值
  72288. * @param {number} k - 参数
  72289. * @return {number} 按指数曲线的缓动进入退出的值
  72290. */
  72291. ExponentialInOut(k) {
  72292. if (k === 0) {
  72293. return 0;
  72294. }
  72295. if (k === 1) {
  72296. return 1;
  72297. }
  72298. if ((k *= 2) < 1) {
  72299. return 0.5 * Math.pow(1024, k - 1);
  72300. }
  72301. return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  72302. }
  72303. // 圆形曲线的缓动(sqrt(1-t^2))
  72304. /**
  72305. * @function LevelRenderer.Animation.easing.CircularIn
  72306. * @description 返回按圆形曲线的缓动进入的值
  72307. * @param {number} k - 参数
  72308. * @return {number} 按圆形曲线的缓动进入的值
  72309. */
  72310. CircularIn(k) {
  72311. return 1 - Math.sqrt(1 - k * k);
  72312. }
  72313. /**
  72314. * @function LevelRenderer.Animation.easing.CircularOut
  72315. * @description 返回按圆形曲线的缓动退出的值
  72316. * @param {number} k - 参数
  72317. * @return {number} 按圆形曲线的缓动退出的值
  72318. */
  72319. CircularOut(k) {
  72320. return Math.sqrt(1 - (--k * k));
  72321. }
  72322. /**
  72323. * @function LevelRenderer.Animation.easing.CircularInOut
  72324. * @description 返回按圆形曲线的缓动进入退出的值
  72325. * @param {number} k - 参数
  72326. * @return {number} 按圆形曲线的缓动进入退出的值
  72327. */
  72328. CircularInOut(k) {
  72329. if ((k *= 2) < 1) {
  72330. return -0.5 * (Math.sqrt(1 - k * k) - 1);
  72331. }
  72332. return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  72333. }
  72334. // 创建类似于弹簧在停止前来回振荡的动画
  72335. /**
  72336. * @function LevelRenderer.Animation.easing.ElasticIn
  72337. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  72338. * @param {number} k - 参数
  72339. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  72340. */
  72341. ElasticIn(k) {
  72342. var s;
  72343. var a = 0.1;
  72344. var p = 0.4;
  72345. if (k === 0) {
  72346. return 0;
  72347. }
  72348. if (k === 1) {
  72349. return 1;
  72350. }
  72351. if (a < 1) {
  72352. a = 1;
  72353. s = p / 4;
  72354. } else {
  72355. s = p * Math.asin(1 / a) / (2 * Math.PI);
  72356. }
  72357. return -(a * Math.pow(2, 10 * (k -= 1)) *
  72358. Math.sin((k - s) * (2 * Math.PI) / p));
  72359. }
  72360. /**
  72361. * @function LevelRenderer.Animation.easing.ElasticOut
  72362. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  72363. * @param {number} k - 参数
  72364. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  72365. */
  72366. ElasticOut(k) {
  72367. var s;
  72368. var a = 0.1;
  72369. var p = 0.4;
  72370. if (k === 0) {
  72371. return 0;
  72372. }
  72373. if (k === 1) {
  72374. return 1;
  72375. }
  72376. if (a < 1) {
  72377. a = 1;
  72378. s = p / 4;
  72379. } else {
  72380. s = p * Math.asin(1 / a) / (2 * Math.PI);
  72381. }
  72382. return (a * Math.pow(2, -10 * k) *
  72383. Math.sin((k - s) * (2 * Math.PI) / p) + 1);
  72384. }
  72385. /**
  72386. * @function LevelRenderer.Animation.easing.ElasticInOut
  72387. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  72388. * @param {number} k - 参数
  72389. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  72390. */
  72391. ElasticInOut(k) {
  72392. var s;
  72393. var a = 0.1;
  72394. var p = 0.4;
  72395. if (k === 0) {
  72396. return 0;
  72397. }
  72398. if (k === 1) {
  72399. return 1;
  72400. }
  72401. if (a < 1) {
  72402. a = 1;
  72403. s = p / 4;
  72404. } else {
  72405. s = p * Math.asin(1 / a) / (2 * Math.PI);
  72406. }
  72407. if ((k *= 2) < 1) {
  72408. return -0.5 * (a * Math.pow(2, 10 * (k -= 1))
  72409. * Math.sin((k - s) * (2 * Math.PI) / p));
  72410. }
  72411. return a * Math.pow(2, -10 * (k -= 1))
  72412. * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
  72413. }
  72414. // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动
  72415. /**
  72416. * @function LevelRenderer.Animation.easing.BackIn
  72417. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  72418. * @param {number} k - 参数
  72419. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  72420. */
  72421. BackIn(k) {
  72422. var s = 1.70158;
  72423. return k * k * ((s + 1) * k - s);
  72424. }
  72425. /**
  72426. * @function LevelRenderer.Animation.easing.BackOut
  72427. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  72428. * @param {number} k - 参数
  72429. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  72430. */
  72431. BackOut(k) {
  72432. var s = 1.70158;
  72433. return --k * k * ((s + 1) * k + s) + 1;
  72434. }
  72435. /**
  72436. * @function LevelRenderer.Animation.easing.BackInOut
  72437. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  72438. * @param {number} k - 参数
  72439. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  72440. */
  72441. BackInOut(k) {
  72442. var s = 1.70158 * 1.525;
  72443. if ((k *= 2) < 1) {
  72444. return 0.5 * (k * k * ((s + 1) * k - s));
  72445. }
  72446. return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
  72447. }
  72448. // 创建弹跳效果
  72449. /**
  72450. * @function LevelRenderer.Animation.easing.BounceIn
  72451. * @description 返回按弹跳效果的缓动进入的值
  72452. * @param {number} k - 参数
  72453. * @return {number} 按弹跳效果的缓动进入的值
  72454. */
  72455. BounceIn(k) {
  72456. return 1 - this.BounceOut(1 - k);
  72457. }
  72458. /**
  72459. * @function LevelRenderer.Animation.easing.BounceOut
  72460. * @description 返回按弹跳效果的缓动退出的值
  72461. * @param {number} k - 参数
  72462. * @return {number} 按弹跳效果的缓动退出的值
  72463. */
  72464. BounceOut(k) {
  72465. if (k < (1 / 2.75)) {
  72466. return 7.5625 * k * k;
  72467. } else if (k < (2 / 2.75)) {
  72468. return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
  72469. } else if (k < (2.5 / 2.75)) {
  72470. return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
  72471. } else {
  72472. return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
  72473. }
  72474. }
  72475. /**
  72476. * @function LevelRenderer.Animation.easing.BounceInOut
  72477. * @description 返回按弹跳效果的缓动进入退出的值
  72478. * @param {number} k - 参数
  72479. * @return {number} 按弹跳效果的缓动进入退出的值
  72480. */
  72481. BounceInOut(k) {
  72482. if (k < 0.5) {
  72483. return this.BounceIn(k * 2) * 0.5;
  72484. }
  72485. return this.BounceOut(k * 2 - 1) * 0.5 + 0.5;
  72486. }
  72487. }
  72488. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Clip.js
  72489. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72490. * This program are made available under the terms of the Apache License, Version 2.0
  72491. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72492. /**
  72493. * @class LevelRenderer.Animation.Clip
  72494. * @category Visualization Theme
  72495. * @classdesc 动画片段
  72496. * @param {Object} options - 参数。
  72497. * @param {Object} options.target - 动画对象,可以是数组,如果是数组的话会批量分发 onframe 等事件。
  72498. * @param {number} [options.life=1000] - 动画时长。
  72499. * @param {number} [options.delay=0] - 动画延迟时间。
  72500. * @param {boolean} [options.loop=true] - 是否循环。
  72501. * @param {number} [options.gap=0] - 循环的间隔时间。
  72502. * @param {Object} options.onframe - 帧。
  72503. * @param {boolean} options.easing - 是否消除。
  72504. * @param {boolean} options.ondestroy - 是否销毁。
  72505. * @param {boolean} options.onrestart - 是否重播。
  72506. * @private
  72507. */
  72508. class Clip {
  72509. constructor(options) {
  72510. this._targetPool = options.target || {};
  72511. if (!(this._targetPool instanceof Array)) {
  72512. this._targetPool = [this._targetPool];
  72513. }
  72514. // 生命周期
  72515. this._life = options.life || 1000;
  72516. // 延时
  72517. this._delay = options.delay || 0;
  72518. // 开始时间
  72519. this._startTime = new Date().getTime() + this._delay;// 单位毫秒
  72520. // 结束时间
  72521. this._endTime = this._startTime + this._life * 1000;
  72522. // 是否循环
  72523. this.loop = typeof options.loop == 'undefined'
  72524. ? false : options.loop;
  72525. this.gap = options.gap || 0;
  72526. this.easing = options.easing || 'Linear';
  72527. this.onframe = options.onframe;
  72528. this.ondestroy = options.ondestroy;
  72529. this.onrestart = options.onrestart;
  72530. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Clip";
  72531. }
  72532. /**
  72533. * @function LevelRenderer.Animation.Clip.prototype.destroy
  72534. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  72535. */
  72536. destroy() {
  72537. }
  72538. step(time) {
  72539. var easing = new Easing();
  72540. var percent = (time - this._startTime) / this._life;
  72541. // 还没开始
  72542. if (percent < 0) {
  72543. return;
  72544. }
  72545. percent = Math.min(percent, 1);
  72546. var easingFunc = typeof this.easing == 'string'
  72547. ? easing[this.easing]
  72548. : this.easing;
  72549. var schedule = typeof easingFunc === 'function'
  72550. ? easingFunc(percent)
  72551. : percent;
  72552. this.fire('frame', schedule);
  72553. // 结束
  72554. if (percent == 1) {
  72555. if (this.loop) {
  72556. this.restart();
  72557. // 重新开始周期
  72558. // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
  72559. return 'restart';
  72560. }
  72561. // 动画完成将这个控制器标识为待删除
  72562. // 在Animation.update中进行批量删除
  72563. this._needsRemove = true;
  72564. return 'destroy';
  72565. }
  72566. return null;
  72567. }
  72568. restart() {
  72569. var time = new Date().getTime();
  72570. var remainder = (time - this._startTime) % this._life;
  72571. this._startTime = new Date().getTime() - remainder + this.gap;
  72572. }
  72573. fire(eventType, arg) {
  72574. for (var i = 0, len = this._targetPool.length; i < len; i++) {
  72575. if (this['on' + eventType]) {
  72576. this['on' + eventType](this._targetPool[i], arg);
  72577. }
  72578. }
  72579. }
  72580. }
  72581. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Animation.js
  72582. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72583. * This program are made available under the terms of the Apache License, Version 2.0
  72584. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72585. /**
  72586. * @class LevelRenderer.Animation
  72587. * @classdesc 动画主类, 调度和管理所有动画控制器
  72588. * @category Visualization Theme
  72589. * @extends {LevelRenderer.Eventful}
  72590. * @param {Object} options - 动画参数。
  72591. * @param {Object} options.onframe - onframe。
  72592. * @param {Object} options.stage - stage。
  72593. * @example 例如:
  72594. * (start code)
  72595. * var animation = new LevelRenderer.Animation();
  72596. * var obj = {
  72597. * x: 100,
  72598. * y: 100
  72599. * };
  72600. * animation.animate(node.position)
  72601. * .when(1000, {
  72602. * x: 500,
  72603. * y: 500
  72604. * })
  72605. * .when(2000, {
  72606. * x: 100,
  72607. * y: 100
  72608. * })
  72609. * .start('spline');
  72610. * (end)
  72611. * @private
  72612. */
  72613. class Animation extends Eventful {
  72614. constructor(options) {
  72615. super(options);
  72616. options = options || {};
  72617. /**
  72618. * @member {Object} LevelRenderer.Animation.prototype.stage
  72619. * @description stage。
  72620. */
  72621. this.stage = {};
  72622. /**
  72623. * @member {Object} LevelRenderer.Animation.prototype.onframe
  72624. * @description onframe。
  72625. */
  72626. this.onframe = function () {
  72627. };
  72628. /**
  72629. * @member {Array} LevelRenderer.Animation.prototype._clips
  72630. * @description _clips。
  72631. */
  72632. this._clips = [];
  72633. /**
  72634. * @member {boolean} LevelRenderer.Animation.prototype._running
  72635. * @description _running。
  72636. */
  72637. this._running = false;
  72638. /**
  72639. * @member {number} LevelRenderer.Animation.prototype._time
  72640. * @description _time。
  72641. */
  72642. this._time = 0;
  72643. Util_Util.extend(this, options);
  72644. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation";
  72645. }
  72646. /**
  72647. * @function LevelRenderer.Animation.prototype.add
  72648. * @description 添加动画片段。
  72649. * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
  72650. */
  72651. add(clip) {
  72652. this._clips.push(clip);
  72653. }
  72654. /**
  72655. * @function LevelRenderer.Animation.prototype.remove
  72656. * @description 删除动画片段。
  72657. * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
  72658. */
  72659. remove(clip) {
  72660. var idx = new levelRenderer_Util_Util().indexOf(this._clips, clip);
  72661. if (idx >= 0) {
  72662. this._clips.splice(idx, 1);
  72663. }
  72664. }
  72665. /**
  72666. * @function LevelRenderer.Animation.prototype.update
  72667. * @description 更新动画片段。
  72668. */
  72669. _update() {
  72670. var time = new Date().getTime();
  72671. var delta = time - this._time;
  72672. var clips = this._clips;
  72673. var len = clips.length;
  72674. var deferredEvents = [];
  72675. var deferredClips = [];
  72676. for (let i = 0; i < len; i++) {
  72677. var clip = clips[i];
  72678. var e = clip.step(time);
  72679. // Throw out the events need to be called after
  72680. // stage.update, like destroy
  72681. if (e) {
  72682. deferredEvents.push(e);
  72683. deferredClips.push(clip);
  72684. }
  72685. }
  72686. if (this.stage.update) {
  72687. this.stage.update();
  72688. }
  72689. // Remove the finished clip
  72690. for (let i = 0; i < len;) {
  72691. if (clips[i]._needsRemove) {
  72692. clips[i] = clips[len - 1];
  72693. clips.pop();
  72694. len--;
  72695. } else {
  72696. i++;
  72697. }
  72698. }
  72699. len = deferredEvents.length;
  72700. for (let i = 0; i < len; i++) {
  72701. deferredClips[i].fire(deferredEvents[i]);
  72702. }
  72703. this._time = time;
  72704. this.onframe(delta);
  72705. this.dispatch('frame', delta);
  72706. }
  72707. /**
  72708. * @function LevelRenderer.Animation.prototype.start
  72709. * @description 开始运行动画。
  72710. */
  72711. start() {
  72712. var requestAnimationFrame = window.requestAnimationFrame
  72713. || window.msRequestAnimationFrame
  72714. || window.mozRequestAnimationFrame
  72715. || window.webkitRequestAnimationFrame
  72716. || function (func) {
  72717. setTimeout(func, 16);
  72718. };
  72719. var self = this;
  72720. this._running = true;
  72721. function step() {
  72722. if (self._running) {
  72723. self._update();
  72724. requestAnimationFrame(step);
  72725. }
  72726. }
  72727. this._time = new Date().getTime();
  72728. requestAnimationFrame(step);
  72729. }
  72730. /**
  72731. * @function LevelRenderer.Animation.prototype.stop
  72732. * @description 停止运行动画。
  72733. */
  72734. stop() {
  72735. this._running = false;
  72736. }
  72737. /**
  72738. * @function LevelRenderer.Animation.prototype.clear
  72739. * @description 清除所有动画片段。
  72740. */
  72741. clear() {
  72742. this._clips = [];
  72743. }
  72744. /**
  72745. * @function LevelRenderer.Animation.prototype.animate
  72746. * @description 对一个目标创建一个animator对象,可以指定目标中的属性使用动画。
  72747. * @param {Object} target - 目标对象。
  72748. * @param {Object} options - 动画参数选项。
  72749. * @param {boolean} [options.loop=false] - 是否循环播放动画。
  72750. * @param {function} [options.getter] - 如果指定getter函数,会通过getter函数取属性值。
  72751. * @param {function} [options.setter] - 如果指定setter函数,会通过setter函数设置属性值。
  72752. * @returns {LevelRenderer.Animation.Animator} Animator。
  72753. */
  72754. animate(target, options) {
  72755. options = options || {};
  72756. var deferred = new Animator(
  72757. target,
  72758. options.loop,
  72759. options.getter,
  72760. options.setter
  72761. );
  72762. deferred.animation = this;
  72763. return deferred;
  72764. }
  72765. static _interpolateNumber(p0, p1, percent) {
  72766. return (p1 - p0) * percent + p0;
  72767. }
  72768. static _interpolateArray(p0, p1, percent, out, arrDim) {
  72769. var len = p0.length;
  72770. if (arrDim == 1) {
  72771. for (let i = 0; i < len; i++) {
  72772. out[i] = Animation._interpolateNumber(p0[i], p1[i], percent);
  72773. }
  72774. } else {
  72775. var len2 = p0[0].length;
  72776. for (let i = 0; i < len; i++) {
  72777. for (let j = 0; j < len2; j++) {
  72778. out[i][j] = Animation._interpolateNumber(
  72779. p0[i][j], p1[i][j], percent
  72780. );
  72781. }
  72782. }
  72783. }
  72784. }
  72785. static _isArrayLike(data) {
  72786. switch (typeof data) {
  72787. case 'undefined':
  72788. case 'string':
  72789. return false;
  72790. }
  72791. return typeof data.length !== 'undefined';
  72792. }
  72793. static _catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) {
  72794. var len = p0.length;
  72795. if (arrDim == 1) {
  72796. for (let i = 0; i < len; i++) {
  72797. out[i] = Animation._catmullRomInterpolate(
  72798. p0[i], p1[i], p2[i], p3[i], t, t2, t3
  72799. );
  72800. }
  72801. } else {
  72802. var len2 = p0[0].length;
  72803. for (let i = 0; i < len; i++) {
  72804. for (var j = 0; j < len2; j++) {
  72805. out[i][j] = Animation._catmullRomInterpolate(
  72806. p0[i][j], p1[i][j], p2[i][j], p3[i][j],
  72807. t, t2, t3
  72808. );
  72809. }
  72810. }
  72811. }
  72812. }
  72813. static _catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
  72814. var v0 = (p2 - p0) * 0.5;
  72815. var v1 = (p3 - p1) * 0.5;
  72816. return (2 * (p1 - p2) + v0 + v1) * t3
  72817. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  72818. + v0 * t + p1;
  72819. }
  72820. static _cloneValue(value) {
  72821. var arraySlice = Array.prototype.slice;
  72822. if (Animation._isArrayLike(value)) {
  72823. var len = value.length;
  72824. if (Animation._isArrayLike(value[0])) {
  72825. var ret = [];
  72826. for (var i = 0; i < len; i++) {
  72827. ret.push(arraySlice.call(value[i]));
  72828. }
  72829. return ret;
  72830. } else {
  72831. return arraySlice.call(value);
  72832. }
  72833. } else {
  72834. return value;
  72835. }
  72836. }
  72837. static rgba2String(rgba) {
  72838. rgba[0] = Math.floor(rgba[0]);
  72839. rgba[1] = Math.floor(rgba[1]);
  72840. rgba[2] = Math.floor(rgba[2]);
  72841. return 'rgba(' + rgba.join(',') + ')';
  72842. }
  72843. }
  72844. /**
  72845. * @class LevelRenderer.Animation.Animator
  72846. */
  72847. class Animator {
  72848. /**
  72849. * @function LevelRenderer.Animation.Animator.prototype.animate
  72850. * @description 构造函数
  72851. * @param {Object} target - 目标对象。
  72852. * @param {Object} options - 动画参数选项。
  72853. * @param {boolean} [loop=false] - 是否循环播放动画。
  72854. * @param {function} [getterl] - 如果指定getter函数,会通过getter函数取属性值。
  72855. * @param {function} [setter] - 如果指定setter函数,会通过setter函数设置属性值。
  72856. */
  72857. constructor(target, loop, getter, setter) {
  72858. /**
  72859. * @member {Object} LevelRenderer.Animation.Animator.prototype._tracks
  72860. * @description _tracks。
  72861. */
  72862. this._tracks = {};
  72863. /**
  72864. * @member {Object} LevelRenderer.Animation.Animator.prototype._target
  72865. * @description _target。
  72866. */
  72867. this._target = target;
  72868. /**
  72869. * @member {boolean} LevelRenderer.Animation.Animator.prototype._loop
  72870. * @description _loop。
  72871. */
  72872. this._loop = loop || false;
  72873. /**
  72874. * @member {function} LevelRenderer.Animation.Animator.prototype._getter
  72875. * @description _getter。
  72876. */
  72877. this._getter = getter || _defaultGetter;
  72878. /**
  72879. * @member {function} LevelRenderer.Animation.Animator.prototype._setter
  72880. * @description _setter。
  72881. */
  72882. this._setter = setter || _defaultSetter;
  72883. /**
  72884. * @member {number} LevelRenderer.Animation.Animator.prototype._clipCount
  72885. * @description _clipCount。
  72886. */
  72887. this._clipCount = 0;
  72888. /**
  72889. * @member {number} LevelRenderer.Animation.Animator.prototype._delay
  72890. * @description _delay。
  72891. */
  72892. this._delay = 0;
  72893. /**
  72894. * @member {Array} LevelRenderer.Animation.Animator.prototype._doneList
  72895. * @description _doneList。
  72896. */
  72897. this._doneList = [];
  72898. /**
  72899. * @member {Array} LevelRenderer.Animation.Animator.prototype._onframeList
  72900. * @description _onframeList。
  72901. */
  72902. this._onframeList = [];
  72903. /**
  72904. * @member {Array} LevelRenderer.Animation.Animator.prototype._clipList
  72905. * @description _clipList。
  72906. */
  72907. this._clipList = [];
  72908. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Animator";
  72909. //Function
  72910. function _defaultGetter(target, key) {
  72911. return target[key];
  72912. }
  72913. function _defaultSetter(target, key, value) {
  72914. target[key] = value;
  72915. }
  72916. }
  72917. /**
  72918. * @function LevelRenderer.Animation.Animator.prototype.when
  72919. * @description 设置动画关键帧
  72920. * @param {number} time - 关键帧时间,单位是ms
  72921. * @param {Object} props - 关键帧的属性值,key-value表示
  72922. * @returns {LevelRenderer.Animation.Animator} Animator
  72923. */
  72924. when(time /* ms */, props) {
  72925. for (var propName in props) {
  72926. if (!this._tracks[propName]) {
  72927. this._tracks[propName] = [];
  72928. // If time is 0
  72929. // Then props is given initialize value
  72930. // Else
  72931. // Initialize value from current prop value
  72932. if (time !== 0) {
  72933. this._tracks[propName].push({
  72934. time: 0,
  72935. value: Animation._cloneValue(
  72936. this._getter(this._target, propName)
  72937. )
  72938. });
  72939. }
  72940. }
  72941. this._tracks[propName].push({
  72942. time: parseInt(time, 10),
  72943. value: props[propName]
  72944. });
  72945. }
  72946. return this;
  72947. }
  72948. /**
  72949. * @function LevelRenderer.Animation.Animator.prototype.during
  72950. * @description 添加动画每一帧的回调函数
  72951. * @param {RequestCallback} callback - 回调函数
  72952. * @returns {LevelRenderer.Animation.Animator} Animator
  72953. */
  72954. during(callback) {
  72955. this._onframeList.push(callback);
  72956. return this;
  72957. }
  72958. /**
  72959. * @function LevelRenderer.Animation.Animator.prototype.start
  72960. * @description 开始执行动画
  72961. * @param {(string|function)} easing - 动画缓动函数。详见:<{@link LevelRenderer.Animation.easing}>。
  72962. * @returns {LevelRenderer.Animation.Animator} Animator
  72963. */
  72964. start(easing) {
  72965. var self = this;
  72966. var setter = this._setter;
  72967. var getter = this._getter;
  72968. var onFrameListLen = self._onframeList.length;
  72969. var useSpline = easing === 'spline';
  72970. var ondestroy = function () {
  72971. self._clipCount--;
  72972. if (self._clipCount === 0) {
  72973. // Clear all tracks
  72974. self._tracks = {};
  72975. var len = self._doneList.length;
  72976. for (var i = 0; i < len; i++) {
  72977. self._doneList[i].call(self);
  72978. }
  72979. }
  72980. };
  72981. var createTrackClip = function (keyframes, propName) {
  72982. var trackLen = keyframes.length;
  72983. if (!trackLen) {
  72984. return;
  72985. }
  72986. // Guess data type
  72987. var firstVal = keyframes[0].value;
  72988. var isValueArray = Animation._isArrayLike(firstVal);
  72989. var isValueColor = false;
  72990. // For vertices morphing
  72991. var arrDim = (
  72992. isValueArray
  72993. && Animation._isArrayLike(firstVal[0])
  72994. )
  72995. ? 2 : 1;
  72996. // Sort keyframe as ascending
  72997. keyframes.sort(function (a, b) {
  72998. return a.time - b.time;
  72999. });
  73000. var trackMaxTime = keyframes[trackLen - 1].time;
  73001. // Percents of each keyframe
  73002. var kfPercents = [];
  73003. // Value of each keyframe
  73004. var kfValues = [];
  73005. for (let i = 0; i < trackLen; i++) {
  73006. kfPercents.push(keyframes[i].time / trackMaxTime);
  73007. // Assume value is a color when it is a string
  73008. var value = keyframes[i].value;
  73009. if (typeof(value) == 'string') {
  73010. value = SUtil_SUtil.Util_color.toArray(value);
  73011. if (value.length === 0) { // Invalid color
  73012. value[0] = value[1] = value[2] = 0;
  73013. value[3] = 1;
  73014. }
  73015. isValueColor = true;
  73016. }
  73017. kfValues.push(value);
  73018. }
  73019. // Cache the key of last frame to speed up when
  73020. // animation playback is sequency
  73021. var cacheKey = 0;
  73022. var cachePercent = 0;
  73023. var start;
  73024. var i;
  73025. var w;
  73026. var p0;
  73027. var p1;
  73028. var p2;
  73029. var p3;
  73030. if (isValueColor) {
  73031. var rgba = [0, 0, 0, 0];
  73032. }
  73033. var onframe = function (target, percent) {
  73034. // Find the range keyframes
  73035. // kf1-----kf2---------current--------kf3
  73036. // find kf2 and kf3 and do interpolation
  73037. if (percent < cachePercent) {
  73038. // Start from next key
  73039. start = Math.min(cacheKey + 1, trackLen - 1);
  73040. for (i = start; i >= 0; i--) {
  73041. if (kfPercents[i] <= percent) {
  73042. break;
  73043. }
  73044. }
  73045. i = Math.min(i, trackLen - 2);
  73046. } else {
  73047. for (i = cacheKey; i < trackLen; i++) {
  73048. if (kfPercents[i] > percent) {
  73049. break;
  73050. }
  73051. }
  73052. i = Math.min(i - 1, trackLen - 2);
  73053. }
  73054. cacheKey = i;
  73055. cachePercent = percent;
  73056. var range = (kfPercents[i + 1] - kfPercents[i]);
  73057. if (range === 0) {
  73058. return;
  73059. } else {
  73060. w = (percent - kfPercents[i]) / range;
  73061. }
  73062. if (useSpline) {
  73063. p1 = kfValues[i];
  73064. p0 = kfValues[i === 0 ? i : i - 1];
  73065. p2 = kfValues[i > trackLen - 2 ? trackLen - 1 : i + 1];
  73066. p3 = kfValues[i > trackLen - 3 ? trackLen - 1 : i + 2];
  73067. if (isValueArray) {
  73068. Animation._catmullRomInterpolateArray(
  73069. p0, p1, p2, p3, w, w * w, w * w * w,
  73070. getter(target, propName),
  73071. arrDim
  73072. );
  73073. } else {
  73074. let value;
  73075. if (isValueColor) {
  73076. // value = LevelRenderer.Animation._catmullRomInterpolateArray(
  73077. // p0, p1, p2, p3, w, w * w, w * w * w,
  73078. // rgba, 1
  73079. // );
  73080. value = Animation.rgba2String(rgba);
  73081. } else {
  73082. value = Animation._catmullRomInterpolate(
  73083. p0, p1, p2, p3, w, w * w, w * w * w
  73084. );
  73085. }
  73086. setter(
  73087. target,
  73088. propName,
  73089. value
  73090. );
  73091. }
  73092. } else {
  73093. if (isValueArray) {
  73094. Animation._interpolateArray(
  73095. kfValues[i], kfValues[i + 1], w,
  73096. getter(target, propName),
  73097. arrDim
  73098. );
  73099. } else {
  73100. let value;
  73101. if (isValueColor) {
  73102. Animation._interpolateArray(
  73103. kfValues[i], kfValues[i + 1], w,
  73104. rgba, 1
  73105. );
  73106. value = Animation.rgba2String(rgba);
  73107. } else {
  73108. value = Animation._interpolateNumber(kfValues[i], kfValues[i + 1], w);
  73109. }
  73110. setter(
  73111. target,
  73112. propName,
  73113. value
  73114. );
  73115. }
  73116. }
  73117. for (i = 0; i < onFrameListLen; i++) {
  73118. self._onframeList[i](target, percent);
  73119. }
  73120. };
  73121. var clip = new Clip({
  73122. target: self._target,
  73123. life: trackMaxTime,
  73124. loop: self._loop,
  73125. delay: self._delay,
  73126. onframe: onframe,
  73127. ondestroy: ondestroy
  73128. });
  73129. if (easing && easing !== 'spline') {
  73130. clip.easing = easing;
  73131. }
  73132. self._clipList.push(clip);
  73133. self._clipCount++;
  73134. self.animation.add(clip);
  73135. };
  73136. for (var propName in this._tracks) {
  73137. createTrackClip(this._tracks[propName], propName);
  73138. }
  73139. return this;
  73140. }
  73141. /**
  73142. * @function LevelRenderer.Animation.Animator.prototype.stop
  73143. * @description 停止动画
  73144. */
  73145. stop() {
  73146. for (var i = 0; i < this._clipList.length; i++) {
  73147. var clip = this._clipList[i];
  73148. this.animation.remove(clip);
  73149. }
  73150. this._clipList = [];
  73151. }
  73152. /**
  73153. * @function LevelRenderer.Animation.Animator.prototype.delay
  73154. * @description 设置动画延迟开始的时间
  73155. * @param {number} time - 时间,单位ms
  73156. * @returns {LevelRenderer.Animation.Animator} Animator
  73157. */
  73158. delay(time) {
  73159. this._delay = time;
  73160. return this;
  73161. }
  73162. /**
  73163. * @function LevelRenderer.Animation.Animator.prototype.done
  73164. * @description 添加动画结束的回调
  73165. * @param {function} cb - Function
  73166. * @returns {LevelRenderer.Animation.Animator} Animator
  73167. */
  73168. done(cb) {
  73169. if (cb) {
  73170. this._doneList.push(cb);
  73171. }
  73172. return this;
  73173. }
  73174. }
  73175. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Render.js
  73176. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73177. * This program are made available under the terms of the Apache License, Version 2.0
  73178. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73179. /**
  73180. * @private
  73181. * @class LevelRenderer.Render
  73182. * @category Visualization Theme
  73183. * @classdesc Render 接口类,对外可用的所有接口都在这里。内部使用非 get 接口统一返回 this 对象,支持链式调用。
  73184. * @param {string} id - 唯一标识。
  73185. * @param {HTMLElement} dom - Dom 对象。
  73186. */
  73187. class Render {
  73188. constructor(id, dom) {
  73189. /**
  73190. * @member {string} LevelRenderer.Render.prototype.id
  73191. * @description 唯一标识。
  73192. */
  73193. this.id = id;
  73194. /**
  73195. * @member {LevelRenderer.Storage} LevelRenderer.Render.prototype.storage
  73196. * @description 图形仓库对象。
  73197. */
  73198. this.storage = new Storage();
  73199. /**
  73200. * @member {LevelRenderer.Painter} LevelRenderer.Render.prototype.painter
  73201. * @description 绘制器对象。
  73202. *
  73203. */
  73204. this.painter = new Painter(dom, this.storage);
  73205. /**
  73206. * @member {LevelRenderer.Handler} LevelRenderer.Render.prototype.handler
  73207. * @description 事件处理对象。
  73208. *
  73209. */
  73210. this.handler = new Handler(dom, this.storage, this.painter);
  73211. /**
  73212. * @member {Array} LevelRenderer.Render.prototype.animatingElements
  73213. * @description 动画控制数组。
  73214. *
  73215. */
  73216. this.animatingElements = [];
  73217. /**
  73218. * @member {LevelRenderer.animation.Animation} LevelRenderer.Render.prototype.animation
  73219. * @description 动画对象。
  73220. *
  73221. */
  73222. this.animation = new Animation({
  73223. stage: {
  73224. update: Render.getFrameCallback(this)
  73225. }
  73226. });
  73227. /**
  73228. * @member {boolean} LevelRenderer.Render.prototype._needsRefreshNextFrame
  73229. * @description 是否需要刷新下一帧。
  73230. *
  73231. */
  73232. this._needsRefreshNextFrame = false;
  73233. this.animation.start();
  73234. this.CLASS_NAME = "SuperMap.LevelRenderer.Render";
  73235. }
  73236. /**
  73237. * @function LevelRenderer.Render.prototype.destory
  73238. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  73239. */
  73240. destroy() {
  73241. this.id = null;
  73242. this.storage = null;
  73243. this.painter = null;
  73244. this.handler = null;
  73245. this.animatingElements = null;
  73246. this.animation = null;
  73247. this._needsRefreshNextFrame = null;
  73248. }
  73249. /**
  73250. * @function LevelRenderer.Render.prototype.getId
  73251. * @description 获取实例唯一标识。
  73252. * @return {string} 实例唯一标识。
  73253. */
  73254. getId() {
  73255. return this.id;
  73256. }
  73257. /**
  73258. * @function LevelRenderer.Render.prototype.addShape
  73259. * @description 添加图形形状到根节点。
  73260. *
  73261. * @param {LevelRenderer.Shape} shape - 图形对象,可用属性全集,详见各 shape。
  73262. * @return {LevelRenderer.Render} this。
  73263. */
  73264. addShape(shape) {
  73265. this.storage.addRoot(shape);
  73266. return this;
  73267. }
  73268. /**
  73269. * @function LevelRenderer.Render.prototype.addGroup
  73270. * @description 添加组到根节点。
  73271. *
  73272. * (code)
  73273. * //添加组到根节点例子
  73274. * var render = new LevelRenderer.Render("Render",document.getElementById('lRendertest'));
  73275. * render.clear();
  73276. * var g = new LevelRenderer.Group();
  73277. * g.addChild(new LevelRenderer.Shape.Circle({
  73278. * style: {
  73279. * x: 100,
  73280. * y: 100,
  73281. * r: 20,
  73282. * brushType: 'fill'
  73283. * }
  73284. * }));
  73285. * render.addGroup(g);
  73286. * render.render();
  73287. * (end)
  73288. *
  73289. * @param {LevelRenderer.Group} group - 组对象。
  73290. * @return {LevelRenderer.Render} this。
  73291. */
  73292. addGroup(group) {
  73293. this.storage.addRoot(group);
  73294. return this;
  73295. }
  73296. /**
  73297. * @function LevelRenderer.Render.prototype.delShape
  73298. * @description 从根节点删除图形形状。
  73299. *
  73300. * @param {string} shapeId - 图形对象唯一标识。
  73301. * @return {LevelRenderer.Render} this。
  73302. */
  73303. delShape(shapeId) {
  73304. this.storage.delRoot(shapeId);
  73305. return this;
  73306. }
  73307. /**
  73308. * @function LevelRenderer.Render.prototype.delGroup
  73309. * @description 从根节点删除组。
  73310. *
  73311. * @param {string} groupId - 组对象唯一标识。
  73312. * @return {LevelRenderer.Render} this。
  73313. */
  73314. delGroup(groupId) {
  73315. this.storage.delRoot(groupId);
  73316. return this;
  73317. }
  73318. /**
  73319. * @function LevelRenderer.Render.prototype.modShape
  73320. * @description 修改图形形状。
  73321. *
  73322. * @param {string} shapeId - 图形对象唯一标识。
  73323. * @param {LevelRenderer.Shape} shape - 图形对象。
  73324. * @return {LevelRenderer.Render} this。
  73325. */
  73326. modShape(shapeId, shape) {
  73327. this.storage.mod(shapeId, shape);
  73328. return this;
  73329. }
  73330. /**
  73331. * @function LevelRenderer.Render.prototype.modGroup
  73332. * @description 修改组。
  73333. *
  73334. * @param {string} groupId - 组对象唯一标识。
  73335. * @param {LevelRenderer.Group} group - 组对象。
  73336. * @return {LevelRenderer.Render} this。
  73337. */
  73338. modGroup(groupId, group) {
  73339. this.storage.mod(groupId, group);
  73340. return this;
  73341. }
  73342. /**
  73343. * @function LevelRenderer.Render.prototype.modLayer
  73344. * @description 修改指定 zlevel 的绘制配置项。
  73345. *
  73346. * @param {string} zLevel - 组对象唯一标识。
  73347. * @param {Object} config - 配置对象。
  73348. * @param {string} clearColor - 每次清空画布的颜色。默认值:0。
  73349. * @param {noolean} motionBlur - 是否开启动态模糊。默认值:false。
  73350. * @param {number} lastFrameAlpha - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  73351. * @param {Array.<number>} position - 层的平移。
  73352. * @param {Array.<number>} rotation - 层的旋转。
  73353. * @param {Array.<number>} scale - 层的缩放。
  73354. * @param {boolean} zoomable - 层是否支持鼠标缩放操作。默认值:false。
  73355. * @param {boolean} panable - 层是否支持鼠标平移操作。默认值:false。
  73356. * @return {LevelRenderer.Render} this。
  73357. */
  73358. modLayer(zLevel, config) {
  73359. this.painter.modLayer(zLevel, config);
  73360. return this;
  73361. }
  73362. /**
  73363. * @function LevelRenderer.Render.prototype.addHoverShape
  73364. * @description 添加额外高亮层显示,仅提供添加方法,每次刷新后高亮层图形均被清空。
  73365. *
  73366. * @param {LevelRenderer.Shape} shape - 图形对象。
  73367. * @return {LevelRenderer.Render} this。
  73368. */
  73369. addHoverShape(shape) {
  73370. this.storage.addHover(shape);
  73371. return this;
  73372. }
  73373. /**
  73374. * @function LevelRenderer.Render.prototype.render
  73375. * @description 渲染。
  73376. *
  73377. * @callback {function} callback - 渲染结束后回调函数。
  73378. * @return {LevelRenderer.Render} this。
  73379. */
  73380. render(callback) {
  73381. this.painter.render(callback);
  73382. this._needsRefreshNextFrame = false;
  73383. return this;
  73384. }
  73385. /**
  73386. * @function LevelRenderer.Render.prototype.refresh
  73387. * @description 视图更新。
  73388. *
  73389. * @callback {function} callback - 视图更新后回调函数。
  73390. * @return {LevelRenderer.Render} this。
  73391. */
  73392. refresh(callback) {
  73393. this.painter.refresh(callback);
  73394. this._needsRefreshNextFrame = false;
  73395. return this;
  73396. }
  73397. /**
  73398. * @function LevelRenderer.Render.prototype.refreshNextFrame
  73399. * @description 标记视图在浏览器下一帧需要绘制。
  73400. * @return {LevelRenderer.Render} this。
  73401. */
  73402. refreshNextFrame() {
  73403. this._needsRefreshNextFrame = true;
  73404. return this;
  73405. }
  73406. /**
  73407. * @function LevelRenderer.Render.prototype.refreshHover
  73408. * @description 绘制(视图更新)高亮层。
  73409. * @callback {function} callback - 视图更新后回调函数。
  73410. * @return {LevelRenderer.Render} this。
  73411. */
  73412. refreshHover(callback) {
  73413. this.painter.refreshHover(callback);
  73414. return this;
  73415. }
  73416. /**
  73417. * @function LevelRenderer.Render.prototype.refreshShapes
  73418. * @description 视图更新。
  73419. *
  73420. * @param {Array.<LevelRenderer.Shape>} shapeList - 需要更新的图形列表。
  73421. * @callback {function} callback - 视图更新后回调函数。
  73422. * @return {LevelRenderer.Render} this。
  73423. */
  73424. refreshShapes(shapeList, callback) {
  73425. this.painter.refreshShapes(shapeList, callback);
  73426. return this;
  73427. }
  73428. /**
  73429. * @function LevelRenderer.Render.prototype.resize
  73430. * @description 调整视图大小。
  73431. * @return {LevelRenderer.Render} this。
  73432. */
  73433. resize() {
  73434. this.painter.resize();
  73435. return this;
  73436. }
  73437. /**
  73438. * @function LevelRenderer.Render.prototype.animate
  73439. * @description 动画。
  73440. *
  73441. * @example
  73442. * zr.animate(circle.id, 'style', false)
  73443. * .when(1000, {x: 10} )
  73444. * .done(function(){ // Animation done })
  73445. * .start()
  73446. *
  73447. *
  73448. * @param {Array.<(LevelRenderer.Shape/LevelRenderer.Group)>} el - 动画对象。
  73449. * @param {string} path - 需要添加动画的属性获取路径,可以通过 a.b.c 来获取深层的属性。若传入对象为<LevelRenderer.Group>,path需为空字符串。
  73450. * @param {function} loop - 动画是否循环。
  73451. * @return {LevelRenderer.animation.Animator} Animator。
  73452. */
  73453. animate(el, path, loop) {
  73454. if (typeof(el) === 'string') {
  73455. el = this.storage.get(el);
  73456. }
  73457. if (el) {
  73458. var target;
  73459. if (path) {
  73460. var pathSplitted = path.split('.');
  73461. var prop = el;
  73462. for (var i = 0, l = pathSplitted.length; i < l; i++) {
  73463. if (!prop) {
  73464. continue;
  73465. }
  73466. prop = prop[pathSplitted[i]];
  73467. }
  73468. if (prop) {
  73469. target = prop;
  73470. }
  73471. } else {
  73472. target = el;
  73473. }
  73474. if (!target) {
  73475. SUtil_SUtil.Util_log(
  73476. 'Property "'
  73477. + path
  73478. + '" is not existed in element '
  73479. + el.id
  73480. );
  73481. return;
  73482. }
  73483. var animatingElements = this.animatingElements;
  73484. if (typeof el.__aniCount === 'undefined') {
  73485. // 正在进行的动画记数
  73486. el.__aniCount = 0;
  73487. }
  73488. if (el.__aniCount === 0) {
  73489. animatingElements.push(el);
  73490. }
  73491. el.__aniCount++;
  73492. return this.animation.animate(target, {loop: loop})
  73493. .done(function () {
  73494. el.__aniCount--;
  73495. if (el.__aniCount === 0) {
  73496. // 从animatingElements里移除
  73497. var idx = new levelRenderer_Util_Util().indexOf(animatingElements, el);
  73498. animatingElements.splice(idx, 1);
  73499. }
  73500. });
  73501. } else {
  73502. SUtil_SUtil.Util_log('Element not existed');
  73503. }
  73504. }
  73505. /**
  73506. * @function LevelRenderer.Render.prototype.clearAnimation
  73507. * @description 停止所有动画。
  73508. *
  73509. */
  73510. clearAnimation() {
  73511. this.animation.clear();
  73512. }
  73513. /**
  73514. * @function LevelRenderer.Render.prototype.getWidth
  73515. * @description 获取视图宽度。
  73516. * @return {number} 视图宽度。
  73517. */
  73518. getWidth() {
  73519. return this.painter.getWidth();
  73520. }
  73521. /**
  73522. * @function LevelRenderer.Render.prototype.getHeight
  73523. * @description 获取视图高度。
  73524. * @return {number} 视图高度。
  73525. */
  73526. getHeight() {
  73527. return this.painter.getHeight();
  73528. }
  73529. /**
  73530. * @function LevelRenderer.Render.prototype.toDataURL
  73531. * @description 图像导出。
  73532. *
  73533. * @param {string} type - 类型。
  73534. * @param {string} backgroundColor - 背景色,默认值:"#FFFFFF"。
  73535. * @param {string} args - 参数。
  73536. * @return {string} 图片的 Base64 url。
  73537. */
  73538. toDataURL(type, backgroundColor, args) {
  73539. return this.painter.toDataURL(type, backgroundColor, args);
  73540. }
  73541. /**
  73542. * @function LevelRenderer.Render.prototype.shapeToImage
  73543. * @description 将常规 shape 转成 image shape。
  73544. *
  73545. * @param {LevelRenderer.Shape} e - 图形。
  73546. * @param {number} width - 宽度。
  73547. * @param {number} height - 高度。
  73548. * @return {Object} image shape。
  73549. */
  73550. shapeToImage(e, width, height) {
  73551. var id = Util_Util.createUniqueID("SuperMap.LevelRenderer.ToImage_");
  73552. return this.painter.shapeToImage(id, e, width, height);
  73553. }
  73554. /**
  73555. * @function LevelRenderer.Render.prototype.on
  73556. * @description 事件绑定。
  73557. *
  73558. * @param {string} eventName - 事件名称。
  73559. * @param {function} eventHandler - 响应函数。
  73560. * @return {LevelRenderer.Render} this。
  73561. */
  73562. on(eventName, eventHandler) {
  73563. this.handler.on(eventName, eventHandler);
  73564. return this;
  73565. }
  73566. /**
  73567. * @function LevelRenderer.Render.prototype.un
  73568. * @description 事件解绑定,参数为空则解绑所有自定义事件。
  73569. *
  73570. * @param {string} eventName - 事件名称。
  73571. * @param {function} eventHandler - 响应函数。
  73572. * @return {LevelRenderer.Render} this。
  73573. */
  73574. un(eventName, eventHandler) {
  73575. this.handler.un(eventName, eventHandler);
  73576. return this;
  73577. }
  73578. /**
  73579. * @function LevelRenderer.Render.prototype.trigger
  73580. * @description 事件触发。
  73581. *
  73582. * @param {string} eventName - 事件名称,resize,hover,drag,etc。
  73583. * @param {event} event - event dom事件对象。
  73584. * @return {LevelRenderer.Render} this。
  73585. */
  73586. trigger(eventName, event) {
  73587. this.handler.trigger(eventName, event);
  73588. this.handler.dispatch(eventName, event);
  73589. return this;
  73590. }
  73591. /**
  73592. * @function LevelRenderer.Render.prototype.clear
  73593. * @description 清除当前 Render 下所有类图的数据和显示,clear 后 MVC 和已绑定事件均还存在在,Render 可用。
  73594. * @return {LevelRenderer.Render} this。
  73595. */
  73596. clear() {
  73597. this.storage.delRoot();
  73598. this.painter.clear();
  73599. return this;
  73600. }
  73601. /**
  73602. * @function LevelRenderer.Render.prototype.dispose
  73603. * @description 释放当前 Render 实例(删除包括 dom,数据、显示和事件绑定),dispose后 Render 不可用。
  73604. */
  73605. dispose() {
  73606. this.animation.stop();
  73607. this.clear();
  73608. this.storage.dispose();
  73609. this.painter.dispose();
  73610. this.handler.dispose();
  73611. this.animation = null;
  73612. this.animatingElements = null;
  73613. this.storage = null;
  73614. this.painter = null;
  73615. this.handler = null;
  73616. // 释放后告诉全局删除对自己的索引,没想到啥好方法
  73617. // zrender.delInstance(this.id);
  73618. }
  73619. // SMIC-方法扩展 - start
  73620. /**
  73621. * @function LevelRenderer.Render.prototype.updateHoverShapes
  73622. * @description 更新设置显示高亮图层。
  73623. *
  73624. * @param {Array.<LevelRenderer.Shape>} shapes - 图形数组。
  73625. * @return {LevelRenderer.Render} this。
  73626. */
  73627. updateHoverShapes(shapes) {
  73628. this.painter.updateHoverLayer(shapes);
  73629. return this;
  73630. }
  73631. /**
  73632. * @function LevelRenderer.Render.prototype.getAllShapes
  73633. * @description 获取所有图形。
  73634. * @return {Array.<LevelRenderer.Shape>} 图形数组。
  73635. */
  73636. getAllShapes() {
  73637. return this.storage._shapeList;
  73638. }
  73639. /**
  73640. * @function LevelRenderer.Render.prototype.clearAll
  73641. * @description 清除高亮和图形图层。
  73642. * @return {LevelRenderer.Render} this。
  73643. */
  73644. clearAll() {
  73645. this.clear();
  73646. this.painter.clearHover();
  73647. return this;
  73648. }
  73649. /**
  73650. * @function LevelRenderer.Render.prototype.getHoverOne
  73651. * @description 获取单个高亮图形,当前鼠标对应。
  73652. * @return {LevelRenderer.Shape} 高亮图形。
  73653. */
  73654. getHoverOne() {
  73655. return this.handler.getLastHoverOne();
  73656. }
  73657. static getFrameCallback(renderInstance) {
  73658. return function () {
  73659. var animatingElements = renderInstance.animatingElements;
  73660. //animatingElements instanceof Array 临时解决 destory 报错
  73661. if (animatingElements instanceof Array) {
  73662. for (var i = 0, l = animatingElements.length; i < l; i++) {
  73663. renderInstance.storage.mod(animatingElements[i].id);
  73664. }
  73665. if (animatingElements.length || renderInstance._needsRefreshNextFrame) {
  73666. renderInstance.refresh();
  73667. }
  73668. }
  73669. };
  73670. }
  73671. // SMIC-方法扩展 - end
  73672. }
  73673. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/LevelRenderer.js
  73674. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73675. * This program are made available under the terms of the Apache License, Version 2.0
  73676. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73677. /**
  73678. * @class LevelRenderer
  73679. * @deprecatedclass SuperMap.LevelRenderer
  73680. * @category Visualization Theme
  73681. * @classdesc LevelRenderer 渲染器
  73682. * @example
  73683. * //在渲染器上加上图形
  73684. * var levelRenderer = new LevelRenderer();
  73685. * var zr = levelRenderer.init(document.getElementById('lRendertest'));
  73686. * zr.clear();
  73687. * zr.addShape(new LevelRenderer.Shape.Circle({
  73688. * style:{
  73689. * x : 100,
  73690. * y : 100,
  73691. * r : 50,
  73692. * brushType: 'fill'
  73693. * }
  73694. * }));
  73695. * zr.render();
  73696. * @private
  73697. */
  73698. class LevelRenderer {
  73699. constructor() {
  73700. /**
  73701. * @member {Object} LevelRenderer.prototype._instances
  73702. * @description LevelRenderer 实例 map 索引
  73703. */
  73704. LevelRenderer._instances = {};
  73705. // 工具
  73706. LevelRenderer.Tool = {};
  73707. /**
  73708. * @member {string} LevelRenderer.prototype.version
  73709. * @description 版本。zRender(Baidu)的版本号
  73710. * 记录当前 LevelRenderer 是在 zRender 的那个版本上构建而来。
  73711. * 在每次完整评判和实施由 zRender(Baidu)升级带来的 LevelRenderer 升级后修改。
  73712. */
  73713. this.version = '2.0.4';
  73714. this.CLASS_NAME = "SuperMap.LevelRenderer";
  73715. }
  73716. /**
  73717. * @function LevelRenderer.prototype.destroy
  73718. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  73719. */
  73720. destroy() {
  73721. this.dispose();
  73722. this.version = null;
  73723. }
  73724. /**
  73725. * @function LevelRenderer.prototype.init
  73726. * @description 创建 LevelRenderer 实例。
  73727. * @param {HTMLElement} dom - 绘图容器。
  73728. * @returns {LevelRenderer} LevelRenderer 实例。
  73729. */
  73730. init(dom) {
  73731. var zr = new Render(Util_Util.createUniqueID("LRenderer_"), dom);
  73732. LevelRenderer._instances[zr.id] = zr;
  73733. return zr;
  73734. }
  73735. /**
  73736. * @function LevelRenderer.prototype.dispose
  73737. * @description LevelRenderer 实例销毁。
  73738. * 可以通过 zrender.dispose(zr) 销毁指定 LevelRenderer.Render 实例。
  73739. * 也可以通过 zr.dispose() 直接销毁
  73740. * @param {LevelRenderer.Render} zr - ZRender对象,不传此参数则销毁全部。
  73741. * @returns {LevelRenderer} this。
  73742. */
  73743. dispose(zr) {
  73744. if (zr) {
  73745. zr.dispose();
  73746. this.delInstance(zr.id);
  73747. } else {
  73748. for (var key in LevelRenderer._instances) {
  73749. LevelRenderer._instances[key].dispose();
  73750. }
  73751. LevelRenderer._instances = {};
  73752. }
  73753. return this;
  73754. }
  73755. /**
  73756. * @function LevelRenderer.prototype.getInstance
  73757. * @description 获取 LevelRenderer.Render 实例。
  73758. * @param {string} id - ZRender对象索引。
  73759. * @returns {LevelRenderer.Render} LevelRenderer.Render 实例。
  73760. */
  73761. getInstance(id) {
  73762. return LevelRenderer._instances[id];
  73763. }
  73764. /**
  73765. * @function LevelRenderer.prototype.delInstance
  73766. * @description 删除 zrender 实例,LevelRenderer.Render 实例 dispose 时会调用,删除后 getInstance 则返回 undefined
  73767. * @param {string} id - ZRender对象索引。
  73768. * @param {string} id - LevelRenderer.Render 对象索引。
  73769. * @returns {LevelRenderer} this。
  73770. */
  73771. delInstance(id) {
  73772. delete LevelRenderer._instances[id];
  73773. return this;
  73774. }
  73775. }
  73776. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicEllipse.js
  73777. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73778. * This program are made available under the terms of the Apache License, Version 2.0
  73779. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73780. /**
  73781. * @private
  73782. * @class LevelRenderer.Shape.SmicEllipse
  73783. * @category Visualization Theme
  73784. * @classdesc 椭圆。
  73785. * @extends LevelRenderer.Shape
  73786. * @example
  73787. * var shape = new LevelRenderer.Shape.SmicEllipse({
  73788. * style: {
  73789. * x: 100,
  73790. * y: 100,
  73791. * a: 40,
  73792. * b: 20,
  73793. * brushType: 'both',
  73794. * color: 'blue',
  73795. * strokeColor: 'red',
  73796. * lineWidth: 3,
  73797. * text: 'SmicEllipse'
  73798. * }
  73799. * });
  73800. * levelRenderer.addShape(shape);
  73801. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  73802. *
  73803. */
  73804. class SmicEllipse extends (/* unused pure expression or super */ null && (Shape)) {
  73805. constructor(options) {
  73806. super(options);
  73807. /**
  73808. * @member {string} LevelRenderer.Shape.SmicEllipse.prototype.type
  73809. * @description 图形类型。
  73810. */
  73811. this.type = 'smicellipse';
  73812. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  73813. this.refOriginalPosition = [0, 0];
  73814. }
  73815. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicEllipse";
  73816. }
  73817. /**
  73818. * @function LevelRenderer.Shape.SmicEllipse.prototype.destroy
  73819. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  73820. */
  73821. destroy() {
  73822. this.type = null;
  73823. super.destroy();
  73824. }
  73825. /**
  73826. * @function LevelRenderer.Shape.SmicEllipse.prototype.buildPath
  73827. * @description 构建椭圆的 Path。
  73828. *
  73829. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  73830. * @param {Object} style - style。
  73831. *
  73832. */
  73833. buildPath(ctx, style) {
  73834. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  73835. this.refOriginalPosition = [0, 0];
  73836. }
  73837. var __OP = this.refOriginalPosition;
  73838. var k = 0.5522848;
  73839. var x = style.x + __OP[0];
  73840. var y = style.y + __OP[1];
  73841. var a = style.a;
  73842. var b = style.b;
  73843. var ox = a * k; // 水平控制点偏移量
  73844. var oy = b * k; // 垂直控制点偏移量
  73845. // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
  73846. ctx.moveTo(x - a, y);
  73847. ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
  73848. ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
  73849. ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
  73850. ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
  73851. ctx.closePath();
  73852. }
  73853. /**
  73854. * @function LevelRenderer.Shape.SmicEllipse.prototype.getRect
  73855. * @description 计算返回椭圆包围盒矩形
  73856. *
  73857. * @param {Object} style - style
  73858. * @return {Object} 边框对象。包含属性:x,y,width,height。
  73859. *
  73860. */
  73861. getRect(style) {
  73862. if (style.__rect) {
  73863. return style.__rect;
  73864. }
  73865. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  73866. this.refOriginalPosition = [0, 0];
  73867. }
  73868. var __OP = this.refOriginalPosition;
  73869. var lineWidth;
  73870. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  73871. lineWidth = style.lineWidth || 1;
  73872. } else {
  73873. lineWidth = 0;
  73874. }
  73875. style.__rect = {
  73876. x: Math.round((style.x + __OP[0]) - style.a - lineWidth / 2),
  73877. y: Math.round((style.x + __OP[1]) - style.b - lineWidth / 2),
  73878. width: style.a * 2 + lineWidth,
  73879. height: style.b * 2 + lineWidth
  73880. };
  73881. return style.__rect;
  73882. }
  73883. }
  73884. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicIsogon.js
  73885. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73886. * This program are made available under the terms of the Apache License, Version 2.0
  73887. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73888. /**
  73889. * @private
  73890. * @class LevelRenderer.Shape.SmicIsogon
  73891. * @category Visualization Theme
  73892. * @classdesc 正多边形。
  73893. * @extends LevelRenderer.Shape
  73894. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  73895. */
  73896. class SmicIsogon extends (/* unused pure expression or super */ null && (Shape)) {
  73897. constructor(options) {
  73898. super(options);
  73899. /**
  73900. * @member {string} LevelRenderer.Shape.SmicIsogon.prototype.type
  73901. * @description 图形类型。
  73902. */
  73903. this.type = 'smicisogon';
  73904. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  73905. this.refOriginalPosition = [0, 0];
  73906. }
  73907. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicIsogon";
  73908. }
  73909. /**
  73910. * @function LevelRenderer.Shape.SmicIsogon.prototype.destroy
  73911. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  73912. */
  73913. destroy() {
  73914. this.type = null;
  73915. super.destroy();
  73916. }
  73917. /**
  73918. * @function LevelRenderer.Shape.SmicIsogon.prototype.buildPath
  73919. * @description 创建n角星(n>=3)路径。
  73920. *
  73921. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  73922. * @param {Object} style - style。
  73923. *
  73924. */
  73925. buildPath(ctx, style) {
  73926. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  73927. this.refOriginalPosition = [0, 0];
  73928. }
  73929. var __OP = this.refOriginalPosition;
  73930. var sin = SUtil.Util_math.sin;
  73931. var cos = SUtil.Util_math.cos;
  73932. var PI = Math.PI;
  73933. var n = style.n;
  73934. if (!n || n < 2) {
  73935. return;
  73936. }
  73937. var x = style.x + __OP[0];
  73938. var y = style.y + __OP[1];
  73939. var r = style.r;
  73940. var dStep = 2 * PI / n;
  73941. var deg = -PI / 2;
  73942. var xStart = x + r * cos(deg);
  73943. var yStart = y + r * sin(deg);
  73944. deg += dStep;
  73945. // 记录边界点,用于判断insight
  73946. var pointList = style.pointList = [];
  73947. pointList.push([xStart, yStart]);
  73948. for (let i = 0, end = n - 1; i < end; i++) {
  73949. pointList.push([x + r * cos(deg), y + r * sin(deg)]);
  73950. deg += dStep;
  73951. }
  73952. pointList.push([xStart, yStart]);
  73953. // 绘制
  73954. ctx.moveTo(pointList[0][0], pointList[0][1]);
  73955. for (let i = 0; i < pointList.length; i++) {
  73956. ctx.lineTo(pointList[i][0], pointList[i][1]);
  73957. }
  73958. ctx.closePath();
  73959. return;
  73960. }
  73961. /**
  73962. * @function LevelRenderer.Shape.SmicIsogon.prototype.getRect
  73963. * @description 计算返回正多边形的包围盒矩形。
  73964. *
  73965. * @param {Object} style - style
  73966. * @return {Object} 边框对象。包含属性:x,y,width,height。
  73967. */
  73968. getRect(style) {
  73969. if (style.__rect) {
  73970. return style.__rect;
  73971. }
  73972. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  73973. this.refOriginalPosition = [0, 0];
  73974. }
  73975. var __OP = this.refOriginalPosition;
  73976. var lineWidth;
  73977. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  73978. lineWidth = style.lineWidth || 1;
  73979. } else {
  73980. lineWidth = 0;
  73981. }
  73982. style.__rect = {
  73983. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  73984. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  73985. width: style.r * 2 + lineWidth,
  73986. height: style.r * 2 + lineWidth
  73987. };
  73988. return style.__rect;
  73989. }
  73990. }
  73991. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRing.js
  73992. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73993. * This program are made available under the terms of the Apache License, Version 2.0
  73994. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73995. /**
  73996. * @private
  73997. * @class LevelRenderer.Shape.SmicRing
  73998. * @category Visualization Theme
  73999. * @classdesc 圆环。
  74000. * @extends LevelRenderer.Shape
  74001. * @example
  74002. * var shape = new LevelRenderer.Shape.SmicRing({
  74003. * style: {
  74004. * x: 100,
  74005. * y: 100,
  74006. * r0: 30,
  74007. * r: 50
  74008. * }
  74009. * });
  74010. * levelRenderer.addShape(shape);
  74011. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  74012. */
  74013. class SmicRing extends (/* unused pure expression or super */ null && (Shape)) {
  74014. constructor(options) {
  74015. super(options);
  74016. /**
  74017. * @member {string} LevelRenderer.Shape.SmicRing.prototype.type
  74018. * @description 图形类型。
  74019. */
  74020. this.type = 'smicring';
  74021. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  74022. this.refOriginalPosition = [0, 0];
  74023. }
  74024. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRing";
  74025. }
  74026. /**
  74027. * @function LevelRenderer.Shape.SmicRing.prototype.destroy
  74028. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  74029. */
  74030. destroy() {
  74031. this.type = null;
  74032. super.destroy();
  74033. }
  74034. /**
  74035. * @function LevelRenderer.Shape.SmicRing.prototype.buildPath
  74036. * @description 创建圆环路径。
  74037. *
  74038. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  74039. * @param {Object} style - style。
  74040. *
  74041. */
  74042. buildPath(ctx, style) {
  74043. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  74044. this.refOriginalPosition = [0, 0];
  74045. }
  74046. var __OP = this.refOriginalPosition;
  74047. // 非零环绕填充优化
  74048. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, false);
  74049. ctx.moveTo((style.x + __OP[0]) + style.r0, style.y + __OP[1]);
  74050. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r0, 0, Math.PI * 2, true);
  74051. return;
  74052. }
  74053. /**
  74054. * @function LevelRenderer.Shape.SmicRing.prototype.getRect
  74055. * @description 计算返回圆环包围盒矩阵
  74056. *
  74057. * @param {Object} style - style
  74058. * @return {Object} 边框对象。包含属性:x,y,width,height。
  74059. */
  74060. getRect(style) {
  74061. if (style.__rect) {
  74062. return style.__rect;
  74063. }
  74064. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  74065. this.refOriginalPosition = [0, 0];
  74066. }
  74067. var __OP = this.refOriginalPosition;
  74068. var lineWidth;
  74069. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  74070. lineWidth = style.lineWidth || 1;
  74071. } else {
  74072. lineWidth = 0;
  74073. }
  74074. style.__rect = {
  74075. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  74076. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  74077. width: style.r * 2 + lineWidth,
  74078. height: style.r * 2 + lineWidth
  74079. };
  74080. return style.__rect;
  74081. }
  74082. }
  74083. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicStar.js
  74084. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74085. * This program are made available under the terms of the Apache License, Version 2.0
  74086. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74087. /**
  74088. * @private
  74089. * @class LevelRenderer.Shape.SmicStar
  74090. * @category Visualization Theme
  74091. * @classdesc n 角星(n>3)。
  74092. * @extends LevelRenderer.Shape
  74093. * @example
  74094. * var shape = new LevelRenderer.Shape.SmicStar({
  74095. * style: {
  74096. * x: 200,
  74097. * y: 100,
  74098. * r: 150,
  74099. * n: 5,
  74100. * text: '五角星'
  74101. * }
  74102. * });
  74103. * levelRenderer.addShape(shape);
  74104. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  74105. *
  74106. */
  74107. class SmicStar extends (/* unused pure expression or super */ null && (Shape)) {
  74108. constructor(options) {
  74109. super(options);
  74110. /**
  74111. * @member {string} LevelRenderer.Shape.SmicStar.prototype.type
  74112. * @description 图形类型。
  74113. */
  74114. this.type = 'smicstar';
  74115. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  74116. this.refOriginalPosition = [0, 0];
  74117. }
  74118. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicStar";
  74119. }
  74120. /**
  74121. * @function LevelRenderer.Shape.SmicStar.prototype.destroy
  74122. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  74123. */
  74124. destroy() {
  74125. this.type = null;
  74126. super.destroy();
  74127. }
  74128. /**
  74129. * @function LevelRenderer.Shape.SmicStar.prototype.buildPath
  74130. * @description 创建n 角星(n>3)路径。
  74131. *
  74132. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  74133. * @param {Object} style - style。
  74134. *
  74135. */
  74136. buildPath(ctx, style) {
  74137. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  74138. this.refOriginalPosition = [0, 0];
  74139. }
  74140. var __OP = this.refOriginalPosition;
  74141. var n = style.n;
  74142. if (!n || n < 2) {
  74143. return;
  74144. }
  74145. var sin = SUtil.Util_math.sin;
  74146. var cos = SUtil.Util_math.cos;
  74147. var PI = Math.PI;
  74148. var x = style.x + __OP[0];
  74149. var y = style.y + __OP[1];
  74150. var r = style.r;
  74151. var r0 = style.r0;
  74152. // 如果未指定内部顶点外接圆半径,则自动计算
  74153. if (r0 == null) {
  74154. r0 = n > 4
  74155. // 相隔的外部顶点的连线的交点,
  74156. // 被取为内部交点,以此计算r0
  74157. ? r * cos(2 * PI / n) / cos(PI / n)
  74158. // 二三四角星的特殊处理
  74159. : r / 3;
  74160. }
  74161. var dStep = PI / n;
  74162. var deg = -PI / 2;
  74163. var xStart = x + r * cos(deg);
  74164. var yStart = y + r * sin(deg);
  74165. deg += dStep;
  74166. // 记录边界点,用于判断inside
  74167. var pointList = style.pointList = [];
  74168. pointList.push([xStart, yStart]);
  74169. for (var i = 0, end = n * 2 - 1, ri; i < end; i++) {
  74170. ri = i % 2 === 0 ? r0 : r;
  74171. pointList.push([x + ri * cos(deg), y + ri * sin(deg)]);
  74172. deg += dStep;
  74173. }
  74174. pointList.push([xStart, yStart]);
  74175. // 绘制
  74176. ctx.moveTo(pointList[0][0], pointList[0][1]);
  74177. for (let i = 0; i < pointList.length; i++) {
  74178. ctx.lineTo(pointList[i][0], pointList[i][1]);
  74179. }
  74180. ctx.closePath();
  74181. return;
  74182. }
  74183. /**
  74184. * @function LevelRenderer.Shape.SmicStar.prototype.getRect
  74185. * @description 返回 n 角星包围盒矩形。
  74186. *
  74187. * @param {Object} style - style
  74188. * @return {Object} 边框对象。包含属性:x,y,width,height。
  74189. */
  74190. getRect(style) {
  74191. if (style.__rect) {
  74192. return style.__rect;
  74193. }
  74194. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  74195. this.refOriginalPosition = [0, 0];
  74196. }
  74197. var __OP = this.refOriginalPosition;
  74198. var lineWidth;
  74199. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  74200. lineWidth = style.lineWidth || 1;
  74201. } else {
  74202. lineWidth = 0;
  74203. }
  74204. style.__rect = {
  74205. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  74206. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  74207. width: style.r * 2 + lineWidth,
  74208. height: style.r * 2 + lineWidth
  74209. };
  74210. return style.__rect;
  74211. }
  74212. }
  74213. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/index.js
  74214. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74215. * This program are made available under the terms of the Apache License, Version 2.0
  74216. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74217. ;// CONCATENATED MODULE: ./src/common/overlay/threejs/Transform.js
  74218. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74219. * This program are made available under the terms of the Apache License, Version 2.0
  74220. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74221. function wrap(source, min, max) {
  74222. if (source === max || source === min) {
  74223. return source;
  74224. }
  74225. let len = max - min;
  74226. return ((source - min) % len + len) % len + min
  74227. }
  74228. function rad(angle) {
  74229. return angle * Math.PI / 180;
  74230. }
  74231. var Projection = {
  74232. R: 6378137,
  74233. minZoom: 0,
  74234. maxZoom: 22,
  74235. nativeMaxZoom: 19,
  74236. RAD: Math.PI / 180,
  74237. METERS_PER_DEGREE: 6378137 * Math.PI / 180,
  74238. MAX_LATITUDE: 85.0511287798,
  74239. project: function (lngLat) {
  74240. const rad = this.RAD,
  74241. metersPerDegree = this.METERS_PER_DEGREE,
  74242. max = this.MAX_LATITUDE;
  74243. let ll = (lngLat instanceof Array)
  74244. ? {lng: lngLat[0], lat: lngLat[1]}
  74245. : {lng: lngLat.lng, lat: lngLat.lat};
  74246. let lng = ll.lng, lat = Math.max(Math.min(max, ll.lat), -max);
  74247. let c;
  74248. if (lat === 0) {
  74249. c = 0;
  74250. } else {
  74251. c = Math.log(Math.tan((90 + lat) * rad / 2)) / rad;
  74252. }
  74253. return {x: lng * metersPerDegree, y: c * metersPerDegree};
  74254. },
  74255. unproject: function (point) {
  74256. const x = point.x,
  74257. y = point.y;
  74258. const rad = this.RAD,
  74259. metersPerDegree = this.METERS_PER_DEGREE;
  74260. let c;
  74261. if (y === 0) {
  74262. c = 0;
  74263. } else {
  74264. c = y / metersPerDegree;
  74265. c = (2 * Math.atan(Math.exp(c * rad)) - Math.PI / 2) / rad;
  74266. }
  74267. return {lng: wrap(x / metersPerDegree, -180, 180), lat: wrap(c, -this.MAX_LATITUDE, this.MAX_LATITUDE)};
  74268. },
  74269. locate: function (lngLat, dx, dy) {
  74270. if (!lngLat) {
  74271. return null;
  74272. }
  74273. dx = !dx ? 0 : dx;
  74274. dy = !dy ? 0 : dy;
  74275. if (!dx && !dy) {
  74276. return lngLat;
  74277. }
  74278. let lng = lngLat.lng;
  74279. if (dx !== 0) {
  74280. let ndx = Math.abs(dx), radLng = rad(lngLat.lng);
  74281. let sLng = 2 * Math.sqrt(Math.pow(Math.sin(ndx / (2 * this.R)), 2) / Math.pow(Math.cos(radLng), 2));
  74282. radLng = radLng + sLng * (ndx > 0 ? 1 : -1);
  74283. lng = wrap(radLng * 180 / Math.PI, -180, 180);
  74284. }
  74285. let lat = lngLat.lat;
  74286. if (dy !== 0) {
  74287. let ndy = Math.abs(dy), radLat = rad(lngLat.lat);
  74288. let sLat = Math.sin(ndy / (2 * this.R)) * 2;
  74289. radLat = radLat + sLat * (ndy > 0 ? 1 : -1);
  74290. lat = wrap(radLat * 180 / Math.PI, -90, 90);
  74291. }
  74292. return {lng, lat};
  74293. },
  74294. getResolution: function (zoom) {
  74295. if (!this.resolutions) {
  74296. var resolutions = [];
  74297. var d = 2 * 6378137 * Math.PI;
  74298. for (var i = 0; i <= this.maxZoom; i++) {
  74299. resolutions[i] = d / (256 * Math.pow(2, i));
  74300. }
  74301. this.resolutions = resolutions;
  74302. }
  74303. let z = (zoom | 0), length = this.resolutions.length;
  74304. z = z < 0 ? 0 : z > length - 1 ? length - 1 : z;
  74305. const res = this.resolutions[z];
  74306. if ((zoom | 0) !== zoom && z !== length - 1) {
  74307. const next = this.resolutions[z + 1];
  74308. return res + (next - res) * (zoom - z);
  74309. }
  74310. return res;
  74311. }
  74312. };
  74313. var Transform = {
  74314. matrix: [1, -1, 0, 0],
  74315. projection: Projection,
  74316. project: function (lngLat) {
  74317. return this.projection.project(lngLat);
  74318. },
  74319. unproject: function (point) {
  74320. return this.projection.unproject(point);
  74321. },
  74322. lngLatToPoint: function (lngLat, zoom) {
  74323. var pt = this.project(lngLat);
  74324. return this.transform(pt, this.projection.getResolution(zoom));
  74325. },
  74326. locate: function (lngLat, dx, dy) {
  74327. return this.projection.locate(lngLat, dx, dy);
  74328. },
  74329. transform: function (point, scale) {
  74330. return {
  74331. x: this.matrix[0] * (point.x - this.matrix[2]) / scale,
  74332. y: this.matrix[1] * (point.y - this.matrix[3]) / scale
  74333. };
  74334. }
  74335. };
  74336. ;// CONCATENATED MODULE: ./src/common/overlay/index.js
  74337. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74338. * This program are made available under the terms of the Apache License, Version 2.0
  74339. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74340. ;// CONCATENATED MODULE: ./src/common/components/CommonTypes.js
  74341. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74342. * This program are made available under the terms of the Apache License, Version 2.0
  74343. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74344. /**
  74345. * @description 该文件用于存储一些公用常量
  74346. * @private
  74347. */
  74348. const CommonTypes_FileTypes = {
  74349. EXCEL: "EXCEL",
  74350. CSV: "CSV",
  74351. ISERVER: "ISERVER",
  74352. GEOJSON: "GEOJSON",
  74353. JSON: 'JSON'
  74354. };
  74355. const CommonTypes_FileConfig = {
  74356. fileMaxSize: 10 * 1024 * 1024
  74357. };
  74358. ;// CONCATENATED MODULE: ./src/common/components/openfile/FileModel.js
  74359. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74360. * This program are made available under the terms of the Apache License, Version 2.0
  74361. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74362. /**
  74363. * @class FileModel
  74364. * @deprecatedclass SuperMap.FileModel
  74365. * @description 文件数据组件数据模型,用于存储一些文件数据或状态,todo 结构待完善
  74366. * @category Components OpenFile
  74367. * @private
  74368. */
  74369. class FileModel {
  74370. constructor(options) {
  74371. this.FileTypes = FileTypes;
  74372. this.FileConfig = FileConfig;
  74373. this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
  74374. }
  74375. /**
  74376. * @function FileModel.prototype.set
  74377. * @description 设置属性值
  74378. * @param {string} key - 属性名称
  74379. * @param {string|Object} value - 属性值
  74380. */
  74381. set(key, value) {
  74382. this[key] = value;
  74383. }
  74384. /**
  74385. * @function FileModel.prototype.get
  74386. * @description 获取数据值
  74387. * @param {string} key - 属性名称
  74388. * @returns {string|Object} value - 返回属性值
  74389. */
  74390. get(key) {
  74391. return this[key];
  74392. }
  74393. }
  74394. ;// CONCATENATED MODULE: ./src/common/components/messagebox/MessageBox.js
  74395. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74396. * This program are made available under the terms of the Apache License, Version 2.0
  74397. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74398. /**
  74399. * @class MessageBox
  74400. * @aliasclass Components.MessageBox
  74401. * @deprecatedclass SuperMap.Components.MessageBox
  74402. * @version 9.1.1
  74403. * @classdesc 组件信息提示框。
  74404. * @category Components Common
  74405. * @usage
  74406. */
  74407. class MessageBox {
  74408. constructor() {
  74409. this._initView();
  74410. }
  74411. _initView() {
  74412. //原生js形式
  74413. const messageBoxContainer = document.createElement("div");
  74414. messageBoxContainer.hidden = true;
  74415. messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  74416. //图标
  74417. const iconContainer = document.createElement("div");
  74418. iconContainer.setAttribute("class", "icon");
  74419. this.icon = document.createElement("span");
  74420. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  74421. iconContainer.appendChild(this.icon);
  74422. messageBoxContainer.appendChild(iconContainer);
  74423. //内容:
  74424. const messageBox = document.createElement("div");
  74425. messageBox.setAttribute("class", "component-messagebox");
  74426. messageBox.innerHTML = "";
  74427. messageBoxContainer.appendChild(messageBox);
  74428. this.messageBox = messageBox;
  74429. //关闭按钮
  74430. const cancelContainer = document.createElement("div");
  74431. cancelContainer.setAttribute("class", "component-messagebox__cancelbtncontainer");
  74432. const cancelBtn = document.createElement("button");
  74433. cancelBtn.setAttribute("class", "component-messagebox__cancelBtn");
  74434. cancelBtn.innerHTML = "x";
  74435. cancelBtn.onclick = this.closeView.bind(this);
  74436. cancelContainer.appendChild(cancelBtn);
  74437. messageBoxContainer.appendChild(cancelContainer);
  74438. this.messageBoxContainer = messageBoxContainer;
  74439. document.body.appendChild(this.messageBoxContainer);
  74440. }
  74441. /**
  74442. * @function MessageBox.prototype.closeView
  74443. * @description 关闭提示框。
  74444. */
  74445. closeView() {
  74446. this.messageBoxContainer.hidden = true;
  74447. }
  74448. /**
  74449. * @function MessageBox.prototype.showView
  74450. * @description 显示提示框。
  74451. * @param {string} message - 提示框显示内容。
  74452. * @param {string}[type="warring"] 提示框类型,如 "warring", "failure", "success"。
  74453. */
  74454. showView(message, type = 'warring') {
  74455. //设置提示框的样式:
  74456. if (type === "success") {
  74457. this.icon.setAttribute("class", "supermapol-icons-message-success");
  74458. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-green");
  74459. } else if (type === "failure") {
  74460. this.icon.setAttribute("class", "supermapol-icons-message-failure");
  74461. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-red");
  74462. } else if (type === "warring") {
  74463. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  74464. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  74465. }
  74466. this.messageBox.innerHTML = message;
  74467. this.messageBoxContainer.hidden = false;
  74468. }
  74469. }
  74470. ;// CONCATENATED MODULE: external "function(){try{return echarts}catch(e){return {}}}()"
  74471. const external_function_try_return_echarts_catch_e_return_namespaceObject = function(){try{return echarts}catch(e){return {}}}();
  74472. ;// CONCATENATED MODULE: ./src/common/lang/locales/en-US.js
  74473. 
  74474. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74475. * This program are made available under the terms of the Apache License, Version 2.0
  74476. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74477. /**
  74478. * Namespace: SuperMap.Lang["en"]
  74479. * Dictionary for English. Keys for entries are used in calls to
  74480. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  74481. * strings formatted for use with <SuperMap.String.format> calls.
  74482. */
  74483. let en = {
  74484. 'title_dataFlowService': 'Data Flow Service',
  74485. 'title_distributedAnalysis': 'Distributed Analysis',
  74486. 'title_clientComputing': 'Client Computing',
  74487. 'title_dataServiceQuery': 'Data Service Query',
  74488. 'title_searchCity':'Search city',
  74489. 'title_searchLayer':' Search layer',
  74490. 'text_input_value_inputDataFlowUrl': 'Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  74491. 'text_displayFeaturesInfo': 'Display feature information',
  74492. 'text_subscribe': 'subscribe',
  74493. 'text_cancelSubscribe': 'unsubscribe',
  74494. 'text_densityAnalysis': 'Density Analysis',
  74495. 'text_CalculateTheValuePerUnitArea': 'Calculate the value per unit area within the neighborhood shape',
  74496. 'text_option_selectDataset':'Please select a dataset',
  74497. 'text_label_dataset': 'Dataset',
  74498. 'text_option_simplePointDensityAnalysis': 'Simple point density analysis',
  74499. 'text_option_nuclearDensityAnalysis': 'Nuclear density analysis',
  74500. 'text_label_analyticalMethod': 'Analytical method',
  74501. 'text_option_quadrilateral': 'Quadrilateral',
  74502. 'text_option_hexagon': 'hexagon',
  74503. 'text_label_meshType': 'Mesh type',
  74504. 'text_option_notSet': 'Not set',
  74505. 'text_label_weightField': 'Weight field',
  74506. 'text_label_gridSizeInMeters': 'Grid size',
  74507. 'text_label_searchRadius': 'Search radius',
  74508. 'text_label_queryRange': 'Scope of analysis',
  74509. 'text_label_areaUnit': 'Area unit',
  74510. 'text_option_equidistantSegmentation': 'Equidistant segmentation',
  74511. 'text_option_logarithm': 'Logarithm',
  74512. 'text_option_equalCountingSegment': 'Equal counting segment',
  74513. 'text_option_squareRootSegmentation': 'Square root segmentation',
  74514. 'text_label_thematicMapSegmentationMode': 'Thematic map segmentation mode',
  74515. 'text_label_thematicMapSegmentationParameters': 'Thematic map segmentation parameters',
  74516. 'text_option_greenOrangePurpleGradient': 'Green orange purple gradient',
  74517. 'text_option_greenOrangeRedGradient': 'Green orange red gradient',
  74518. 'text_option_rainbowGradient': 'Rainbow gradient',
  74519. 'text_option_spectralGradient': 'Spectral gradient',
  74520. 'text_option_terrainGradient': 'Terrain gradient',
  74521. 'text_label_thematicMapColorGradientMode': 'Thematic map color gradient mode',
  74522. 'text_label_resultLayerName': 'Result layer name',
  74523. 'text_chooseFile': 'Open File',
  74524. 'text_isoline': 'Isoline',
  74525. 'text_extractDiscreteValue': 'Extract discrete value generation curve',
  74526. 'text_buffer': 'Buffer',
  74527. 'text_specifyTheDistance': 'Specify the distance to create the surrounding area',
  74528. 'text_label_analysisLayer': 'Analysis layer',
  74529. 'text_label_extractField': 'Extract field',
  74530. 'text_label_extractedValue': 'Extracted value',
  74531. 'text_label_distanceAttenuation': 'Distance attenuation',
  74532. 'text_label_gridSize': 'gridSize',
  74533. 'text_label_bufferRadius': 'Buffer radius',
  74534. 'text_label_defaultkilometers': 'Default 10 kilometers',
  74535. 'text_label_kilometer': 'kilometer',
  74536. 'text_label_unit': 'unit',
  74537. 'text_retainOriginal': 'Retain original object field',
  74538. 'text_mergeBuffer': 'Merge buffer',
  74539. 'text_label_color': 'Color',
  74540. 'text_label_buffer': '[Buffer]',
  74541. 'text_label_isolines': '[Isolines]',
  74542. 'text_label_queryRangeTips': 'The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850',
  74543. 'text_label_queryModel': 'Query mode',
  74544. 'text_label_IDArrayOfFeatures': 'ID array of features',
  74545. 'text_label_maxFeatures': 'The maximum number of features that can be returned',
  74546. 'text_label_bufferDistance': 'Buffer distance',
  74547. 'text_label_queryRange1': 'Query range',
  74548. 'text_label_spatialQueryMode': 'Spatial query mode',
  74549. 'text_label_featureFilter': 'Feature filter',
  74550. 'text_label_geometricObject': 'Geometric object',
  74551. 'text_label_queryMode': 'Query mode',
  74552. 'text_label_searchTips': 'Search for city locations or layer features',
  74553. 'text_label_chooseSearchLayers': 'Select a query layer',
  74554. 'text_loadSearchCriteria': 'Load search criteria',
  74555. 'text_saveSearchCriteria': 'Save search criteria',
  74556. "btn_analyze": "Analyze",
  74557. "btn_analyzing": "Analyzing",
  74558. "btn_emptyTheAnalysisLayer": "Empty the analysis layer",
  74559. "btn_cancelAnalysis": "Cancel",
  74560. "btn_query": "Query",
  74561. "btn_querying": "Querying",
  74562. "btn_emptyTheRresultLayer": "Clear all result layers",
  74563. 'msg_dataReturnedIsEmpty.': 'The request is successful and the data returned by the query is empty.',
  74564. 'msg_dataFlowServiceHasBeenSubscribed': 'The data stream service has been subscribed to.',
  74565. 'msg_inputDataFlowUrlFirst': 'Please enter the data stream service address first.',
  74566. 'msg_datasetOrMethodUnsupport': 'This dataset does not support this analysis type. Please reselect the dataset.',
  74567. 'msg_selectDataset': 'Please select a data set!',
  74568. 'msg_setTheWeightField': 'Please set the weight field!',
  74569. 'msg_theFieldNotSupportAnalysis': 'The field you currently select does not support analysis!',
  74570. 'msg_resultIsEmpty': 'The result of the analysis is empty!',
  74571. 'msg_openFileFail': 'Failed to open file!',
  74572. 'msg_fileTypeUnsupported': 'File format is not supported!',
  74573. 'msg_fileSizeExceeded': 'File size exceeded! The file size should not exceed 10M!',
  74574. 'msg_dataInWrongGeoJSONFormat': 'Wrong data format! Non standard GEOJSON format data!',
  74575. 'msg_dataInWrongFormat': 'Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!',
  74576. 'msg_searchKeywords': "Search keywords cannot be empty. Please enter your search criteria.",
  74577. 'msg_searchGeocodeField':"Did not match the address matching service data!",
  74578. 'msg_cityGeocodeField':"The address matching service of the current city is not configured.",
  74579. 'msg_getFeatureField':"No related vector features found!",
  74580. 'msg_dataflowservicesubscribed':'The data stream service has been subscribed to.',
  74581. 'msg_subscribesucceeded':'The data stream service subscription was successful.',
  74582. 'msg_crsunsupport':'Does not support the coordinate system of the current map',
  74583. 'msg_tilematrixsetunsupport':'Incoming TileMatrixSet is not supported',
  74584. 'msg_jsonResolveFiled': 'JSON format parsing failure!',
  74585. 'msg_requestContentFiled': 'Failed to request data through iportal!',
  74586. 'msg_getdatafailed': 'Failed to get data!'
  74587. };
  74588. ;// CONCATENATED MODULE: ./src/common/lang/locales/zh-CN.js
  74589. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74590. * This program are made available under the terms of the Apache License, Version 2.0
  74591. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74592. /**
  74593. * Namespace: SuperMap.Lang["zh-CN"]
  74594. * Dictionary for Simplified Chinese. Keys for entries are used in calls to
  74595. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  74596. * strings formatted for use with <SuperMap.String.format> calls.
  74597. */
  74598. let zh = {
  74599. 'title_dataFlowService': '数据流服务',
  74600. 'title_distributedAnalysis': '分布式分析',
  74601. 'title_clientComputing': '客户端计算',
  74602. 'title_dataServiceQuery': '数据服务查询',
  74603. 'title_searchCity':'搜索城市',
  74604. 'title_searchLayer':'搜索图层',
  74605. 'text_input_value_inputDataFlowUrl': '请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  74606. 'text_displayFeaturesInfo': '显示要素信息',
  74607. 'text_subscribe': '订阅',
  74608. 'text_cancelSubscribe': '取消订阅',
  74609. 'text_densityAnalysis': '密度分析',
  74610. 'text_CalculateTheValuePerUnitArea': '计算点指定邻域形状内的每单位面积量值',
  74611. 'text_option_selectDataset':'请选择数据集',
  74612. 'text_label_dataset': '数据集',
  74613. 'text_option_simplePointDensityAnalysis': '简单点密度分析',
  74614. 'text_option_nuclearDensityAnalysis': '核密度分析',
  74615. 'text_label_analyticalMethod': '分析方法',
  74616. 'text_option_quadrilateral': '四边形',
  74617. 'text_option_hexagon': '六边形',
  74618. 'text_label_meshType': '网格面类型',
  74619. 'text_option_notSet': '未设置',
  74620. 'text_label_weightField': '权重字段',
  74621. 'text_label_gridSizeInMeters': '网格大小',
  74622. 'text_label_searchRadius': '搜索半径',
  74623. 'text_label_queryRange': '分析范围',
  74624. 'text_label_areaUnit': '面积单位',
  74625. 'text_option_equidistantSegmentation': '等距离分段',
  74626. 'text_option_logarithm': '对数',
  74627. 'text_option_equalCountingSegment': '等计数分段',
  74628. 'text_option_squareRootSegmentation': '平方根分段',
  74629. 'text_label_thematicMapSegmentationMode': '专题图分段模式',
  74630. 'text_label_thematicMapSegmentationParameters': '专题图分段参数',
  74631. 'text_option_greenOrangePurpleGradient': '绿橙紫渐变',
  74632. 'text_option_greenOrangeRedGradient': '绿橙红渐变',
  74633. 'text_option_rainbowGradient': '彩虹渐变',
  74634. 'text_option_spectralGradient': '光谱渐变',
  74635. 'text_option_terrainGradient': '地形渐变',
  74636. 'text_label_thematicMapColorGradientMode': '专题图颜色渐变模式',
  74637. 'text_label_resultLayerName': '结果图层名称',
  74638. 'text_chooseFile': '选择文件',
  74639. 'text_isoline': '等值线',
  74640. 'text_extractDiscreteValue': '提取离散值生成曲线',
  74641. 'text_buffer': '缓冲区',
  74642. 'text_specifyTheDistance': '指定距离创建周边区域',
  74643. 'text_label_analysisLayer': '分析图层',
  74644. 'text_label_extractField': '提取字段',
  74645. 'text_label_extractedValue': '提取值',
  74646. 'text_label_distanceAttenuation': '距离衰减',
  74647. 'text_label_gridSize': '栅格大小',
  74648. 'text_label_bufferRadius': '缓冲半径',
  74649. 'text_label_defaultkilometers': '默认10千米',
  74650. 'text_option_kilometer': '千米',
  74651. 'text_label_unit': '单位',
  74652. 'text_retainOriginal': '保留原对象字段属性',
  74653. 'text_mergeBuffer': '合并缓冲区',
  74654. 'text_label_color': '颜色',
  74655. 'text_label_buffer': '[缓冲区]',
  74656. 'text_label_isolines': '[等值线]',
  74657. 'text_label_queryRangeTips': '默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850',
  74658. 'text_label_IDArrayOfFeatures': '要素 ID 数组',
  74659. 'text_label_maxFeatures': '最多可返回的要素数量',
  74660. 'text_label_bufferDistance': '缓冲区距离',
  74661. 'text_label_queryRange1': '查询范围',
  74662. 'text_label_spatialQueryMode': '空间查询模式',
  74663. 'text_label_featureFilter': '要素过滤器',
  74664. 'text_label_geometricObject': '几何对象',
  74665. 'text_label_queryMode': '查询模式',
  74666. 'text_label_searchTips': '搜索城市地点或图层要素',
  74667. 'text_label_chooseSearchLayers': '选择查询图层',
  74668. 'text_loadSearchCriteria': '加载搜索条件',
  74669. 'text_saveSearchCriteria': '保存搜索条件',
  74670. "btn_analyze": "分析",
  74671. "btn_analyzing": "分析中",
  74672. "btn_emptyTheAnalysisLayer": "清空分析图层",
  74673. "btn_cancelAnalysis": "取消",
  74674. "btn_query": "查询",
  74675. "btn_querying": "查询中",
  74676. "btn_emptyTheRresultLayer": "清除所有结果图层",
  74677. 'msg_dataFlowServiceHasBeenSubscribed': '已订阅该数据流服务。',
  74678. 'msg_inputDataFlowUrlFirst': '请先输入数据流服务地址。',
  74679. 'msg_datasetOrMethodUnsupport': '该数据集不支持本分析类型,请重新选择数据集',
  74680. 'msg_selectDataset': '请选择数据集!',
  74681. 'msg_setTheWeightField': '请设置权重字段!',
  74682. 'msg_theFieldNotSupportAnalysis': '您当前选择的字段不支持分析!',
  74683. 'msg_resultIsEmpty': '分析的结果为空!',
  74684. 'msg_dataReturnedIsEmpty': '请求成功,查询返回的数据为空。',
  74685. 'msg_openFileFail': '打开文件失败!',
  74686. 'msg_fileTypeUnsupported': '不支持该文件格式!',
  74687. 'msg_fileSizeExceeded': '文件大小超限!文件大小不得超过 10M!',
  74688. 'msg_dataInWrongGeoJSONFormat': '数据格式错误!非标准的 GEOJSON 格式数据!',
  74689. 'msg_dataInWrongFormat': '数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!',
  74690. 'msg_searchKeywords': "搜索关键字不能为空,请输入搜索条件。",
  74691. 'msg_searchGeocodeField':"未匹配到地址匹配服务数据!",
  74692. 'msg_cityGeocodeField':"未配置当前城市的地址匹配服务。",
  74693. 'msg_getFeatureField':"未查找到相关矢量要素!",
  74694. 'msg_dataflowservicesubscribed':'已订阅该数据流服务。',
  74695. 'msg_subscribesucceeded':'数据流服务订阅成功。',
  74696. 'msg_crsunsupport':'不支持当前地图的坐标系',
  74697. 'msg_tilematrixsetunsupport':'不支持传入的TileMatrixSet',
  74698. 'msg_jsonResolveFiled': 'json格式解析失败!',
  74699. 'msg_requestContentFiled': '通过iportal请求数据失败!',
  74700. 'msg_getdatafailed': '获取数据失败!'
  74701. };
  74702. ;// CONCATENATED MODULE: ./src/common/lang/Lang.js
  74703. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74704. * This program are made available under the terms of the Apache License, Version 2.0
  74705. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74706. /**
  74707. * @name Lang
  74708. * @namespace
  74709. * @category BaseTypes Internationalization
  74710. * @description 国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
  74711. * @usage
  74712. * ```
  74713. * // 浏览器
  74714. * <script type="text/javascript" src="{cdn}"></script>
  74715. * <script>
  74716. * const result = {namespace}.Lang.getCode();
  74717. *
  74718. * // 弃用的写法
  74719. * const result = SuperMap.Lang.getCode();
  74720. *
  74721. * </script>
  74722. *
  74723. * // ES6 Import
  74724. * import { Lang } from '{npm}';
  74725. *
  74726. * const result = Lang.getCode();
  74727. *
  74728. * ```
  74729. */
  74730. let Lang = {
  74731. 'en-US': en,
  74732. "zh-CN": zh,
  74733. /**
  74734. * @member {string} Lang.code
  74735. * @description 当前所使用的语言类型。
  74736. */
  74737. code: null,
  74738. /**
  74739. * @member {string} [Lang.defaultCode='en-US']
  74740. * @description 默认使用的语言类型。
  74741. */
  74742. defaultCode: "en-US",
  74743. /**
  74744. * @function Lang.getCode
  74745. * @description 获取当前的语言代码。
  74746. * @returns {string} 当前的语言代码。
  74747. */
  74748. getCode: function () {
  74749. if (!Lang.code) {
  74750. Lang.setCode();
  74751. }
  74752. return Lang.code;
  74753. },
  74754. /**
  74755. * @function Lang.setCode
  74756. * @description 设置语言代码。
  74757. * @param {string} code - 此参数遵循IETF规范。
  74758. */
  74759. setCode: function () {
  74760. var lang = this.getLanguageFromCookie();
  74761. if (!lang) {
  74762. lang = Lang.defaultCode;
  74763. if (navigator.appName === 'Netscape') {
  74764. lang = navigator.language;
  74765. } else {
  74766. lang = navigator.browserLanguage;
  74767. }
  74768. }
  74769. if (lang.indexOf('zh') === 0) {
  74770. lang = 'zh-CN';
  74771. }
  74772. if (lang.indexOf('en') === 0) {
  74773. lang = 'en-US';
  74774. }
  74775. Lang.code = lang;
  74776. },
  74777. /**
  74778. * @function Lang.getLanguageFromCookie
  74779. * @description 从 cookie 中获取语言类型。
  74780. */
  74781. getLanguageFromCookie() {
  74782. var name = 'language=';
  74783. var ca = document.cookie.split(';');
  74784. for (var i = 0; i < ca.length; i++) {
  74785. var c = ca[i];
  74786. while (c.charAt(0) === ' ') {
  74787. c = c.substring(1)
  74788. }
  74789. if (c.indexOf(name) !== -1) {
  74790. return c.substring(name.length, c.length)
  74791. }
  74792. }
  74793. return "";
  74794. },
  74795. /**
  74796. * @function Lang.i18n
  74797. * @description 从当前语言字符串的字典查找 key。
  74798. * @param {string} key - 字典中 i18n 字符串值的关键字。
  74799. * @returns {string} 国际化的字符串。
  74800. */
  74801. i18n: function (key) {
  74802. var dictionary = Lang[Lang.getCode()];
  74803. var message = dictionary && dictionary[key];
  74804. if (!message) {
  74805. // Message not found, fall back to message key
  74806. message = key;
  74807. }
  74808. return message;
  74809. }
  74810. };
  74811. ;// CONCATENATED MODULE: external "function(){try{return XLSX}catch(e){return {}}}()"
  74812. const external_function_try_return_XLSX_catch_e_return_namespaceObject = function(){try{return XLSX}catch(e){return {}}}();
  74813. ;// CONCATENATED MODULE: ./src/common/components/util/FileReaderUtil.js
  74814. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74815. * This program are made available under the terms of the Apache License, Version 2.0
  74816. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74817. /**
  74818. * @name FileReaderUtil
  74819. * @namespace
  74820. * @category Components OpenFile
  74821. * @description 组件读取文件工具类。
  74822. * @version 9.1.1
  74823. * @type {{rABS: (boolean|*), rABF: (boolean|*), rAT: (boolean|*), readFile: (function(*, *=, *=, *=, *=)), readTextFile: (function(*, *=, *=, *=)), readXLSXFile: (function(*, *=, *=, *=)), processDataToGeoJson: (function(string, Object): GeoJSONObject), processExcelDataToGeoJson: (function(Object): GeoJSONObject), isXField: (function(*)), isYField: (function(*)), string2Csv: (function(*, *=))}}
  74824. * @usage
  74825. * ```
  74826. * // 浏览器
  74827. * <script type="text/javascript" src="{cdn}"></script>
  74828. * <script>
  74829. * const result = {namespace}.Components.FileReaderUtil.isXField(data);
  74830. *
  74831. * // 弃用的写法
  74832. * const result = SuperMap.Components.FileReaderUtil.isXField(data);
  74833. *
  74834. * </script>
  74835. *
  74836. * // ES6 Import
  74837. * import { FileReaderUtil } from '{npm}';
  74838. *
  74839. * const result = FileReaderUtil.isXField(data);
  74840. * ```
  74841. */
  74842. let FileReaderUtil = {
  74843. rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
  74844. rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
  74845. rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
  74846. /**
  74847. * @function FileReaderUtil.prototype.readFile
  74848. * @description 读取文件。
  74849. * @param {string} fileType - 当前读取的文件类型。
  74850. *
  74851. * @param {Object} file - 读取回来的文件内容对象。
  74852. * @param {function} success - 读取文件成功回调函数。
  74853. * @param {function} failed - 读取文件失败回调函数。
  74854. * @param {Object} context - 回调重定向对象。
  74855. */
  74856. readFile(fileType, file, success, failed, context) {
  74857. if (CommonTypes_FileTypes.JSON === fileType || CommonTypes_FileTypes.GEOJSON === fileType) {
  74858. this.readTextFile(file, success, failed, context)
  74859. } else if (CommonTypes_FileTypes.EXCEL === fileType || CommonTypes_FileTypes.CSV === fileType) {
  74860. this.readXLSXFile(file, success, failed, context)
  74861. }
  74862. },
  74863. /**
  74864. * @description 读取文本文件。
  74865. * @param {Object} file 文件内容对象。
  74866. * @param {function} success 读取文件成功回调函数。
  74867. * @param {function} failed 读取文件失败回调函数。
  74868. * @param {Object} context - 回调重定向对象。
  74869. */
  74870. readTextFile(file, success, failed, context) {
  74871. let reader = new FileReader();
  74872. reader.onloadend = function (evt) {
  74873. success && success.call(context, evt.target.result);
  74874. };
  74875. reader.onerror = function (error) {
  74876. failed && failed.call(context, error)
  74877. };
  74878. this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
  74879. },
  74880. /**
  74881. * @description 读取excel或csv文件。
  74882. * @param {Object} file 文件内容对象。
  74883. * @param {function} success 读取文件成功回调函数。
  74884. * @param {function} failed 读取文件失败回调函数。
  74885. * @param {Object} context - 回调重定向对象。
  74886. */
  74887. readXLSXFile(file, success, failed, context) {
  74888. let reader = new FileReader();
  74889. reader.onloadend = function (evt) {
  74890. let xLSXData = new Uint8Array(evt.target.result);
  74891. let workbook = external_function_try_return_XLSX_catch_e_return_namespaceObject.read(xLSXData, {type: "array"});
  74892. try {
  74893. if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
  74894. //暂时只读取第一个sheets的内容
  74895. let sheetName = workbook.SheetNames[0];
  74896. let xLSXCSVString = external_function_try_return_XLSX_catch_e_return_namespaceObject.utils.sheet_to_csv(workbook.Sheets[sheetName]);
  74897. success && success.call(context, xLSXCSVString);
  74898. }
  74899. } catch (error) {
  74900. failed && failed.call(context, error);
  74901. }
  74902. };
  74903. reader.onerror = function (error) {
  74904. failed && failed.call(context, error)
  74905. };
  74906. this.rABF && reader.readAsArrayBuffer(file.file);
  74907. },
  74908. /**
  74909. * @function FileReaderUtil.prototype.processDataToGeoJson
  74910. * @description 将读取回来得数据统一处理为 GeoJSON 格式。
  74911. * @param {string} type - 文件类型。
  74912. * @param {Object} data - 读取返回的数据对象。
  74913. * @param {function} success - 数据处理成功的回调。
  74914. * @param {function} failed - 数据处理失败的回调。
  74915. * @param {Object} context - 回调重定向对象。
  74916. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据。
  74917. * @private
  74918. */
  74919. processDataToGeoJson(type, data, success, failed, context) {
  74920. let geojson = null;
  74921. if (type === "EXCEL" || type === "CSV") {
  74922. geojson = this.processExcelDataToGeoJson(data);
  74923. success && success.call(context, geojson);
  74924. } else if (type === 'JSON' || type === 'GEOJSON') {
  74925. let result = data;
  74926. //geojson、json未知,通过类容来判断
  74927. if ((typeof result) === "string") {
  74928. result = JSON.parse(result);
  74929. }
  74930. if (result.type === 'ISERVER') {
  74931. geojson = result.data.recordsets[0].features;
  74932. } else if (result.type === 'FeatureCollection') {
  74933. //geojson
  74934. geojson = result;
  74935. } else {
  74936. //不支持数据
  74937. failed && failed.call(context, Lang.i18n('msg_dataInWrongGeoJSONFormat'));
  74938. }
  74939. success && success.call(context, geojson);
  74940. } else {
  74941. failed && failed.call(context, Lang.i18n('msg_dataInWrongFormat'));
  74942. }
  74943. },
  74944. /**
  74945. * @function FileReaderUtil.prototype.processExcelDataToGeoJson
  74946. * @description 表格文件数据处理。
  74947. * @param {Object} data - 读取的表格文件数据。
  74948. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据。
  74949. * @private
  74950. */
  74951. processExcelDataToGeoJson(data) {
  74952. //处理为对象格式转化
  74953. let dataContent = this.string2Csv(data);
  74954. let fieldCaptions = dataContent.colTitles;
  74955. //位置属性处理
  74956. let xfieldIndex = -1,
  74957. yfieldIndex = -1;
  74958. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  74959. if (this.isXField(fieldCaptions[i])) {
  74960. xfieldIndex = i;
  74961. }
  74962. if (this.isYField(fieldCaptions[i])) {
  74963. yfieldIndex = i;
  74964. }
  74965. }
  74966. // feature 构建后期支持坐标系 4326/3857
  74967. let features = [];
  74968. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  74969. let row = dataContent.rows[i];
  74970. //if (featureFrom === "LonLat") {
  74971. let x = Number(row[xfieldIndex]),
  74972. y = Number(row[yfieldIndex]);
  74973. //属性信息
  74974. let attributes = {};
  74975. for (let index in dataContent.colTitles) {
  74976. let key = dataContent.colTitles[index];
  74977. attributes[key] = dataContent.rows[i][index];
  74978. }
  74979. //目前csv 只支持处理点,所以先生成点类型的 geojson
  74980. let feature = {
  74981. "type": "Feature",
  74982. "geometry": {
  74983. "type": "Point",
  74984. "coordinates": [x, y]
  74985. },
  74986. "properties": attributes
  74987. };
  74988. features.push(feature);
  74989. }
  74990. return features;
  74991. },
  74992. /**
  74993. * @description 判断是否地理X坐标。
  74994. * @param {string} data 字段名。
  74995. */
  74996. isXField(data) {
  74997. var lowerdata = data.toLowerCase();
  74998. return (lowerdata === "x" || lowerdata === "smx" ||
  74999. lowerdata === "jd" || lowerdata === "经度" || lowerdata === "东经" || lowerdata === "longitude" ||
  75000. lowerdata === "lot" || lowerdata === "lon" || lowerdata === "lng" || lowerdata === "x坐标");
  75001. },
  75002. /**
  75003. * @description 判断是否地理Y坐标。
  75004. * @param {string} data 字段名。
  75005. */
  75006. isYField(data) {
  75007. var lowerdata = data.toLowerCase();
  75008. return (lowerdata === "y" || lowerdata === "smy" ||
  75009. lowerdata === "wd" || lowerdata === "纬度" || lowerdata === "北纬" ||
  75010. lowerdata === "latitude" || lowerdata === "lat" || lowerdata === "y坐标");
  75011. },
  75012. /**
  75013. * @description 字符串转为dataEditor 支持的csv格式数据。
  75014. * @param {string} string 待转化的字符串。
  75015. * @param {boolean} withoutTitle 是否需要列标题。
  75016. */
  75017. string2Csv(string, withoutTitle) {
  75018. // let rows = string.split('\r\n');
  75019. let rows = string.split('\n');
  75020. let result = {};
  75021. if (!withoutTitle) {
  75022. result["colTitles"] = rows[0].split(',');
  75023. } else {
  75024. result["colTitles"] = [];
  75025. }
  75026. result['rows'] = [];
  75027. for (let i = (withoutTitle) ? 0 : 1; i < rows.length; i++) {
  75028. rows[i] && result['rows'].push(rows[i].split(','));
  75029. }
  75030. return result;
  75031. }
  75032. };
  75033. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartModel.js
  75034. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75035. * This program are made available under the terms of the Apache License, Version 2.0
  75036. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75037. /**
  75038. * @class ChartModel
  75039. * @classdesc 图表组件数据模型
  75040. * @private
  75041. * @param {Object} datasets - 数据来源。
  75042. * @category Components Chart
  75043. * @fires ChartModel#getdatafailed
  75044. */
  75045. class ChartModel {
  75046. constructor(datasets) {
  75047. this.datasets = datasets;
  75048. this.EVENT_TYPES = ['getdatafailed'];
  75049. this.events = new Events(this, null, this.EVENT_TYPES);
  75050. }
  75051. /**
  75052. * @private
  75053. * @function ChartModel.prototype.getDatasetInfo
  75054. * @description 获得数据集数据。
  75055. * @param {string} datasetUrl - 数据集资源地址。
  75056. */
  75057. getDatasetInfo(success) {
  75058. let datasetUrl = this.datasets.url;
  75059. let me = this;
  75060. FetchRequest.get(datasetUrl)
  75061. .then(function (response) {
  75062. return response.json();
  75063. })
  75064. .then(function (results) {
  75065. if (results.datasetInfo) {
  75066. let datasetInfo = results.datasetInfo;
  75067. me.datasetsInfo = {
  75068. dataSourceName: datasetInfo.dataSourceName,
  75069. datasetName: datasetInfo.name,
  75070. mapName: results.name
  75071. };
  75072. success({
  75073. result: me.datasetsInfo
  75074. });
  75075. }
  75076. })
  75077. .catch(function (error) {
  75078. console.log(error);
  75079. me._fireFailedEvent(error);
  75080. });
  75081. }
  75082. /**
  75083. * @private
  75084. * @function ChartModel.prototype.getDataFeatures
  75085. * @description 请求数据集的数据信息
  75086. * @param {Object} results - 数据集信息。
  75087. * @param {function} success - 成功回调函数。
  75088. */
  75089. getDataFeatures(results, success) {
  75090. let datasetsInfo = results.result;
  75091. let getFeatureParam, getFeatureBySQLParams, getFeatureBySQLService;
  75092. let params = {
  75093. name: datasetsInfo.datasetName + '@' + datasetsInfo.dataSourceName
  75094. };
  75095. Object.assign(params, this.datasets.queryInfo);
  75096. getFeatureParam = new FilterParameter(params);
  75097. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  75098. queryParameter: getFeatureParam,
  75099. datasetNames: [datasetsInfo.dataSourceName + ':' + datasetsInfo.datasetName],
  75100. fromIndex: 0,
  75101. toIndex: 100000
  75102. });
  75103. getFeatureBySQLService = new GetFeaturesBySQLService(datasetsInfo.dataUrl, {
  75104. eventListeners: {
  75105. processCompleted: success,
  75106. processFailed: function () {}
  75107. }
  75108. });
  75109. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  75110. }
  75111. /**
  75112. * @private
  75113. * @function ChartModel.prototype.getLayerFeatures
  75114. * @description 请求图层要素的数据信息
  75115. * @param {Object} results - 数据集信息。
  75116. * @param {Callbacks} success - 成功回调函数。
  75117. */
  75118. getLayerFeatures(results, success) {
  75119. let datasetsInfo = results.result;
  75120. let queryParam, queryBySQLParams, queryBySQLService;
  75121. let params = {
  75122. name: datasetsInfo.mapName
  75123. };
  75124. Object.assign(params, this.datasets.queryInfo);
  75125. queryParam = new FilterParameter(params);
  75126. queryBySQLParams = new QueryBySQLParameters({
  75127. queryParams: [queryParam],
  75128. expectCount: 100000
  75129. });
  75130. queryBySQLService = new QueryBySQLService(datasetsInfo.dataUrl, {
  75131. eventListeners: {
  75132. processCompleted: success,
  75133. processFailed: function () {}
  75134. }
  75135. });
  75136. queryBySQLService.processAsync(queryBySQLParams);
  75137. }
  75138. /**
  75139. * @private
  75140. * @function ChartModel.prototype.getDataInfoByIptl
  75141. * @description 用dataId获取iportal的数据。
  75142. * @param {Callbacks} success - 成功回调函数。
  75143. *
  75144. */
  75145. getDataInfoByIptl(success) {
  75146. // success是chart的回调
  75147. this.getServiceInfo(this.datasets.url, success);
  75148. }
  75149. /**
  75150. * @private
  75151. * @function ChartModel.prototype.getServiceInfo
  75152. * @description 用iportal获取dataItemServices。
  75153. * @param {string} url
  75154. * @param {Callbacks} success - 成功回调函数。
  75155. * */
  75156. getServiceInfo(url, success) {
  75157. let me = this;
  75158. FetchRequest.get(url, null, {
  75159. withCredentials: this.datasets.withCredentials
  75160. })
  75161. .then((response) => {
  75162. return response.json();
  75163. })
  75164. .then((data) => {
  75165. if (data.succeed === false) {
  75166. //请求失败
  75167. me._fireFailedEvent(data);
  75168. return;
  75169. }
  75170. // 是否有rest服务
  75171. if (data.dataItemServices && data.dataItemServices.length > 0) {
  75172. let dataItemServices = data.dataItemServices,
  75173. resultData;
  75174. dataItemServices.forEach((item) => {
  75175. // 如果有restdata并且发布成功,就请求restdata服务
  75176. // 如果有restmap并且发布成功,就请求restmap服务
  75177. // 其他情况就请求iportal/content.json
  75178. if (item.serviceType === 'RESTDATA' && item.serviceStatus === 'PUBLISHED') {
  75179. resultData = item;
  75180. } else if (item.serviceType === 'RESTMAP' && item.serviceStatus === 'PUBLISHED') {
  75181. resultData = item;
  75182. } else {
  75183. me.getDatafromContent(url, success);
  75184. return;
  75185. }
  75186. });
  75187. // 如果有服务,获取数据源和数据集, 然后请求rest服务
  75188. resultData && me.getDatafromRest(resultData.serviceType, resultData.address, success);
  75189. } else {
  75190. me.getDatafromContent(url, success);
  75191. return;
  75192. }
  75193. })
  75194. .catch((error) => {
  75195. console.log(error);
  75196. me._fireFailedEvent(error);
  75197. });
  75198. }
  75199. /**
  75200. * @private
  75201. * @function ChartModel.prototype.getDatafromURL
  75202. * @description 用iportal获取数据。(通过固定的url来请求,但是不能请求工作空间的数据)
  75203. * @param {string} url
  75204. * @param {Callbacks} success - 成功回调函数。
  75205. */
  75206. getDatafromContent(url, success) {
  75207. // 成功回调传入的results
  75208. let results = {
  75209. result: {}
  75210. },
  75211. me = this;
  75212. url += '/content.json?pageSize=9999999&currentPage=1';
  75213. // 获取图层数据
  75214. FetchRequest.get(url, null, {
  75215. withCredentials: this.datasets.withCredentials
  75216. })
  75217. .then((response) => {
  75218. return response.json();
  75219. })
  75220. .then((data) => {
  75221. if (data.succeed === false) {
  75222. //请求失败
  75223. me._fireFailedEvent(data);
  75224. return;
  75225. }
  75226. if (data.type) {
  75227. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  75228. // 将字符串转换成json
  75229. data.content = JSON.parse(data.content.trim());
  75230. // 如果是json文件 data.content = {type:'fco', features},格式不固定
  75231. if (!data.content.features) {
  75232. //json格式解析失败
  75233. console.log(Lang.i18n('msg_jsonResolveFiled'));
  75234. return;
  75235. }
  75236. let features = this._formatGeoJSON(data.content);
  75237. results.result.features = {
  75238. type: data.content.type,
  75239. features
  75240. };
  75241. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  75242. let features = this._excelData2Feature(data.content);
  75243. results.result.features = {
  75244. type: 'FeatureCollection',
  75245. features
  75246. };
  75247. }
  75248. success(results, 'content');
  75249. }
  75250. }, this)
  75251. .catch((error) => {
  75252. console.log(error);
  75253. me._fireFailedEvent(error);
  75254. });
  75255. }
  75256. /**
  75257. * @private
  75258. * @function ChartModel.prototype._getDataSource
  75259. * @description 获取数据源名和数据集名。
  75260. * @param {string} serviceType 服务类型
  75261. * @param {string} address 地址
  75262. * @param {Callbacks} success - 成功回调函数。
  75263. * @return {Array.<string>} ["数据源名:数据集名"]
  75264. * @return {string} 图层名
  75265. */
  75266. getDatafromRest(serviceType, address, success) {
  75267. let me = this,
  75268. withCredentials = this.datasets.withCredentials;
  75269. if (serviceType === 'RESTDATA') {
  75270. let url = `${address}/data/datasources`,
  75271. sourceName,
  75272. datasetName;
  75273. // 请求获取数据源名
  75274. FetchRequest.get(url, null, {
  75275. withCredentials
  75276. })
  75277. .then((response) => {
  75278. return response.json();
  75279. })
  75280. .then((data) => {
  75281. sourceName = data.datasourceNames[0];
  75282. url = `${address}/data/datasources/${sourceName}/datasets`;
  75283. // 请求获取数据集名
  75284. FetchRequest.get(url, null, {
  75285. withCredentials
  75286. })
  75287. .then((response) => {
  75288. return response.json();
  75289. })
  75290. .then((data) => {
  75291. datasetName = data.datasetNames[0];
  75292. // 请求restdata服务
  75293. me.getDatafromRestData(`${address}/data`, [sourceName + ':' + datasetName], success);
  75294. return [sourceName + ':' + datasetName];
  75295. })
  75296. .catch(function (error) {
  75297. me._fireFailedEvent(error);
  75298. });
  75299. })
  75300. .catch(function (error) {
  75301. me._fireFailedEvent(error);
  75302. });
  75303. } else {
  75304. // 如果是地图服务
  75305. let url = `${address}/maps`,
  75306. mapName,
  75307. layerName,
  75308. path;
  75309. // 请求获取地图名
  75310. FetchRequest.get(url, null, {
  75311. withCredentials
  75312. })
  75313. .then((response) => {
  75314. return response.json();
  75315. })
  75316. .then((data) => {
  75317. mapName = data[0].name;
  75318. path = data[0].path;
  75319. url = url = `${address}/maps/${mapName}/layers`;
  75320. // 请求获取图层名
  75321. FetchRequest.get(url, null, {
  75322. withCredentials
  75323. })
  75324. .then((response) => {
  75325. return response.json();
  75326. })
  75327. .then((data) => {
  75328. layerName = data[0].subLayers.layers[0].caption;
  75329. // 请求restmap服务
  75330. me.getDatafromRestMap(layerName, path, success);
  75331. return layerName;
  75332. })
  75333. .catch(function (error) {
  75334. me._fireFailedEvent(error);
  75335. });
  75336. })
  75337. .catch(function (error) {
  75338. me._fireFailedEvent(error);
  75339. });
  75340. }
  75341. }
  75342. /**
  75343. * @private
  75344. * @function ChartModel.prototype.getDatafromRestData
  75345. * @description 请求restdata服务
  75346. * @param {string} url
  75347. * @param {Array<string>} dataSource [数据源名:数据集名]
  75348. * @param {Callbacks} success - 成功回调函数。
  75349. */
  75350. getDatafromRestData(url, dataSource, success) {
  75351. let me = this;
  75352. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'SmID>0';
  75353. this._getFeatureBySQL(
  75354. url,
  75355. dataSource,
  75356. this.datasets.queryInfo,
  75357. (results) => {
  75358. // 此时的features已经处理成geojson了
  75359. success(results, 'RESTDATA');
  75360. },
  75361. (error) => {
  75362. console.log(error);
  75363. me._fireFailedEvent(error);
  75364. }
  75365. );
  75366. }
  75367. /**
  75368. * @private
  75369. * @function ChartModel.prototype.getDatafromRestMap
  75370. * @description 请求restmap服务
  75371. * @param {string} dataSource layerName
  75372. * @param {string} path - map服务地址。
  75373. * @param {Callbacks} success - 成功回调函数。
  75374. */
  75375. getDatafromRestMap(dataSource, path, success) {
  75376. let me = this;
  75377. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'smid=1';
  75378. this._queryFeatureBySQL(
  75379. path,
  75380. dataSource,
  75381. this.datasets.queryInfo,
  75382. null,
  75383. null,
  75384. (results) => {
  75385. // let features = result.result.recordsets[0].features;
  75386. success(results, 'RESTMAP');
  75387. },
  75388. (error) => {
  75389. console.log(error);
  75390. me._fireFailedEvent(error);
  75391. }
  75392. );
  75393. }
  75394. /**
  75395. * @private
  75396. * @function ChartModel.prototype._getFeatureBySQL
  75397. * @description 通过 sql 方式查询数据。
  75398. */
  75399. _getFeatureBySQL(url, datasetNames, queryInfo, processCompleted, processFaild) {
  75400. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  75401. let params = {
  75402. name: datasetNames.join().replace(':', '@')
  75403. };
  75404. Object.assign(params, queryInfo);
  75405. getFeatureParam = new FilterParameter(params);
  75406. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  75407. queryParameter: getFeatureParam,
  75408. datasetNames: datasetNames,
  75409. fromIndex: 0,
  75410. toIndex: 100000,
  75411. returnContent: true
  75412. });
  75413. let options = {
  75414. eventListeners: {
  75415. processCompleted: (getFeaturesEventArgs) => {
  75416. processCompleted && processCompleted(getFeaturesEventArgs);
  75417. },
  75418. processFailed: (e) => {
  75419. processFaild && processFaild(e);
  75420. }
  75421. }
  75422. };
  75423. getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
  75424. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  75425. }
  75426. /**
  75427. * @private
  75428. * @function ChartModel.prototype._queryFeatureBySQL
  75429. * @description 通过 sql 方式查询数据。
  75430. */
  75431. _queryFeatureBySQL(
  75432. url,
  75433. layerName,
  75434. queryInfo,
  75435. fields,
  75436. epsgCode,
  75437. processCompleted,
  75438. processFaild,
  75439. startRecord,
  75440. recordLength,
  75441. onlyAttribute
  75442. ) {
  75443. var queryParam, queryBySQLParams;
  75444. var filterParams = {
  75445. name: layerName
  75446. };
  75447. Object.assign(filterParams, queryInfo);
  75448. queryParam = new FilterParameter(filterParams);
  75449. if (fields) {
  75450. queryParam.fields = fields;
  75451. }
  75452. var params = {
  75453. queryParams: [queryParam]
  75454. };
  75455. if (onlyAttribute) {
  75456. params.queryOption = QueryOption.ATTRIBUTE;
  75457. }
  75458. startRecord && (params.startRecord = startRecord);
  75459. recordLength && (params.expectCount = recordLength);
  75460. if (epsgCode) {
  75461. params.prjCoordSys = {
  75462. epsgCode: epsgCode
  75463. };
  75464. }
  75465. queryBySQLParams = new QueryBySQLParameters(params);
  75466. this._queryBySQL(url, queryBySQLParams, (data) => {
  75467. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  75468. });
  75469. }
  75470. /**
  75471. * @function ChartModel.prototype._queryBySQL
  75472. * @description SQL 查询服务。
  75473. * @param {QueryBySQLParameters} params - SQL 查询相关参数类。
  75474. * @param {RequestCallback} callback - 回调函数。
  75475. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 结果类型。
  75476. */
  75477. _queryBySQL(url, params, callback, resultFormat) {
  75478. var me = this;
  75479. var queryBySQLService = new QueryBySQLService(url, {
  75480. eventListeners: {
  75481. scope: me,
  75482. processCompleted: callback,
  75483. processFailed: callback
  75484. },
  75485. format: me._processFormat(resultFormat)
  75486. });
  75487. queryBySQLService.processAsync(params);
  75488. }
  75489. /**
  75490. * @function ChartModel.prototype._processFormat
  75491. * @description 将数据转换成geojson。
  75492. * @param {Object} resultFormat - 返回结果集。
  75493. * @return {Object} [resultFormat=DataFormat.GEOJSON] - 结果类型。
  75494. */
  75495. _processFormat(resultFormat) {
  75496. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  75497. }
  75498. /**
  75499. * @private
  75500. * @function ChartModel.prototype._formatGeoJSON
  75501. * @description 格式 GeoJSON。
  75502. * @param {GeoJSON} data - GeoJSON 数据。
  75503. */
  75504. _formatGeoJSON(data) {
  75505. let features = data.features;
  75506. features.forEach((row, index) => {
  75507. row.properties['index'] = index;
  75508. });
  75509. return features;
  75510. }
  75511. /**
  75512. * @private
  75513. * @description 将 csv 和 xls 文件内容转换成 geojson
  75514. * @function ChartModel.prototype._excelData2Feature
  75515. * @param content 文件内容
  75516. * @param layerInfo 图层信息
  75517. * @returns {Array} feature的数组集合
  75518. */
  75519. _excelData2Feature(dataContent) {
  75520. let fieldCaptions = dataContent.colTitles;
  75521. //位置属性处理
  75522. let xfieldIndex = -1,
  75523. yfieldIndex = -1;
  75524. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  75525. if (FileReaderUtil.isXField(fieldCaptions[i])) {
  75526. xfieldIndex = i;
  75527. }
  75528. if (FileReaderUtil.isYField(fieldCaptions[i])) {
  75529. yfieldIndex = i;
  75530. }
  75531. }
  75532. // feature 构建后期支持坐标系 4326/3857
  75533. let features = [];
  75534. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  75535. let row = dataContent.rows[i];
  75536. let x = Number(row[xfieldIndex]),
  75537. y = Number(row[yfieldIndex]);
  75538. //属性信息
  75539. let attributes = {};
  75540. for (let index in dataContent.colTitles) {
  75541. let key = dataContent.colTitles[index];
  75542. attributes[key] = dataContent.rows[i][index];
  75543. }
  75544. attributes['index'] = i + '';
  75545. //目前csv 只支持处理点,所以先生成点类型的 geojson
  75546. let feature = {
  75547. type: 'Feature',
  75548. geometry: {
  75549. type: 'Point',
  75550. coordinates: [x, y]
  75551. },
  75552. properties: attributes
  75553. };
  75554. features.push(feature);
  75555. }
  75556. return features;
  75557. }
  75558. /**
  75559. * @private
  75560. * @description 请求数据失败的事件
  75561. * @function ChartModel.prototype._fireFailedEvent
  75562. * @param {Object} error 错误信息
  75563. */
  75564. _fireFailedEvent(error) {
  75565. let errorData = error
  75566. ? {
  75567. error,
  75568. message: Lang.i18n('msg_getdatafailed')
  75569. }
  75570. : {
  75571. message: Lang.i18n('msg_getdatafailed')
  75572. };
  75573. /**
  75574. * @event ChartModel#getdatafailed
  75575. * @description 监听到获取数据失败事件后触发
  75576. * @property {Object} error - 事件对象。
  75577. */
  75578. this.events.triggerEvent('getdatafailed', errorData);
  75579. }
  75580. }
  75581. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartViewModel.js
  75582. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75583. * This program are made available under the terms of the Apache License, Version 2.0
  75584. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75585. /**
  75586. * @class ChartViewModel
  75587. * @aliasclass Components.ChartViewModel
  75588. * @deprecatedclass SuperMap.Components.ChartViewModel
  75589. * @classdesc 图表组件功能类。
  75590. * @category Components Chart
  75591. * @version 10.0.0
  75592. * @param {Object} options - 可选参数。
  75593. * @param {string} options.type - 图表类型。
  75594. * @param {ChartView.Datasets} options.datasets - 数据来源。
  75595. * @param {Array.<Object>} options.chartOptions - 图表可选配置。
  75596. * @param {Array.<Object>} options.chartOptions.xAxis - X轴可选参数。
  75597. * @param {string} options.chartOptions.xAxis.field - X轴字段名。
  75598. * @param {string} options.chartOptions.xAxis.name - X轴名称。
  75599. * @param {Array.<Object>} options.chartOptions.yAxis - Y轴可选参数。
  75600. * @param {string} options.chartOptions.yAxis.field - Y轴字段名。
  75601. * @param {string} options.chartOptions.yAxis.name - Y轴名称。
  75602. * @fires ChartViewModel#getdatafailed
  75603. * @usage
  75604. */
  75605. class ChartViewModel {
  75606. constructor(options) {
  75607. this.datasets = options.datasets;
  75608. this.xField = [];
  75609. this.yField = [];
  75610. this.grid = {
  75611. top: "50px",
  75612. bottom: "50px",
  75613. left: "50px",
  75614. right: "60px"
  75615. };
  75616. this.chartType = options.type || "bar";
  75617. this._initXYField(options.chartOptions);
  75618. this.EVENT_TYPES = ["getdatafailed"];
  75619. this.events = new Events(this, null, this.EVENT_TYPES);
  75620. }
  75621. /**
  75622. * @function ChartViewModel.prototype._initXYField
  75623. * @description 初始化XY字段。
  75624. * @private
  75625. * @param {Object} chartOptions - options里的图表参数。
  75626. */
  75627. _initXYField(chartOptions) {
  75628. let me = this;
  75629. if (chartOptions && chartOptions.length > 0) {
  75630. chartOptions.forEach(function (option) {
  75631. if (option.xAxis) {
  75632. me.xField.push({
  75633. field: option.xAxis.field,
  75634. name: option.xAxis.name
  75635. });
  75636. }
  75637. if (option.yAxis) {
  75638. me.yField.push({
  75639. field: option.yAxis.field,
  75640. name: option.yAxis.name
  75641. });
  75642. }
  75643. });
  75644. }
  75645. }
  75646. /**
  75647. * @function ChartViewModel.prototype.getDatasetInfo
  75648. * @description 获得数据集数据。
  75649. * @param {function} success - 成功回调函数。
  75650. */
  75651. getDatasetInfo(success) {
  75652. this.createChart = success;
  75653. if (this.datasets && this._checkUrl(this.datasets.url)) {
  75654. this.chartModel = new ChartModel(this.datasets);
  75655. if(this.datasets.type === 'iServer'){
  75656. this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this));
  75657. }else if(this.datasets.type === 'iPortal'){
  75658. this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this));
  75659. }
  75660. /**
  75661. * @event ChartViewModel#getdatafailed
  75662. * @description 监听到获取数据失败事件后触发。
  75663. * @property {Object} error - 事件对象。
  75664. */
  75665. this.chartModel.events.on({"getdatafailed": (error) => {
  75666. this.events.triggerEvent("getdatafailed", error)
  75667. }});
  75668. }
  75669. }
  75670. /**
  75671. * @function ChartViewModel.prototype._getDatasetInfoSuccess
  75672. * @description 成功回调函数。
  75673. * @private
  75674. * @param {Object} results - 数据集信息。
  75675. */
  75676. _getDatasetInfoSuccess(results) {
  75677. let datasetUrl = this.datasets.url;
  75678. //判断服务为地图服务 或者 数据服务
  75679. let restIndex = datasetUrl.indexOf("rest");
  75680. if (restIndex > 0) {
  75681. let index = datasetUrl.indexOf("/", restIndex + 5);
  75682. let type = datasetUrl.substring(restIndex + 5, index);
  75683. let dataUrl = datasetUrl.substring(0, restIndex + 4) + "/data";
  75684. if (type === "maps") {
  75685. let mapIndex = datasetUrl.indexOf("/", index + 1);
  75686. let mapName = datasetUrl.substring(index + 1, mapIndex);
  75687. dataUrl = datasetUrl.substring(0, restIndex + 4) + "/maps/" + mapName;
  75688. results.result.dataUrl = dataUrl;
  75689. this._getLayerFeatures(results);
  75690. } else if (type === "data") {
  75691. results.result.dataUrl = dataUrl;
  75692. this._getDataFeatures(results);
  75693. }
  75694. }
  75695. }
  75696. /**
  75697. * @function ChartViewModel.prototype._getDataInfoSuccess
  75698. * @description 请求iportal数据成功之后的回调。
  75699. * @private
  75700. */
  75701. _getDataInfoSuccess(results, type) {
  75702. let me = this;
  75703. if(type === 'RESTMAP'){
  75704. me._getChartDatasFromLayer(results);
  75705. }else{
  75706. me._getChartDatas(results);
  75707. }
  75708. }
  75709. /**
  75710. * @function ChartViewModel.prototype._getDataFeatures
  75711. * @description 请求数据集的数据信息
  75712. * @private
  75713. * @param {Object} results - 数据集信息
  75714. */
  75715. _getDataFeatures(results) {
  75716. this.chartModel.getDataFeatures(results, this._getChartDatas.bind(this));
  75717. }
  75718. /**
  75719. * @function ChartViewModel.prototype._getLayerFeatures
  75720. * @description 请求图层的数据信息。
  75721. * @private
  75722. * @param {Object} results - 数据集信息。
  75723. */
  75724. _getLayerFeatures(results) {
  75725. this.chartModel.getLayerFeatures(results, this._getChartDatasFromLayer.bind(this));
  75726. }
  75727. /**
  75728. * @function ChartViewModel.prototype._getChartDatas
  75729. * @description 将请求回来的数据转换为图表所需的数据格式。
  75730. * @private
  75731. * @param {Object} results - 数据要素信息。
  75732. */
  75733. _getChartDatas(results) {
  75734. if (results) {
  75735. // 数据来自restdata---results.result.features
  75736. this.features = results.result.features;
  75737. let features = this.features.features;
  75738. let data = {};
  75739. if (features.length) {
  75740. let feature = features[0];
  75741. let attrFields = [],
  75742. itemTypes = [];
  75743. for (let attr in feature.properties) {
  75744. attrFields.push(attr);
  75745. itemTypes.push(this._getDataType(feature.properties[attr]));
  75746. }
  75747. data = {
  75748. features,
  75749. fieldCaptions: attrFields,
  75750. fieldTypes: itemTypes,
  75751. fieldValues: []
  75752. }
  75753. for (let m in itemTypes) {
  75754. let fieldValue = [];
  75755. for (let j in features) {
  75756. let feature = features[j];
  75757. let caption = data.fieldCaptions[m];
  75758. let value = feature.properties[caption];
  75759. fieldValue.push(value);
  75760. }
  75761. data.fieldValues.push(fieldValue);
  75762. }
  75763. this.createChart(data);
  75764. }
  75765. }
  75766. }
  75767. /**
  75768. * @function ChartViewModel.prototype._getChartDatasFromLayer
  75769. * @description 将请求回来的数据转换为图表所需的数据格式。
  75770. * @private
  75771. * @param {Object} results - 图层数据要素信息。
  75772. */
  75773. _getChartDatasFromLayer(results) {
  75774. if (results.result.recordsets) {
  75775. let recordsets = results.result.recordsets[0];
  75776. let features = recordsets.features.features;
  75777. this.features = recordsets.features;
  75778. let data = {};
  75779. if (features.length) {
  75780. data = {
  75781. features: recordsets.features,
  75782. fieldCaptions: recordsets.fieldCaptions,
  75783. fieldTypes: recordsets.fieldTypes,
  75784. fieldValues: []
  75785. }
  75786. for (let m in data.fieldCaptions) {
  75787. let fieldValue = [];
  75788. for (let j in features) {
  75789. let feature = features[j];
  75790. let caption = data.fieldCaptions[m];
  75791. let value = feature.properties[caption];
  75792. fieldValue.push(value);
  75793. }
  75794. data.fieldValues.push(fieldValue);
  75795. }
  75796. this.createChart(data);
  75797. }
  75798. }
  75799. }
  75800. /**
  75801. * @function ChartViewModel.prototype._createChartOptions
  75802. * @description 创建图表所需参数。
  75803. * @private
  75804. * @param {Object} data - 图表数据。
  75805. */
  75806. _createChartOptions(data) {
  75807. this.calculatedData = this._createChartDatas(data);
  75808. return this.updateChartOptions(this.chartType);
  75809. }
  75810. /**
  75811. * @function ChartViewModel.prototype.changeType
  75812. * @description 改变图表类型。
  75813. * @param {string} type - 图表类型。
  75814. */
  75815. changeType(type) {
  75816. if (type !== this.chartType) {
  75817. this.chartType = type;
  75818. return this.updateChartOptions(this.chartType);
  75819. }
  75820. }
  75821. /**
  75822. * @function ChartViewModel.prototype.updateData
  75823. * @description 改变图表类型。
  75824. * @param {ChartView.Datasets} datasets - 数据来源。
  75825. * @param {function} success 成功回调函数。
  75826. */
  75827. updateData(datasets, chartOption, success) {
  75828. this.updateChart = success;
  75829. this.xField = [];
  75830. this.yField = [];
  75831. this._initXYField(chartOption);
  75832. // type的设置默认值
  75833. datasets.type = datasets.type || 'iServer';
  75834. // withCredentials的设置默认值
  75835. datasets.withCredentials = datasets.withCredentials || false;
  75836. this.datasets = datasets;
  75837. this.getDatasetInfo(this._updateDataSuccess.bind(this));
  75838. }
  75839. /**
  75840. * @function ChartViewModel.prototype._updateDataSuccess
  75841. * @description 改变图表类型。
  75842. * @private
  75843. * @param {Object} data - 图表数据。
  75844. */
  75845. _updateDataSuccess(data) {
  75846. let options = this._createChartOptions(data);
  75847. this.updateChart(options);
  75848. }
  75849. /**
  75850. * @function ChartViewModel.prototype.updateChartOptions
  75851. * @description 更新图表所需参数。
  75852. * @param {string} type - 图表类型。
  75853. * @param {Object} style - 图表样式。
  75854. */
  75855. updateChartOptions(type, style) {
  75856. if (this.calculatedData) {
  75857. let grid = this.grid;
  75858. let series = this._createChartSeries(this.calculatedData, type);
  75859. let datas = [];
  75860. for (let i in this.calculatedData.XData) {
  75861. datas.push({
  75862. value: this.calculatedData.XData[i].fieldsData
  75863. });
  75864. }
  75865. let xAxis = {
  75866. type: "category",
  75867. name: this.xField[0].name || "X",
  75868. data: datas,
  75869. nameTextStyle: {
  75870. color: '#fff',
  75871. fontSize: 14
  75872. },
  75873. splitLine: {
  75874. show: false
  75875. },
  75876. axisLine: {
  75877. lineStyle: {
  75878. color: '#eee'
  75879. }
  75880. }
  75881. }
  75882. let yAxis = {
  75883. type: "value",
  75884. name: this.yFieldName || "Y",
  75885. data: {},
  75886. nameTextStyle: {
  75887. color: '#fff',
  75888. fontSize: 14
  75889. },
  75890. splitLine: {
  75891. show: false
  75892. },
  75893. axisLine: {
  75894. lineStyle: {
  75895. color: '#eee'
  75896. }
  75897. }
  75898. }
  75899. let tooltip = {
  75900. formatter: '{b0}: {c0}'
  75901. };
  75902. let backgroundColor = '#404a59';
  75903. if (style) {
  75904. if (style.grid) {
  75905. grid = style.grid;
  75906. }
  75907. if (style.tooltip) {
  75908. tooltip = style.tooltip;
  75909. }
  75910. if (style.backgroundColor) {
  75911. backgroundColor = style.backgroundColor;
  75912. }
  75913. }
  75914. return {
  75915. backgroundColor: backgroundColor,
  75916. grid: grid,
  75917. series: series,
  75918. xAxis: xAxis,
  75919. yAxis: yAxis,
  75920. tooltip: tooltip
  75921. }
  75922. }
  75923. }
  75924. /**
  75925. * @function ChartViewModel.prototype._createChartDatas
  75926. * @description 构建图表数据。
  75927. * @private
  75928. * @param {Object} data - 源数据。
  75929. */
  75930. _createChartDatas(data) {
  75931. let fieldIndex = 0, yfieldIndexs = [];
  75932. let fieldCaptions = data.fieldCaptions;
  75933. let me = this;
  75934. //X
  75935. fieldCaptions.forEach(function (field, index) {
  75936. if (me.xField[0] && field === me.xField[0].field) {
  75937. fieldIndex = index;
  75938. }
  75939. });
  75940. //Y
  75941. this.yFieldName = "";
  75942. this.yField.forEach(function (value, index) {
  75943. if (index !== 0) {
  75944. me.yFieldName = me.yFieldName + ",";
  75945. }
  75946. me.yFieldName = me.yFieldName + value.name;
  75947. fieldCaptions.forEach(function (field, index) {
  75948. if (field === value.field) {
  75949. yfieldIndexs.push(index);
  75950. }
  75951. });
  75952. })
  75953. let datas = this._getAttrData(data, fieldIndex);
  75954. let yDatas = [];
  75955. if (yfieldIndexs.length > 0) {
  75956. yfieldIndexs.forEach(function (yfieldIndex) {
  75957. let yData = [];
  75958. for (let i in data.fieldValues[yfieldIndex]) {
  75959. yData.push({
  75960. value: data.fieldValues[yfieldIndex][i]
  75961. });
  75962. }
  75963. yDatas.push(yData);
  75964. });
  75965. } else { //未指定Y字段时,y轴计数
  75966. let YData = [],
  75967. XData = [],
  75968. len = datas.length;
  75969. //计算X轴,Y轴数据,并去重
  75970. for (let i = 0; i < len; i++) {
  75971. let isSame = false;
  75972. for (let j = 0, leng = XData.length; j < leng; j++) {
  75973. if (datas[i].fieldsData === XData[j].fieldsData) {
  75974. YData[j].value++;
  75975. XData[j].recordIndexs.push(i);
  75976. isSame = true;
  75977. break;
  75978. }
  75979. }
  75980. if (!isSame) {
  75981. if (datas[i].fieldsData) {
  75982. XData.push({ fieldsData: datas[i].fieldsData, recordIndexs: [i] });
  75983. YData.push({ value: 1 });
  75984. }
  75985. }
  75986. }
  75987. datas = XData;
  75988. yDatas = [YData];
  75989. }
  75990. return {
  75991. XData: datas,
  75992. YData: yDatas
  75993. }
  75994. }
  75995. /**
  75996. * @function ChartViewModel.prototype._getAttrData
  75997. * @description 选中字段数据。
  75998. * @private
  75999. * @param {Object} datacontent - 图表数据。
  76000. * @param {number} index - 字段索引。
  76001. */
  76002. _getAttrData(datacontent, index) {
  76003. if (index === 0) {
  76004. this.xField = [{
  76005. field: datacontent.fieldCaptions[index],
  76006. name: datacontent.fieldCaptions[index]
  76007. }];
  76008. }
  76009. let fieldsDatas = [];
  76010. for (let i = 0, len = datacontent.fieldValues[index].length; i < len; i++) {
  76011. let value = datacontent.fieldValues[index][i];
  76012. fieldsDatas.push({
  76013. recordIndexs: i,
  76014. fieldsData: value
  76015. });
  76016. }
  76017. return fieldsDatas;
  76018. }
  76019. /**
  76020. * @function ChartViewModel.prototype._createChartSeries
  76021. * @description 图表数据。
  76022. * @private
  76023. * @param {Object} calculatedData - 图表数据。
  76024. * @param {string} chartType - 图表类型。
  76025. */
  76026. _createChartSeries(calculatedData, chartType) {
  76027. let series = [];
  76028. let yDatas = calculatedData.YData;
  76029. yDatas.forEach(function (yData) {
  76030. let value = 0;
  76031. let serieData = [];
  76032. for (let data of yData) {
  76033. value = data.value;
  76034. serieData.push({
  76035. value: value
  76036. });
  76037. }
  76038. let serie = {
  76039. type: chartType,
  76040. data: serieData,
  76041. name: "y"
  76042. };
  76043. series.push(serie);
  76044. });
  76045. return series;
  76046. }
  76047. /**
  76048. * @function ChartViewModel.prototype._isDate
  76049. * @description 判断是否为日期。
  76050. * @private
  76051. * @param {string} data - 字符串。
  76052. */
  76053. _isDate(data) {
  76054. let reg = /((^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(10|12|0?[13578])([-\/\._])(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(11|0?[469])([-\/\._])(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))([-\/\._])(0?2)([-\/\._])(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)([-\/\._])(0?2)([-\/\._])(29)$)|(^([3579][26]00)([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][0][48])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][0][48])([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][2468][048])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][2468][048])([-\/\._])(0?2)([-\/\._])(29)$)|(^([1][89][13579][26])([-\/\._])(0?2)([-\/\._])(29)$)|(^([2-9][0-9][13579][26])([-\/\._])(0?2)([-\/\._])(29)$))/ig;
  76055. return reg.test(data);
  76056. }
  76057. /**
  76058. * @function ChartViewModel.prototype._isNumber
  76059. * @description 判断是否为数值。
  76060. * @private
  76061. * @param {string} data - 字符串。
  76062. */
  76063. _isNumber(data) {
  76064. let mdata = Number(data);
  76065. if (mdata === 0) {
  76066. return true;
  76067. }
  76068. return !isNaN(mdata);
  76069. }
  76070. /**
  76071. * @function ChartViewModel.prototype._getDataType
  76072. * @description 判断数据的类型。
  76073. * @private
  76074. * @param {string} data - 字符串。
  76075. */
  76076. _getDataType(data) {
  76077. if (data !== null && data !== undefined && data !== '') {
  76078. if (this._isDate(data)) {
  76079. return "DATE";
  76080. }
  76081. if (this._isNumber(data)) {
  76082. return "NUMBER";
  76083. }
  76084. }
  76085. return "STRING";
  76086. }
  76087. /**
  76088. * @function ChartViewModel.prototype._checkUrl
  76089. * @description 检查url是否符合要求。
  76090. * @private
  76091. * @param {string} url。
  76092. */
  76093. _checkUrl(url) {
  76094. let match;
  76095. if (url === '' || !this._isMatchUrl(url)) {
  76096. match = false;
  76097. } else if (/^http[s]?:\/\/localhost/.test(url) || /^http[s]?:\/\/127.0.0.1/.test(url)) {
  76098. //不是实际域名
  76099. match = false;
  76100. } else {
  76101. match = true;
  76102. }
  76103. return match;
  76104. }
  76105. /**
  76106. * @function ChartViewModel.prototype._isMatchUrl
  76107. * @description 判断输入的地址是否符合地址格式。
  76108. * @private
  76109. * @param {string} str - url。
  76110. */
  76111. _isMatchUrl(str) {
  76112. var reg = new RegExp('(https?|http|file|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
  76113. return reg.test(str);
  76114. }
  76115. /**
  76116. * @function ChartViewModel.prototype.getStyle
  76117. * @description 获取图表样式。
  76118. */
  76119. getStyle() {
  76120. let style = {
  76121. grid: this.grid,
  76122. tooltip: this.tooltip,
  76123. backgroundColor: this.backgroundColor
  76124. }
  76125. return style;
  76126. }
  76127. /**
  76128. * @function ChartViewModel.prototype.getFeatures
  76129. * @description 获取地图服务,数据服务请求返回的数据。
  76130. */
  76131. getFeatures() {
  76132. return this.features;
  76133. }
  76134. /**
  76135. * @function ChartViewModel.prototype.setStyle
  76136. * @description 设置图表样式。
  76137. * @param {Object} style - 图表样式
  76138. */
  76139. setStyle(style) {
  76140. return this.updateChartOptions(this.chartType, style);
  76141. }
  76142. }
  76143. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartView.js
  76144. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76145. * This program are made available under the terms of the Apache License, Version 2.0
  76146. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76147. /**
  76148. * @class ChartView
  76149. * @aliasclass Components.ChartView
  76150. * @deprecatedclass SuperMap.Components.Chart
  76151. * @classdesc 图表组件。
  76152. * @modulecategory Components
  76153. * @version 9.1.2
  76154. * @param {string} domID - 图表dom元素ID。
  76155. * @param {Object} options - 可选参数。
  76156. * @param {string} options.type - 图表类型。
  76157. * @param {ChartView.Datasets} options.datasets - 数据来源。
  76158. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  76159. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  76160. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  76161. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  76162. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  76163. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  76164. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  76165. * @category Components Chart
  76166. * @usage
  76167. */
  76168. /**
  76169. * @typedef {Object} ChartView.Datasets - 数据来源。
  76170. * @property {string} [type = 'iServer'] - 服务类型 iServer, iPortal。
  76171. * @property {string} url - 服务地址。
  76172. * @property {boolean} [withCredentials = false] - 设置请求是否带cookie。
  76173. * @property {FilterParameter} queryInfo - 查询条件。
  76174. */
  76175. class ChartView {
  76176. constructor(domID, options) {
  76177. this.domID = domID;
  76178. this.chartType = options.type || "bar";
  76179. // 设置options.datasets.type的默认值是iServer
  76180. options.datasets.type = options.datasets.type || 'iServer';
  76181. // 设置withCredentials的默认值为false
  76182. options.datasets.withCredentials = options.datasets.withCredentials || false;
  76183. this.viewModel = new ChartViewModel(options);
  76184. //添加控件。
  76185. this._fillDataToView();
  76186. }
  76187. /**
  76188. * @function ChartView.prototype.onAdd
  76189. * @description 创建图表之后成功回调。
  76190. * @param {function} addChart - 回调函数。
  76191. */
  76192. onAdd(addChart) {
  76193. this.addChart = addChart;
  76194. }
  76195. /**
  76196. * @function ChartView.prototype._fillDataToView
  76197. * @description 填充数据到 view。
  76198. * @private
  76199. */
  76200. _fillDataToView() {
  76201. let messageboxs = new MessageBox();
  76202. //iclient 绑定createChart事件成功回调
  76203. this.viewModel.getDatasetInfo(this._createChart.bind(this));
  76204. this.viewModel.events.on({
  76205. "getdatafailed": (error) => {
  76206. messageboxs.showView(error.message);
  76207. }
  76208. });
  76209. }
  76210. /**
  76211. * @function ChartView.prototype.getStyle
  76212. * @description 获取图表样式。
  76213. */
  76214. getStyle() {
  76215. return this.viewModel.getStyle()
  76216. }
  76217. /**
  76218. * @function ChartView.prototype.getFeatures
  76219. * @description 获取地图服务,数据服务请求返回的数据。
  76220. */
  76221. getFeatures() {
  76222. return this.viewModel.getFeatures();
  76223. }
  76224. /**
  76225. * @function ChartView.prototype.setStyle
  76226. * @description 设置图表样式。
  76227. * @param {Object} style - 图表样式,参考Echarts-options样式设置。
  76228. */
  76229. setStyle(style) {
  76230. let newOptions = this.viewModel.setStyle(style);
  76231. this._updateChart(newOptions);
  76232. }
  76233. /**
  76234. * @function ChartView.prototype.changeType
  76235. * @description 改变图表类型。
  76236. * @param {string} type - 图表类型。
  76237. */
  76238. changeType(type) {
  76239. if (this.chartType !== type) {
  76240. this.chartType = type;
  76241. let newOptions = this.viewModel.changeType(type);
  76242. this._updateChart(newOptions);
  76243. }
  76244. }
  76245. /**
  76246. * @function ChartView.prototype.updateData
  76247. * @description 更新图表数据。
  76248. * @param {ChartView.Datasets} datasets - 数据来源。
  76249. * @param {Object} chartOption - X,Y轴信息。
  76250. */
  76251. updateData(datasets, chartOption) {
  76252. let me = this;
  76253. this.viewModel.updateData(datasets, chartOption, function (options) {
  76254. me._updateChart(options);
  76255. if (me.addChart) {
  76256. me.addChart();
  76257. }
  76258. });
  76259. }
  76260. /**
  76261. * @function ChartView.prototype._createChart
  76262. * @description 创建图表。
  76263. * @private
  76264. * @param {Object} data - 图表数据。
  76265. */
  76266. _createChart(data) {
  76267. this.echart = external_function_try_return_echarts_catch_e_return_namespaceObject.init(
  76268. document.getElementById(this.domID),
  76269. null, {
  76270. renderer: "canvas"
  76271. }
  76272. )
  76273. let options = this.viewModel._createChartOptions(data);
  76274. this.echart.setOption(options);
  76275. if (this.addChart) {
  76276. this.addChart();
  76277. }
  76278. }
  76279. /**
  76280. * @function ChartView.prototype._updateChart
  76281. * @description 更新图表。
  76282. * @private
  76283. * @param {Object} options - 图表参数。
  76284. */
  76285. _updateChart(options) {
  76286. if (this.echart) {
  76287. this.echart.clear();
  76288. this.echart.setOption(options);
  76289. }
  76290. }
  76291. }
  76292. ;// CONCATENATED MODULE: ./src/common/components/templates/TemplateBase.js
  76293. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76294. * This program are made available under the terms of the Apache License, Version 2.0
  76295. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76296. /**
  76297. * @class TemplateBase
  76298. * @aliasclass Components.TemplateBase
  76299. * @deprecatedclass SuperMap.Components.TemplateBase
  76300. * @classdesc 组件公用组件父类,用于约束统一封装的公用组件结构。
  76301. * @version 9.1.1
  76302. * @param {Object} options - 组件配置参数。
  76303. * @param {string} options.id - 组件 dom 元素 id。
  76304. * @category Components Common
  76305. * @usage
  76306. */
  76307. class TemplateBase {
  76308. constructor(options) {
  76309. options = options ? options : {};
  76310. /**
  76311. * @member {string} [TemplateBase.prototype.id=null]
  76312. * @description 组件 dom 元素 id。
  76313. */
  76314. this.id = options.id ? options.id : null;
  76315. /**
  76316. * @member {HTMLElement} [TemplateBase.prototype.rootContainer=null]
  76317. * @description 组件 dom 元素对象。
  76318. */
  76319. this.rootContainer = null;
  76320. }
  76321. /**
  76322. * @function TemplateBase.prototype.getElement
  76323. * @description 获取当前组件元素对象。
  76324. * @return {HTMLElement} 组件 dom 元素对象
  76325. */
  76326. getElement() {
  76327. //todo 其实感觉再这里给组件设置不太合理
  76328. if (this.id) {
  76329. this.rootContainer.id = this.id;
  76330. }
  76331. return this.rootContainer;
  76332. }
  76333. /**
  76334. * @function TemplateBase.prototype._initView
  76335. * @private
  76336. * @description 初始化模板。
  76337. */
  76338. _initView() {
  76339. //子类实现此方法
  76340. }
  76341. /**
  76342. * @function TemplateBase.prototype.showView
  76343. * @description 显示组件。
  76344. */
  76345. showView() {
  76346. this.rootContainer.hidden = false;
  76347. }
  76348. /**
  76349. * @function TemplateBase.prototype.closeView
  76350. * @description 隐藏组件。
  76351. */
  76352. closeView() {
  76353. this.rootContainer.hidden = true;
  76354. }
  76355. }
  76356. ;// CONCATENATED MODULE: ./src/common/components/templates/CommonContainer.js
  76357. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76358. * This program are made available under the terms of the Apache License, Version 2.0
  76359. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76360. /**
  76361. * @class CommonContainer
  76362. * @aliasclass Components.CommonContainer
  76363. * @deprecatedclass SuperMap.Components.CommonContainer
  76364. * @classdesc 组件统一外框。
  76365. * @version 9.1.1
  76366. * @param {Object} options - 组件配置参数。
  76367. * @param {string} options.id - 组件 dom 元素 id。
  76368. * @param {string} options.title - 标题。
  76369. * @category Components Common
  76370. * @extends {TemplateBase}
  76371. * @usage
  76372. */
  76373. class CommonContainer extends TemplateBase {
  76374. constructor(options) {
  76375. super(options);
  76376. let title = options.title ? options.title : "";
  76377. this._initView(title);
  76378. }
  76379. /**
  76380. * @private
  76381. * @override
  76382. */
  76383. _initView(title) {
  76384. const container = document.createElement("div");
  76385. container.setAttribute("class", "component-container");
  76386. //title
  76387. const titleContainer = document.createElement("div");
  76388. titleContainer.setAttribute("class", "component-title");
  76389. const titleContent = document.createElement("div");
  76390. titleContent.innerHTML = title;
  76391. titleContainer.appendChild(titleContent);
  76392. container.appendChild(titleContainer);
  76393. //container
  76394. const componentContent = document.createElement("div");
  76395. componentContent.setAttribute("class", "component-content");
  76396. container.appendChild(componentContent);
  76397. this.content = componentContent;
  76398. this.rootContainer = container;
  76399. return container;
  76400. }
  76401. /**
  76402. * @function CommonContainer.prototype.getContentElement
  76403. * @description 获取内容元素容器。
  76404. */
  76405. getContentElement() {
  76406. return this.content;
  76407. }
  76408. /**
  76409. * @function CommonContainer.prototype.appendContent
  76410. * @description 填充内容元素。
  76411. */
  76412. appendContent(element) {
  76413. this.content.appendChild(element);
  76414. }
  76415. }
  76416. ;// CONCATENATED MODULE: ./src/common/components/templates/Select.js
  76417. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76418. * This program are made available under the terms of the Apache License, Version 2.0
  76419. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76420. /**
  76421. * @class Select
  76422. * @aliasclass Components.Select
  76423. * @deprecatedclass SuperMap.Components.Select
  76424. * @classdesc 组件统一的文字下拉框。
  76425. * @version 9.1.1
  76426. * @param {Array.<string|Array>} options - 组件配置参数数组。
  76427. * @param {string} options.id - 组件 dom 元素 id。
  76428. * @param {string} [options.labelName] - label 名称。
  76429. * @param {Array.<string>} options.optionsArr - 需要创建的 option 数据数组。
  76430. * @param {function} [options.optionsClickCb] - option 点击事件回调函数。
  76431. * @extends {TemplateBase}
  76432. * @category Components Common
  76433. * @usage
  76434. */
  76435. class Select extends TemplateBase {
  76436. constructor(options) {
  76437. super(options);
  76438. this._initView(options);
  76439. }
  76440. _initView(options) {
  76441. let selectTool = this._createElement('div', "component-selecttool");
  76442. if (options.labelName) {
  76443. let label = this._createElement('label', 'component-selecttool__lable--describe', selectTool);
  76444. label.innerHTML = options.labelName;
  76445. }
  76446. let chartSelect = this._createElement('div', 'component-selecttool--chart', selectTool);
  76447. chartSelect.setAttribute('tabindex', '1');
  76448. let selectName = this._createElement('div', "component-selecttool__name", chartSelect);
  76449. selectName.title = options.optionsArr[0];
  76450. selectName.innerHTML = options.optionsArr[0];
  76451. let chartTriangleBtn = this._createElement('div', 'component-selecttool__trianglebtn--chart', chartSelect);
  76452. let triangleBtn = this._createElement('div', 'component-triangle-down-img', chartTriangleBtn);
  76453. let selectContent = this._createElement('div', 'component-selecttool__content', chartSelect);
  76454. let scrollarea = this._createElement('div', 'component-selecttool__content--chart', selectContent);
  76455. let scrollareaContent = this._createElement('div', 'component-selecttool__scrollarea__content', scrollarea);
  76456. scrollareaContent.setAttribute('tabindex', '1');
  76457. this.createOptions(scrollareaContent, options.optionsArr);
  76458. this.optionClickEvent(scrollareaContent, selectName, options.optionsClickCb);
  76459. // 下拉框显示 & 隐藏事件
  76460. this._selectClickEvent(chartSelect, selectContent, triangleBtn);
  76461. this.rootContainer = selectTool;
  76462. }
  76463. /**
  76464. * @function Select.prototype.createOptions
  76465. * @description 创建所属下拉框选项。
  76466. */
  76467. createOptions(container, optionsArr) {
  76468. for (let i in optionsArr) {
  76469. let option = this._createElement('div', 'component-selecttool__option', container);
  76470. option.title = optionsArr[i];
  76471. option.innerHTML = optionsArr[i];
  76472. }
  76473. }
  76474. /**
  76475. * @function Select.prototype._selectClickEvent
  76476. * @description select 点击显示&隐藏事件。
  76477. * @private
  76478. */
  76479. _selectClickEvent(eventElement, contentElement, triangleBtn) {
  76480. eventElement.onclick = function (e) {
  76481. if (contentElement.style.display === "block") {
  76482. contentElement.style.display = "none";
  76483. triangleBtn.className = "component-triangle-down-img";
  76484. } else {
  76485. contentElement.style.display = "block";
  76486. triangleBtn.className = "triangle-up-img";
  76487. }
  76488. e.preventDefault();
  76489. e.stopPropagation();
  76490. };
  76491. eventElement.onmousedown = function (evt) {
  76492. //console.log('dropdownbox onmousedown '+evt.target.className);
  76493. if (evt.target !== this) {
  76494. this.focus();
  76495. evt.preventDefault();
  76496. evt.stopPropagation()
  76497. }
  76498. };
  76499. eventElement.onblur = function () {
  76500. contentElement.style.display = "none";
  76501. triangleBtn.className = "component-triangle-down-img";
  76502. }
  76503. }
  76504. /**
  76505. * @function Select.prototype._createElement
  76506. * @description 通用创建元素。
  76507. * @private
  76508. */
  76509. _createElement(tagName, className, parentEle) {
  76510. let ele = document.createElement(tagName || 'div');
  76511. className && (ele.className = className);
  76512. parentEle && parentEle.appendChild(ele);
  76513. return ele;
  76514. }
  76515. /**
  76516. * @function Select.prototype.optionClickEvent
  76517. * @description 下拉框的 option 的点击事件。
  76518. */
  76519. optionClickEvent(optionEleArr, selectNameEle, optionsClickCb) {
  76520. for (let i = 0; i < optionEleArr.children.length; i++) {
  76521. let childEle = optionEleArr.children[i];
  76522. childEle.onclick = function () {
  76523. selectNameEle.innerHTML = childEle.innerHTML;
  76524. selectNameEle.title = childEle.title;
  76525. if (childEle.getAttribute('data-value')) {
  76526. selectNameEle.setAttribute('data-value', childEle.getAttribute('data-value'))
  76527. }
  76528. optionsClickCb && optionsClickCb(childEle);
  76529. }
  76530. }
  76531. }
  76532. }
  76533. ;// CONCATENATED MODULE: ./src/common/components/templates/DropDownBox.js
  76534. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76535. * This program are made available under the terms of the Apache License, Version 2.0
  76536. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76537. /**
  76538. * @class DropDownBox
  76539. * @aliasclass Components.DropDownBox
  76540. * @deprecatedclass SuperMap.Components.DropDownBox
  76541. * @classdesc 组件统一的图片下拉框。
  76542. * @version 9.1.1
  76543. * @param {Array.<Object>} options - 组件配置参数数组。
  76544. * @param {string} options.id - 组件 dom 元素 id。
  76545. * @param {string} options.title - 下拉框 title。
  76546. * @param {string} options.remark - 下拉框解释标记文本。
  76547. * @param {string} [options.dataValue] - 下拉框 attribute 名为 data-value 的值 。
  76548. * @param {string} [options.icon] - 下拉框图标。
  76549. * @param {string} [options.icon.className] - 下拉框图标类名。
  76550. * @param {string} [options.icon.background] - 下拉框图标背景 url。
  76551. * @category Components Common
  76552. * @extends {TemplateBase}
  76553. * @usage
  76554. */
  76555. class DropDownBox extends TemplateBase {
  76556. constructor(optionsArr) {
  76557. super(optionsArr);
  76558. this._initView(optionsArr);
  76559. }
  76560. /**
  76561. * @function DropDownBox.prototype._initView
  76562. * @description 初始化下拉框。
  76563. * @private
  76564. * @override
  76565. */
  76566. _initView(optionsArr) {
  76567. let dropDownContainer = document.createElement('div');
  76568. dropDownContainer.className = 'component-dropdownbox--container';
  76569. let dropDownBox = document.createElement('div');
  76570. dropDownBox.setAttribute('tabindex', '1');
  76571. dropDownBox.className = "component-dropdownbox";
  76572. dropDownContainer.appendChild(dropDownBox);
  76573. let dropDownTopContainer = document.createElement('div');
  76574. dropDownBox.appendChild(dropDownTopContainer);
  76575. this._createDropDownOption(optionsArr[0], dropDownTopContainer);
  76576. let triangleBtnContainer = document.createElement('div');
  76577. triangleBtnContainer.className = 'component-dropdownbox__triangle-btn';
  76578. dropDownBox.appendChild(triangleBtnContainer);
  76579. let triangleBtn = document.createElement('div');
  76580. triangleBtn.className = 'component-triangle-down-img';
  76581. triangleBtnContainer.appendChild(triangleBtn);
  76582. let createDropDownBoxParam = {
  76583. "parentEle": dropDownBox,
  76584. "dropDownContent": ['component-dropdownbox__content component-dropdownbox__content--chart', 'dropDownContent'],
  76585. "scrollareaContent": 'component-selecttool__scrollarea__content',
  76586. "optionsArr": optionsArr,
  76587. "triangleBtn": triangleBtn,
  76588. "dropDownTopContainer": dropDownTopContainer
  76589. };
  76590. this._createDropDownBox(createDropDownBoxParam);
  76591. this.rootContainer = dropDownContainer;
  76592. }
  76593. /**
  76594. * @function DropDownBox.prototype._createDropDownBox
  76595. * @description 创建下拉框。
  76596. * @private
  76597. */
  76598. _createDropDownBox(createDropDownBoxParam) {
  76599. let dropDownBox = createDropDownBoxParam.parentEle;
  76600. let dropDownTopContainer = createDropDownBoxParam.dropDownTopContainer;
  76601. let dropDownContent = document.createElement('div');
  76602. dropDownContent.className = createDropDownBoxParam.dropDownContent[0];
  76603. dropDownBox.appendChild(dropDownContent);
  76604. let scrollareaContent = document.createElement('div');
  76605. scrollareaContent.className = createDropDownBoxParam.scrollareaContent;
  76606. dropDownContent.appendChild(scrollareaContent);
  76607. let optionsArr = createDropDownBoxParam.optionsArr;
  76608. for (let i = 0; i < optionsArr.length; i++) {
  76609. this._createDropDownOption(optionsArr[i], scrollareaContent)
  76610. }
  76611. // 下拉框显示 & 隐藏事件
  76612. let triangleBtn = createDropDownBoxParam.triangleBtn;
  76613. this._dropDownClickEvent(dropDownBox, dropDownContent, triangleBtn);
  76614. this._eleOnblur(dropDownBox, dropDownContent, triangleBtn);
  76615. // 下拉框 options 点击事件
  76616. let scrollareaOptions = scrollareaContent.children;
  76617. for (let i = 0; i < scrollareaOptions.length; i++) {
  76618. scrollareaOptions[i].onclick = function () {
  76619. dropDownTopContainer.innerHTML = scrollareaOptions[i].outerHTML;
  76620. //evt.stopPropagation();
  76621. }
  76622. }
  76623. }
  76624. /**
  76625. * @function DropDownBox.prototype._createDropDownOption
  76626. * @description 创建下拉框子元素。
  76627. * @private
  76628. */
  76629. _createDropDownOption(data, parentElement) {
  76630. let ele = document.createElement('div');
  76631. ele.className = 'component-dropdownbox__item';
  76632. let dataItem = data;
  76633. if (dataItem['dataValue']) {
  76634. ele.setAttribute('data-value', dataItem['dataValue']);
  76635. }
  76636. parentElement.appendChild(ele);
  76637. let imgContainer = document.createElement('div');
  76638. imgContainer.className = 'component-dropdownbox__item__img';
  76639. ele.appendChild(imgContainer);
  76640. let img = document.createElement('div');
  76641. if (dataItem.icon.className) {
  76642. img.className = dataItem.icon.className;
  76643. }
  76644. if (dataItem.icon.background) {
  76645. img.style.background = dataItem.icon.background;
  76646. }
  76647. imgContainer.appendChild(img);
  76648. let title = document.createElement('div');
  76649. title.className = 'component-dropdownbox__item__title';
  76650. title.title = dataItem.title;
  76651. title.innerHTML = dataItem.title;
  76652. ele.appendChild(title);
  76653. let remark = document.createElement('div');
  76654. remark.className = 'component-dropdownbox__item__remark';
  76655. remark.title = dataItem.remark;
  76656. remark.innerHTML = dataItem.remark;
  76657. ele.appendChild(remark);
  76658. }
  76659. /**
  76660. * @function DropDownBox.prototype._dropDownClickEvent
  76661. * @description 下拉框点击事件。
  76662. * @private
  76663. */
  76664. _dropDownClickEvent(eventElement, contentElement, triangleBtn) {
  76665. eventElement.onclick = function (e) {
  76666. if (contentElement.style.display === "block") {
  76667. contentElement.style.display = "none";
  76668. triangleBtn.className = "component-triangle-down-img";
  76669. } else {
  76670. contentElement.style.display = "block";
  76671. triangleBtn.className = "triangle-up-img";
  76672. }
  76673. e.preventDefault();
  76674. e.stopPropagation()
  76675. };
  76676. eventElement.onmousedown = function (evt) {
  76677. //console.log('dropdownbox onmousedown '+evt.target.className);
  76678. if (evt.target !== this) {
  76679. this.focus();
  76680. evt.preventDefault();
  76681. evt.stopPropagation()
  76682. }
  76683. }
  76684. }
  76685. /**
  76686. * @function DropDownBox.prototype._eleOnblur
  76687. * @description 下拉框失焦事件。
  76688. * @private
  76689. */
  76690. _eleOnblur(eventElement, contentElement, triangleBtn) {
  76691. eventElement.onblur = function () {
  76692. contentElement.style.display = "none";
  76693. triangleBtn.className = "component-triangle-down-img";
  76694. }
  76695. }
  76696. /**
  76697. * @function DropDownBox.prototype._createElement
  76698. * @description 通用创建元素。
  76699. * @private
  76700. */
  76701. _createElement(tagName, className, parentEle) {
  76702. let ele = document.createElement(tagName || 'div');
  76703. className && (ele.className = className);
  76704. parentEle && parentEle.appendChild(ele);
  76705. return ele;
  76706. }
  76707. }
  76708. ;// CONCATENATED MODULE: ./src/common/components/templates/PopContainer.js
  76709. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76710. * This program are made available under the terms of the Apache License, Version 2.0
  76711. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76712. /**
  76713. * @class PopContainer
  76714. * @aliasclass Components.PopContainer
  76715. * @deprecatedclass SuperMap.Components.PopContainer
  76716. * @classdesc 弹框组件。
  76717. * @version 9.1.1
  76718. * @param {Object} options - 组件配置参数。
  76719. * @param {string} options.id - 组件 dom 元素 id。
  76720. * @param {string} options.title - 弹框组件名称。
  76721. * @extends {TemplateBase}
  76722. * @category Components Common
  76723. * @usage
  76724. */
  76725. class PopContainer extends TemplateBase {
  76726. constructor(options) {
  76727. options = options ? options : {};
  76728. super(options);
  76729. options.title = options.title ? options.title : "";
  76730. this._initView(options.title);
  76731. }
  76732. /**
  76733. * @private
  76734. * @override
  76735. */
  76736. _initView(titile) {
  76737. const container = document.createElement("div");
  76738. container.setAttribute("class", "component-popcontainer");
  76739. //header
  76740. const header = document.createElement("div");
  76741. header.setAttribute("class", "component-popcontainer__header");
  76742. const title = document.createElement("label");
  76743. title.setAttribute("class", "component-popcontainer__header__title");
  76744. title.innerHTML = titile;
  76745. header.appendChild(title);
  76746. const closeBtn = document.createElement("span");
  76747. closeBtn.setAttribute("class", "supermapol-icons-clear component-popcontainer__header__close");
  76748. closeBtn.onclick = this.closeView.bind(this);
  76749. container.appendChild(closeBtn);
  76750. container.appendChild(header);
  76751. //content
  76752. const content = document.createElement("div");
  76753. content.setAttribute("class", "component-popcontainer__content");
  76754. this.content = content;
  76755. container.appendChild(content);
  76756. this.rootContainer = container;
  76757. }
  76758. /**
  76759. * @function PopContainer.prototype.appendContent
  76760. * @description 追加内容。
  76761. * @param {HTMLElement} dom - 内容元素。
  76762. */
  76763. appendContent(dom) {
  76764. this.content.appendChild(dom);
  76765. }
  76766. }
  76767. ;// CONCATENATED MODULE: ./src/common/components/templates/AttributesPopContainer.js
  76768. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76769. * This program are made available under the terms of the Apache License, Version 2.0
  76770. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76771. /**
  76772. * @class AttributesPopContainer
  76773. * @aliasclass Components.AttributesPopContainer
  76774. * @deprecatedclass SuperMap.Components.AttributesPopContainer
  76775. * @classdesc 属性弹框组件
  76776. * @version 9.1.1
  76777. * @param {Object} options - 组件配置参数。
  76778. * @param {string} options.id - 组件 dom 元素 id。
  76779. * @param {Object} options.title - 属性弹框组件名称。
  76780. * @param {Object} options.attributes - 组件需要显示的属性内容。
  76781. * @extends {PopContainer}
  76782. * @category Components Common
  76783. * @usage
  76784. */
  76785. class AttributesPopContainer extends PopContainer {
  76786. constructor(options) {
  76787. //默认为属性:
  76788. options.title = options.title ? options.title : "属性";
  76789. super(options);
  76790. this.rootContainer.firstChild.hidden = true;
  76791. options.attributes = options.attributes ? options.attributes : [];
  76792. this._createAttributesTable(options.attributes);
  76793. }
  76794. _createAttributesTable(attributes) {
  76795. const table = document.createElement("table");
  76796. table.setAttribute("class", "component-popcontainer__content__table");
  76797. const tbody = document.createElement("tbody");
  76798. let single = true;
  76799. for (let name in attributes) {
  76800. const tr = document.createElement("tr");
  76801. if (single) {
  76802. tr.setAttribute("class", "component-popcontainer__content__td--color");
  76803. }
  76804. const title = document.createElement("td");
  76805. const titleSpan = document.createElement("Span");
  76806. titleSpan.innerHTML = name;
  76807. title.appendChild(titleSpan);
  76808. const value = document.createElement("td");
  76809. value.innerHTML = attributes[name];
  76810. tr.appendChild(title);
  76811. tr.appendChild(value);
  76812. tbody.appendChild(tr);
  76813. single = !single;
  76814. }
  76815. table.appendChild(tbody);
  76816. this.appendContent(table);
  76817. }
  76818. }
  76819. ;// CONCATENATED MODULE: ./src/common/components/templates/IndexTabsPageContainer.js
  76820. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76821. * This program are made available under the terms of the Apache License, Version 2.0
  76822. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76823. /**
  76824. * @class IndexTabsPageContainer
  76825. * @aliasclass Components.IndexTabsPageContainer
  76826. * @deprecatedclass SuperMap.Components.IndexTabsPageContainer
  76827. * @classdesc 标签索引组件。
  76828. * @version 9.1.1
  76829. * @param {Object} options - 组件配置参数。
  76830. * @param {string} options.id - 组件 dom 元素 id。
  76831. * @category Components Common
  76832. * @extends {TemplateBase}
  76833. * @usage
  76834. */
  76835. class IndexTabsPageContainer extends TemplateBase {
  76836. constructor(options) {
  76837. super(options);
  76838. this._initView();
  76839. }
  76840. /**
  76841. * @private
  76842. * @override
  76843. */
  76844. _initView() {
  76845. const container = document.createElement("div");
  76846. container.setAttribute("class", "component-tabpage");
  76847. const header = document.createElement("ul");
  76848. this.header = header;
  76849. const content = document.createElement("div");
  76850. content.setAttribute("class", "component-tabpage__content");
  76851. this.content = content;
  76852. container.appendChild(header);
  76853. container.appendChild(content);
  76854. this.rootContainer = container;
  76855. }
  76856. /**
  76857. * @function IndexTabsPageContainer.prototype.setTabs
  76858. * @description 设置标签元素。
  76859. * @param {Array.<HTMLElement>} tabs
  76860. */
  76861. setTabs(tabs) {
  76862. this.removeAllTabs();
  76863. this.appendTabs(tabs);
  76864. }
  76865. /**
  76866. * @function IndexTabsPageContainer.prototype.appendTabs
  76867. * @description 追加标签元素。
  76868. * @param {Array.<HTMLElement>} tabs
  76869. */
  76870. appendTabs(tabs) {
  76871. for (let i = 0; i < tabs.length; i++) {
  76872. let title = document.createElement("span");
  76873. title.index = i;
  76874. title.appendChild(document.createTextNode(tabs[i].title));
  76875. //绑定标签切换对应页面:
  76876. title.onclick = this._changeTabsPage.bind(this);
  76877. let content = tabs[i].content;
  76878. content.index = i;
  76879. content.hidden = true;
  76880. this.header.appendChild(title);
  76881. this.content.appendChild(content);
  76882. }
  76883. //todo 确认是否两个子元素的 index 相互对应
  76884. //默认显示第一个标签对象
  76885. this.header.firstChild.setAttribute("class", "on");
  76886. this.content.firstChild.hidden = false;
  76887. }
  76888. /**
  76889. * @function IndexTabsPageContainer.prototype.removeTab
  76890. * @description 删除某个标签页面。
  76891. * @param {number} index - 标签索引号。
  76892. */
  76893. removeTab(index) {
  76894. this.header.removeChild(this.header.children[index]);
  76895. this.content.removeChild(this.content.children[index]);
  76896. }
  76897. /**
  76898. * @function IndexTabsPageContainer.prototype.removeAllTabs
  76899. * @description 删除所有标签。
  76900. */
  76901. removeAllTabs() {
  76902. for (let i = this.header.children.length; i > 0; i--) {
  76903. this.header.removeChild(this.header.children[i]);
  76904. this.content.removeChild(this.content.children[i]);
  76905. }
  76906. }
  76907. _changeTabsPage(e) {
  76908. const index = e.target.index;
  76909. for (let i = 0; i < this.header.children.length; i++) {
  76910. this.header.children[i].setAttribute("class", "");
  76911. this.content.children[i].hidden = true;
  76912. if (i === index) {
  76913. this.header.children[i].setAttribute("class", "on");
  76914. this.content.children[i].hidden = false;
  76915. }
  76916. }
  76917. }
  76918. }
  76919. ;// CONCATENATED MODULE: ./src/common/components/templates/CityTabsPage.js
  76920. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76921. * This program are made available under the terms of the Apache License, Version 2.0
  76922. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76923. /**
  76924. * @class CityTabsPage
  76925. * @aliasclass Components.CityTabsPage
  76926. * @deprecatedclass SuperMap.Components.CityTabsPage
  76927. * @classdesc 城市地址匹配组件模板
  76928. * @version 9.1.1
  76929. * @param {Object} options - 组件配置参数。
  76930. * @param {string} options.id - 组件 dom 元素 id。
  76931. * @param {Object|Array.<string>} options.config - 城市名称配置列表,支持两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或
  76932. * ["成都市","北京市"],用户可根据自己的项目需求进行配置
  76933. * @extends {IndexTabsPageContainer}
  76934. * @category Components Common
  76935. * @usage
  76936. */
  76937. class CityTabsPage extends IndexTabsPageContainer {
  76938. constructor(options) {
  76939. super(options);
  76940. //去掉默认的边框阴影样式:
  76941. this.rootContainer.classList.add("component-citytabpage--noneBoxShadow");
  76942. this.config = options.config;
  76943. //header,若 config为城市名称数组,则直接加载内容
  76944. if (Util_Util.isArray(this.config)) {
  76945. this.header.hidden = true;
  76946. this._createCityItem("城市", this.config);
  76947. this.content.style.border = "none";
  76948. } else {
  76949. this._createTabs();
  76950. this.header.onclick = (e) => {
  76951. //关闭所有元素 是否有更简化的写法?
  76952. for (let i = 0; i < this.header.children.length; i++) {
  76953. this.header.children[i].setAttribute("class", "");
  76954. }
  76955. //打开点击内容元素
  76956. e.target.setAttribute("class", "on");
  76957. this._createCityContent(e.target.innerHTML);
  76958. };
  76959. }
  76960. }
  76961. /**
  76962. * @function CityTabsPage.prototype._createTabs
  76963. * @description 创建 Tabs
  76964. * @private
  76965. */
  76966. _createTabs() {
  76967. //header
  76968. if (Util_Util.isArray(this.config)) {
  76969. for (let i = 0; i < this.config.length; i++) {
  76970. let innerHTML = "";
  76971. for (const key in this.config[i]) {
  76972. innerHTML += key;
  76973. }
  76974. let li = document.createElement("li");
  76975. li.innerHTML = innerHTML;
  76976. this.header.appendChild(li);
  76977. }
  76978. } else {
  76979. for (const key in this.config) {
  76980. let li = document.createElement("li");
  76981. li.innerHTML = key;
  76982. this.header.appendChild(li);
  76983. }
  76984. }
  76985. this.header.firstChild.setAttribute("class", "on");
  76986. this._createCityContent(this.header.firstChild.innerHTML);
  76987. }
  76988. /**
  76989. * @function CityTabsPage.prototype._createCityContent
  76990. * @description 创建列表容器
  76991. * @private
  76992. */
  76993. _createCityContent(keyName) {
  76994. //清除元素:
  76995. for (let i = this.content.children.length; i > 0; i--) {
  76996. this.content.removeChild(this.content.children[i - 1]);
  76997. }
  76998. //创建对应元素
  76999. const cities = this.config[keyName];
  77000. for (let key in cities) {
  77001. this._createCityItem(key, cities[key]);
  77002. }
  77003. }
  77004. /**
  77005. * @function CityTabsPage.prototype._createCityContent
  77006. * @description 创建列表容器
  77007. * @private
  77008. */
  77009. _createCityItem(key, cities) {
  77010. const city = document.createElement("div");
  77011. const cityClass = document.createElement("div");
  77012. cityClass.setAttribute("class", "component-citytabpag__py-key");
  77013. cityClass.innerHTML = key;
  77014. city.appendChild(cityClass);
  77015. const cityContent = document.createElement("div");
  77016. cityContent.setAttribute("class", "component-citytabpag__content");
  77017. for (let i = 0; i < cities.length; i++) {
  77018. let span = document.createElement("span");
  77019. span.innerHTML = cities[i];
  77020. cityContent.appendChild(span);
  77021. }
  77022. //HOT 元素长度单独微调:
  77023. if (key === "HOT") {
  77024. cityContent.style.width = "428px";
  77025. }
  77026. city.appendChild(cityContent);
  77027. this.content.appendChild(city);
  77028. }
  77029. }
  77030. ;// CONCATENATED MODULE: ./src/common/components/templates/NavTabsPage.js
  77031. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  77032. * This program are made available under the terms of the Apache License, Version 2.0
  77033. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77034. /**
  77035. * @class NavTabsPage
  77036. * @aliasclass Components.NavTabsPage
  77037. * @deprecatedclass SuperMap.Components.NavTabsPage
  77038. * @classdesc 标签页面组件。
  77039. * @version 9.1.1
  77040. * @param {Object} options - 组件配置参数。
  77041. * @param {string} options.id - 组件 dom 元素 id。
  77042. * @param {Array.<Object>} [options.tabs=[]] - 标签对象数组,形如:[{title: "",content: HTMLElement}],初始时,传入则创建页面。
  77043. * @extends {TemplateBase}
  77044. * @category Components Common
  77045. * @usage
  77046. */
  77047. // todo 思考拆分的控件应该以哪种方式使用
  77048. class NavTabsPage extends TemplateBase {
  77049. constructor(options) {
  77050. super(options);
  77051. this.navTabsTitle = null;
  77052. this.navTabsContent = null;
  77053. options.tabs = options.tabs ? options.tabs : [];
  77054. this._initView(options.tabs);
  77055. }
  77056. /**
  77057. * @override
  77058. * @private
  77059. */
  77060. _initView(tabs) {
  77061. const navTabsPage = document.createElement("div");
  77062. navTabsPage.setAttribute("class", "component-navtabspage");
  77063. //关闭按钮
  77064. const closeBtn = document.createElement("span");
  77065. closeBtn.setAttribute("class", "supermapol-icons-close");
  77066. closeBtn.onclick = this.closeView.bind(this);
  77067. navTabsPage.appendChild(closeBtn);
  77068. //标签
  77069. const navTabsTitle = document.createElement("div");
  77070. this.navTabsTitle = navTabsTitle;
  77071. navTabsTitle.setAttribute("class", "component-navtabspage__title");
  77072. navTabsPage.appendChild(navTabsTitle);
  77073. //内容
  77074. const navTabsContent = document.createElement("div");
  77075. this.navTabsContent = navTabsContent;
  77076. navTabsContent.setAttribute("class", "component-navtabspage__content");
  77077. navTabsPage.appendChild(navTabsContent);
  77078. //若 tabs 初始传入值,则
  77079. if (tabs.length > 0) {
  77080. this.appendTabs(tabs);
  77081. }
  77082. this.rootContainer = navTabsPage;
  77083. }
  77084. /**
  77085. * @function NavTabsPage.prototype.setTabs
  77086. * @description 设置标签。
  77087. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  77088. */
  77089. setTabs(tabs) {
  77090. this.removeAllTabs();
  77091. this.appendTabs(tabs);
  77092. }
  77093. /**
  77094. * @function NavTabsPage.prototype.appendTabs
  77095. * @description 添加标签页面。
  77096. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  77097. */
  77098. appendTabs(tabs) {
  77099. for (let i = 0; i < tabs.length; i++) {
  77100. let title = document.createElement("span");
  77101. title.index = i;
  77102. title.appendChild(document.createTextNode(tabs[i].title));
  77103. //绑定标签切换对应页面:
  77104. title.onclick = this._changeTabsPage.bind(this);
  77105. let content = tabs[i].content;
  77106. content.index = i;
  77107. content.hidden = true;
  77108. this.navTabsTitle.appendChild(title);
  77109. this.navTabsContent.appendChild(content);
  77110. }
  77111. //todo 确认是否两个子元素的 index 相互对应
  77112. //默认显示第一个标签对象
  77113. this.navTabsTitle.firstChild.setAttribute("class", "component-navtabspage__tabs--select");
  77114. this.navTabsContent.firstChild.hidden = false;
  77115. }
  77116. /**
  77117. * @function NavTabsPage.prototype.removeTab
  77118. * @description 删除某个标签页面。
  77119. * @param {number} index - 标签索引号。
  77120. */
  77121. removeTab(index) {
  77122. this.navTabsTitle.removeChild(this.navTabsTitle.children[index]);
  77123. this.navTabsContent.removeChild(this.navTabsContent.children[index]);
  77124. }
  77125. /**
  77126. * @function NavTabsPage.prototype.removeAllTabs
  77127. * @description 删除所有标签。
  77128. */
  77129. removeAllTabs() {
  77130. for (let i = this.navTabsTitle.children.length; i > 0; i--) {
  77131. this.navTabsTitle.removeChild(this.navTabsTitle.children[i]);
  77132. this.navTabsContent.removeChild(this.navTabsContent.children[i]);
  77133. }
  77134. }
  77135. _changeTabsPage(e) {
  77136. const index = e.target.index;
  77137. for (let i = 0; i < this.navTabsTitle.children.length; i++) {
  77138. this.navTabsTitle.children[i].setAttribute("class", "");
  77139. this.navTabsContent.children[i].hidden = true;
  77140. if (i === index) {
  77141. this.navTabsTitle.children[i].setAttribute("class", "component-navtabspage__tabs--select");
  77142. this.navTabsContent.children[i].hidden = false;
  77143. }
  77144. }
  77145. }
  77146. }
  77147. ;// CONCATENATED MODULE: ./src/common/components/templates/PaginationContainer.js
  77148. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  77149. * This program are made available under the terms of the Apache License, Version 2.0
  77150. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77151. /**
  77152. * @class PaginationContainer
  77153. * @aliasclass Components.PaginationContainer
  77154. * @deprecatedclass SuperMap.Components.PaginationContainer
  77155. * @classdesc 分页组件模板。
  77156. * @version 9.1.1
  77157. * @param {Object} options - 组件配置参数。
  77158. * @param {string} options.id - 组件 dom 元素 id。
  77159. * @param {HTMLElement} options.contents - 页面填充的 DOM 元素对象。
  77160. * @param {number} options.pageCounts - 页数。
  77161. * @extends {TemplateBase}
  77162. * @category Components Common
  77163. * @usage
  77164. */
  77165. class PaginationContainer extends TemplateBase {
  77166. constructor(options) {
  77167. options = options ? options : {};
  77168. super(options);
  77169. this.currentPage = 0;
  77170. this.pageNumberLis = [];
  77171. this.currentPageNumberLis = [];
  77172. this.linkageEvent = null;
  77173. options.contents = options.contents ? options.contents : null;
  77174. options.pageCounts = options.pageCounts ? options.pageCounts : 0;
  77175. this._initView(options.contents, options.pageCounts);
  77176. }
  77177. /**
  77178. * @function PaginationContainer.prototype.setLinkageEvent
  77179. * @description 设置页面联动方法。
  77180. * @param {function} linkageEvent - 联动方法,实现指定功能。
  77181. */
  77182. setLinkageEvent(linkageEvent) {
  77183. this.linkageEvent = linkageEvent;
  77184. }
  77185. /**
  77186. * @private
  77187. * @override
  77188. */
  77189. _initView(contents, pageCounts) {
  77190. const container = document.createElement("div");
  77191. container.setAttribute("class", "component-pagination");
  77192. //content
  77193. const content = document.createElement("div");
  77194. content.setAttribute("class", "component-pagination__content");
  77195. container.appendChild(content);
  77196. this.content = content;
  77197. //link
  77198. const link = document.createElement("ul");
  77199. link.setAttribute("class", "component-pagination__link");
  77200. link.onclick = this._changePageEvent.bind(this);
  77201. container.appendChild(link);
  77202. this._createLink(link);
  77203. this.link = link;
  77204. //填充内容:
  77205. if (contents) {
  77206. this.setContent(contents);
  77207. }
  77208. if (pageCounts !== 0) {
  77209. this.setPageLink(pageCounts);
  77210. }
  77211. this.rootContainer = container;
  77212. }
  77213. /**---------以下是页面相关操作 **/
  77214. /**
  77215. * @function PaginationContainer.prototype.setContent
  77216. * @description 设置页面内容。
  77217. * @param {HTMLElement} element - 页面内容元素。
  77218. */
  77219. setContent(element) {
  77220. this.clearContent();
  77221. this.appendContent(element);
  77222. }
  77223. /**
  77224. * @function PaginationContainer.prototype.appendContent
  77225. * @description 追加内容。
  77226. * @param {HTMLElement} element - 页面内容元素。
  77227. */
  77228. appendContent(element) {
  77229. this.content.appendChild(element);
  77230. }
  77231. /**
  77232. * @function PaginationContainer.prototype.clearContent
  77233. * @description 清空内容元素。
  77234. */
  77235. clearContent() {
  77236. for (let i = this.content.children.length - 1; i >= 0; i--) {
  77237. this.content.removeChild(this.content.children[i]);
  77238. }
  77239. }
  77240. /** -----以下是页码相关的操作:**/
  77241. /**
  77242. * @function PaginationContainer.prototype.setPageLink
  77243. * @description 设置页码数。
  77244. * @param {number} pageNumber - 页码数。
  77245. */
  77246. setPageLink(pageNumber) {
  77247. //清空当前页码
  77248. this.pageNumberLis = [];
  77249. this.currentPageNumberLis = [];
  77250. this.clearPageLink();
  77251. //创建页码
  77252. this._createPageLi(pageNumber);
  77253. //添加页码到页码列表
  77254. this._appendPageLink();
  77255. }
  77256. /**
  77257. * @description 创建页码。
  77258. * @param pageNumber
  77259. * @private
  77260. */
  77261. _createPageLi(pageNumber) {
  77262. for (let i = 0; i < pageNumber; i++) {
  77263. const pageLi = document.createElement("li");
  77264. pageLi.innerHTML = i + 1;
  77265. /*const liContent = document.createElement("span");
  77266. liContent.innerHTML = i + 1;*/
  77267. // pageLi.appendChild(liContent);
  77268. this.pageNumberLis.push(pageLi);
  77269. }
  77270. this.pageNumberLis[0].setAttribute("class", "active");
  77271. this.currentPage = 1;
  77272. if (pageNumber < 5) {
  77273. this.currentPageNumberLis = this.pageNumberLis;
  77274. } else {
  77275. for (let i = 0; i < 5; i++) {
  77276. this.currentPageNumberLis.push(this.pageNumberLis[i]);
  77277. }
  77278. }
  77279. }
  77280. /**
  77281. * @description 添加页码到页码列表。
  77282. * @private
  77283. */
  77284. _appendPageLink() {
  77285. //todo 如何插入中间
  77286. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  77287. this.link.insertBefore(this.currentPageNumberLis[i], this.link.childNodes[this.link.children.length - 2]);
  77288. }
  77289. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  77290. //清空 active 状态
  77291. this.currentPageNumberLis[i].setAttribute("class", "");
  77292. //给当前选中的 li 赋值 active 状态
  77293. if (Number(this.currentPageNumberLis[i].innerHTML) === this.currentPage) {
  77294. this.currentPageNumberLis[i].setAttribute("class", "active");
  77295. }
  77296. }
  77297. //根据 currentPage 改变按钮状态
  77298. this._changeDisableState();
  77299. if (this.linkageEvent) {
  77300. this.linkageEvent(this.currentPage);
  77301. }
  77302. }
  77303. /**
  77304. * @function PaginationContainer.prototype.clearPageLink
  77305. * @description 清除页码列表。
  77306. */
  77307. clearPageLink() {
  77308. for (let i = this.link.children.length - 3; i > 1; i--) {
  77309. this.link.removeChild(this.link.children[i]);
  77310. }
  77311. }
  77312. /**
  77313. * @description 创建页码按钮。
  77314. * @param ul
  77315. * @private
  77316. */
  77317. _createLink(ul) {
  77318. for (let i = 0; i < 4; i++) {
  77319. const li = document.createElement("li");
  77320. li.setAttribute("class", "disable");
  77321. const liContent = document.createElement("span");
  77322. li.appendChild(liContent);
  77323. if (i === 0) {
  77324. liContent.id = "first";
  77325. liContent.setAttribute("class", "supermapol-icons-first");
  77326. } else if (i === 1) {
  77327. liContent.id = "prev";
  77328. liContent.setAttribute("class", "supermapol-icons-prev");
  77329. } else if (i === 2) {
  77330. liContent.id = "next";
  77331. liContent.setAttribute("class", "supermapol-icons-next");
  77332. } else if (i === 3) {
  77333. liContent.id = "last";
  77334. liContent.setAttribute("class", "supermapol-icons-last");
  77335. }
  77336. ul.appendChild(li);
  77337. }
  77338. }
  77339. /**
  77340. * @description 点击页码事件。
  77341. * @param e
  77342. * @private
  77343. */
  77344. _changePageEvent(e) {
  77345. //todo
  77346. const trigger = e.target;
  77347. //若列表禁用,点击无效
  77348. if (trigger.parentElement.classList[0] === "disable") {
  77349. return;
  77350. }
  77351. let targetLi;
  77352. if (trigger.id) {
  77353. targetLi = trigger.id;
  77354. } else if (Number(trigger.innerHTML)) {
  77355. targetLi = Number(trigger.innerHTML);
  77356. } else {
  77357. return;
  77358. }
  77359. //页码预处理:
  77360. this._prePageNum(targetLi);
  77361. //根据 currentPageNumberLis 创建页码列表
  77362. this.clearPageLink();
  77363. this._appendPageLink();
  77364. }
  77365. /**
  77366. * @description 根据 currentPage 改变按钮状态。
  77367. * @private
  77368. */
  77369. _changeDisableState() {
  77370. this.link.children[0].setAttribute("class", "");
  77371. this.link.children[1].setAttribute("class", "");
  77372. this.link.children[this.link.children.length - 1].setAttribute("class", "");
  77373. this.link.children[this.link.children.length - 2].setAttribute("class", "");
  77374. if (this.currentPage === 1) {
  77375. this.link.children[0].setAttribute("class", "disable");
  77376. this.link.children[1].setAttribute("class", "disable");
  77377. }
  77378. if (this.currentPage === this.pageNumberLis.length) {
  77379. this.link.children[this.link.children.length - 1].setAttribute("class", "disable");
  77380. this.link.children[this.link.children.length - 2].setAttribute("class", "disable");
  77381. }
  77382. }
  77383. /**
  77384. * @description 根据点击页码列表事件准备需展现的页码列表。
  77385. * @param {string|number} targetLi - 被点击的列表对象 id 或 被点击的页码值。
  77386. * @private
  77387. */
  77388. _prePageNum(targetLi) {
  77389. const currentPageNumberLis = [];
  77390. if (targetLi === "first") {
  77391. this.currentPage = 1;
  77392. } else if (targetLi === "last") {
  77393. this.currentPage = this.pageNumberLis.length;
  77394. } else if (targetLi === "prev") {
  77395. this.currentPage = this.currentPage - 1;
  77396. } else if (targetLi === "next") {
  77397. this.currentPage = this.currentPage + 1;
  77398. } else {
  77399. this.currentPage = targetLi;
  77400. }
  77401. if (this.pageNumberLis.length <= 5) {
  77402. for (let i = 0; i < this.pageNumberLis.length; i++) {
  77403. currentPageNumberLis.push(this.pageNumberLis[i]);
  77404. }
  77405. } else {
  77406. //当前点击前三,都取前五
  77407. if (this.currentPage <= 3) {
  77408. for (let i = 0; i < 5; i++) {
  77409. currentPageNumberLis.push(this.pageNumberLis[i]);
  77410. }
  77411. } else if (this.currentPage >= this.pageNumberLis.length - 3) {
  77412. //点击后三,都取后5
  77413. for (let i = this.pageNumberLis.length - 5; i < this.pageNumberLis.length; i++) {
  77414. currentPageNumberLis.push(this.pageNumberLis[i]);
  77415. }
  77416. } else {
  77417. //其他,取中间:
  77418. for (let i = this.currentPage - 3; i <= this.currentPage + 1; i++) {
  77419. currentPageNumberLis.push(this.pageNumberLis[i]);
  77420. }
  77421. }
  77422. }
  77423. if (currentPageNumberLis.length > 0) {
  77424. this.currentPageNumberLis = currentPageNumberLis;
  77425. }
  77426. }
  77427. }
  77428. ;// CONCATENATED MODULE: ./src/common/components/util/Util.js
  77429. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  77430. * This program are made available under the terms of the Apache License, Version 2.0
  77431. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77432. /**
  77433. * @name ComponentsUtil
  77434. * @namespace
  77435. * @category BaseTypes Util
  77436. * @description 获取文件类型工具类。
  77437. * @usage
  77438. * ```
  77439. * // 浏览器
  77440. * <script type="text/javascript" src="{cdn}"></script>
  77441. * <script>
  77442. * const result = {namespace}.ComponentsUtil.getFileType(fileName);
  77443. *
  77444. * </script>
  77445. * // ES6 Import
  77446. * import { ComponentsUtil } from '{npm}';
  77447. *
  77448. * const result = ComponentsUtil.getFileType(fileName);
  77449. * ```
  77450. */
  77451. let ComponentsUtil = {
  77452. /**
  77453. * @function ComponentsUtil.getFileType
  77454. * @description 获取上传文件类型。
  77455. * @param {string} fileName - 文件名称。
  77456. */
  77457. getFileType(fileName) {
  77458. let regCSV = /^.*\.(?:csv)$/i;
  77459. let regExcel = /^.*\.(?:xls|xlsx)$/i; //文件名可以带空格
  77460. let regGeojson = /^.*\.(?:geojson|json)$/i;
  77461. if (regExcel.test(fileName)) { //校验不通过
  77462. return CommonTypes_FileTypes.EXCEL;
  77463. } else if (regCSV.test(fileName)) {
  77464. return CommonTypes_FileTypes.CSV;
  77465. } else if (regGeojson.test(fileName)) {
  77466. return CommonTypes_FileTypes.GEOJSON;
  77467. }
  77468. return null;
  77469. }
  77470. };
  77471. ;// CONCATENATED MODULE: ./src/common/components/util/index.js
  77472. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  77473. * This program are made available under the terms of the Apache License, Version 2.0
  77474. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77475. ;// CONCATENATED MODULE: ./src/common/components/index.js
  77476. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  77477. * This program are made available under the terms of the Apache License, Version 2.0
  77478. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77479. //数据
  77480. //组件
  77481. //提示框组件
  77482. //图表组件
  77483. //公用模板:
  77484. //工具类
  77485. ;// CONCATENATED MODULE: ./src/common/lang/index.js
  77486. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  77487. * This program are made available under the terms of the Apache License, Version 2.0
  77488. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77489. // EXTERNAL MODULE: ./node_modules/lodash.uniqby/index.js
  77490. var lodash_uniqby = __webpack_require__(618);
  77491. var lodash_uniqby_default = /*#__PURE__*/__webpack_require__.n(lodash_uniqby);
  77492. ;// CONCATENATED MODULE: ./src/common/overlay/knowledge-graph/format.js
  77493. function transformGraphMap(data, graphMap) {
  77494. const style = graphMap && graphMap.styles && graphMap.styles.style;
  77495. const captionField = graphMap && graphMap.captionFields && graphMap.captionFields.captionField;
  77496. const rst = { nodes: [], edges: [] };
  77497. data.forEach((item) => {
  77498. const pathData = item.path;
  77499. if (pathData) {
  77500. const { nodes, edges } = transformPath(pathData, style, captionField);
  77501. rst.nodes.push(...nodes);
  77502. rst.edges.push(...edges);
  77503. } else if (isEdge(item)) {
  77504. const edge = edgeFromGraphMap(item, style);
  77505. rst.edges.push(edge);
  77506. } else {
  77507. const node = nodeFromGraphMap(item, style, captionField);
  77508. rst.nodes.push(node);
  77509. }
  77510. });
  77511. return { nodes: uniqData(rst.nodes), edges: uniqData(rst.edges, 'edgeId') };
  77512. }
  77513. function uniqData(data, paramName = 'id') {
  77514. return lodash_uniqby_default()(data, paramName);
  77515. }
  77516. function isEdge(entity) {
  77517. return entity.hasOwnProperty('start') && entity.hasOwnProperty('end');
  77518. }
  77519. function transformPath(pathData, style, captionField) {
  77520. const rst = { nodes: [], edges: [] };
  77521. pathData.forEach((item) => {
  77522. if (isEdge(item)) {
  77523. const edge = edgeFromGraphMap(item, style);
  77524. rst.edges.push(edge);
  77525. } else {
  77526. const node = nodeFromGraphMap(item, style, captionField);
  77527. rst.nodes.push(node);
  77528. }
  77529. });
  77530. return rst;
  77531. }
  77532. function nodeFromGraphMap(entity, style, captionField) {
  77533. const { id, properties, lables } = entity;
  77534. const styleData = style ? getNodeStyle(entity, style) : {};
  77535. const label = getNodeLabel(entity, captionField);
  77536. const fillColor = styleData.fillColor || '';
  77537. const node = {
  77538. id: id + '',
  77539. label: label,
  77540. properties,
  77541. lables
  77542. };
  77543. if (styleData.size) {
  77544. node.size = styleData.size;
  77545. delete styleData.size;
  77546. }
  77547. if (styleData.fillColor) {
  77548. node.style = {
  77549. fill: fillColor,
  77550. stroke: fillColor
  77551. };
  77552. delete styleData.fillColor;
  77553. }
  77554. if (Object.keys(styleData).length !== 0) {
  77555. node.labelCfg = {
  77556. style: styleData
  77557. };
  77558. }
  77559. return node;
  77560. }
  77561. function edgeFromGraphMap(entity, style) {
  77562. const { start, end, id, type, properties } = entity;
  77563. const styleData = style ? getEdgeStyle(entity, style) : {};
  77564. return {
  77565. source: start + '',
  77566. target: end + '',
  77567. edgeId: id + '',
  77568. label: type,
  77569. labelCfg: {
  77570. style: styleData
  77571. },
  77572. properties
  77573. };
  77574. }
  77575. function getEdgeStyle(entity, style) {
  77576. if (!style) {
  77577. return {};
  77578. }
  77579. const { id, type } = entity;
  77580. const data = style.filter((item) => item.type === 'relationShip');
  77581. for (let i = 0; i < data.length; i++) {
  77582. const { textColor, font, relationTypes, relationIds } = data[i];
  77583. const ids = JSON.parse(relationIds || '[]');
  77584. const types = JSON.parse(relationTypes || '[]');
  77585. if (ids.includes(id) || types.includes(type)) {
  77586. return {
  77587. fontSize: compileFontSize(font.fontSize),
  77588. fontFamily: font.fontName,
  77589. fill: textColor,
  77590. ...formatFontStyle(font.fontStyle)
  77591. };
  77592. }
  77593. }
  77594. return {};
  77595. }
  77596. function getNodeStyle(entity, style) {
  77597. if (!style) {
  77598. return {};
  77599. }
  77600. const { id, labels } = entity;
  77601. const data = style.filter((item) => item.type === 'entity');
  77602. for (let i = 0; i < data.length; i++) {
  77603. const { color, textColor, font, size, entityTypes, entityIds } = data[i];
  77604. const ids = JSON.parse(entityIds || '[]');
  77605. const types = JSON.parse(entityTypes || '[]');
  77606. if (ids.includes(id) || types.includes(labels[0])) {
  77607. return {
  77608. fillColor: color,
  77609. fontSize: compileFontSize(font.fontSize),
  77610. fontFamily: font.fontName,
  77611. fill: textColor,
  77612. size: size,
  77613. // stroke: color,
  77614. ...formatFontStyle(font.fontStyle)
  77615. };
  77616. }
  77617. }
  77618. return {};
  77619. }
  77620. function getNodeLabel(entity, captionField) {
  77621. const { id, labels, properties } = entity;
  77622. if (captionField) {
  77623. const data = captionField instanceof Array ? captionField : [captionField];
  77624. for (let i = 0; i < data.length; i++) {
  77625. const { name, entityTypes, entityIds } = data[i];
  77626. const ids = JSON.parse(entityIds || '[]');
  77627. const types = JSON.parse(entityTypes || '[]');
  77628. if (ids.includes(id) || types.includes(labels[0])) {
  77629. return properties[name] || '';
  77630. }
  77631. }
  77632. }
  77633. return properties[properties._labelfieldname] || '';
  77634. }
  77635. function formatFontStyle(fontStyle) {
  77636. if (fontStyle === 1) {
  77637. return { fontWeight: 600 };
  77638. }
  77639. if (fontStyle === 2) {
  77640. return { fontStyle: 'italic' };
  77641. }
  77642. return {};
  77643. }
  77644. function compileFontSize(fontSize) {
  77645. return fontSize * 0.8;
  77646. }
  77647. // 处理graphMap数据的展开 折叠 隐藏的实体数据
  77648. function transformExpandCollapseHiddenData(graphMap) {
  77649. const { expand, collapse, hidden } = graphMap.dataContent;
  77650. return {
  77651. expand: expand && JSON.parse(expand),
  77652. collapse: collapse && JSON.parse(collapse),
  77653. hidden: hidden && JSON.parse(hidden)
  77654. };
  77655. }
  77656. ;// CONCATENATED MODULE: external "function(){try{return G6}catch(e){return {}}}()"
  77657. const external_function_try_return_G6_catch_e_return_namespaceObject = function(){try{return G6}catch(e){return {}}}();
  77658. var external_function_try_return_G6_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_G6_catch_e_return_namespaceObject);
  77659. // EXTERNAL MODULE: ./node_modules/insert-css/index.js
  77660. var insert_css = __webpack_require__(186);
  77661. var insert_css_default = /*#__PURE__*/__webpack_require__.n(insert_css);
  77662. ;// CONCATENATED MODULE: ./src/common/overlay/knowledge-graph/G6Render.js
  77663. /**
  77664. * @private
  77665. * @class G6Render
  77666. * @category iServer G6Render
  77667. * @classdesc G6Render
  77668. * @param {KnowledgeGraph.Data} data - 创建graph实例的数据项。
  77669. * @param {KnowledgeGraph.Config} [config] - 创建graph实例的配置项。
  77670. * @private
  77671. */
  77672. class G6Render {
  77673. constructor() {
  77674. this.config = null;
  77675. this.graph = null;
  77676. this.data = null;
  77677. this.collpasedData = {};
  77678. this.importG6();
  77679. this.CLASS_NAME = 'SuperMap.G6Render';
  77680. }
  77681. importG6() {
  77682. if (!(external_function_try_return_G6_catch_e_return_default())) {
  77683. console.log('please import g6, eg:https://gw.alipayobjects.com/os/lib/antv/g6/4.3.2/dist/g6.min.js');
  77684. }
  77685. }
  77686. /**
  77687. * @function G6Render.prototype.initGraph
  77688. * @description 创建KnowledgeGraph实例
  77689. * @param {KnowledgeGraph.Config} config - graph配置项。
  77690. * @returns {Object} graph实例。
  77691. */
  77692. initGraph(config) {
  77693. const graph = new (external_function_try_return_G6_catch_e_return_default()).Graph(config);
  77694. this.graph = graph;
  77695. if (!config || config.highlightNode !== false) {
  77696. this.highlightNode(graph);
  77697. }
  77698. if (!config || config.highlightEdge !== false) {
  77699. this.highlightEdge(graph);
  77700. }
  77701. if (config.dragCanvas !== false || config.dragNode !== false) {
  77702. // 阻止事件冒泡
  77703. this.stopDefaultEventPropagation();
  77704. }
  77705. return graph;
  77706. }
  77707. _getContextMenu() {
  77708. const contextMenu = new (external_function_try_return_G6_catch_e_return_default()).Menu({
  77709. shouldBegin(evt) {
  77710. if (evt.target && evt.target.isCanvas && evt.target.isCanvas()) {
  77711. return true;
  77712. }
  77713. if (evt.item) {
  77714. return true;
  77715. }
  77716. return false;
  77717. },
  77718. getContent: (evt) => {
  77719. const { item } = evt;
  77720. if (evt.target && evt.target.isCanvas && evt.target.isCanvas()) {
  77721. return;
  77722. }
  77723. if (!item) {
  77724. return;
  77725. }
  77726. const itemType = item.getType();
  77727. const model = item.getModel();
  77728. if (itemType && model) {
  77729. if (itemType === 'node') {
  77730. if (this.isCollpased(model.id)) {
  77731. return `<ul>
  77732. <li id='expand'>展开</li>
  77733. <li id='hide'>隐藏</li>
  77734. </ul>`;
  77735. } else {
  77736. return `<ul>
  77737. <li id='collapse'>折叠</li>
  77738. <li id='hide'>隐藏</li>
  77739. </ul>`;
  77740. }
  77741. }
  77742. }
  77743. },
  77744. handleMenuClick: (target, item) => {
  77745. const liIdStrs = target.id.split('-');
  77746. switch (liIdStrs[0]) {
  77747. case 'hide':
  77748. this.hideItem(item);
  77749. break;
  77750. case 'expand':
  77751. this.expandNode(item);
  77752. break;
  77753. case 'collapse':
  77754. this.collapseNode(item);
  77755. break;
  77756. case 'show':
  77757. this.showItem(item);
  77758. break;
  77759. default:
  77760. break;
  77761. }
  77762. },
  77763. // 需要加上父级容器的 padding-left 16 与自身偏移量 10
  77764. offsetX: 16 + 10,
  77765. // 需要加上父级容器的 padding-top 24 、画布兄弟元素高度、与自身偏移量 10
  77766. offsetY: 0,
  77767. // 在哪些类型的元素上响应
  77768. itemTypes: ['node', 'edge', 'canvas']
  77769. });
  77770. return contextMenu;
  77771. }
  77772. _getGraphConfig(config) {
  77773. const animateConfig = {
  77774. speed: 120,
  77775. maxIteration: 83,
  77776. tick: () => {
  77777. this.refreshPositions()
  77778. }
  77779. };
  77780. const defaultLayout = {
  77781. type: 'fruchterman',
  77782. gravity: 5
  77783. };
  77784. const defaultNode = {};
  77785. const defaultEdge = {
  77786. type: 'line',
  77787. style: {
  77788. endArrow: {
  77789. path: 'M 0,0 L 2,1 L 2,-1 Z'
  77790. },
  77791. lineWidth: 0.5
  77792. },
  77793. labelCfg: {
  77794. autoRotate: true,
  77795. style: {
  77796. fontSize: 4,
  77797. fill: '#333'
  77798. }
  77799. }
  77800. };
  77801. const defaultMode = {
  77802. default: ['drag-canvas', 'zoom-canvas', 'drag-node']
  77803. };
  77804. const contextMenu = this._getContextMenu();
  77805. const defaultPlugins = [new (external_function_try_return_G6_catch_e_return_default()).ToolBar(), contextMenu];
  77806. const hoverColor = '#b4d6ff';
  77807. const defaultNodeHighlightStyle = {
  77808. lineWidth: 3,
  77809. stroke: hoverColor
  77810. };
  77811. const defaultEdgeHighlightStyle = {
  77812. stroke: hoverColor,
  77813. lineWidth: 2,
  77814. endArrow: {
  77815. path: 'M 0,0 L 2,1 L 2,-1 Z',
  77816. fill: hoverColor
  77817. }
  77818. };
  77819. const defaultGraphConfig = (container = 'knowledgeGraph') => {
  77820. const dom = document.querySelector(`#${container}`);
  77821. return {
  77822. container: container, // String | HTMLElement,必须,在 Step 1 中创建的容器 id 或容器本身
  77823. width: dom.scrollWidth, // Number,必须,图的宽度
  77824. height: dom.scrollHeight, // Number,必须,图的高度
  77825. plugins: defaultPlugins,
  77826. modes: defaultMode,
  77827. layout: { ...defaultLayout, ...animateConfig },
  77828. defaultNode,
  77829. defaultEdge,
  77830. nodeStateStyles: {
  77831. hover: defaultNodeHighlightStyle
  77832. },
  77833. edgeStateStyles: {
  77834. hover: defaultEdgeHighlightStyle
  77835. }
  77836. };
  77837. };
  77838. if (!config) {
  77839. this._setToolBarStyle();
  77840. return defaultGraphConfig();
  77841. }
  77842. config.container = config.container || 'knowledgeGraph';
  77843. const dom =
  77844. typeof config.container === 'string' ? document.querySelector(`#${config.container}`) : config.container;
  77845. config.width = config.width || dom.scrollWidth;
  77846. config.height = config.height || dom.scrollHeight;
  77847. config.layout = { ...defaultLayout, ...(config.layout || {}), ...(config.animate !== false ? animateConfig : {}) };
  77848. config.defaultNode = { ...defaultNode, ...(config.defaultNode || {}) };
  77849. config.defaultEdge = { ...defaultEdge, ...(config.defaultEdge || {}) };
  77850. config.modes = {
  77851. default: [
  77852. config.dragCanvas !== false && 'drag-canvas',
  77853. config.zoomCanvas !== false && 'zoom-canvas',
  77854. config.dragNode !== false && 'drag-node'
  77855. ]
  77856. };
  77857. config.nodeStateStyles = {
  77858. hover: { ...defaultNodeHighlightStyle, ...(config.nodeHighlightStyle || {}) }
  77859. };
  77860. config.edgeStateStyles = {
  77861. hover: { ...defaultEdgeHighlightStyle, ...(config.edgeHighlightStyle || {}) }
  77862. };
  77863. if (config.showToolBar !== false) {
  77864. config.plugins = [new (external_function_try_return_G6_catch_e_return_default()).ToolBar()];
  77865. this._setToolBarStyle();
  77866. }
  77867. if (config.showContextMenu !== false) {
  77868. config.plugins = [...(config.plugins || []), contextMenu];
  77869. this._setToolBarStyle();
  77870. }
  77871. return config;
  77872. }
  77873. /**
  77874. * @function KnowledgeGraph.prototype.changeSize
  77875. * @description 当源数据中现有节点/边 的数据项发生配置的变更时,根据新数据刷新视图。
  77876. * @param {number} width - 宽度。
  77877. * @param {number} height - 高度。
  77878. */
  77879. changeSize(width, height) {
  77880. return this.graph.changeSize(width, height);
  77881. }
  77882. /**
  77883. * @function G6Render.prototype.autoResize
  77884. * @description 浏览器窗口大小发生改变时,重新渲染;
  77885. */
  77886. autoResize() {
  77887. const dom = this.getContainer();
  77888. window.addEventListener('resize', () => {
  77889. const width = dom.scrollWidth;
  77890. const height = dom.scrollHeight;
  77891. this.graph.changeSize(width, height);
  77892. this.graph.refresh();
  77893. });
  77894. }
  77895. /**
  77896. * @function G6Render.prototype.zoom
  77897. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  77898. * @param {number} ratio 缩放比例。
  77899. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  77900. * @param {boolean} [animate] 是否开启动画。
  77901. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  77902. */
  77903. zoom(ratio, center, animate, animateCfg) {
  77904. this.graph.zoom(ratio, center, animate, animateCfg);
  77905. }
  77906. /**
  77907. * @function G6Render.prototype.zoomTo
  77908. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  77909. * @param {number} ratio 缩放比例。
  77910. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  77911. * @param {boolean} [animate] 是否开启动画。
  77912. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  77913. */
  77914. zoomTo(ratio, center, animate, animateCfg) {
  77915. this.graph.zoomTo(ratio, center, animate, animateCfg);
  77916. }
  77917. /**
  77918. * @function G6Render.prototype.fitView
  77919. * @description 让画布内容适应视口。
  77920. * @param {Array.<number>|number} [padding] [top, right, bottom, left] 四个方向上的间距值。
  77921. * @param {Object} [rules] fitView 的规则,参数如下:{ onlyOutOfViewPort?: boolean; direction?: 'x' / 'y' / 'both'; ratioRule?: 'max' / 'min}。
  77922. * @param {boolean} [animate] 是否开启动画。
  77923. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  77924. */
  77925. fitView(padding, rules, animate, animateCfg) {
  77926. this.graph.fitView(padding, rules, animate, animateCfg);
  77927. }
  77928. /**
  77929. * @function G6Render.prototype.fitCenter
  77930. * @description 平移图到中心将对齐到画布中心,但不缩放。优先级低于 fitView。
  77931. * @param {boolean} [animate] 是否开启动画。
  77932. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画,参见基础动画教程。若未配置,则跟随 graph 的 animateCfg 参数。
  77933. */
  77934. fitCenter(animate, animateCfg) {
  77935. this.graph.fitCenter(animate, animateCfg);
  77936. }
  77937. /**
  77938. * @function G6Render.prototype.getGraphCenterPoint
  77939. * @description 获取图内容的中心绘制坐标。
  77940. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  77941. */
  77942. getGraphCenterPoint() {
  77943. return this.graph.getGraphCenterPoint();
  77944. }
  77945. /**
  77946. * @function G6Render.prototype.getViewPortCenterPoint
  77947. * @description 获取视口中心绘制坐标。
  77948. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  77949. */
  77950. getViewPortCenterPoint() {
  77951. return this.graph.getViewPortCenterPoint();
  77952. }
  77953. /**
  77954. * @function G6Render.prototype.getZoom
  77955. * @description 获取当前视口的缩放比例。
  77956. * @return {number} 返回值表示当前视口的缩放比例, 默认值为 1。
  77957. */
  77958. getZoom() {
  77959. return this.graph.getZoom();
  77960. }
  77961. /**
  77962. * @function G6Render.prototype.getMinZoom
  77963. * @description 获取 graph 当前允许的最小缩放比例。
  77964. * @return {number} 返回值表示当前视口的最小缩放比例。
  77965. */
  77966. getMinZoom() {
  77967. return this.graph.getMinZoom();
  77968. }
  77969. /**
  77970. * @function G6Render.prototype.setMinZoom
  77971. * @description 设置 graph 当前允许的最小缩放比例。
  77972. * @param {number} ratio 缩放比例。
  77973. */
  77974. setMinZoom(ratio) {
  77975. this.graph.setMinZoom(ratio);
  77976. }
  77977. /**
  77978. * @function G6Render.prototype.getMaxZoom
  77979. * @description 获取 graph 当前允许的最大缩放比例。
  77980. * @return {number} 返回值表示当前视口的最大缩放比例。
  77981. */
  77982. getMaxZoom() {
  77983. return this.graph.getMaxZoom();
  77984. }
  77985. /**
  77986. * @function G6Render.prototype.setMaxZoom
  77987. * @description 设置 graph 当前允许的最大缩放比例。
  77988. * @param {number} ratio 缩放比例。
  77989. */
  77990. setMaxZoom(ratio) {
  77991. this.graph.setMaxZoom(ratio);
  77992. }
  77993. /**
  77994. * @function G6Render.prototype.getWidth
  77995. * @description获取 graph 当前的宽度。
  77996. * @return {number} graph 当前的宽度。
  77997. */
  77998. getWidth() {
  77999. return this.graph.getWidth();
  78000. }
  78001. /**
  78002. * @function G6Render.prototype.getHeight
  78003. * @description 获取 graph 当前的高度。
  78004. * @return {number} graph 当前的高度。
  78005. */
  78006. getHeight() {
  78007. return this.graph.getHeight();
  78008. }
  78009. setCenter(centerDrawPoint) {
  78010. var centerCanvasPointX = this.graph.getWidth() / 2;
  78011. var centerCanvasPointY = this.graph.getHeight() / 2;
  78012. var centerCanvasPointNew = this.graph.getCanvasByPoint(centerDrawPoint.x, centerDrawPoint.y);
  78013. this.graph.translate(centerCanvasPointX - centerCanvasPointNew.x, centerCanvasPointY - centerCanvasPointNew.y);
  78014. }
  78015. /**
  78016. * @function G6Render.prototype._setToolBarStyle
  78017. * @description 隐藏工具栏的redo undo realZoom按钮
  78018. * @private
  78019. */
  78020. _setToolBarStyle() {
  78021. insert_css_default()(`
  78022. .g6-component-toolbar li[code='redo'],
  78023. .g6-component-toolbar li[code='undo'],
  78024. .g6-component-toolbar li[code='realZoom'] {
  78025. display: none;
  78026. }
  78027. .g6-component-contextmenu {
  78028. position: absolute;
  78029. z-index: 2;
  78030. list-style-type: none;
  78031. border-radius: 6px;
  78032. font-size: 14px;
  78033. width: fit-content;
  78034. transition: opacity .2s;
  78035. text-align: center;
  78036. box-shadow: 0 5px 18px 0 rgba(0, 0, 0, 0.6);
  78037. border: 0px;
  78038. }
  78039. .g6-component-contextmenu ul {
  78040. padding-left: 0px;
  78041. margin: 0;
  78042. }
  78043. .g6-component-contextmenu li {
  78044. cursor: pointer;
  78045. list-style-type: none;
  78046. list-style: none;
  78047. margin-left: 0;
  78048. line-height: 38px;
  78049. padding: 0px 35px;
  78050. }
  78051. .g6-component-contextmenu li:hover {
  78052. color: #333;
  78053. background: #aaaaaa45;
  78054. }
  78055. `);
  78056. }
  78057. /**
  78058. * @function G6Render.prototype.highlightNode
  78059. * @description 鼠标移入节点,节点高亮
  78060. * @param {Object} graph - graph实例。
  78061. */
  78062. highlightNode(graph = this.graph) {
  78063. function clearAllStats() {
  78064. graph.setAutoPaint(false);
  78065. graph.getNodes().forEach(function (node) {
  78066. graph.clearItemStates(node);
  78067. });
  78068. graph.paint();
  78069. graph.setAutoPaint(true);
  78070. }
  78071. graph.on('node:mouseenter', function (e) {
  78072. const item = e.item;
  78073. graph.setAutoPaint(false);
  78074. graph.getNodes().forEach(function (node) {
  78075. graph.clearItemStates(node);
  78076. });
  78077. graph.setItemState(item, 'hover', true);
  78078. graph.paint();
  78079. graph.setAutoPaint(true);
  78080. });
  78081. graph.on('node:mouseleave', clearAllStats);
  78082. }
  78083. /**
  78084. * @function G6Render.prototype.highlightNode
  78085. * @description 鼠标移入节点,节点高亮
  78086. * @param {Object} graph - graph实例。
  78087. */
  78088. highlightEdge(graph = this.graph) {
  78089. function clearAllStats() {
  78090. graph.setAutoPaint(false);
  78091. graph.getEdges().forEach(function (edge) {
  78092. graph.clearItemStates(edge);
  78093. });
  78094. graph.paint();
  78095. graph.setAutoPaint(true);
  78096. }
  78097. graph.on('edge:mouseenter', function (e) {
  78098. const item = e.item;
  78099. graph.setAutoPaint(false);
  78100. graph.getNodes().forEach(function (node) {
  78101. graph.clearItemStates(node);
  78102. });
  78103. graph.setItemState(item, 'hover', true);
  78104. graph.paint();
  78105. graph.setAutoPaint(true);
  78106. });
  78107. graph.on('edge:mouseleave', clearAllStats);
  78108. }
  78109. /**
  78110. * @function G6Render.prototype.setData
  78111. * @description 设置数据
  78112. * @param {KnowledgeGraph.Data} data - graph数据。
  78113. * @param {Object} [graph] - graph实例。
  78114. */
  78115. setData(data, graph = this.graph) {
  78116. if (!this.data) {
  78117. graph.data(data);
  78118. } else {
  78119. graph.changeData(data);
  78120. }
  78121. this.data = data;
  78122. }
  78123. /**
  78124. * @function G6Render.prototype.render
  78125. * @description 根据提供的数据渲染视图。
  78126. */
  78127. render(graph = this.graph) {
  78128. return graph.render();
  78129. }
  78130. /**
  78131. * @function G6Render.prototype.updateGraph
  78132. * @description 更新数据
  78133. * @param {Object} graph - graph实例。
  78134. * @param {KnowledgeGraph.Data} data - graph数据。
  78135. */
  78136. updateGraph(data, graph = this.graph) {
  78137. this.data = data;
  78138. graph.changeData(data);
  78139. }
  78140. /**
  78141. * @function G6Render.prototype.refresh
  78142. * @description 当源数据中现有节点/边的数据项发生配置的变更时,根据新数据刷新视图。
  78143. * @param {Object} graph - graph实例。
  78144. */
  78145. refresh(graph = this.graph) {
  78146. graph.refresh();
  78147. }
  78148. /**
  78149. * @function G6Render.prototype.getContainer
  78150. * @description 获取 Graph 的 DOM 容器。
  78151. * @param {Object} graph - graph实例。
  78152. * @return {HTMLElement} DOM 容器。
  78153. */
  78154. getContainer(graph = this.graph) {
  78155. return graph.getContainer();
  78156. }
  78157. /**
  78158. * @function G6Render.prototype.getCanvas
  78159. * @description 获取canvas。
  78160. * @param {Object} graph - graph实例。
  78161. * @return {HTMLElement} canvas。
  78162. */
  78163. getCanvas(graph = this.graph) {
  78164. return graph.get('canvas');
  78165. }
  78166. /**
  78167. * @function G6Render.prototype.getNodes
  78168. * @description 获取图中所有节点的实例。
  78169. * @param {Object} graph - graph实例。
  78170. * @return {Array} 返回值表示图中所有节点的实例。
  78171. */
  78172. getNodes(graph = this.graph) {
  78173. return graph.getNodes();
  78174. }
  78175. /**
  78176. * @function G6Render.prototype.getEdges
  78177. * @description 获取图中所有节点的实例。这里返回的是边的实例,而不是边的数据项。
  78178. * @param {Object} graph - graph实例。
  78179. * @return {Array} 返回值表示图中所有边的实例。
  78180. */
  78181. getEdges(graph = this.graph) {
  78182. return graph.getEdges();
  78183. }
  78184. /**
  78185. * @function G6Render.prototype.getNeighbors
  78186. * @description 获取邻居节点数组。
  78187. * @param {Object} graph - graph实例。
  78188. * @param {string | INode} node - 节点 ID 或节点实例。
  78189. * @param {string|undefined} type -['source'| 'target' |undefined] 邻居类型, 'source' 只获取当前节点的源节点,'target' 只获取当前节点指向的目标节点, 若不指定则返回所有类型的邻居。
  78190. * @return {Array} 返回值符合要求的节点数组。
  78191. */
  78192. getNeighbors(node, type, graph = this.graph) {
  78193. return graph.getNeighbors(node, type);
  78194. }
  78195. /**
  78196. * @function G6Render.prototype.findById
  78197. * @description 根据 ID,查询对应的元素实例。
  78198. * @param {Object} graph - graph实例。
  78199. * @param {string} id - 元素 ID
  78200. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  78201. */
  78202. findById(id, graph = this.graph) {
  78203. return graph.findById(id);
  78204. }
  78205. /**
  78206. * @function G6Render.prototype.find
  78207. * @description 获取邻居节点数组。
  78208. * @param {Object} graph - graph实例。
  78209. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  78210. * @param {Function} fn - 查找的规则。
  78211. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  78212. */
  78213. find(type, fn, graph = this.graph) {
  78214. return graph.find(type, fn);
  78215. }
  78216. /**
  78217. * @function G6Render.prototype.findAll
  78218. * @description 获取邻居节点数组。
  78219. * @param {Object} graph - graph实例。
  78220. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  78221. * @param {Function} fn - 查找的规则。
  78222. * @return {Object} 如果有符合规则的元素实例,则返回所有元素实例,否则返回 undefined。
  78223. */
  78224. findAll(type, fn, graph = this.graph) {
  78225. return graph.findAll(type, fn);
  78226. }
  78227. /**
  78228. * @function G6Render.prototype.getEdgesByNode
  78229. * @description 获取与当前节点有关联的所有边。
  78230. * @param {Object} node - node实例。
  78231. * @return {Array} edge实例数组。
  78232. */
  78233. getEdgesByNode(node) {
  78234. return node.getEdges();
  78235. }
  78236. /**
  78237. * @function G6Render.prototype.getEdgesByNode
  78238. * @description 获取与当前节点关联的所有入边。
  78239. * @param {Object} node - node实例。
  78240. * @return {Array} edge实例数组。
  78241. */
  78242. getInEdges(node) {
  78243. return node.getInEdges();
  78244. }
  78245. /**
  78246. * @function G6Render.prototype.getEdgesByNode
  78247. * @description 获取与当前节点关联的所有出边。
  78248. * @param {Object} node - node实例。
  78249. * @return {Array} edge实例数组。
  78250. */
  78251. getOutEdges(node) {
  78252. return node.getOutEdges();
  78253. }
  78254. /**
  78255. * @function G6Render.prototype.getSourceByEdge
  78256. * @description 获取当前边的起始节点
  78257. * @param {Object} edge - node实例。
  78258. * @return {Object} 返回值为起始节点的实例。
  78259. */
  78260. getSourceByEdge(edge) {
  78261. return edge.getSource();
  78262. }
  78263. /**
  78264. * @function G6Render.prototype.getTargetByEdge
  78265. * @description 获取当前边的终止节点。
  78266. * @param {Object} edge - node实例。
  78267. * @return {Object} 终止节点的实例。
  78268. */
  78269. getTargetByEdge(edge) {
  78270. return edge.getTarget();
  78271. }
  78272. /**
  78273. * @function G6Render.prototype.expandNode
  78274. * @description 展开当前节点。
  78275. * @param {Object} item - 元素 ID 或元素实例。
  78276. */
  78277. expandNode(item) {
  78278. const id = item.getModel().id;
  78279. this._expandCollapseNode(this.collpasedData[id], 'show');
  78280. delete this.collpasedData[id];
  78281. }
  78282. /**
  78283. * @function G6Render.prototype.collapseNode
  78284. * @description 收起当前节点。
  78285. * @param {Object} item - 元素 ID 或元素实例。
  78286. * @param {Object} graph - graph实例。
  78287. */
  78288. collapseNode(item) {
  78289. const id = item.getModel().id;
  78290. const result = [];
  78291. this._collapseFunc(item, result);
  78292. this.collpasedData[id] = result;
  78293. this._expandCollapseNode(result);
  78294. }
  78295. isCollpased(id) {
  78296. return !!this.collpasedData[id];
  78297. }
  78298. _collapseFunc(item, res = []) {
  78299. const sourceNodes = this.getNeighbors(item, 'target');
  78300. const targetNodes = this.getNeighbors(item, 'source');
  78301. // 指出节点, 如果没有其他链接,隐藏
  78302. for (let i = 0; i < sourceNodes.length; i++) {
  78303. const sourceNode = sourceNodes[i];
  78304. const model = sourceNode.getModel();
  78305. let nodes = this.getNeighbors(sourceNode);
  78306. // if (nodes && exceptNode) {
  78307. // nodes = nodes.filter((item) => item.id !== exceptNode);
  78308. // }
  78309. if (nodes.length === 1) {
  78310. res.push({ id: model.id });
  78311. }
  78312. }
  78313. // 指入节点, 如果没有其他链接或者没有指入节点隐藏,隐藏
  78314. for (let i = 0; i < targetNodes.length; i++) {
  78315. const targetNode = targetNodes[i];
  78316. const model = targetNode.getModel();
  78317. let nodes = this.getNeighbors(targetNode);
  78318. let targetNodeNodes = this.getNeighbors(targetNode, 'source');
  78319. // if (nodes && exceptNode) {
  78320. // nodes = nodes.filter((item) => item.id !== exceptNode);
  78321. // }
  78322. // if (targetNodeNodes && exceptNode) {
  78323. // targetNodeNodes = targetNodeNodes.filter((item) => item.id !== exceptNode);
  78324. // }
  78325. if (nodes.length === 1 || targetNodeNodes.length === 0) {
  78326. res.push({ id: model.id });
  78327. } else {
  78328. const result = [];
  78329. this._collapseFunc(targetNode, result);
  78330. res.push({ id: model.id, children: result });
  78331. }
  78332. }
  78333. return res;
  78334. }
  78335. _expandCollapseNode(data, type = 'hide') {
  78336. if (!data) {
  78337. return;
  78338. }
  78339. data.forEach((item) => {
  78340. if (type === 'hide') {
  78341. this.hideItem(item.id);
  78342. } else {
  78343. this.showItem(item.id);
  78344. // 如果是把之前的折叠也展开了, 就要把之前的折叠数据删除
  78345. if (this.isCollpased(item.id)) {
  78346. delete this.collpasedData[item.id];
  78347. }
  78348. }
  78349. if (item.children) {
  78350. this._expandCollapseNode(item.children, type);
  78351. }
  78352. });
  78353. }
  78354. /**
  78355. * @function G6Render.prototype.showItem
  78356. * @description 显示指定的元素。若 item 为节点,则相关边也会随之显示。而show() 则将只显示自身。
  78357. * @param {string|Object} item - 元素 ID 或元素实例。
  78358. * @param {boolean} [stack] - 操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  78359. * @param {Object} graph - graph实例。
  78360. */
  78361. showItem(item, stack, graph = this.graph) {
  78362. graph.showItem(item, stack);
  78363. }
  78364. /**
  78365. * @function G6Render.prototype.showItem
  78366. * @description 隐藏指定元素。若 item 为节点,则相关边也会随之隐藏。而 hide() 则将只隐藏自身。
  78367. * @param {string|Object} item - 元素 ID 或元素实例。
  78368. * @param {boolean} [stack] -操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  78369. * @param {Object} graph - graph实例。
  78370. */
  78371. hideItem(item, stack, graph = this.graph) {
  78372. graph.hideItem(item, stack);
  78373. }
  78374. /**
  78375. * @function G6Render.prototype.show
  78376. * @description 显示元素。只显示 item 自身,若需要在显示节点的同时显示相关边,应调用showItem(item)。
  78377. * @param {Object} item - 元素实例。
  78378. */
  78379. show(item) {
  78380. item.show();
  78381. }
  78382. /**
  78383. * @function G6Render.prototype.hide
  78384. * @description 隐藏元素。只隐藏 item 自身,若需要在隐藏节点的同时隐藏相关边,应调用 hideItem(item)。
  78385. * @param {Object} item - 元素实例。
  78386. */
  78387. hide(item) {
  78388. item.hide();
  78389. }
  78390. /**
  78391. * @function G6Render.prototype.changeVisibility
  78392. * @description 更改元素是否显示。
  78393. * @param {Object} item - 元素实例。
  78394. * @param {boolean} visible - 是否显示元素,true 为显示,false 为隐藏。
  78395. */
  78396. changeVisibility(item, visible) {
  78397. item.changeVisibility(visible);
  78398. }
  78399. /**
  78400. * @function G6Render.prototype.isVisible
  78401. * @description 查询元素显示状态。
  78402. * @param {Object} item - 元素实例。
  78403. * @return {boolean} - 返回值为 true,则表示当前元素处于显示状态,否则处于隐藏状态。
  78404. */
  78405. isVisible(item) {
  78406. return item.isVisible();
  78407. }
  78408. /**
  78409. * @function G6Render.prototype.getModel
  78410. * @description 获取元素的数据模型。
  78411. * @param {Object} item - 元素实例。
  78412. * @return {KnowledgeGraph.Data} - 返回值为节点的数据模型。
  78413. */
  78414. getModel(item) {
  78415. return item.getModel();
  78416. }
  78417. /**
  78418. * @function G6Render.prototype.addItem
  78419. * @description 新增元素(节点和边)。
  78420. * @param {Object} graph - graph实例。
  78421. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  78422. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  78423. */
  78424. addItem(type, model, graph = this.graph) {
  78425. graph.addItem(type, model);
  78426. }
  78427. /**
  78428. * @function G6Render.prototype.addItem
  78429. * @description 删除元素。
  78430. * @param {string|Object} item - 元素 ID 或元素实例
  78431. * @param {Object} graph - graph实例。
  78432. */
  78433. removeItem(item, graph = this.graph) {
  78434. graph.removeItem(item);
  78435. }
  78436. /**
  78437. * @function G6Render.prototype.updateItem
  78438. * @description 更新元素,包括更新数据、样式等。
  78439. * @param {Object} graph - graph实例。
  78440. * @param {string|Object} item - 元素 ID 或元素实例。
  78441. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  78442. */
  78443. updateItem(item, model, graph = this.graph) {
  78444. graph.updateItem(item, model);
  78445. }
  78446. /**
  78447. * @function G6Render.prototype.refreshItem
  78448. * @description 刷新指定元素。
  78449. * @param {Object} graph - graph实例。
  78450. * @param {string|Object} item - 元素 ID 或元素实例。
  78451. */
  78452. refreshItem(item, graph = this.graph) {
  78453. graph.refreshItem(item);
  78454. }
  78455. /**
  78456. * @function G6Render.prototype.refreshPositions
  78457. * @description 当节点位置发生变化时,刷新所有节点位置,并重计算边的位置。
  78458. * @param {Object} graph - graph实例。
  78459. */
  78460. refreshPositions(graph = this.graph) {
  78461. graph.refreshPositions();
  78462. }
  78463. /**
  78464. * @function G6Render.prototype.on
  78465. * @description graph监听事件
  78466. * @param {Object} graph - graph实例。
  78467. * @param {string} eventName - 事件名,可选事件名参见 Event。
  78468. * @param {Function} handler - 监听函数。
  78469. */
  78470. on(eventName, handler, graph = this.graph) {
  78471. graph.on(eventName, handler);
  78472. }
  78473. /**
  78474. * @function G6Render.prototype.off
  78475. * @description graph关闭事件
  78476. * @param {Object} graph - graph实例。
  78477. * @param {string} eventName - 事件名,可选事件名参见 Event。
  78478. * @param {Function} handler - 监听函数。
  78479. */
  78480. off(eventName, handler, graph = this.graph) {
  78481. graph.off(eventName, handler);
  78482. }
  78483. /**
  78484. * @function G6Render.prototype.toDataURL
  78485. * @description 转换成图片
  78486. * @param {Object} graph - graph实例。
  78487. * @param {string} type - 图片类型 'image/png' / 'image/jpeg' / 'image/webp' / 'image/bmp'。
  78488. * @param {string} [backgroundColor] - 图片的背景色,可选,不传值时将导出透明背景的图片。
  78489. * @return {string} 返回值表示生成的图片的 URL。
  78490. */
  78491. toDataURL(type, backgroundColor, graph = this.graph) {
  78492. graph.toDataURL(type, backgroundColor);
  78493. }
  78494. /**
  78495. * @function G6Render.prototype.bindNodeDefaultDragEvent
  78496. * @description 给graph的节点绑定默认的拖拽事件
  78497. *
  78498. * @param {Object} graph - graph实例。
  78499. */
  78500. bindNodeDefaultDragEvent(graph = this.graph) {
  78501. graph.on('node:dragstart', function (e) {
  78502. refreshDragedNodePosition(e);
  78503. });
  78504. graph.on('node:drag', function (e) {
  78505. refreshDragedNodePosition(e);
  78506. });
  78507. graph.on('node:dragend', function (e) {
  78508. e.item.get('model').fx = null;
  78509. e.item.get('model').fy = null;
  78510. });
  78511. }
  78512. /**
  78513. * @function G6Render.prototype.stopDefaultEventPropagation
  78514. * @description 阻止点击事件冒泡
  78515. * @param {Object} graph - graph实例。
  78516. */
  78517. stopDefaultEventPropagation(graph = this.graph) {
  78518. graph.on('click', function (e) {
  78519. e.stopPropagation();
  78520. });
  78521. graph.on('mousedown', function (e) {
  78522. e.stopPropagation();
  78523. });
  78524. graph.on('mouseover', function (e) {
  78525. e.stopPropagation();
  78526. });
  78527. graph.on('mouseout', function (e) {
  78528. e.stopPropagation();
  78529. });
  78530. }
  78531. /**
  78532. * @function G6Render.prototype.clear
  78533. * @description 清除画布元素
  78534. * @param {Object} graph - graph实例。
  78535. */
  78536. clear(graph = this.graph) {
  78537. graph.clear();
  78538. }
  78539. /**
  78540. * @function G6Render.prototype.destroy
  78541. * @description 销毁画布
  78542. * @param {Object} graph - graph实例。
  78543. */
  78544. destroy(graph = this.graph) {
  78545. graph.destroy();
  78546. }
  78547. }
  78548. /**
  78549. * @description 更新拖拽后节点的x ,y
  78550. */
  78551. function refreshDragedNodePosition(e) {
  78552. const model = e.item.get('model');
  78553. model.fx = e.x;
  78554. model.fy = e.y;
  78555. model.x = e.x;
  78556. model.y = e.y;
  78557. return model;
  78558. }
  78559. // EXTERNAL MODULE: ./node_modules/lodash.clonedeep/index.js
  78560. var lodash_clonedeep = __webpack_require__(465);
  78561. var lodash_clonedeep_default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep);
  78562. ;// CONCATENATED MODULE: ./src/common/overlay/KnowledgeGraph.js
  78563. /**
  78564. * @class KnowledgeGraph
  78565. * @category iServer KnowledgeGraph
  78566. * @classdesc KnowledgeGraph知识图谱
  78567. * @version 11.1.0
  78568. * @param { KnowledgeGraph.Config } config - 创建graph实例的配置项。
  78569. * @usage
  78570. */
  78571. /**
  78572. * @typedef {Object} KnowledgeGraph.Data - 创建graph实例的数据项。
  78573. * @property {Array.<KnowledgeGraph.Node>} data.nodes - 创建graph节点。
  78574. * @property {Array.<KnowledgeGraph.Edge>} data.edges - 创建graph边。
  78575. */
  78576. /**
  78577. * @typedef {Object} KnowledgeGraph.Config - 创建graph实例的配置项。
  78578. * @property {string | HTMLElement} container - 创建的容器 id 或容器本身, 默认是'knowledgeGraph'。
  78579. * @property {number} width - 图的宽度, 默认是container的width。
  78580. * @property {number} height - 图的高度,默认是container的height。
  78581. * @property {Array.<number>} [center] - 中心点的渲染坐标。可以通过KnowledgeGraph.prototype.getViewPortCenterPoint获取。
  78582. * @property {number} [zoom] - 缩放比例。
  78583. * @property {number} [minZoom] - 最小缩放比例。若 fitView、zoom、zoomTo 等操作导致图的缩放比例小于该值,则将使用该值进行缩放,并返回 false。
  78584. * @property {number} [maxZoom] - 最大缩放比例。若 fitView、zoom、zoomTo 等操作导致图的缩放比例大于该值,则将使用该值进行缩放,并返回 false。
  78585. * @property {KnowledgeGraph.Layout} [layout] - 布局。
  78586. * @property {boolean} [animate=true] - 是否开启动画。
  78587. * @property {boolean} [autoResize=true] - 当视口变换时,是否自动重绘。
  78588. * @property {KnowledgeGraph.NodeStyle} [defaultNode] - 默认状态下节点的配置,比如 type, size, color。会被写入的 data 覆盖。
  78589. * @property {KnowledgeGraph.EdgeStyle} [defaultEdge] - 默认状态下边的配置,比如 type, size, color。会被写入的 data 覆盖。
  78590. * @property {KnowledgeGraph.NodeStyle} [nodeHighlightStyle] - 鼠标移入节点高亮样式。默认样式:{strokeColor: 'blue',stroke: 10, opacity: 0.8}。
  78591. * @property {KnowledgeGraph.EdgeStyle} [edgeHighlightStyle] - 鼠标移入边高亮样式。默认样式:{strokeColor: 'blue',stroke: 10, opacity: 0.8}。
  78592. * @property {boolean} [highlightNode = true] - 鼠标移入是否高亮节点。
  78593. * @property {boolean} [highlightEdge = true] - 鼠标移入是否高亮边。
  78594. * @property {boolean} [showToolBar = true] - 是否打开工具条, 包含放大,缩小,切换到实际大小功能。
  78595. * @property {boolean} [showContextMenu = true] - 是否打开节点的右键菜单, 包含展开\折叠、隐藏功能。
  78596. * @property {boolean} [dragCanvas = true] - 是否可以拖拽canvas。
  78597. * @property {boolean} [zoomCanvas = true] - 是否可以缩放canvas。
  78598. * @property {boolean} [dragNode = true] - 是否可以拖拽node节点。
  78599. * @property {number} [nodeLabelMaxWidth] - node节点的标签开启省略号配置项,大于该宽度使用省略号。
  78600. */
  78601. /**
  78602. * @typedef {Object} KnowledgeGraph.Layout - 布局。
  78603. * @property {string} [type='fruchterman'] - 布局类型, 可选值:['fruchterman']。 默认'fruchterman'。
  78604. */
  78605. /**
  78606. * @typedef {Object} KnowledgeGraph.Node - node节点配置项。
  78607. * @property {string} id - 元素的标识 ID,必须是唯一的 string
  78608. * @property {string} [category] - 分类。
  78609. * @property {number} [x] - x坐标。
  78610. * @property {number} [y] - y坐标。
  78611. * @property {number} [size=20] - 节点的大小。
  78612. * @property {Array.<number>|number} [anchorPoints=20] - 指定边连入节点的连接点的位置(相对于该节点而言),可以为空。例如: [0, 0],代表节点左上角的锚点,[1, 1],代表节点右下角的锚点。
  78613. * @property {string} [type] - 元素的类型,不传则使用默认值,节点默认类型为 'circle'。可选值['circle','rect','ellipse','diamond', 'image']
  78614. * @property {string} [label] - 元素的文本标签,有该字段时默认会渲染 label 。
  78615. * @property {KnowledgeGraph.NodeLabelCfg} [labelCfg] - 元素文本标签的配置项,详见各子模块内容。
  78616. * @property {KnowledgeGraph.NodeStyle} [style] - 样式属性。
  78617. */
  78618. /**
  78619. * @typedef {Object} KnowledgeGraph.Edge - edge边配置项。
  78620. * @property {string} [source] -起始点 id 。
  78621. * @property {string} [target] - 结束点 id 。
  78622. * @property {number} [sourceAnchor] - 边的起始节点上的锚点的索引值。
  78623. * @property {number} [targetAnchor] - 边的终止节点上的锚点的索引值。
  78624. * @property {string} [type='line'] - 指定边的类型,可以是内置边的类型名称,也可以是自定义边的名称。默认为 'line'。可选值['line','arc','polyline','quadratic']。
  78625. * @property {string} [label] - 文本文字,如果没有则不会显示。
  78626. * @property {KnowledgeGraph.EdgeLabelCfg} [labelCfg] - 配置标签文本。
  78627. * @property {KnowledgeGraph.EdgeStyle} [style] - 通过 style 配置来修改边的填充色、边框颜色、阴影等属性,具体配置属性见:图形样式属性。
  78628. */
  78629. /**
  78630. * @typedef {Object} KnowledgeGraph.NodeLabelCfg - node节点配置项。
  78631. * @property {string} [position] - 文本相对于节点的位置,目前支持的位置有:'center','top','left','right','bottom'。默认为 'center'。modelRect 节点不支持该属性。
  78632. * @property {KnowledgeGraph.TextStyle} [style] - 标签的样式属性。
  78633. * @property {number} [offset] - 文本的偏移,position 为 'bottom' 时,文本的上方偏移量;position 为 'left' 时,文本的右方偏移量;以此类推在其他 position 时的情况。modelRect 节点的 offset 为左边距。
  78634. */
  78635. /**
  78636. * @typedef {Object} KnowledgeGraph.NodeStyle - 节点样式通用配置项。
  78637. * @property {string} [fill] - 节点填充色。
  78638. * @property {string} [stroke] - 节点的描边颜色。
  78639. * @property {number} [lineWidth] - 描边宽度。
  78640. * @property {Array.<number>} [lineDash] -描边虚线,数组代表实、虚长度。
  78641. * @property {number} [fillOpacity] - 设置填充的 alpha 或透明值。
  78642. * @property {string} [shadowColor] - 阴影颜色。
  78643. * @property {number} [shadowBlur] - 阴影范围。
  78644. * @property {number} [shadowOffsetX] - 阴影 x 方向偏移量。
  78645. * @property {number} [shadowOffsetY] - 阴影 y 方向偏移量。
  78646. * @property {number} [opacity] - 设置绘图的当前 alpha 或透明值。
  78647. * @property {string} [cursor] - 鼠标在该边上时的鼠标样式,CSS 的 cursor 选项都支持。
  78648. */
  78649. /**
  78650. * @typedef {Object} KnowledgeGraph.TextStyle - 文本样式。
  78651. * @property {string} [textAlign] - 设置文本内容的当前对齐方式。支持的属性:center / end / left / right / start,默认值为 start。
  78652. * @property {string} [textBaseline] - 设置在绘制文本时使用的当前文本基线。支持的属性:top / middle / bottom / alphabetic / hanging。默认值为 bottom。
  78653. * @property {string} [fontStyle] - 字体样式。对应 font-style。
  78654. * @property {string} [fontVariant] - 设置为小型大写字母字体。对应 font-variant。
  78655. * @property {number} [fontWeight] - 字体粗细。对应 font-weight。
  78656. * @property {number} [fontSize] - 字体大小。对应 font-size, 边标签文本默认大小是7。
  78657. * @property {string} [fontFamily] - 字体系列。对应 font-family。
  78658. * @property {number} [lineHeight] - 行高。对应 line-height。
  78659. */
  78660. /**
  78661. * @typedef {Object} KnowledgeGraph.EdgeLabelCfg - node节点配置项。
  78662. * @property {string} [position] - 文本相对于边的位置,目前支持的位置有:'start','middle','end'。默认为'middle'。
  78663. * @property {number} [refX] - 标签在 x 方向的偏移量。
  78664. * @property {number} [refY] -标签在 y 方向的偏移量。
  78665. * @property {boolean} [autoRotate=true] - 标签文字是否跟随边旋转,默认: true。
  78666. * @property { KnowledgeGraph.TextStyle} [style] - 标签的样式属性,默认: {fontSize: 3,fill: '#333'}。
  78667. */
  78668. /**
  78669. * @typedef {Object} KnowledgeGraph.EdgeStyle - 边样式通用配置项。
  78670. * @property {string} [stroke] - 边的颜色。
  78671. * @property {number} [lineWidth] - 边宽度。
  78672. * @property {number} [lineAppendWidth] -边响应鼠标事件时的检测宽度,当 lineWidth 太小而不易选中时,可以通过该参数提升击中范围。
  78673. * @property {boolean|Object} [endArrow=true] - 为 true 时在边的结束端绘制默认箭头,为 false 时不绘制结束端箭头, 默认值{path: 'M 0,0 L 2,1 L 2,-1 Z'}
  78674. * @property {boolean|Object} [startArrow] - 为 true 时在边的开始端绘制默认箭头,为 false 时不绘制结束端箭头。
  78675. * @property {number} [strokeOpacity] - 边透明度。
  78676. * @property {string} [shadowColor] - 阴影颜色。
  78677. * @property {number} [shadowBlur] - 阴影模糊程度。
  78678. * @property {number} [shadowOffsetX] - 阴影 x 方向偏移量。
  78679. * @property {number} [shadowOffsetY] - 阴影 y 方向偏移量。
  78680. * @property {Array.<number>} [lineDash] - 设置线的虚线样式,可以指定一个数组。一组描述交替绘制线段和间距(坐标空间单位)长度的数字。 如果数组元素的数量是奇数, 数组的元素会被复制并重复。例如, [5, 15, 25] 会变成 [5, 15, 25, 5, 15, 25]。
  78681. * @property {string} [cursor] - 鼠标在该边上时的鼠标样式,CSS 的 cursor 选项都支持。
  78682. */
  78683. /**
  78684. * @typedef {Object} KnowledgeGraph.AnimateConfig - 动画配置项。
  78685. * @property {number} [duration= 500] - 一次动画的时长。
  78686. * @property {string} [easing='linearEasing'] - 动画函数。
  78687. * @property {number} [delay=0] - 是否重复执行动画。
  78688. * @property {boolean} [repeat=false] - 边透明度。
  78689. * @property {string} [shadowColor] - 阴影颜色。
  78690. */
  78691. class KnowledgeGraph {
  78692. constructor(config, type = 'G6') {
  78693. /**
  78694. * @member {string} KnowledgeGraph.prototype.graph
  78695. * @description graph实例。
  78696. */
  78697. this.graph = null;
  78698. this.config = lodash_clonedeep_default()(config);
  78699. this.graphRender = null;
  78700. this.type = type;
  78701. this.createGraphRender(this.type);
  78702. this.config = this.graphRender._getGraphConfig(this.config);
  78703. this.createGraph(this.config);
  78704. this.CLASS_NAME = 'SuperMap.KnowledgeGraph';
  78705. }
  78706. /**
  78707. * @function KnowledgeGraph.dataFromGraphMap
  78708. * @description 将iServer GraphMap数据转换成KnowledgeGraph数据。
  78709. * @param {Object} queryResult - iServer知识图谱服务query数据。
  78710. * @param {Object} graphMap - iServer知识图谱服务GraphMap数据(data.graphMap)。
  78711. * @return {KnowledgeGraph.Data} 返回数据。
  78712. */
  78713. static dataFromGraphMap(queryResult, graphMap) {
  78714. return transformGraphMap(queryResult, graphMap);
  78715. }
  78716. /**
  78717. * @function KnowledgeGraph.dataFromKnowledgeGraphQuery
  78718. * @description 将iServer KnowledgeGraphService query数据转换成KnowledgeGraph数据。
  78719. * @param {Object} queryResult - iServer知识图谱服务query数据。
  78720. * @return {KnowledgeGraph.Data} 返回数据。
  78721. */
  78722. static dataFromKnowledgeGraphQuery(queryResult) {
  78723. return transformGraphMap(queryResult);
  78724. }
  78725. /**
  78726. * @function KnowledgeGraph.prototype.handleNodeStatus
  78727. * @description 展开、折叠、隐藏节点
  78728. * @param {Object} data - 展开 折叠 隐藏的对象, eg: {expand:['id1'], collapse:['id2'], hidden:['id3']}
  78729. */
  78730. handleNodeStatus(data) {
  78731. const { expand, collapse, hidden } = data;
  78732. // 解析expand参数,里面的节点再执行一次查询显示出来
  78733. this.expandNodes(expand);
  78734. // 解析collapse参数,折叠这个里面的节点
  78735. this.collapseNodes(collapse);
  78736. // 解析hidden,隐藏这个里面额的节点
  78737. this.hideNodes(hidden);
  78738. }
  78739. /**
  78740. * @function KnowledgeGraph.prototype.expandNodes
  78741. * @description 展开节点。
  78742. * @param {Array.<string>} expandData - 元素 ID 数组。
  78743. */
  78744. expandNodes(expandData) {
  78745. if (!expandData) {
  78746. return;
  78747. }
  78748. expandData.forEach((item) => {
  78749. this.expandNode(item + '');
  78750. });
  78751. }
  78752. /**
  78753. * @function KnowledgeGraph.prototype.collapseNodes
  78754. * @description 折叠节点。
  78755. * @param {Array.<string>} collapseData - 元素 ID 数组。
  78756. */
  78757. collapseNodes(collapseData) {
  78758. if (!collapseData) {
  78759. return;
  78760. }
  78761. collapseData.forEach((item) => {
  78762. this.collapseNode(item + '');
  78763. });
  78764. }
  78765. /**
  78766. * @function KnowledgeGraph.prototype.hideNodes
  78767. * @description 隐藏节点。
  78768. * @param {Array.<string>} hiddenData - 元素 ID 数组。
  78769. */
  78770. hideNodes(hiddenData) {
  78771. if (!hiddenData) {
  78772. return;
  78773. }
  78774. hiddenData.forEach((item) => {
  78775. this.hideItem(item + '');
  78776. });
  78777. }
  78778. /**
  78779. * @function KnowledgeGraph.prototype.createGraphRender
  78780. * @description 创建KnowledgeGraphRender
  78781. * @param {string} type -类型, 默认是G6。
  78782. * @private
  78783. */
  78784. createGraphRender(type) {
  78785. if (type === 'G6') {
  78786. this.graphRender = new G6Render();
  78787. }
  78788. }
  78789. /**
  78790. * @function KnowledgeGraph.prototype.createGraph
  78791. * @description 创建KnowledgeGraph的guaph实例。
  78792. * @param {Object} config - graph配置项。
  78793. * @returns {Object} graph实例。
  78794. */
  78795. createGraph(config) {
  78796. const graph = this.initGraph(config);
  78797. this.graph = graph;
  78798. this.autoResize();
  78799. return graph;
  78800. }
  78801. /**
  78802. * @function KnowledgeGraph.prototype.getGraph
  78803. * @description 获取KnowledgeGraph的guaph实例。
  78804. * @returns {Object} graph实例。
  78805. */
  78806. getGraph() {
  78807. return this.graph;
  78808. }
  78809. /**
  78810. * @function KnowledgeGraph.prototype.autoResize
  78811. * @description 浏览器窗口大小发生改变时,重新设置canvas画布的大小,重新渲染。
  78812. */
  78813. autoResize() {
  78814. if (this.config && this.config.autoResize !== false) {
  78815. this.graphRender.autoResize();
  78816. }
  78817. }
  78818. /**
  78819. * @function KnowledgeGraph.prototype.zoom
  78820. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  78821. * @param {number} ratio 缩放比例。
  78822. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  78823. * @param {boolean} [animate] 是否开启动画。
  78824. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  78825. */
  78826. zoom(ratio, center, animate, animateCfg) {
  78827. this.graphRender.zoom(ratio, center, animate, animateCfg);
  78828. }
  78829. /**
  78830. * @function KnowledgeGraph.prototype.zoomTo
  78831. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  78832. * @param {number} ratio 缩放比例。
  78833. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  78834. * @param {boolean} [animate] 是否开启动画。
  78835. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  78836. */
  78837. zoomTo(ratio, center, animate, animateCfg) {
  78838. this.graphRender.zoomTo(ratio, center, animate, animateCfg);
  78839. }
  78840. /**
  78841. * @function KnowledgeGraph.prototype.fitView
  78842. * @description 让画布内容适应视口。
  78843. * @param {Array.<number>|number} [padding] [top, right, bottom, left] 四个方向上的间距值。
  78844. * @param {Object} [rules] fitView 的规则,参数如下:{ onlyOutOfViewPort?: boolean; direction?: 'x' / 'y' / 'both'; ratioRule?: 'max' / 'min}。
  78845. * @param {boolean} [animate] 是否开启动画。
  78846. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  78847. */
  78848. fitView(padding, rules, animate, animateCfg) {
  78849. this.graphRender.fitView(padding, rules, animate, animateCfg);
  78850. }
  78851. /**
  78852. * @function KnowledgeGraph.prototype.fitCenter
  78853. * @description 平移图到中心将对齐到画布中心,但不缩放。优先级低于 fitView。
  78854. * @param {boolean} [animate] 是否开启动画。
  78855. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画,参见基础动画教程。若未配置,则跟随 graph 的 animateCfg 参数。
  78856. */
  78857. fitCenter(animate, animateCfg) {
  78858. this.graphRender.fitCenter(animate, animateCfg);
  78859. }
  78860. /**
  78861. * @function KnowledgeGraph.prototype.getGraphCenterPoint
  78862. * @description 获取图内容的中心绘制坐标。
  78863. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  78864. */
  78865. getGraphCenterPoint() {
  78866. return this.graphRender.getGraphCenterPoint();
  78867. }
  78868. /**
  78869. * @function KnowledgeGraph.prototype.getViewPortCenterPoint
  78870. * @description 获取窗口的中心绘制坐标。
  78871. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  78872. */
  78873. getViewPortCenterPoint() {
  78874. return this.graphRender.getViewPortCenterPoint();
  78875. }
  78876. /**
  78877. * @function KnowledgeGraph.prototype.getZoom
  78878. * @description 获取当前视口的缩放比例。
  78879. * @return {number} 返回值表示当前视口的缩放比例, 默认值为 1。
  78880. */
  78881. getZoom() {
  78882. return this.graphRender.getZoom();
  78883. }
  78884. /**
  78885. * @function KnowledgeGraph.prototype.getMinZoom
  78886. * @description 获取 graph 当前允许的最小缩放比例。
  78887. * @return {number} 返回值表示当前视口的最小缩放比例。
  78888. */
  78889. getMinZoom() {
  78890. return this.graphRender.getMinZoom();
  78891. }
  78892. /**
  78893. * @function KnowledgeGraph.prototype.setMinZoom
  78894. * @description 设置 graph 当前允许的最小缩放比例。
  78895. * @param {number} ratio 缩放比例。
  78896. */
  78897. setMinZoom(ratio) {
  78898. this.graphRender.setMinZoom(ratio);
  78899. }
  78900. /**
  78901. * @function KnowledgeGraph.prototype.getMaxZoom
  78902. * @description 获取 graph 当前允许的最大缩放比例。
  78903. * @return {number} 返回值表示当前视口的最大缩放比例。
  78904. */
  78905. getMaxZoom() {
  78906. return this.graphRender.getMaxZoom();
  78907. }
  78908. /**
  78909. * @function KnowledgeGraph.prototype.setMaxZoom
  78910. * @description 设置 graph 当前允许的最大缩放比例。
  78911. * @param {number} ratio 缩放比例。
  78912. */
  78913. setMaxZoom(ratio) {
  78914. this.graphRender.setMaxZoom(ratio);
  78915. }
  78916. /**
  78917. * @function KnowledgeGraph.prototype.getWidth
  78918. * @description获取 graph 当前的宽度。
  78919. * @return {number} graph 当前的宽度。
  78920. */
  78921. getWidth() {
  78922. return this.graphRender.getWidth();
  78923. }
  78924. /**
  78925. * @function KnowledgeGraph.prototype.getHeight
  78926. * @description 获取 graph 当前的高度。
  78927. * @return {number} graph 当前的高度。
  78928. */
  78929. getHeight() {
  78930. return this.graphRender.getHeight();
  78931. }
  78932. /**
  78933. * @function KnowledgeGraph.prototype.initGraph
  78934. * @description 创建KnowledgeGraph实例
  78935. * @param {Object} config - graph配置项。
  78936. * @returns {Object} graph实例。
  78937. */
  78938. initGraph(config) {
  78939. const graph = this.graphRender.initGraph(config);
  78940. this.graph = graph;
  78941. const cb = () => {
  78942. if (this.config.zoom !== undefined) {
  78943. this.zoom(this.config.zoom);
  78944. }
  78945. if (this.config.center !== undefined) {
  78946. this.graphRender.setCenter({ x: this.config.center[0], y: this.config.center[1] });
  78947. }
  78948. };
  78949. this.graph.on('beforelayout', cb);
  78950. return graph;
  78951. }
  78952. /**
  78953. * @function KnowledgeGraph.prototype.setData
  78954. * @description 设置默认数据
  78955. * @param {KnowledgeGraph.Data} data - graph数据。
  78956. * @param {Object} [graph = this.graph] - graph实例。
  78957. */
  78958. setData(data, graph = this.graph) {
  78959. data = data || { nodes: [], edges: [] };
  78960. if (this.config && this.config.nodeLabelMaxWidth) {
  78961. data.nodes = this.nodeLabelOpenEllipsis(this.config.nodeLabelMaxWidth, data.nodes);
  78962. }
  78963. this.graphRender.setData(data, graph);
  78964. this.render(graph); // 渲染图
  78965. this.data = data;
  78966. }
  78967. /**
  78968. * @function KnowledgeGraph.prototype.render
  78969. * @description 根据提供的数据渲染视图。
  78970. * @param {Object} [graph = this.graph] - graph实例。
  78971. */
  78972. render(graph = this.graph) {
  78973. graph && this.graphRender.render(graph);
  78974. }
  78975. /**
  78976. * @function KnowledgeGraph.prototype.updateGraph
  78977. * @description 更新数据
  78978. * @param {KnowledgeGraph.Data} data - graph数据。
  78979. * @param {Object} [graph = this.graph] - graph实例。
  78980. */
  78981. updateGraph(data, graph = this.graph) {
  78982. graph && this.graphRender.updateGraph(data, graph);
  78983. }
  78984. /**
  78985. * @function KnowledgeGraph.prototype.refresh
  78986. * @description 改变画布大小。
  78987. */
  78988. refresh() {
  78989. return this.graphRender.refresh();
  78990. }
  78991. /**
  78992. * @function KnowledgeGraph.prototype.changeSize
  78993. * @description 改变画布大小。
  78994. * @param {number} width - 宽度。
  78995. * @param {number} height - 高度。
  78996. */
  78997. changeSize(width, height) {
  78998. return this.graphRender.changeSize(width, height);
  78999. }
  79000. /**
  79001. * @function KnowledgeGraph.prototype.resize
  79002. * @description 改变画布大小后,重新渲染。
  79003. * @param {number} width - 宽度。
  79004. * @param {number} height - 高度。
  79005. */
  79006. resize(width, height) {
  79007. this.graphRender.changeSize(width, height);
  79008. this.graphRender.refresh();
  79009. }
  79010. /**
  79011. * @function KnowledgeGraph.prototype.getContainer
  79012. * @description 获取 Graph 的 DOM 容器。
  79013. * @return {HTMLElement} DOM 容器。
  79014. */
  79015. getContainer() {
  79016. return this.graphRender.getContainer();
  79017. }
  79018. /**
  79019. * @function KnowledgeGraph.prototype.getCanvas
  79020. * @description 获取canvas。
  79021. * @return {HTMLElement} canvas。
  79022. */
  79023. getCanvas() {
  79024. return this.graphRender.getCanvas();
  79025. }
  79026. /**
  79027. * @function KnowledgeGraph.prototype.getNodes
  79028. * @description 获取图中所有节点的实例。
  79029. * @return {Array} 返回值表示图中所有节点的实例。
  79030. */
  79031. getNodes() {
  79032. return this.graphRender.getNodes();
  79033. }
  79034. /**
  79035. * @function KnowledgeGraph.prototype.getEdges
  79036. * @description 获取图中所有节点的实例。这里返回的是边的实例,而不是边的数据项。
  79037. * @return {Array} 返回值表示图中所有边的实例。
  79038. */
  79039. getEdges() {
  79040. return this.graphRender.getEdges();
  79041. }
  79042. /**
  79043. * @function KnowledgeGraph.prototype.getNeighbors
  79044. * @description 获取邻居节点数组。
  79045. * @param {string | INode} node - 节点 ID 或节点实例。
  79046. * @param {string | undefined} type - ['source'| 'target' | undefined] 邻居类型, 'source' 只获取当前节点的源节点,'target' 只获取当前节点指向的目标节点, 若不指定则返回所有类型的邻居。
  79047. * @return {Array} 返回值符合要求的节点数组。
  79048. */
  79049. getNeighbors(node, type) {
  79050. return this.graphRender.getNeighbors(node, type);
  79051. }
  79052. /**
  79053. * @function KnowledgeGraph.prototype.findById
  79054. * @description 根据 ID,查询对应的元素实例。
  79055. * @param {string} id - 元素 ID。
  79056. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  79057. */
  79058. findById(id) {
  79059. return this.graphRender.findById(id);
  79060. }
  79061. /**
  79062. * @function KnowledgeGraph.prototype.find
  79063. * @description 获取邻居节点数组。
  79064. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  79065. * @param {Function} fn - 查找的规则。
  79066. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  79067. */
  79068. find(type, fn) {
  79069. return this.graphRender.find(type, fn);
  79070. }
  79071. /**
  79072. * @function KnowledgeGraph.prototype.findAll
  79073. * @description 获取邻居节点数组。
  79074. * @param {string} type - 元素类型,可选值为 'node'、'edge'。
  79075. * @param {Function} fn - 查找的规则。
  79076. * @return {Object} 如果有符合规则的元素实例,则返回所有元素实例,否则返回 undefined。
  79077. */
  79078. findAll(type, fn) {
  79079. return this.graphRender.findAll(type, fn);
  79080. }
  79081. /**
  79082. * @function KnowledgeGraph.prototype.getEdgesByNode
  79083. * @description 获取与当前节点有关联的所有边。
  79084. * @param {Object} node - node实例。
  79085. * @return {Array} edge实例数组。
  79086. */
  79087. getEdgesByNode(node) {
  79088. return this.graphRender.getEdgesByNode(node);
  79089. }
  79090. /**
  79091. * @function KnowledgeGraph.prototype.getInEdges
  79092. * @description 获取与当前节点关联的所有入边。
  79093. * @param {Object} node - node实例。
  79094. * @return {Array} edge实例数组。
  79095. */
  79096. getInEdges(node) {
  79097. return this.graphRender.getInEdges(node);
  79098. }
  79099. /**
  79100. * @function KnowledgeGraph.prototype.getOutEdges
  79101. * @description 获取与当前节点关联的所有出边。
  79102. * @param {Object} node - node实例。
  79103. * @return {Array} edge实例数组。
  79104. */
  79105. getOutEdges(node) {
  79106. return this.graphRender.getOutEdges(node);
  79107. }
  79108. /**
  79109. * @function KnowledgeGraph.prototype.getSourceByEdge
  79110. * @description 获取当前边的起始节点
  79111. * @param {Object} edge - node实例。
  79112. * @return {Object} 返回值为起始节点的实例。
  79113. */
  79114. getSourceByEdge(edge) {
  79115. return this.graphRender.getSourceByEdge(edge);
  79116. }
  79117. /**
  79118. * @function KnowledgeGraph.prototype.getTargetByEdge
  79119. * @description 获取当前边的终止节点。
  79120. * @param {Object} edge - node实例。
  79121. * @return {Object} 终止节点的实例。
  79122. */
  79123. getTargetByEdge(edge) {
  79124. return this.graphRender.getTargetByEdge(edge);
  79125. }
  79126. /**
  79127. * @function KnowledgeGraph.prototype.expandNode
  79128. * @description 展开当前节点。
  79129. * @param {string} id - 元素 ID。
  79130. */
  79131. expandNode(id) {
  79132. const item = this.findById(id);
  79133. item && this.graphRender.expandNode(item);
  79134. }
  79135. /**
  79136. * @function KnowledgeGraph.prototype.collapseNode
  79137. * @description 收起当前节点。
  79138. * @param {string} id - 元素 ID。
  79139. */
  79140. collapseNode(id) {
  79141. const item = this.findById(id);
  79142. item && this.graphRender.collapseNode(item);
  79143. }
  79144. /**
  79145. * @function KnowledgeGraph.prototype.showItem
  79146. * @description 显示指定的元素。若 item 为节点,则相关边也会随之显示。而show() 则将只显示自身。
  79147. * @param {string|Object} item - 元素 ID 或元素实例。
  79148. * @param {boolean} [stack] - 操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  79149. */
  79150. showItem(item, stack) {
  79151. this.graphRender.showItem(item, stack);
  79152. }
  79153. /**
  79154. * @function KnowledgeGraph.prototype.showItem
  79155. * @description 隐藏指定元素。若 item 为节点,则相关边也会随之隐藏。而 hide() 则将只隐藏自身。
  79156. * @param {string|Object} item - 元素 ID 或元素实例。
  79157. * @param {boolean} [stack] -操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  79158. */
  79159. hideItem(item, stack) {
  79160. this.graphRender.hideItem(item, stack);
  79161. }
  79162. /**
  79163. * @function KnowledgeGraph.prototype.show
  79164. * @description 显示元素。只显示 item 自身,若需要在显示节点的同时显示相关边,应调用showItem(item)。
  79165. * @param {Object} item - 元素实例。
  79166. */
  79167. show(item) {
  79168. this.graphRender.show(item);
  79169. }
  79170. /**
  79171. * @function KnowledgeGraph.prototype.hide
  79172. * @description 隐藏元素。只隐藏 item 自身,若需要在隐藏节点的同时隐藏相关边,应调用 hideItem(item)。
  79173. * @param {Object} item - 元素实例。
  79174. */
  79175. hide(item) {
  79176. this.graphRender.hide(item);
  79177. }
  79178. /**
  79179. * @function KnowledgeGraph.prototype.changeVisibility
  79180. * @description 更改元素是否显示。
  79181. * @param {Object} item - 元素实例。
  79182. * @param {boolean} visible - 是否显示元素,true 为显示,false 为隐藏。
  79183. */
  79184. changeVisibility(item, visible) {
  79185. this.graphRender.changeVisibility(item, visible);
  79186. }
  79187. /**
  79188. * @function KnowledgeGraph.prototype.isVisible
  79189. * @description 查询元素显示状态。
  79190. * @param {Object} item - 元素实例。
  79191. * @return {boolean} - 返回值为 true,则表示当前元素处于显示状态,否则处于隐藏状态。
  79192. */
  79193. isVisible(item) {
  79194. return this.graphRender.isVisible(item);
  79195. }
  79196. /**
  79197. * @function KnowledgeGraph.prototype.getModel
  79198. * @description 获取元素的数据模型。
  79199. * @param {Object} item - 元素实例。
  79200. * @return {Object} - 返回值为节点的数据模型。
  79201. */
  79202. getModel(item) {
  79203. return this.graphRender.getModel(item);
  79204. }
  79205. /**
  79206. * @function KnowledgeGraph.prototype.addItem
  79207. * @description 新增元素(节点和边)。
  79208. * @param {string} type - 元素类型,可选值为 'node'、'edge'。
  79209. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  79210. */
  79211. addItem(type, model) {
  79212. return this.graphRender.addItem(type, model);
  79213. }
  79214. /**
  79215. * @function KnowledgeGraph.prototype.removeItem
  79216. * @description 删除元素。
  79217. * @param {string|Object} item - 元素 ID 或元素实例。
  79218. */
  79219. removeItem(item) {
  79220. return this.graphRender.removeItem(item);
  79221. }
  79222. /**
  79223. * @function KnowledgeGraph.prototype.updateItem
  79224. * @description 更新元素,包括更新数据、样式等。
  79225. * @param {string|Object} item - 元素 ID 或元素实例。
  79226. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  79227. */
  79228. updateItem(item, model) {
  79229. return this.graphRender.updateItem(item, model);
  79230. }
  79231. /**
  79232. * @function KnowledgeGraph.prototype.refreshItem
  79233. * @description 刷新指定元素。
  79234. * @param {string|Object} item - 元素 ID 或元素实例。
  79235. */
  79236. refreshItem(item) {
  79237. return this.graphRender.refreshItem(item);
  79238. }
  79239. /**
  79240. * @function KnowledgeGraph.prototype.refreshPositions
  79241. * @description 当节点位置发生变化时,刷新所有节点位置,并重计算边的位置。
  79242. */
  79243. refreshPositions() {
  79244. return this.graphRender.refreshPositions();
  79245. }
  79246. /**
  79247. * @function KnowledgeGraph.prototype.on
  79248. * @description graph监听事件
  79249. * @param {string} eventName - 事件名,可选事件名参见: Node交互事件名、Edge交互事件名、Canvas交互事件名 时机事件
  79250. * 通用事件名: click dbclick mouseenter mousemove mouseout mouseover mouseleave mousedown mouseup contextmenu dragstart drag dragend dragenter dragleave drop keydown keyup wheel touchstart touchmove touchend
  79251. * Node交互事件名: node:通用事件名, 例如 node:click
  79252. * Edge交互事件名: edge:通用事件名, 例如 edge:click
  79253. * Canvas交互事件名: canvas:通用事件名,例如 canvas:click
  79254. * 时机事件:用于监听图的某方法调用前后的时机。
  79255. * beforerender 调用 render 方法之前触发
  79256. * afterrender 调用 render 方法之后触发
  79257. * beforeadditem 调用 addItem 方法之前触发
  79258. * afteradditem 调用 addItem 方法之后触发
  79259. * beforeremoveitem 调用 removeItem 方法之前触发
  79260. * afterremoveitem 调用 removeItem 方法之后触发
  79261. * beforeupdateitem 调用 updateItem 方法之前触发
  79262. * afterupdateitem 调用 updateItem 方法之后触发
  79263. * beforegraphrefresh 调用 refresh 方法之前触发
  79264. * aftergraphrefresh 调用 refresh 方法之后触发
  79265. * beforelayout 布局前触发。调用 graph.render 时会进行布局,因此 render 时会触发。或用户主动调用图的 graph.layout 时触发
  79266. * afterlayout 布局完成后触发。调用 graph.render 时会进行布局,因此 render 时布局完成后会触发。或用户主动调用图的 graph.layout 时布局完成后触发
  79267. * viewportchange 调用 graph.moveTo 或 graph.zoom 均会触发该事件
  79268. * @param {Function} handler - 监听函数。
  79269. */
  79270. on(eventName, handler) {
  79271. this.graphRender.on(eventName, handler);
  79272. }
  79273. /**
  79274. * @function KnowledgeGraph.prototype.off
  79275. * @description graph关闭事件。
  79276. * @param {string} eventName - 事件名,参考on方法的事件名。
  79277. * @param {Function} handler - 监听函数。
  79278. */
  79279. off(eventName, handler) {
  79280. this.graphRender.off(eventName, handler);
  79281. }
  79282. /**
  79283. * @function KnowledgeGraph.prototype.toDataURL
  79284. * @description 转换成图片。
  79285. * @param {string} type - 图片类型 'image/png' / 'image/jpeg' / 'image/webp' / 'image/bmp'。
  79286. * @param {string} [backgroundColor] - 图片的背景色,可选,不传值时将导出透明背景的图片。
  79287. * @return {string} 返回值表示生成的图片的 URL。
  79288. */
  79289. toDataURL(type, backgroundColor) {
  79290. this.graphRender.toDataURL(type, backgroundColor);
  79291. }
  79292. /**
  79293. * @function KnowledgeGraph.prototype.nodeLabelOpenEllipsis
  79294. * @description 转换label的省略号。
  79295. * @param {Object} nodeLabelMaxWidth - node节点标签是否开启省略号
  79296. * @param {Object} nodes - graph的nodes数据。
  79297. * @return {Array} nodes
  79298. */
  79299. nodeLabelOpenEllipsis(nodeLabelMaxWidth, nodes) {
  79300. if (!nodes) {
  79301. return [];
  79302. }
  79303. if (!nodeLabelMaxWidth) {
  79304. return nodes;
  79305. }
  79306. return nodes.map((node) => {
  79307. const fontSize =
  79308. (node.labelCfg && node.labelCfg.fontSize) ||
  79309. (this.defaultNode && this.defaultNode.labelCfg && this.defaultNode.labelCfg.fontSize) ||
  79310. 14;
  79311. node.label = fittingStr(node.label, nodeLabelMaxWidth, fontSize);
  79312. return node;
  79313. });
  79314. }
  79315. /**
  79316. * @function KnowledgeGraph.prototype.clear
  79317. * @description 清除画布元素。
  79318. * @param {Object} [graph = this.graph] - graph实例。
  79319. */
  79320. clear(graph = this.graph) {
  79321. graph && graph.clear();
  79322. }
  79323. /**
  79324. * @function KnowledgeGraph.prototype.destroy
  79325. * @description 销毁画布。
  79326. * @param {Object} [graph = this.graph] - graph实例。
  79327. */
  79328. destroy(graph = this.graph) {
  79329. graph && graph.destroy();
  79330. }
  79331. }
  79332. /**
  79333. * @private
  79334. * @description 大于最大宽度的字符串会返回带有省略号的字符串 xxx...。
  79335. * @param {string} label - 需要处理的字符串。
  79336. * @param {number} maxWidth - 最大宽度。
  79337. * @param {number} fontSize - 字体大小。
  79338. * @returns {string} 处理之后的字符串。
  79339. */
  79340. function fittingStr(label, maxWidth, fontSize) {
  79341. const calcLabelLength = (label) => {
  79342. let len = 0;
  79343. for (let i = 0; i < label.length; i++) {
  79344. if (label.charCodeAt(i) > 0 && label.charCodeAt(i) < 128) {
  79345. len++;
  79346. } else {
  79347. len += 2;
  79348. }
  79349. }
  79350. return len;
  79351. };
  79352. const fontWidth = fontSize * 1; //字号+边距
  79353. maxWidth = maxWidth * 1.6; // 需要根据自己项目调整
  79354. const width = calcLabelLength(label) * fontWidth;
  79355. const ellipsis = '…';
  79356. if (width > maxWidth) {
  79357. const len = Math.floor((maxWidth - 20) / fontWidth);
  79358. const result = label.substring(0, len);
  79359. if ((label.substring(len).length + ellipsis.length) * fontWidth > maxWidth) {
  79360. return result + '\n' + label.substring(len, len + len - 2) + ellipsis;
  79361. } else if (label.substring(len).length == 0) {
  79362. return result;
  79363. } else {
  79364. return result + '\n' + label.substring(len);
  79365. }
  79366. } else {
  79367. return label;
  79368. }
  79369. }
  79370. ;// CONCATENATED MODULE: ./src/common/index.common.js
  79371. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79372. * This program are made available under the terms of the Apache License, Version 2.0
  79373. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79374. ;// CONCATENATED MODULE: ./src/common/index.all.js
  79375. ;// CONCATENATED MODULE: ./src/common/namespace.js
  79376. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  79377. * This program are made available under the terms of the Apache License, Version 2.0
  79378. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79379. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  79380. * This program are made available under the terms of the Apache License, Version 2.0
  79381. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79382. // Lang
  79383. SuperMap.Lang = Lang;
  79384. SuperMap.i18n = SuperMap.Lang.i18n;
  79385. // CommonUtil
  79386. SuperMap.Util = { ...SuperMap.Util, ...Util_Util };
  79387. SuperMap.Browser = Browser;
  79388. SuperMap.INCHES_PER_UNIT = INCHES_PER_UNIT;
  79389. SuperMap.METERS_PER_INCH = METERS_PER_INCH;
  79390. SuperMap.DOTS_PER_INCH = DOTS_PER_INCH;
  79391. SuperMap.IS_GECKO = IS_GECKO;
  79392. // FetchRequest
  79393. SuperMap.setCORS = setCORS;
  79394. SuperMap.isCORS = isCORS;
  79395. SuperMap.setRequestTimeout = setRequestTimeout;
  79396. SuperMap.getRequestTimeout = getRequestTimeout;
  79397. SuperMap.FetchRequest = FetchRequest;
  79398. // commontypes
  79399. SuperMap.inherit = inheritExt;
  79400. SuperMap.mixin = mixinExt;
  79401. SuperMap.String = StringExt;
  79402. SuperMap.Number = NumberExt;
  79403. SuperMap.Function = FunctionExt;
  79404. SuperMap.Array = ArrayExt;
  79405. SuperMap.Date = DateExt;
  79406. SuperMap.Event = Event;
  79407. SuperMap.Bounds = Bounds;
  79408. SuperMap.Credential = Credential;
  79409. SuperMap.Events = Events;
  79410. SuperMap.Feature = Feature_Feature;
  79411. SuperMap.Geometry = Geometry_Geometry;
  79412. SuperMap.Pixel = Pixel;
  79413. SuperMap.Size = Size;
  79414. SuperMap.Feature.Vector = Vector;
  79415. SuperMap.Geometry.Collection = Collection;
  79416. SuperMap.Geometry.Curve = Curve;
  79417. SuperMap.Geometry.GeoText = GeoText;
  79418. SuperMap.Geometry.LinearRing = LinearRing_LinearRing;
  79419. SuperMap.Geometry.LineString = LineString;
  79420. SuperMap.Geometry.MultiLineString = MultiLineString;
  79421. SuperMap.Geometry.MultiPoint = MultiPoint;
  79422. SuperMap.Geometry.MultiPolygon = MultiPolygon;
  79423. SuperMap.Geometry.Point = Point;
  79424. SuperMap.Geometry.Polygon = Polygon_Polygon;
  79425. SuperMap.Geometry.Rectangle = Rectangle;
  79426. // Components
  79427. SuperMap.Components.Chart = ChartView;
  79428. SuperMap.Components.ChartViewModel = ChartViewModel;
  79429. SuperMap.Components.MessageBox = MessageBox;
  79430. SuperMap.Components.AttributesPopContainer = AttributesPopContainer;
  79431. SuperMap.Components.CityTabsPage = CityTabsPage;
  79432. SuperMap.Components.CommonContainer = CommonContainer;
  79433. SuperMap.Components.DropDownBox = DropDownBox;
  79434. SuperMap.Components.IndexTabsPageContainer = IndexTabsPageContainer;
  79435. SuperMap.Components.NavTabsPage = NavTabsPage;
  79436. SuperMap.Components.PaginationContainer = PaginationContainer;
  79437. SuperMap.Components.PopContainer = PopContainer;
  79438. SuperMap.Components.Select = Select;
  79439. SuperMap.Components.TemplateBase = TemplateBase;
  79440. SuperMap.Components.FileReaderUtil = FileReaderUtil;
  79441. // control
  79442. SuperMap.TimeControlBase = TimeControlBase;
  79443. SuperMap.TimeFlowControl = TimeFlowControl;
  79444. // Format
  79445. SuperMap.Format = SuperMap.Format || Format;
  79446. SuperMap.Format.GeoJSON = GeoJSON;
  79447. SuperMap.Format.JSON = JSONFormat;
  79448. SuperMap.Format.WKT = WKT;
  79449. // iManager
  79450. SuperMap.iManager = IManager;
  79451. SuperMap.iManagerCreateNodeParam = IManagerCreateNodeParam;
  79452. SuperMap.iManagerServiceBase = IManagerServiceBase;
  79453. // iPortal
  79454. SuperMap.iPortal = IPortal;
  79455. SuperMap.iPortalAddDataParam = IPortalAddDataParam;
  79456. SuperMap.iPortalAddResourceParam = IPortalAddResourceParam;
  79457. SuperMap.iPortalDataConnectionInfoParam = IPortalDataConnectionInfoParam;
  79458. SuperMap.iPortalDataMetaInfoParam = IPortalDataMetaInfoParam;
  79459. SuperMap.iPortalDataStoreInfoParam = IPortalDataStoreInfoParam;
  79460. SuperMap.iPortalQueryParam = IPortalQueryParam;
  79461. SuperMap.iPortalQueryResult = IPortalQueryResult;
  79462. SuperMap.iPortalRegisterServiceParam = IPortalRegisterServiceParam;
  79463. SuperMap.iPortalResource = IPortalResource;
  79464. SuperMap.iPortalServiceBase = IPortalServiceBase;
  79465. SuperMap.iPortalShareEntity = IPortalShareEntity;
  79466. SuperMap.iPortalShareParam = IPortalShareParam;
  79467. SuperMap.iPortalUser = IPortalUser;
  79468. // iServer
  79469. SuperMap.AddressMatchService = AddressMatchService_AddressMatchService;
  79470. SuperMap.AggregationParameter = AggregationParameter;
  79471. SuperMap.AreaSolarRadiationParameters = AreaSolarRadiationParameters;
  79472. SuperMap.AreaSolarRadiationService = AreaSolarRadiationService;
  79473. SuperMap.BucketAggParameter = BucketAggParameter;
  79474. SuperMap.BufferAnalystParameters = BufferAnalystParameters;
  79475. SuperMap.BufferAnalystService = BufferAnalystService;
  79476. SuperMap.BufferDistance = BufferDistance;
  79477. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter;
  79478. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService;
  79479. SuperMap.BufferSetting = BufferSetting;
  79480. SuperMap.BurstPipelineAnalystParameters = BurstPipelineAnalystParameters;
  79481. SuperMap.BurstPipelineAnalystService = BurstPipelineAnalystService;
  79482. SuperMap.ChartFeatureInfoSpecsService = ChartFeatureInfoSpecsService;
  79483. SuperMap.ChartQueryFilterParameter = ChartQueryFilterParameter;
  79484. SuperMap.ChartQueryParameters = ChartQueryParameters;
  79485. SuperMap.ChartQueryService = ChartQueryService;
  79486. SuperMap.ClipParameter = ClipParameter;
  79487. SuperMap.ColorDictionary = ColorDictionary;
  79488. SuperMap.CommonServiceBase = CommonServiceBase;
  79489. SuperMap.ComputeWeightMatrixParameters = ComputeWeightMatrixParameters;
  79490. SuperMap.ComputeWeightMatrixService = ComputeWeightMatrixService;
  79491. SuperMap.CreateDatasetParameters = CreateDatasetParameters;
  79492. SuperMap.DataFlowService = DataFlowService_DataFlowService;
  79493. SuperMap.DataReturnOption = DataReturnOption;
  79494. SuperMap.DatasetBufferAnalystParameters = DatasetBufferAnalystParameters;
  79495. SuperMap.DatasetInfo = DatasetInfo;
  79496. SuperMap.DatasetOverlayAnalystParameters = DatasetOverlayAnalystParameters;
  79497. SuperMap.DatasetService = DatasetService_DatasetService;
  79498. SuperMap.DatasetSurfaceAnalystParameters = DatasetSurfaceAnalystParameters;
  79499. SuperMap.DatasetThiessenAnalystParameters = DatasetThiessenAnalystParameters;
  79500. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo;
  79501. SuperMap.DatasourceService = DatasourceService_DatasourceService;
  79502. SuperMap.DensityAnalystService = DensityAnalystService;
  79503. SuperMap.DensityKernelAnalystParameters = DensityKernelAnalystParameters;
  79504. SuperMap.EditFeaturesParameters = EditFeaturesParameters;
  79505. SuperMap.EditFeaturesService = EditFeaturesService;
  79506. SuperMap.FacilityAnalyst3DParameters = FacilityAnalyst3DParameters;
  79507. SuperMap.FacilityAnalystSinks3DParameters = FacilityAnalystSinks3DParameters;
  79508. SuperMap.FacilityAnalystSinks3DService = FacilityAnalystSinks3DService;
  79509. SuperMap.FacilityAnalystSources3DParameters = FacilityAnalystSources3DParameters;
  79510. SuperMap.FacilityAnalystSources3DService = FacilityAnalystSources3DService;
  79511. SuperMap.FacilityAnalystStreamParameters = FacilityAnalystStreamParameters;
  79512. SuperMap.FacilityAnalystStreamService = FacilityAnalystStreamService;
  79513. SuperMap.FacilityAnalystTracedown3DParameters = FacilityAnalystTracedown3DParameters;
  79514. SuperMap.FacilityAnalystTracedown3DService = FacilityAnalystTracedown3DService;
  79515. SuperMap.FacilityAnalystTraceup3DParameters = FacilityAnalystTraceup3DParameters;
  79516. SuperMap.FacilityAnalystTraceup3DService = FacilityAnalystTraceup3DService;
  79517. SuperMap.FacilityAnalystUpstream3DParameters = FacilityAnalystUpstream3DParameters;
  79518. SuperMap.FacilityAnalystUpstream3DService = FacilityAnalystUpstream3DService;
  79519. SuperMap.FieldParameters = FieldParameters;
  79520. SuperMap.FieldsFilter = FieldsFilter;
  79521. SuperMap.FieldStatisticService = FieldStatisticService;
  79522. SuperMap.FieldStatisticsParameters = FieldStatisticsParameters;
  79523. SuperMap.FilterParameter = FilterParameter;
  79524. SuperMap.FindClosestFacilitiesParameters = FindClosestFacilitiesParameters;
  79525. SuperMap.FindClosestFacilitiesService = FindClosestFacilitiesService;
  79526. SuperMap.FindLocationParameters = FindLocationParameters;
  79527. SuperMap.FindLocationService = FindLocationService;
  79528. SuperMap.FindMTSPPathsParameters = FindMTSPPathsParameters;
  79529. SuperMap.FindMTSPPathsService = FindMTSPPathsService;
  79530. SuperMap.FindPathParameters = FindPathParameters;
  79531. SuperMap.FindPathService = FindPathService;
  79532. SuperMap.FindServiceAreasParameters = FindServiceAreasParameters;
  79533. SuperMap.FindServiceAreasService = FindServiceAreasService;
  79534. SuperMap.FindTSPPathsParameters = FindTSPPathsParameters;
  79535. SuperMap.FindTSPPathsService = FindTSPPathsService;
  79536. SuperMap.GenerateSpatialDataParameters = GenerateSpatialDataParameters;
  79537. SuperMap.GenerateSpatialDataService = GenerateSpatialDataService;
  79538. SuperMap.GeoCodingParameter = GeoCodingParameter;
  79539. SuperMap.GeoDecodingParameter = GeoDecodingParameter;
  79540. SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter;
  79541. SuperMap.GeometryBatchAnalystService = GeometryBatchAnalystService;
  79542. SuperMap.GeometryBufferAnalystParameters = GeometryBufferAnalystParameters;
  79543. SuperMap.GeometryOverlayAnalystParameters = GeometryOverlayAnalystParameters;
  79544. SuperMap.GeometrySurfaceAnalystParameters = GeometrySurfaceAnalystParameters;
  79545. SuperMap.GeometryThiessenAnalystParameters = GeometryThiessenAnalystParameters;
  79546. SuperMap.GeoprocessingService = GeoprocessingService_GeoprocessingService;
  79547. SuperMap.GeoRelationAnalystParameters = GeoRelationAnalystParameters;
  79548. SuperMap.GeoRelationAnalystService = GeoRelationAnalystService;
  79549. SuperMap.GetFeaturesByBoundsParameters = GetFeaturesByBoundsParameters;
  79550. SuperMap.GetFeaturesByBoundsService = GetFeaturesByBoundsService;
  79551. SuperMap.GetFeaturesByBufferParameters = GetFeaturesByBufferParameters;
  79552. SuperMap.GetFeaturesByBufferService = GetFeaturesByBufferService;
  79553. SuperMap.GetFeaturesByGeometryParameters = GetFeaturesByGeometryParameters;
  79554. SuperMap.GetFeaturesByGeometryService = GetFeaturesByGeometryService;
  79555. SuperMap.GetFeaturesByIDsParameters = GetFeaturesByIDsParameters;
  79556. SuperMap.GetFeaturesByIDsService = GetFeaturesByIDsService;
  79557. SuperMap.GetFeaturesBySQLParameters = GetFeaturesBySQLParameters;
  79558. SuperMap.GetFeaturesBySQLService = GetFeaturesBySQLService;
  79559. SuperMap.GetFeaturesParametersBase = GetFeaturesParametersBase;
  79560. SuperMap.GetFeaturesServiceBase = GetFeaturesServiceBase;
  79561. SuperMap.GetFieldsService = GetFieldsService;
  79562. SuperMap.GetGridCellInfosParameters = GetGridCellInfosParameters;
  79563. SuperMap.GetGridCellInfosService = GetGridCellInfosService;
  79564. SuperMap.GetLayersInfoService = GetLayersInfoService;
  79565. SuperMap.Grid = Grid;
  79566. SuperMap.HillshadeParameter = HillshadeParameter;
  79567. SuperMap.Image = UGCImage;
  79568. SuperMap.ImageCollectionService = ImageCollectionService_ImageCollectionService;
  79569. SuperMap.ImageGFAspect = ImageGFAspect;
  79570. SuperMap.ImageGFHillShade = ImageGFHillShade;
  79571. SuperMap.ImageGFOrtho = ImageGFOrtho;
  79572. SuperMap.ImageGFSlope = ImageGFSlope;
  79573. SuperMap.ImageRenderingRule = ImageRenderingRule;
  79574. SuperMap.ImageSearchParameter = ImageSearchParameter;
  79575. SuperMap.ImageService = ImageService_ImageService;
  79576. SuperMap.ImageStretchOption = ImageStretchOption;
  79577. SuperMap.InterpolationAnalystParameters = InterpolationAnalystParameters;
  79578. SuperMap.InterpolationAnalystService = InterpolationAnalystService;
  79579. SuperMap.InterpolationDensityAnalystParameters = InterpolationDensityAnalystParameters;
  79580. SuperMap.InterpolationIDWAnalystParameters = InterpolationIDWAnalystParameters;
  79581. SuperMap.InterpolationKrigingAnalystParameters = InterpolationKrigingAnalystParameters;
  79582. SuperMap.InterpolationRBFAnalystParameters = InterpolationRBFAnalystParameters;
  79583. SuperMap.JoinItem = JoinItem;
  79584. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter;
  79585. SuperMap.KernelDensityJobsService = KernelDensityJobsService;
  79586. SuperMap.LabelImageCell = LabelImageCell;
  79587. SuperMap.LabelMatrixCell = LabelMatrixCell;
  79588. SuperMap.LabelMixedTextStyle = LabelMixedTextStyle;
  79589. SuperMap.LabelSymbolCell = LabelSymbolCell;
  79590. SuperMap.LabelThemeCell = LabelThemeCell;
  79591. SuperMap.LayerStatus = LayerStatus;
  79592. SuperMap.LinkItem = LinkItem;
  79593. SuperMap.MappingParameters = MappingParameters;
  79594. SuperMap.MapService = MapService_MapService;
  79595. SuperMap.MathExpressionAnalysisParameters = MathExpressionAnalysisParameters;
  79596. SuperMap.MathExpressionAnalysisService = MathExpressionAnalysisService;
  79597. SuperMap.MeasureParameters = MeasureParameters;
  79598. SuperMap.MeasureService = MeasureService_MeasureService;
  79599. SuperMap.MetricsAggParameter = MetricsAggParameter;
  79600. SuperMap.NDVIParameter = NDVIParameter;
  79601. SuperMap.NetworkAnalystServiceBase = NetworkAnalystServiceBase;
  79602. SuperMap.OutputSetting = OutputSetting;
  79603. SuperMap.OverlapDisplayedOptions = OverlapDisplayedOptions;
  79604. SuperMap.OverlayAnalystParameters = OverlayAnalystParameters;
  79605. SuperMap.OverlayAnalystService = OverlayAnalystService;
  79606. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter;
  79607. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService;
  79608. SuperMap.PointWithMeasure = PointWithMeasure;
  79609. SuperMap.ProcessingServiceBase = ProcessingServiceBase;
  79610. SuperMap.QueryByBoundsParameters = QueryByBoundsParameters;
  79611. SuperMap.QueryByBoundsService = QueryByBoundsService;
  79612. SuperMap.QueryByDistanceParameters = QueryByDistanceParameters;
  79613. SuperMap.QueryByDistanceService = QueryByDistanceService;
  79614. SuperMap.QueryByGeometryParameters = QueryByGeometryParameters;
  79615. SuperMap.QueryByGeometryService = QueryByGeometryService;
  79616. SuperMap.QueryBySQLParameters = QueryBySQLParameters;
  79617. SuperMap.QueryBySQLService = QueryBySQLService;
  79618. SuperMap.QueryParameters = QueryParameters;
  79619. SuperMap.QueryService = QueryService_QueryService;
  79620. SuperMap.RasterFunctionParameter = RasterFunctionParameter;
  79621. SuperMap.Route = Route;
  79622. SuperMap.RouteCalculateMeasureParameters = RouteCalculateMeasureParameters;
  79623. SuperMap.RouteCalculateMeasureService = RouteCalculateMeasureService;
  79624. SuperMap.RouteLocatorParameters = RouteLocatorParameters;
  79625. SuperMap.RouteLocatorService = RouteLocatorService;
  79626. SuperMap.ServerColor = ServerColor;
  79627. SuperMap.ServerFeature = ServerFeature;
  79628. SuperMap.ServerGeometry = ServerGeometry;
  79629. SuperMap.ServerStyle = ServerStyle;
  79630. SuperMap.ServerTextStyle = ServerTextStyle;
  79631. SuperMap.ServerTheme = ServerTheme;
  79632. SuperMap.SetDatasourceParameters = SetDatasourceParameters;
  79633. SuperMap.SetLayerInfoParameters = SetLayerInfoParameters;
  79634. SuperMap.SetLayerInfoService = SetLayerInfoService;
  79635. SuperMap.SetLayersInfoParameters = SetLayersInfoParameters;
  79636. SuperMap.SetLayersInfoService = SetLayersInfoService;
  79637. SuperMap.SetLayerStatusParameters = SetLayerStatusParameters;
  79638. SuperMap.SetLayerStatusService = SetLayerStatusService;
  79639. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter;
  79640. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService;
  79641. SuperMap.Sortby = Sortby;
  79642. SuperMap.SpatialAnalystBase = SpatialAnalystBase;
  79643. SuperMap.StopQueryParameters = StopQueryParameters;
  79644. SuperMap.StopQueryService = StopQueryService;
  79645. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter;
  79646. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService;
  79647. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter;
  79648. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService;
  79649. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter;
  79650. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService;
  79651. SuperMap.SupplyCenter = SupplyCenter;
  79652. SuperMap.SurfaceAnalystParameters = SurfaceAnalystParameters;
  79653. SuperMap.SurfaceAnalystParametersSetting = SurfaceAnalystParametersSetting;
  79654. SuperMap.SurfaceAnalystService = SurfaceAnalystService;
  79655. SuperMap.TerrainCurvatureCalculationParameters = TerrainCurvatureCalculationParameters;
  79656. SuperMap.TerrainCurvatureCalculationService = TerrainCurvatureCalculationService;
  79657. SuperMap.Theme = Theme;
  79658. SuperMap.ThemeDotDensity = ThemeDotDensity;
  79659. SuperMap.ThemeFlow = ThemeFlow;
  79660. SuperMap.ThemeGraduatedSymbol = ThemeGraduatedSymbol;
  79661. SuperMap.ThemeGraduatedSymbolStyle = ThemeGraduatedSymbolStyle;
  79662. SuperMap.ThemeGraph = ThemeGraph;
  79663. SuperMap.ThemeGraphAxes = ThemeGraphAxes;
  79664. SuperMap.ThemeGraphItem = ThemeGraphItem;
  79665. SuperMap.ThemeGraphSize = ThemeGraphSize;
  79666. SuperMap.ThemeGraphText = ThemeGraphText;
  79667. SuperMap.ThemeGridRange = ThemeGridRange;
  79668. SuperMap.ThemeGridRangeItem = ThemeGridRangeItem;
  79669. SuperMap.ThemeGridUnique = ThemeGridUnique;
  79670. SuperMap.ThemeGridUniqueItem = ThemeGridUniqueItem;
  79671. SuperMap.ThemeLabel = ThemeLabel;
  79672. SuperMap.ThemeLabelAlongLine = ThemeLabelAlongLine;
  79673. SuperMap.ThemeLabelBackground = ThemeLabelBackground;
  79674. SuperMap.ThemeLabelItem = ThemeLabelItem;
  79675. SuperMap.ThemeLabelText = ThemeLabelText;
  79676. SuperMap.ThemeLabelUniqueItem = ThemeLabelUniqueItem;
  79677. SuperMap.ThemeMemoryData = ThemeMemoryData;
  79678. SuperMap.ThemeOffset = ThemeOffset;
  79679. SuperMap.ThemeParameters = ThemeParameters;
  79680. SuperMap.ThemeRange = ThemeRange;
  79681. SuperMap.ThemeRangeItem = ThemeRangeItem;
  79682. SuperMap.ThemeService = ThemeService_ThemeService;
  79683. SuperMap.ThemeUnique = ThemeUnique;
  79684. SuperMap.ThemeUniqueItem = ThemeUniqueItem;
  79685. SuperMap.ThiessenAnalystParameters = ThiessenAnalystParameters;
  79686. SuperMap.ThiessenAnalystService = ThiessenAnalystService;
  79687. SuperMap.TilesetsService = TilesetsService;
  79688. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter;
  79689. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService;
  79690. SuperMap.TransferLine = TransferLine;
  79691. SuperMap.TransferPathParameters = TransferPathParameters;
  79692. SuperMap.TransferPathService = TransferPathService;
  79693. SuperMap.TransferSolutionParameters = TransferSolutionParameters;
  79694. SuperMap.TransferSolutionService = TransferSolutionService;
  79695. SuperMap.TransportationAnalystParameter = TransportationAnalystParameter;
  79696. SuperMap.TransportationAnalystResultSetting = TransportationAnalystResultSetting;
  79697. SuperMap.UGCLayer = UGCLayer;
  79698. SuperMap.UGCMapLayer = UGCMapLayer;
  79699. SuperMap.UGCSubLayer = UGCSubLayer;
  79700. SuperMap.UpdateDatasetParameters = UpdateDatasetParameters;
  79701. SuperMap.UpdateEdgeWeightParameters = UpdateEdgeWeightParameters;
  79702. SuperMap.UpdateEdgeWeightService = UpdateEdgeWeightService;
  79703. SuperMap.UpdateTurnNodeWeightParameters = UpdateTurnNodeWeightParameters;
  79704. SuperMap.UpdateTurnNodeWeightService = UpdateTurnNodeWeightService;
  79705. SuperMap.Vector = Vector_Vector;
  79706. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter;
  79707. SuperMap.VectorClipJobsService = VectorClipJobsService;
  79708. SuperMap.WebPrintingJobContent = WebPrintingJobContent;
  79709. SuperMap.WebPrintingJobCustomItems = WebPrintingJobCustomItems;
  79710. SuperMap.WebPrintingJobExportOptions = WebPrintingJobExportOptions;
  79711. SuperMap.WebPrintingJobImage = WebPrintingJobImage;
  79712. SuperMap.WebPrintingJobLayers = WebPrintingJobLayers;
  79713. SuperMap.WebPrintingJobLayoutOptions = WebPrintingJobLayoutOptions;
  79714. SuperMap.WebPrintingJobLegendOptions = WebPrintingJobLegendOptions;
  79715. SuperMap.WebPrintingJobLittleMapOptions = WebPrintingJobLittleMapOptions;
  79716. SuperMap.WebPrintingJobNorthArrowOptions = WebPrintingJobNorthArrowOptions;
  79717. SuperMap.WebPrintingJobParameters = WebPrintingJobParameters;
  79718. SuperMap.WebPrintingJobScaleBarOptions = WebPrintingJobScaleBarOptions;
  79719. SuperMap.WebPrintingService = WebPrintingService;
  79720. //Online
  79721. SuperMap.Online = Online;
  79722. SuperMap.OnlineData = OnlineData;
  79723. SuperMap.OnlineQueryDatasParameter = OnlineQueryDatasParameter;
  79724. SuperMap.ServiceStatus = ServiceStatus;
  79725. // 包含online中的DataItemType数据类型
  79726. SuperMap.DataItemType = DataItemType;
  79727. SuperMap.DataItemOrderBy = DataItemOrderBy;
  79728. SuperMap.FilterField = FilterField;
  79729. SuperMap.OnlineServiceBase = OnlineServiceBase;
  79730. // overlay
  79731. SuperMap.Feature = SuperMap.Feature || {};
  79732. SuperMap.Feature.Theme = Theme_Theme;
  79733. SuperMap.Feature.Theme.Bar = Bar;
  79734. SuperMap.Feature.Theme.Bar3D = Bar3D;
  79735. SuperMap.Feature.Theme.Circle = Circle;
  79736. SuperMap.Feature.Theme.Graph = Graph;
  79737. SuperMap.Feature.Theme.Line = Line;
  79738. SuperMap.Feature.Theme.Pie = Pie;
  79739. SuperMap.Feature.Theme.Point = overlay_Point_Point;
  79740. SuperMap.Feature.Theme.RankSymbol = RankSymbol;
  79741. SuperMap.Feature.Theme.Ring = Ring;
  79742. SuperMap.Feature.Theme.ThemeVector = ThemeVector;
  79743. SuperMap.Feature.ShapeParameters = ShapeParameters;
  79744. SuperMap.Feature.ShapeParameters.Circle = Circle_Circle;
  79745. SuperMap.Feature.ShapeParameters.Image = Image_Image;
  79746. SuperMap.Feature.ShapeParameters.Label = Label;
  79747. SuperMap.Feature.ShapeParameters.Line = Line_Line;
  79748. SuperMap.Feature.ShapeParameters.Point = Point_Point;
  79749. SuperMap.Feature.ShapeParameters.Polygon = feature_Polygon_Polygon;
  79750. SuperMap.Feature.ShapeParameters.Rectangle = Rectangle_Rectangle;
  79751. SuperMap.Feature.ShapeParameters.Sector = Sector;
  79752. SuperMap.Feature.ShapeFactory = ShapeFactory;
  79753. // LevelRenderer
  79754. SuperMap.LevelRenderer = LevelRenderer;
  79755. // security
  79756. SuperMap.KeyServiceParameter = KeyServiceParameter;
  79757. SuperMap.SecurityManager = SecurityManager;
  79758. SuperMap.ServerInfo = ServerInfo;
  79759. SuperMap.TokenServiceParameter = TokenServiceParameter;
  79760. // style
  79761. SuperMap.ThemeStyle = ThemeStyle;
  79762. SuperMap.CartoCSS = CartoCSS;
  79763. // thirdparty
  79764. // SuperMap.BinaryClassification = BinaryClassification;
  79765. // SuperMap.LandcoverClassification = LandcoverClassification;
  79766. // SuperMap.ObjectDetection = ObjectDetection;
  79767. // SuperMap.WebMachineLearning = WebMachineLearning;
  79768. SuperMap.ElasticSearch = ElasticSearch;
  79769. // util
  79770. SuperMap.ArrayStatistic = ArrayStatistic;
  79771. SuperMap.ColorsPickerUtil = ColorsPickerUtil;
  79772. // REST
  79773. SuperMap.DataFormat = DataFormat;
  79774. SuperMap.ServerType = ServerType;
  79775. SuperMap.GeometryType = REST_GeometryType;
  79776. SuperMap.QueryOption = QueryOption;
  79777. SuperMap.JoinType = JoinType;
  79778. SuperMap.SpatialQueryMode = SpatialQueryMode;
  79779. SuperMap.SpatialRelationType = SpatialRelationType;
  79780. SuperMap.MeasureMode = MeasureMode;
  79781. SuperMap.Unit = Unit;
  79782. SuperMap.BufferRadiusUnit = BufferRadiusUnit;
  79783. SuperMap.EngineType = EngineType;
  79784. SuperMap.ThemeGraphTextFormat = ThemeGraphTextFormat;
  79785. SuperMap.ThemeGraphType = ThemeGraphType;
  79786. SuperMap.GraphAxesTextDisplayMode = GraphAxesTextDisplayMode;
  79787. SuperMap.GraduatedMode = GraduatedMode;
  79788. SuperMap.RangeMode = RangeMode;
  79789. SuperMap.ThemeType = ThemeType;
  79790. SuperMap.ColorGradientType = ColorGradientType;
  79791. SuperMap.TextAlignment = TextAlignment;
  79792. SuperMap.FillGradientMode = FillGradientMode;
  79793. SuperMap.AlongLineDirection = AlongLineDirection;
  79794. SuperMap.LabelBackShape = LabelBackShape;
  79795. SuperMap.LabelOverLengthMode = LabelOverLengthMode;
  79796. SuperMap.DirectionType = DirectionType;
  79797. SuperMap.OverlayOperationType = OverlayOperationType;
  79798. SuperMap.OutputType = OutputType;
  79799. SuperMap.SideType = SideType;
  79800. SuperMap.SupplyCenterType = SupplyCenterType;
  79801. SuperMap.TurnType = TurnType;
  79802. SuperMap.BufferEndType = BufferEndType;
  79803. SuperMap.SmoothMethod = SmoothMethod;
  79804. SuperMap.SurfaceAnalystMethod = SurfaceAnalystMethod;
  79805. SuperMap.DataReturnMode = DataReturnMode;
  79806. SuperMap.EditType = EditType;
  79807. SuperMap.TransferTactic = TransferTactic;
  79808. SuperMap.TransferPreference = TransferPreference;
  79809. SuperMap.GridType = GridType;
  79810. SuperMap.ColorSpaceType = ColorSpaceType;
  79811. SuperMap.LayerType = LayerType;
  79812. SuperMap.UGCLayerType = UGCLayerType;
  79813. SuperMap.StatisticMode = StatisticMode;
  79814. SuperMap.PixelFormat = PixelFormat;
  79815. SuperMap.SearchMode = SearchMode;
  79816. SuperMap.InterpolationAlgorithmType = InterpolationAlgorithmType;
  79817. SuperMap.VariogramMode = VariogramMode;
  79818. SuperMap.Exponent = Exponent;
  79819. SuperMap.ClientType = ClientType;
  79820. SuperMap.ChartType = ChartType;
  79821. SuperMap.ClipAnalystMode = ClipAnalystMode;
  79822. SuperMap.AnalystAreaUnit = AnalystAreaUnit;
  79823. SuperMap.AnalystSizeUnit = AnalystSizeUnit;
  79824. SuperMap.StatisticAnalystMode = StatisticAnalystMode;
  79825. SuperMap.SummaryType = SummaryType;
  79826. SuperMap.TopologyValidatorRule = TopologyValidatorRule;
  79827. SuperMap.BucketAggType = BucketAggType;
  79828. SuperMap.MetricsAggType = MetricsAggType;
  79829. SuperMap.GetFeatureMode = GetFeatureMode;
  79830. SuperMap.RasterFunctionType = RasterFunctionType;
  79831. SuperMap.ResourceType = ResourceType;
  79832. SuperMap.OrderBy = OrderBy;
  79833. SuperMap.OrderType = OrderType;
  79834. SuperMap.SearchType = SearchType;
  79835. SuperMap.AggregationTypes = AggregationTypes;
  79836. SuperMap.PermissionType = PermissionType;
  79837. SuperMap.EntityType = EntityType;
  79838. SuperMap.WebExportFormatType = WebExportFormatType;
  79839. SuperMap.WebScaleOrientationType = WebScaleOrientationType;
  79840. SuperMap.WebScaleType = WebScaleType;
  79841. SuperMap.WebScaleUnit = WebScaleUnit;
  79842. SuperMap.KnowledgeGraph = KnowledgeGraph
  79843. ;// CONCATENATED MODULE: external "ol.Observable"
  79844. const external_ol_Observable_namespaceObject = ol.Observable;
  79845. var external_ol_Observable_default = /*#__PURE__*/__webpack_require__.n(external_ol_Observable_namespaceObject);
  79846. ;// CONCATENATED MODULE: ./src/openlayers/services/ServiceBase.js
  79847. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79848. * This program are made available under the terms of the Apache License, Version 2.0
  79849. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79850. /**
  79851. * @class ServiceBase
  79852. * @category iServer Core
  79853. * @classdesc ol.supermap 的服务基类。
  79854. * @param {string} url - 服务地址。
  79855. * @param {Object} options - 参数。
  79856. * @param {string} [options.proxy] - 服务代理地址。
  79857. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  79858. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  79859. * @param {Object} [options.headers] - 请求头。
  79860. * @extends {ol.Observable}
  79861. * @usage
  79862. */
  79863. class ServiceBase extends (external_ol_Observable_default()) {
  79864. constructor(url, options) {
  79865. super(url, options);
  79866. this.options = options || {};
  79867. this.url = url;
  79868. this.dispatchEvent({type: 'initialized', value: this});
  79869. }
  79870. }
  79871. ;// CONCATENATED MODULE: ./src/openlayers/services/MapService.js
  79872. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79873. * This program are made available under the terms of the Apache License, Version 2.0
  79874. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79875. /**
  79876. * @class MapService
  79877. * @category iServer Map
  79878. * @classdesc 地图信息服务类。
  79879. * @modulecategory Services
  79880. * @extends {ServiceBase}
  79881. * @param {string} url - 服务地址。
  79882. * @param {Object} options - 参数。
  79883. * @param {string} [options.proxy] - 服务代理地址。
  79884. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  79885. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  79886. * @param {Object} [options.headers] - 请求头。
  79887. * @example
  79888. * new MapService(url).getMapInfo(function(result){
  79889. * //doSomething
  79890. * })
  79891. * @usage
  79892. */
  79893. class MapService extends ServiceBase {
  79894. constructor(url, options) {
  79895. super(url, options);
  79896. }
  79897. /**
  79898. * @function MapService.prototype.getMapInfo
  79899. * @description 地图信息查询服务。
  79900. * @param {RequestCallback} callback - 回调函数。
  79901. * @returns {MapService} 获取服务信息。
  79902. */
  79903. getMapInfo(callback) {
  79904. var me = this;
  79905. var getMapStatusService = new MapService_MapService(me.url, {
  79906. proxy: me.options.proxy,
  79907. withCredentials: me.options.withCredentials,
  79908. crossOrigin: me.options.crossOrigin,
  79909. headers: me.options.headers,
  79910. projection: me.options.projection
  79911. });
  79912. getMapStatusService.processAsync(callback);
  79913. }
  79914. /**
  79915. * @function MapService.prototype.getWkt
  79916. * @description 获取WKT。
  79917. * @param {RequestCallback} callback - 回调函数。
  79918. */
  79919. getWkt(callback) {
  79920. var me = this;
  79921. var getMapStatusService = new MapService_MapService(`${me.url}/prjCoordSys.wkt`, {
  79922. proxy: me.options.proxy,
  79923. withCredentials: me.options.withCredentials,
  79924. withoutFormatSuffix: true,
  79925. crossOrigin: me.options.crossOrigin,
  79926. headers: me.options.headers,
  79927. projection: me.options.projection
  79928. });
  79929. getMapStatusService.processAsync(callback);
  79930. }
  79931. /**
  79932. * @function MapService.prototype.getTilesets
  79933. * @description 切片列表信息查询服务。
  79934. * @param {RequestCallback} callback - 回调函数。
  79935. * @returns {MapService} 获取服务信息。
  79936. */
  79937. getTilesets(callback) {
  79938. var me = this;
  79939. var tilesetsService = new TilesetsService(me.url, {
  79940. proxy: me.options.proxy,
  79941. withCredentials: me.options.withCredentials,
  79942. crossOrigin: me.options.crossOrigin,
  79943. headers: me.options.headers,
  79944. eventListeners: {
  79945. scope: me,
  79946. processCompleted: callback,
  79947. processFailed: callback
  79948. }
  79949. });
  79950. tilesetsService.processAsync();
  79951. }
  79952. }
  79953. ;// CONCATENATED MODULE: external "ol.control.Control"
  79954. const external_ol_control_Control_namespaceObject = ol.control.Control;
  79955. var external_ol_control_Control_default = /*#__PURE__*/__webpack_require__.n(external_ol_control_Control_namespaceObject);
  79956. ;// CONCATENATED MODULE: ./src/openlayers/control/ChangeTileVersion.js
  79957. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79958. * This program are made available under the terms of the Apache License, Version 2.0
  79959. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79960. /**
  79961. * @class ChangeTileVersion
  79962. * @aliasclass control.ChangeTileVersion
  79963. * @category Control
  79964. * @classdesc 版本切换控件(目前仅支持 IE10 及以上)暂时不支持自定义位置。
  79965. * @modulecategory Control
  79966. * @extends {ol.control.Control}
  79967. * @param {Object} options -参数。
  79968. * @param {string} [options.title='switch tile version'] - 提示信息。
  79969. * @param {string} [options.tooltip='top'] - 提示显示位置 top | right | bottom | left。
  79970. * @param {boolean} [options.collapsed=true] - 是否折叠。
  79971. * @param {string} [options.lastText='-'] - 上一个版本的按钮布局。
  79972. * @param {string} [options.nextText='+'] - 下一个版本的按钮布局。
  79973. * @param {string} [options.ico='V'] - 控件显示的logo。
  79974. * @param {string} [options.orientation='horizontal'] - 方向 horizontal|vertical。
  79975. * @param {boolean} [options.switch=true] - 是否显示上/下一个版本切换控件。
  79976. * @example
  79977. * var control = new ChangeTileVersion({
  79978. * layer: baseLayer,
  79979. * orientation: "horizontal"
  79980. * });
  79981. * map.addControl(control)
  79982. * @usage
  79983. */
  79984. class ChangeTileVersion extends (external_ol_control_Control_default()) {
  79985. constructor(options) {
  79986. options = options || {};
  79987. //鼠标滑过时提示
  79988. if (!options.title) {
  79989. options.title = 'switch tile version';
  79990. }
  79991. //tooltip提示显示位置 top | right | bottom | left
  79992. if (!options.tooltip) {
  79993. options.tooltip = 'top';
  79994. }
  79995. //是否折叠
  79996. if (!options.collapsed) {
  79997. options.collapsed = true;
  79998. }
  79999. //上一个版本的按钮布局
  80000. if (!options.lastText) {
  80001. options.lastText = '-';
  80002. }
  80003. //下一个版本的按钮布局
  80004. if (!options.nextText) {
  80005. options.nextText = '+';
  80006. }
  80007. //控件显示的logo
  80008. if (!options.ico) {
  80009. options.ico = 'V';
  80010. }
  80011. //方向horizontal|vertical
  80012. if (options.orientation !== 'vertical') {
  80013. options.orientation = 'horizontal';
  80014. }
  80015. //是否显示上/下一个版本切换控件
  80016. if (!options.switch) {
  80017. options.switch = true;
  80018. }
  80019. super(options);
  80020. this.options = options;
  80021. this.element = options.element = initLayout.call(this);
  80022. if (options.layer) {
  80023. this.setLayer(options.layer);
  80024. }
  80025. /**
  80026. * @function ChangeTileVersion.prototype.initLayout
  80027. * @description 初始化。
  80028. */
  80029. function initLayout() {
  80030. var className = 'ol-control-ctv';
  80031. this._container = createElement(
  80032. 'div',
  80033. className + ' ' + className + '-' + options.orientation + ' ol-unselectable ol-control'
  80034. );
  80035. //正常情况下显示btn
  80036. this._sliderBtn = createElement('button', className + '-toggle', this._container);
  80037. this._sliderBtn.setAttribute('title', options.title);
  80038. this._sliderBtn.innerHTML = options.ico;
  80039. //滑块拖动时值显示区域
  80040. this._sliderValue = createElement('p', className + '-value', this._container);
  80041. this._sliderValue.innerHTML = options.ico;
  80042. this._sliderValue.setAttribute('title', options.title);
  80043. var sliderClassName = 'ol-ctv-slider';
  80044. this._sliderContent = createElement('div', sliderClassName + '-main' + ' tooltip', this._container);
  80045. //tooltip提示框
  80046. if (options.orientation === 'vertical' && options.tooltip === 'top') {
  80047. options.tooltip = 'right';
  80048. }
  80049. this.tooltip = createElement(
  80050. 'span',
  80051. 'tooltip-text' + ' ' + 'tooltip-' + options.tooltip,
  80052. this._sliderContent
  80053. );
  80054. this.tooltip.innerHTML = options.ico;
  80055. //加控件
  80056. if (options.switch) {
  80057. this._next = createElement(
  80058. 'a',
  80059. sliderClassName + '-incdec' + ' ' + sliderClassName + '-next',
  80060. this._sliderContent
  80061. );
  80062. this._next.innerHTML = options.nextText;
  80063. addDomEvent(this._next, 'click', this.nextTilesVersion, this);
  80064. this._container.classList.add(className + '-incdec');
  80065. }
  80066. //滑块
  80067. this._sliderContainer = createElement('div', sliderClassName + '-container', this._sliderContent);
  80068. this.slider = createElement('input', sliderClassName, this._sliderContainer);
  80069. this.min = this.min == null || isNaN(this.min) ? 0 : parseInt(this.min);
  80070. this.slider.setAttribute('title', options.title);
  80071. this.slider.setAttribute('id', 'slider');
  80072. this.slider.setAttribute('type', 'range');
  80073. this.slider.setAttribute('min', this.min);
  80074. this.slider.setAttribute('max', 0);
  80075. this.slider.setAttribute('step', 1);
  80076. this.slider.setAttribute('value', 0);
  80077. // //判断浏览器是否支持Range滑动条
  80078. // if (this.slider.type == "text") {
  80079. // console.error("抱歉,您的浏览器不支持HTML5 range滑动条,请使用高版本浏览器");
  80080. // }
  80081. this.firstLoad = true;
  80082. if ('oninput' in this.slider || 'onchange' in this.slider) {
  80083. addDomEvent(this.slider, 'change', tilesVersion, this);
  80084. } else {
  80085. this.slider.onpropertychange = tilesVersion;
  80086. }
  80087. //减控件
  80088. if (options.switch) {
  80089. this._last = createElement(
  80090. 'a',
  80091. sliderClassName + '-incdec' + ' ' + sliderClassName + '-last',
  80092. this._sliderContent
  80093. );
  80094. this._last.innerHTML = options.lastText;
  80095. addDomEvent(this._last, 'click', this.lastTilesVersion, this);
  80096. }
  80097. // if (window.matchMedia("screen and (-webkit-min-device-pixel-ratio:0)").matches && options.orientation == 'vertical') {
  80098. if (options.orientation == 'vertical') {
  80099. this.slider.style.width = 170 + 'px';
  80100. this._sliderContainer.style.height = 170 + 'px';
  80101. } else {
  80102. this._sliderContainer.style.width = 150 + 'px';
  80103. }
  80104. addDomEvent(
  80105. this._container,
  80106. 'click',
  80107. function(e) {
  80108. e.preventDefault();
  80109. e.stopPropagation();
  80110. },
  80111. this
  80112. );
  80113. if (options.collapsed) {
  80114. addDomEvent(this._container, 'mouseenter', expand, this);
  80115. addDomEvent(this._container, 'mouseleave', collapse, this);
  80116. addDomEvent(this._sliderBtn, 'click', function(e) {
  80117. e.preventDefault();
  80118. e.stopPropagation();
  80119. });
  80120. addDomEvent(this._sliderBtn, 'click', expand, this);
  80121. addDomEvent(this._sliderBtn, 'focus', expand, this);
  80122. } else {
  80123. expand();
  80124. }
  80125. return this._container;
  80126. }
  80127. /**
  80128. * @function ChangeTileVersion.prototype.createElement
  80129. * @description 新建元素。
  80130. * @param {string} tagName - 标签名。
  80131. * @param {string} className - 类名。
  80132. * @param {Object} container - 容器。
  80133. * @returns {object|HTMLElement} 元素。
  80134. */
  80135. function createElement(tagName, className, container) {
  80136. var el = document.createElement(tagName);
  80137. el.className = className || '';
  80138. if (container) {
  80139. container.appendChild(el);
  80140. }
  80141. return el;
  80142. }
  80143. /**
  80144. * @function ChangeTileVersion.prototype.addDomEvent
  80145. * @description 为元素添加事件。
  80146. * @param {Object} obj - 事件对象集。
  80147. * @param {string} type - 事件类型。
  80148. * @param {Object} fn -容器。
  80149. * @param {Object} context -当前环境。
  80150. * @returns {function} 添加的事件。
  80151. */
  80152. function addDomEvent(obj, type, fn, context) {
  80153. var handler = function(e) {
  80154. if (fn) {
  80155. return fn.call(context || obj, e || window.event);
  80156. }
  80157. };
  80158. var originalHandler = handler;
  80159. if ('addEventListener' in obj) {
  80160. if (type === 'mousewheel') {
  80161. obj.addEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false);
  80162. } else if (type === 'mouseenter' || type === 'mouseleave') {
  80163. handler = function(e) {
  80164. e = e || window.event;
  80165. if (isExternalTarget(obj, e)) {
  80166. originalHandler(e);
  80167. }
  80168. };
  80169. obj.addEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false);
  80170. } else {
  80171. obj.addEventListener(type, handler, false);
  80172. }
  80173. } else if ('attachEvent' in obj) {
  80174. obj.attachEvent('on' + type, handler);
  80175. }
  80176. return this;
  80177. }
  80178. function isExternalTarget(el, e) {
  80179. var related = e.relatedTarget;
  80180. if (!related) {
  80181. return true;
  80182. }
  80183. try {
  80184. while (related && related !== el) {
  80185. related = related.parentNode;
  80186. }
  80187. } catch (err) {
  80188. return false;
  80189. }
  80190. return related !== el;
  80191. }
  80192. function expand() {
  80193. this._container.classList.add('ol-control-ctv-expanded');
  80194. }
  80195. function collapse() {
  80196. this._container.classList.remove('ol-control-ctv-expanded');
  80197. }
  80198. function tilesVersion() {
  80199. var version = this.getVersion();
  80200. this.tilesVersion(version);
  80201. }
  80202. }
  80203. /**
  80204. * @function ChangeTileVersion.prototype.setContent
  80205. * @description 设置版本相关信息。
  80206. * @param {Object} version - 版本信息。
  80207. */
  80208. setContent(version) {
  80209. var content = version || {};
  80210. this.setVersionName(content.desc).setToolTip(content.desc);
  80211. }
  80212. /**
  80213. * @function ChangeTileVersion.prototype.setVersionName
  80214. * @description 设置版本号
  80215. * @param {string} content -版本内容。
  80216. */
  80217. setVersionName(content) {
  80218. var value = content;
  80219. if (!content) {
  80220. value = this.getValue();
  80221. }
  80222. this._sliderValue.innerHTML = value;
  80223. return this;
  80224. }
  80225. /**
  80226. * @function ChangeTileVersion.prototype.setToolTip
  80227. * @description 设置提示信息。
  80228. * @param {string} tooltip - 提示信息。
  80229. * @returns {ChangeTileVersion} ChangeTileVersion的实例对象。
  80230. */
  80231. setToolTip(tooltip) {
  80232. this.tooltip.innerHTML = tooltip;
  80233. return this;
  80234. }
  80235. /**
  80236. * @function ChangeTileVersion.prototype.updateLength
  80237. * @description 更新进度条长度。
  80238. * @param {number} length - 进度条长度。
  80239. */
  80240. updateLength(length) {
  80241. if (length > 0) {
  80242. this.length = length;
  80243. this.max = this.length - 1;
  80244. this.slider.setAttribute('max', this.max);
  80245. }
  80246. }
  80247. /**
  80248. * @function ChangeTileVersion.prototype.setLayer
  80249. * @description 绑定图层。
  80250. * @param {Object} layer - 图层。
  80251. */
  80252. setLayer(layer) {
  80253. if (layer) {
  80254. this.options.layer = layer;
  80255. }
  80256. var me = this;
  80257. var tileLayer = me.options.layer;
  80258. tileLayer.on('tilesetsinfoloaded', function(evt) {
  80259. var tileVersions = evt.value && evt.value.tileVersions;
  80260. me.update(tileVersions);
  80261. });
  80262. tileLayer.on('tileversionschanged', function(evt) {
  80263. var tileVersions = evt.value && evt.value.tileVersion;
  80264. me.setContent(tileVersions);
  80265. });
  80266. me.getTileSetsInfo();
  80267. }
  80268. /**
  80269. * @function ChangeTileVersion.prototype.update
  80270. * @description 更新缓存切片集及进度条长度。
  80271. * @param {Object} tileVersions - 待更新的切片版本。
  80272. */
  80273. update(tileVersions) {
  80274. this.tileVersions = tileVersions ||[];
  80275. this.updateLength(this.tileVersions.length);
  80276. }
  80277. /**
  80278. * @function ChangeTileVersion.prototype.getTileSetsInfo
  80279. * @description 请求获取切片集信息。
  80280. */
  80281. getTileSetsInfo() {
  80282. var me = this;
  80283. if (me.options.layer) {
  80284. new MapService(me.options.layer._url).getTilesets(function getTilesInfoSucceed(info) {
  80285. me.options.layer.setTileSetsInfo(info.result);
  80286. });
  80287. }
  80288. }
  80289. /**
  80290. * @function ChangeTileVersion.prototype.removeLayer
  80291. * @description 移除绑定的地图图层。
  80292. */
  80293. removeLayer() {
  80294. this.options.layer = null;
  80295. }
  80296. /**
  80297. * @function ChangeTileVersion.prototype.nextTilesVersion
  80298. * @description 下一个版本,第一次不进行加减,是无版本的状态。
  80299. * @returns {ChangeTileVersion} ChangeTileVersion的实例对象。
  80300. */
  80301. nextTilesVersion() {
  80302. if (this.firstLoad) {
  80303. this.options.layer.nextTilesVersion();
  80304. this.firstLoad = !!0;
  80305. return this;
  80306. }
  80307. if (parseInt(this.slider.value) > this.max - 1) {
  80308. return this;
  80309. }
  80310. this.slider.value = parseInt(this.slider.value) + 1;
  80311. this.options.layer.nextTilesVersion();
  80312. return this;
  80313. }
  80314. /**
  80315. * @function ChangeTileVersion.prototype.lastTilesVersion
  80316. * @description 获取上一个版本信息。
  80317. * @returns {ChangeTileVersion} ChangeTileVersion的实例对象。
  80318. */
  80319. lastTilesVersion() {
  80320. if (parseInt(this.slider.value) < this.min + 1) {
  80321. return this;
  80322. }
  80323. this.slider.value = parseInt(this.slider.value) - 1;
  80324. this.options.layer.lastTilesVersion();
  80325. return this;
  80326. }
  80327. /**
  80328. * @function ChangeTileVersion.prototype.tilesVersion
  80329. * @description 根据指定版本号请求版本。
  80330. * @param {Object} version - 版本信息。
  80331. */
  80332. tilesVersion(version) {
  80333. var layer = this.options.layer,
  80334. tileVersions = this.tileVersions;
  80335. var len = tileVersions.length;
  80336. for (var i = 0; i < len; i++) {
  80337. if (tileVersions[i].name == version) {
  80338. layer.updateCurrentTileSetsIndex(i);
  80339. layer.changeTilesVersion();
  80340. break;
  80341. }
  80342. }
  80343. }
  80344. /**
  80345. * @function ChangeTileVersion.prototype.getValue
  80346. * @description 获取进度条的值。注:(进度条的值并不是版本号)。
  80347. */
  80348. getValue() {
  80349. return this.slider.value;
  80350. }
  80351. /**
  80352. * @function ChangeTileVersion.prototype.getVersion
  80353. * @description 获取当前进度条值对应的版本号。
  80354. */
  80355. getVersion() {
  80356. var version = this.tileVersions[this.getValue()];
  80357. return version && version.name;
  80358. }
  80359. }
  80360. ;// CONCATENATED MODULE: external "ol.control.ScaleLine"
  80361. const external_ol_control_ScaleLine_namespaceObject = ol.control.ScaleLine;
  80362. var external_ol_control_ScaleLine_default = /*#__PURE__*/__webpack_require__.n(external_ol_control_ScaleLine_namespaceObject);
  80363. ;// CONCATENATED MODULE: external "ol.proj"
  80364. const external_ol_proj_namespaceObject = ol.proj;
  80365. ;// CONCATENATED MODULE: external "ol.AssertionError"
  80366. const external_ol_AssertionError_namespaceObject = ol.AssertionError;
  80367. var external_ol_AssertionError_default = /*#__PURE__*/__webpack_require__.n(external_ol_AssertionError_namespaceObject);
  80368. ;// CONCATENATED MODULE: ./src/openlayers/control/ScaleLine.js
  80369. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80370. * This program are made available under the terms of the Apache License, Version 2.0
  80371. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80372. /**
  80373. * @class ScaleLine
  80374. * @aliasclass control.ScaleLine
  80375. * @category Control
  80376. * @version 9.1.2
  80377. * @classdesc 比例尺控件。
  80378. * <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
  80379. * <p style="color: #ce4844">Notice</p>
  80380. * <p style="font-size: 13px">该功能继承 {@link ol.control.ScaleLine },与 {@link ol.control.ScaleLine } 功能完全相同。仅为修复 `openlayers` v4.6.5 版本中 WGS84 等地理坐标系比例尺数值错误的问题。
  80381. * </div>
  80382. * @modulecategory Control
  80383. * @extends {ol.control.ScaleLine}
  80384. * @param {Object} options -参数。
  80385. * @param {string} [options.className='ol-scale-line'] - CSS Class name.。
  80386. * @param {number} [options.minWidth=64] - 最小像素宽度。
  80387. * @param {(HTMLElement|string) } [options.target] - 指定比例尺控件目标容器。
  80388. * @param {(ol.control.ScaleLine.Units|string)} [options.units='metric'] - 上一个版本的按钮布局。
  80389. * @example
  80390. * var control = new ScaleLine();
  80391. * map.addControl(control)
  80392. * @usage
  80393. */
  80394. class ScaleLine extends (external_ol_control_ScaleLine_default()) {
  80395. constructor(options) {
  80396. options = options || {};
  80397. //需在super之前定义render,真正的调用是在初始化完成后
  80398. options.render = function (mapEvent) {
  80399. var frameState = mapEvent.frameState;
  80400. if (!frameState) {
  80401. this.viewState_ = null; //NOSONAR
  80402. } else {
  80403. this.viewState_ = frameState.viewState; //NOSONAR
  80404. }
  80405. this.updateElementRepair(); //NOSONAR
  80406. };
  80407. super(options); //NOSONAR
  80408. }
  80409. updateElementRepair() {
  80410. const viewState = this.viewState_ || this.o || this.Om;
  80411. if (!viewState) {
  80412. this.renderedVisible_ = this.renderedVisible_ || this.j || this.yn;
  80413. if (this.renderedVisible_) {
  80414. this.element_ = this.element_ || this.c;
  80415. this.element.style.display = 'none';
  80416. this.renderedVisible_ = false;
  80417. }
  80418. return;
  80419. }
  80420. const center = viewState.center;
  80421. const projection = viewState.projection;
  80422. const units = this.getUnits();
  80423. const pointResolutionUnits = units == "degrees" ?
  80424. "degrees" :
  80425. "m";
  80426. let pointResolution =
  80427. external_ol_proj_namespaceObject.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
  80428. this.minWidth_ = this.minWidth_ || this.v || this.Em;
  80429. let nominalCount = this.minWidth_ * pointResolution;
  80430. let suffix = '';
  80431. if (units == "degrees") {
  80432. const metersPerDegree = external_ol_proj_namespaceObject.METERS_PER_UNIT["degrees"];
  80433. nominalCount *= metersPerDegree;
  80434. if (nominalCount < metersPerDegree / 60) {
  80435. suffix = '\u2033'; // seconds
  80436. pointResolution *= 3600;
  80437. } else if (nominalCount < metersPerDegree) {
  80438. suffix = '\u2032'; // minutes
  80439. pointResolution *= 60;
  80440. } else {
  80441. suffix = '\u00b0'; // degrees
  80442. }
  80443. } else if (units == "imperial") {
  80444. if (nominalCount < 0.9144) {
  80445. suffix = 'in';
  80446. pointResolution /= 0.0254;
  80447. } else if (nominalCount < 1609.344) {
  80448. suffix = 'ft';
  80449. pointResolution /= 0.3048;
  80450. } else {
  80451. suffix = 'mi';
  80452. pointResolution /= 1609.344;
  80453. }
  80454. } else if (units == "nautical") {
  80455. pointResolution /= 1852;
  80456. suffix = 'nm';
  80457. } else if (units == "metric") {
  80458. if (nominalCount < 0.001) {
  80459. suffix = 'μm';
  80460. pointResolution *= 1000000;
  80461. } else if (nominalCount < 1) {
  80462. suffix = 'mm';
  80463. pointResolution *= 1000;
  80464. } else if (nominalCount < 1000) {
  80465. suffix = 'm';
  80466. } else {
  80467. suffix = 'km';
  80468. pointResolution /= 1000;
  80469. }
  80470. } else if (units == "us") {
  80471. if (nominalCount < 0.9144) {
  80472. suffix = 'in';
  80473. pointResolution *= 39.37;
  80474. } else if (nominalCount < 1609.344) {
  80475. suffix = 'ft';
  80476. pointResolution /= 0.30480061;
  80477. } else {
  80478. suffix = 'mi';
  80479. pointResolution /= 1609.3472;
  80480. }
  80481. } else {
  80482. throw new (external_ol_AssertionError_default())(33); // Invalid units
  80483. }
  80484. var DIGITS = [1, 2, 5];
  80485. let i = 3 * Math.floor(
  80486. Math.log(this.minWidth_ * pointResolution) / Math.log(10));
  80487. let count, width, decimalCount;
  80488. while (true) { //eslint-disable-line no-constant-condition
  80489. decimalCount = Math.floor(i / 3);
  80490. const decimal = Math.pow(10, decimalCount);
  80491. count = DIGITS[((i % 3) + 3) % 3] * decimal;
  80492. width = Math.round(count / pointResolution);
  80493. if (isNaN(width)) {
  80494. this.element.style.display = 'none';
  80495. this.renderedVisible_ = false;
  80496. return;
  80497. } else if (width >= this.minWidth_) {
  80498. break;
  80499. }
  80500. ++i;
  80501. }
  80502. this.renderedHTML_ = this.renderedHTML_ || this.D || this.am;
  80503. this.innerElement_ = this.innerElement_ || this.l || this.Tm;
  80504. this.renderedWidth_ = this.renderedWidth_ || this.B || this.Am;
  80505. this.renderedVisible_ = this.renderedVisible_ || this.j || this.yn;
  80506. this.element_ = this.element_ || this.c;
  80507. let html= count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;
  80508. if (this.renderedHTML_ != html) {
  80509. this.innerElement_.innerHTML = html;
  80510. this.renderedHTML_ = html;
  80511. }
  80512. if (this.renderedWidth_ != width) {
  80513. this.innerElement_.style.width = width + 'px';
  80514. this.renderedWidth_ = width;
  80515. }
  80516. if (!this.renderedVisible_) {
  80517. this.element.style.display = '';
  80518. this.renderedVisible_ = true;
  80519. }
  80520. }
  80521. }
  80522. ;// CONCATENATED MODULE: ./src/common/control/img/Logo.js
  80523. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80524. * This program are made available under the terms of the Apache License, Version 2.0
  80525. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80526. var LogoBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAF4AAAAdCAYAAAAjHtusAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDY3IDc5LjE1Nzc0NywgMjAxNS8wMy8zMC0yMzo0MDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozYWZlOGIwMi01MWE3LTRiZjYtYWVkYS05MGQ2ZTQ4YjZiMmUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6ODg0NkFBQUE3RjEzMTFFNzhFRjJFQkY4RjcxQjc1NjIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6ODg0NkFBQTk3RjEzMTFFNzhFRjJFQkY4RjcxQjc1NjIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4MWI3NzdhNC1lZmEyLTQ1MzUtOGQzNi03MmRjNDkyODMzN2UiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDpjYTYzODVjMi1jNDQ1LTExN2EtYTc0ZC1lM2I5MzJlMGE4Y2QiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5q1HM0AAAF/ElEQVR42tSabYhUVRjHZ7W01C1uaCRW4F3oi9SXCUnwQ9gsGUFvOEtQH1bLu5VS9sbYh5KicjYt29qiGQwVg2xWWKgocob91AvC+CWsoJqB3qHMSdTMpZyeU/+Df07n3pk7997Z6cBv99z7nHvOvf/z/pxJNZvNVI/jCKXmv6EquAmVkxPSlvtp2GItr0/96fFQForChJAWDiVYTkMYMu4XBFcYjLOwWS3sNwmn8NGzZ0h4Flv/zwIdchAnh/slCGmmKUNIBzYPaXOUr0vPuEjD71JAPh7l61embzinhV3V8nnCGmGT8LwlzSL8/yUh4Tfjo9T/CgnCIYNKycA2Qq21AcHU/VHE80Idoo3Qs0W6p0UtUnkZvEMDeVcCyqxEafF7hL8Qf0oYsIj+lfC9cH1CwhchWAGCtZO+AooQOkdC1Km1VtCb63StW73uFSzgKFUkNwBbmZGGmqowhvg8ZNpH9oXChcIcYRdeNomgxLkaH+S1SGubAxyIpFv+Zp+0DYjrAS00j/dem2VGEl6FJ4Qa4quEu8j2hTCJ+GJhe4JjfQMf6JCYPPbysMPxBlp0BUKOogEF9Rg9/heNvNKYfM0KsZUZaYxX4STGrzJa+zbhPeFH2DcK10KItcI+pI0rVElwXl1ULaKnIJhDw0oRQpTQc1zcbwRU8ATy4DR6yMlTzwkqMziEWHvubJ4Nk4ZtHdnqwvwY17xq3Z4FjrG+z2Kdrdf2ZSGD+xlLPh6t1R0jP9fI22ZzKI92yvQl7EbmBxI4S7Y+vIAOL87QZqsc5uNnssxZIcfYjXT9snCR7jjobidp+FkxA2v+Cq1QervMDmp4P7Xs3YZtE9kOC3P/By6JGaETl8ElwueYTNTDq4UDsKnd7YfCNbT239LF1udS72xYJt1UWxNfN4IIP4bWuTpEja01JtMFZFsm/AHbtHBlDE6yasA4moYTrUbvdBTXHqUrAH4uSadbyzF+vbBM2IsNkS3MNa5305JxqfA02T4TnkX8XOH1mPw8ruVejpxbI9hZD2Cz1U7LdrrUvjP/WfZinNZhr6V27hP+FPZh9aLvLxVO4DllX0G2OcKnlO/DCblxaz6uXBtmi+8mBaP3/SP8IuEIiTRoPPQm2TaEmEyXo0JU+F0YiPFD0hhOsiE/vqeEVwyTgF8L51OilcIZ2I4Ll5NttvAJPfukUeB2sk0ZPSbKIUUJpCII7+DasWy08uhNNazT0wGHI7mAtB7KqMKm38HhDdAUibTVKGicbB8YAqrJ9DRsp43JdB4qUof1HQrPE6XTQWu3Ce/inVzjXhXpMiTwUYugNVQ+p80jrUsV5EH0POKeuXO9QjhFq5GryNYvfEMCDhsftYVsB9ETtG0V9ZjfhCURhbcJFpfwVZ9jvhxsLHwTYtp2svlWQw3vXL8UnqHVSIG8l8ex+tHhBXgjddgqHEZ8ufAA2aaEnYgrF/KrPXrEmMUqZ9THLW06xhoBaVueQpkug+ewOUphE3Qv2Q5gGamXYa+QbVq4O+DQ5FHyZqrjxNt7UHh9uuRa0F7HjCF8o9PCTOGnscM7g2u1Hl9C9oeEnxC/1ajZg8JLiM9Hj9GHJseMShwL2DO0G5yEWn3Zh1QUods5CPkIoqlwAZxhXMsb6HrcEPBxchhdJ6wj29vCW4hfLOzo8J3rltYX50nXQAATSf/K4DEaGlTLvplsk/QCpoD60EQ7gLYZc8H9wq+I3yncEOEcNhuz6HWf3XEiwU/4Y8YEqVp2P10rt+8REvBGw026i4aDcbL9jF8r8Blmf4fCOzhViiscskygXRdehf3CO4hfigmTBXyQrl8TFtD1IzQX3CbcQrY3hPcRv4z8OmHPXwchVNln2MmE7BX6VwIFi/he6uxvb6JM3m0fdqvx/ATidxg2JeC7VDErAw5NzGfvwRJVheEIQ8Mg/pdwIM+UOmi9Q8ivCsrIy0tF+wVbEcLrd3Pb2XisEb4Tdlhsi4WP4RBbaLGrHfC3PrvMIezy9rTpGm5lz9LOMG15xvFxD/j5gjzjjDbMOzk+9zzt3v5bgAEAibzFeFHVgYkAAAAASUVORK5CYII=";
  80527. ;// CONCATENATED MODULE: ./src/openlayers/control/Logo.js
  80528. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80529. * This program are made available under the terms of the Apache License, Version 2.0
  80530. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80531. /**
  80532. * @class Logo
  80533. * @aliasclass control.Logo
  80534. * @category Control
  80535. * @classdesc Logo控件。默认不显示,需手动添加控件。
  80536. * @modulecategory Control
  80537. * @extends {ol.control.Control}
  80538. * @example
  80539. * var control = new Logo();
  80540. * map.addControl(control);
  80541. * @param {Object} options - 参数。
  80542. * @param {string} [options.imageUrl] - logo 图片地址。
  80543. * @param {number} [options.width] - logo 图片宽。
  80544. * @param {number} [options.height] - logo 图片高。
  80545. * @param {string} [options.link='https://iclient.supermap.io'] - 跳转链接。
  80546. * @param {string} [options.alt='SuperMap iClient'] - logo 图片失效时显示文本。
  80547. * @usage
  80548. */
  80549. class Logo extends (external_ol_control_Control_default()) {
  80550. constructor(options) {
  80551. options = options || {};
  80552. options.imageUrl = options.imageUrl || null;
  80553. options.width = options.width || null;
  80554. options.height = options.height || null;
  80555. options.alt = options.alt || "SuperMap iClient";
  80556. super(options);
  80557. this.options = options;
  80558. this.element = options.element = initLayerout.call(this);
  80559. /**
  80560. * @function Logo.prototype.initLayerout
  80561. * @description 初始化图层信息。
  80562. */
  80563. function initLayerout() {
  80564. var className = 'ol-control-logo ol-unselectable ol-control';
  80565. var div = document.createElement("div");
  80566. div.className = className;
  80567. setDivStyle.call(this, div);
  80568. var imgSrc = LogoBase64;
  80569. if (this.options.imageUrl) {
  80570. imgSrc = this.options.imageUrl;
  80571. }
  80572. var alt = this.options.alt;
  80573. var link = this.options.link;
  80574. var imageWidth = "94px";
  80575. var imageHeight = "29px";
  80576. var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  80577. if (this.options.imageUrl) {
  80578. imageWidth = this.options.width;
  80579. imageHeight = this.options.height;
  80580. styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  80581. if (!imageWidth || !imageHeight) {
  80582. styleSize = "";
  80583. }
  80584. }
  80585. div.innerHTML = "<a href='" + link + "' target='_blank' style='border: none;display: block;'>" +
  80586. "<img src=" + imgSrc + " alt='" + alt + "' style='border: none;" + styleSize + "white-space: nowrap;margin-bottom: 2px'></a>";
  80587. return div;
  80588. }
  80589. /**
  80590. * @function Logo.prototype.setDivStyle
  80591. * @description 设置对象 style。
  80592. * @param {HTMLElement} div - 待设置的 div。
  80593. */
  80594. function setDivStyle(div) {
  80595. var attributionsElem = document.getElementsByClassName('ol-attribution');
  80596. attributionsElem = attributionsElem && attributionsElem[0];
  80597. var attrHeight = attributionsElem && attributionsElem.clientHeight || 29;
  80598. div.style.bottom = (parseInt(attrHeight) + 6) + "px";
  80599. div.style.right = "4px";
  80600. div.style.marginTop = 0;
  80601. div.style.marginLeft = 0;
  80602. div.style.marginBottom = 0;
  80603. div.style.marginRight = 0;
  80604. var logoStyle = document.createElement('style');
  80605. logoStyle.type = 'text/css';
  80606. logoStyle.innerHTML = '.ol-control-logo,.ol-control-logo:hover {' +
  80607. 'background-color: rgba(255,255,255,0);' +
  80608. '}';
  80609. document.getElementsByTagName('head')[0].appendChild(logoStyle);
  80610. }
  80611. }
  80612. }
  80613. ;// CONCATENATED MODULE: ./src/openlayers/control/index.js
  80614. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80615. * This program are made available under the terms of the Apache License, Version 2.0
  80616. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80617. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/StyleMap.js
  80618. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80619. * This program are made available under the terms of the Apache License, Version 2.0
  80620. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80621. /**
  80622. * @constant pointMap
  80623. * @description 点图。
  80624. * @private
  80625. */
  80626. var pointMap = {
  80627. "point-file": "pointFile",
  80628. "point-fill": "fillStyle",
  80629. "point-radius": "pointRadius",
  80630. "point-halo-radius": "pointHaloRadius",
  80631. "point-halo-color": "pointHaloColor",
  80632. "point-dx": "offsetX",
  80633. "point-dy": "offsetY",
  80634. "point-opacity": "globalAlpha",
  80635. "point-comp-op": "globalCompositeOperation"
  80636. };
  80637. /**
  80638. * @constant lineMap
  80639. * @description 线图。
  80640. * @private
  80641. */
  80642. var lineMap = {
  80643. "line-color": "strokeStyle",
  80644. "line-width": "lineWidth",
  80645. "line-cap": "lineCap",
  80646. "line-join": "lineJoin",
  80647. "line-miterlimit": "miterLimit",
  80648. "line-dash-offset": "lineDashOffset",
  80649. /*expand*/
  80650. "line-opacity": "strokeOpacity",
  80651. "line-dasharray": "lineDasharray",
  80652. "line-offset": "offset",
  80653. "line-comp-op": "globalCompositeOperation"
  80654. };
  80655. /**
  80656. * @constant polygonMap
  80657. * @description 面图。
  80658. * @private
  80659. */
  80660. var polygonMap = {
  80661. /*包括LINE的部分,用以设置面的外围边界*/
  80662. "line-color": "strokeStyle",
  80663. "line-width": "lineWidth",
  80664. "line-cap": "lineCap",
  80665. "line-join": "lineJoin",
  80666. "line-miterlimit": "miterLimit",
  80667. "line-dash-offset": "lineDashOffset",
  80668. /*expand*/
  80669. "line-opacity": "strokeOpacity",
  80670. "line-dasharray": "lineDasharray",
  80671. /*以下为面的特性*/
  80672. "polygon-fill": "fillStyle",
  80673. "polygon-dx": "offsetX",
  80674. "polygon-dy": "offsetY",
  80675. "polygon-opacity": "fillOpacity",
  80676. "polygon-comp-op": "globalCompositeOperation"
  80677. };
  80678. /**
  80679. * @enum StyleMap {Object}
  80680. * @description 地图样式。
  80681. * @category BaseTypes Constant
  80682. * @usage
  80683. * ```
  80684. * // 浏览器
  80685. * <script type="text/javascript" src="{cdn}"></script>
  80686. * <script>
  80687. * const result = {namespace}.StyleMap.CartoStyleMap;
  80688. *
  80689. * </script>
  80690. * // ES6 Import
  80691. * import { StyleMap } from '{npm}';
  80692. *
  80693. * const result = StyleMap.CartoStyleMap;
  80694. * ```
  80695. */
  80696. var StyleMap = {
  80697. /** CartoCSS 中的 style 属性名与 Canvas 的 style 属性名的对应表 */
  80698. CartoStyleMap: {
  80699. "TEXT": {
  80700. //前两个属性值组成font
  80701. "text-size": "fontSize",
  80702. "text-face-name": "fontFamily",
  80703. "text-align": "textAlign",
  80704. "text-vertical-alignment": "textBaseline",
  80705. "text-horizontal-alignment": "textAlign",
  80706. /*expand*/
  80707. 'text-bold': 'bold',
  80708. 'text-weight': 'fontWeight',
  80709. "text-name": "textName",
  80710. "text-halo-radius": "haloRadius",
  80711. "text-halo-color": "backColor",
  80712. "text-fill": "foreColor",
  80713. "text-opacity": "globalAlpha",
  80714. "text-dx": "offsetX",
  80715. "text-dy": "offsetY",
  80716. "text-comp-op": "globalCompositeOperation"
  80717. },
  80718. /*expand*/
  80719. "POINT": pointMap,
  80720. "MULTIPOINT": pointMap,
  80721. "LINE": lineMap,
  80722. "LINESTRING": lineMap,
  80723. "MULTILINESTRING": lineMap,
  80724. "REGION": polygonMap,
  80725. "POLYGON": polygonMap,
  80726. "MULTIPOLYGON": polygonMap
  80727. },
  80728. /** 服务端传过来的 style 属性名与 Canvas 的 style 属性名的对应表。 */
  80729. ServerStyleMap: {
  80730. fillBackOpaque: {
  80731. canvasStyle: "",
  80732. type: "bool",
  80733. defaultValue: true
  80734. },
  80735. lineWidth: {
  80736. canvasStyle: "lineWidth",
  80737. type: "number",
  80738. unit: "mm",
  80739. defaultValue: 0.1
  80740. },
  80741. fillBackColor: {
  80742. canvasStyle: "",
  80743. type: "color",
  80744. defaultValue: "rgba(0,0,0,0)"
  80745. },
  80746. markerWidth: {
  80747. canvasStyle: "",
  80748. type: "number",
  80749. unit: "mm",
  80750. defaultValue: ""
  80751. },
  80752. markerAngle: {
  80753. canvasStyle: "",
  80754. type: "number",
  80755. unit: "degree",
  80756. defaultValue: ""
  80757. },
  80758. fillForeColor: {
  80759. canvasStyle: "fillStyle",
  80760. type: "color",
  80761. defaultValue: "rgba(0,0,0,0)"
  80762. },
  80763. foreColor: {
  80764. canvasStyle: "fillStyle",
  80765. type: "color",
  80766. defaultValue: "rgba(0,0,0,0)"
  80767. },
  80768. markerSize: {
  80769. canvasStyle: "markerSize",
  80770. type: "number",
  80771. unit: "mm",
  80772. defaultValue: 2.4
  80773. },
  80774. fillGradientOffsetRatioX: {
  80775. canvasStyle: "",
  80776. type: "number",
  80777. defaultValue: 0
  80778. },
  80779. fillGradientOffsetRatioY: {
  80780. canvasStyle: "",
  80781. type: "number",
  80782. defaultValue: 0
  80783. },
  80784. lineColor: {
  80785. canvasStyle: "strokeStyle",
  80786. type: "color",
  80787. defaultValue: "rgba(0,0,0,0)"
  80788. },
  80789. fillOpaqueRate: {
  80790. canvasStyle: "",
  80791. type: "number",
  80792. defaultValue: 100
  80793. },
  80794. markerHeight: {
  80795. canvasStyle: "",
  80796. type: "number",
  80797. unit: "mm",
  80798. defaultValue: 0
  80799. },
  80800. fillGradientMode: {
  80801. canvasStyle: "",
  80802. type: "string",
  80803. defaultValue: "NONE"
  80804. },
  80805. fillSymbolID: {
  80806. canvasStyle: "",
  80807. type: "number",
  80808. defaultValue: 0
  80809. },
  80810. fillGradientAngle: {
  80811. canvasStyle: "",
  80812. type: "number",
  80813. unit: "degree",
  80814. defaultValue: 0
  80815. },
  80816. markerSymbolID: {
  80817. canvasStyle: "",
  80818. type: "number",
  80819. defaultValue: 0
  80820. },
  80821. lineSymbolID: {
  80822. canvasStyle: "",
  80823. type: "number",
  80824. defaultValue: 0
  80825. }
  80826. },
  80827. /** Canvas 中的 globalCompositeOperation 属性值与 CartoCSS 中的 CompOp 属性值对照表。 */
  80828. CartoCompOpMap: {
  80829. "clear": "",
  80830. "src": "",
  80831. "dst": "",
  80832. "src-over": "source-over",
  80833. "dst-over": "destination-over",
  80834. "src-in": "source-in",
  80835. "dst-in": "destination-in",
  80836. "src-out": "source-out",
  80837. "dst-out": "destination-out",
  80838. "src-atop": "source-atop",
  80839. "dst-atop": "destination-atop",
  80840. "xor": "xor",
  80841. "plus": "lighter",
  80842. "minus": "",
  80843. "multiply": "",
  80844. "screen": "",
  80845. "overlay": "",
  80846. "darken": "",
  80847. "lighten": "lighter",
  80848. "color-dodge": "",
  80849. "color-burn": "",
  80850. "hard-light": "",
  80851. "soft-light": "",
  80852. "difference": "",
  80853. "exclusion": "",
  80854. "contrast": "",
  80855. "invert": "",
  80856. "invert-rgb": "",
  80857. "grain-merge": "",
  80858. "grain-extract": "",
  80859. "hue": "",
  80860. "saturation": "",
  80861. "color": "",
  80862. "value": ""
  80863. }
  80864. };
  80865. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/DeafultCanvasStyle.js
  80866. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80867. * This program are made available under the terms of the Apache License, Version 2.0
  80868. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80869. /**
  80870. * @constant pointStyle
  80871. * @description 点属性名的对应表。
  80872. * @private
  80873. */
  80874. var pointStyle = {
  80875. pointFile: "",
  80876. /*expand*/
  80877. pointRadius: 3,
  80878. pointHaloRadius: 1,
  80879. pointHaloColor: "#c33",
  80880. offsetX: 0,
  80881. offsetY: 0,
  80882. fillStyle: "#fc0",
  80883. globalAlpha: 1,
  80884. globalCompositeOperation: "source-over",
  80885. imageSmoothingEnabled: true
  80886. };
  80887. /**
  80888. * @constant lineStyle
  80889. * @description 线属性名的对应表。
  80890. * @private
  80891. */
  80892. var lineStyle = {
  80893. strokeStyle: "rgba(0,0,0,0)",
  80894. lineWidth: 1,
  80895. lineCap: "butt",
  80896. lineJoin: "round",
  80897. miterLimit: 10,
  80898. lineDashOffset: 0,
  80899. /*expand*/
  80900. lineDasharray: [],
  80901. strokeOpacity: 1,
  80902. offset: 0,
  80903. globalAlpha: 1,
  80904. globalCompositeOperation: "source-over",
  80905. imageSmoothingEnabled: true
  80906. };
  80907. /**
  80908. * @constant polygonStyle
  80909. * @description 面属性名的对应表。
  80910. * @private
  80911. */
  80912. var polygonStyle = {
  80913. /*包含LINE的部分*/
  80914. strokeStyle: "rgba(0,0,0,0)",
  80915. lineWidth: 1,
  80916. lineCap: "butt",
  80917. lineJoin: "round",
  80918. miterLimit: 10,
  80919. lineDashOffset: 0,
  80920. /*expand*/
  80921. lineOpacity: 1,
  80922. fillOpacity: 1,
  80923. lineDasharray: [],
  80924. fillStyle: "rgba(0,0,0,0)",
  80925. polygonOpacity: 1,
  80926. /*expand*/
  80927. offsetX: 0,
  80928. offsetY: 0,
  80929. globalAlpha: 1,
  80930. globalCompositeOperation: "source-over",
  80931. imageSmoothingEnabled: true
  80932. };
  80933. /**
  80934. * @constant DeafultCanvasStyle
  80935. * @description 默认画布属性名的对应表。
  80936. * @private
  80937. */
  80938. var DeafultCanvasStyle = {
  80939. /**
  80940. * @constant DeafultCanvasStyle.prototype.TEXT
  80941. * @description 默认文本样式。
  80942. */
  80943. "TEXT": {
  80944. font: "10px sans-serif",
  80945. textAlign: "middle",
  80946. textBaseline: "center",
  80947. direction: "ltr",
  80948. /*expand*/
  80949. bold: false,
  80950. haloRadius: 0,
  80951. backColor: "rgba(255,255,255,1)",
  80952. foreColor: "rgba(0,0,0,1)",
  80953. // foreColor: "rgba(0,0,0,0)",
  80954. offsetX: 0,
  80955. offsetY: 0,
  80956. textHeight: 0,
  80957. globalAlpha: 1,
  80958. globalCompositeOperation: "source-over",
  80959. imageSmoothingEnabled: true
  80960. },
  80961. "POINT": pointStyle,
  80962. "MULTIPOINT": pointStyle,
  80963. "LINE": lineStyle,
  80964. "LINESTRING": lineStyle,
  80965. "MULTILINESTRING": lineStyle,
  80966. "REGION": polygonStyle,
  80967. "POLYGON": polygonStyle,
  80968. "MULTIPOLYGON": polygonStyle,
  80969. "SHADOW": {
  80970. shadowBlur: 0,
  80971. shadowColor: "rgba(0,0,0,0)",
  80972. shadowOffsetX: 0,
  80973. shadowOffsetY: 0
  80974. },
  80975. "GLOBAL": {
  80976. globalAlpha: 1,
  80977. globalCompositeOperation: "source-over",
  80978. imageSmoothingEnabled: true
  80979. }
  80980. };
  80981. ;// CONCATENATED MODULE: external "ol.util"
  80982. const external_ol_util_namespaceObject = ol.util;
  80983. ;// CONCATENATED MODULE: external "ol.geom.Geometry"
  80984. const external_ol_geom_Geometry_namespaceObject = ol.geom.Geometry;
  80985. var external_ol_geom_Geometry_default = /*#__PURE__*/__webpack_require__.n(external_ol_geom_Geometry_namespaceObject);
  80986. ;// CONCATENATED MODULE: external "ol.render"
  80987. const external_ol_render_namespaceObject = ol.render;
  80988. ;// CONCATENATED MODULE: external "ol.source.Vector"
  80989. const external_ol_source_Vector_namespaceObject = ol.source.Vector;
  80990. var external_ol_source_Vector_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_Vector_namespaceObject);
  80991. ;// CONCATENATED MODULE: external "ol.layer.Vector"
  80992. const external_ol_layer_Vector_namespaceObject = ol.layer.Vector;
  80993. var external_ol_layer_Vector_default = /*#__PURE__*/__webpack_require__.n(external_ol_layer_Vector_namespaceObject);
  80994. ;// CONCATENATED MODULE: external "ol.style"
  80995. const external_ol_style_namespaceObject = ol.style;
  80996. ;// CONCATENATED MODULE: external "ol.Feature"
  80997. const external_ol_Feature_namespaceObject = ol.Feature;
  80998. var external_ol_Feature_default = /*#__PURE__*/__webpack_require__.n(external_ol_Feature_namespaceObject);
  80999. ;// CONCATENATED MODULE: external "ol.proj.Projection"
  81000. const external_ol_proj_Projection_namespaceObject = ol.proj.Projection;
  81001. var external_ol_proj_Projection_default = /*#__PURE__*/__webpack_require__.n(external_ol_proj_Projection_namespaceObject);
  81002. ;// CONCATENATED MODULE: ./src/openlayers/core/Util.js
  81003. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81004. * This program are made available under the terms of the Apache License, Version 2.0
  81005. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81006. /**
  81007. * @name Util
  81008. * @namespace
  81009. * @category BaseTypes Util
  81010. * @classdesc 工具类。
  81011. * @usage
  81012. * ```
  81013. * // 浏览器
  81014. * <script type="text/javascript" src="{cdn}"></script>
  81015. * <script>
  81016. * const result = {namespace}.Util.getOlVersion();
  81017. *
  81018. * </script>
  81019. *
  81020. * // ES6 Import
  81021. * import { Util } from '{npm}';
  81022. *
  81023. * const result = Util.getOlVersion();
  81024. * ```
  81025. */
  81026. const core_Util_Util = {
  81027. getOlVersion() {
  81028. if (external_ol_util_namespaceObject && external_ol_util_namespaceObject.VERSION) {
  81029. return external_ol_util_namespaceObject.VERSION.split('.')[0];
  81030. }
  81031. if (window && window.ol) {
  81032. if (window.ol.util) {
  81033. return '6';
  81034. }
  81035. if (window.ol.WebGLMap) {
  81036. return '5';
  81037. }
  81038. }
  81039. return '4';
  81040. },
  81041. /**
  81042. * @function Util.toGeoJSON
  81043. * @description 将传入对象转为 GeoJSON 格式。
  81044. * @param {Object} smObj - 待转参数。
  81045. */
  81046. toGeoJSON(smObj) {
  81047. if (!smObj) {
  81048. return null;
  81049. }
  81050. return new GeoJSON().toGeoJSON(smObj);
  81051. },
  81052. /**
  81053. * @function Util.toSuperMapGeometry
  81054. * @description 将 GeoJSON 对象转为 SuperMap 几何图形。
  81055. * @param {GeoJSONObject} geoJSON - GeoJSON 对象。
  81056. */
  81057. toSuperMapGeometry(geoJSON) {
  81058. if (!geoJSON || !geoJSON.type) {
  81059. return null;
  81060. }
  81061. const result = new GeoJSON().read(geoJSON, 'FeatureCollection');
  81062. return result[0].geometry;
  81063. },
  81064. /**
  81065. * @function Util.resolutionToScale
  81066. * @description 通过分辨率计算比例尺。
  81067. * @param {number} resolution - 分辨率。
  81068. * @param {number} dpi - 屏幕分辨率。
  81069. * @param {string} mapUnit - 地图单位。
  81070. * @returns {number} 比例尺。
  81071. */
  81072. resolutionToScale(resolution, dpi, mapUnit) {
  81073. const inchPerMeter = 1 / 0.0254;
  81074. // 地球半径。
  81075. const meterPerMapUnit = getMeterPerMapUnit(mapUnit);
  81076. const scale = 1 / (resolution * dpi * inchPerMeter * meterPerMapUnit);
  81077. return scale;
  81078. },
  81079. /**
  81080. * @function Util.toSuperMapBounds
  81081. * @description 转为 SuperMapBounds 格式。
  81082. * @param {Array.<number>} bounds - bounds 数组。
  81083. * @returns {Bounds} 返回 SuperMap 的 Bounds 对象。
  81084. */
  81085. toSuperMapBounds(bounds) {
  81086. return new Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  81087. },
  81088. /**
  81089. * @function Util.toProcessingParam
  81090. * @description 将 Region 节点数组转为 Processing 服务需要的分析参数。
  81091. * @param {Array} points - Region 各个节点数组。
  81092. * @returns processing 服务裁剪、查询分析的分析参数。
  81093. */
  81094. toProcessingParam(points) {
  81095. if (points.length < 1) {
  81096. return '';
  81097. }
  81098. const geometryParam = {};
  81099. const results = [];
  81100. for (let i = 0; i < points.length; i++) {
  81101. const point = { x: points[i][0], y: points[i][1] };
  81102. results.push(point);
  81103. }
  81104. results.push(results[0]);
  81105. geometryParam.type = 'REGION';
  81106. geometryParam.points = results;
  81107. return geometryParam;
  81108. },
  81109. /**
  81110. * @function Util.scaleToResolution
  81111. * @description 通过比例尺计算分辨率。
  81112. * @param {number} scale - 比例尺。
  81113. * @param {number} dpi - 屏幕分辨率。
  81114. * @param {string} mapUnit - 地图单位。
  81115. * @returns {number} 分辨率。
  81116. */
  81117. scaleToResolution(scale, dpi, mapUnit) {
  81118. const inchPerMeter = 1 / 0.0254;
  81119. const meterPerMapUnitValue = getMeterPerMapUnit(mapUnit);
  81120. const resolution = 1 / (scale * dpi * inchPerMeter * meterPerMapUnitValue);
  81121. return resolution;
  81122. },
  81123. /**
  81124. * @private
  81125. * @function Util.getMeterPerMapUnit
  81126. * @description 获取每地图单位多少米。
  81127. * @param {string} mapUnit - 地图单位。
  81128. * @returns {number} 返回每地图单位多少米。
  81129. */
  81130. getMeterPerMapUnit: getMeterPerMapUnit,
  81131. /**
  81132. * @function Util.isArray
  81133. * @description 判断是否为数组格式。
  81134. * @param {Object} obj - 待判断对象。
  81135. * @returns {boolean} 是否是数组。
  81136. */
  81137. isArray,
  81138. /**
  81139. * @function Util.Csv2GeoJSON
  81140. * @description 将 csv 格式转为 GeoJSON。
  81141. * @param {Object} csv - csv 对象。
  81142. * @param {Object} options - 转换参数。
  81143. */
  81144. Csv2GeoJSON(csv, options) {
  81145. const defaultOptions = {
  81146. titles: ['lon', 'lat'],
  81147. latitudeTitle: 'lat',
  81148. longitudeTitle: 'lon',
  81149. fieldSeparator: ',',
  81150. lineSeparator: '\n',
  81151. deleteDoubleQuotes: true,
  81152. firstLineTitles: false
  81153. };
  81154. options = options || defaultOptions;
  81155. const _propertiesNames = [];
  81156. if (typeof csv === 'string') {
  81157. let titulos = options.titles;
  81158. if (options.firstLineTitles) {
  81159. csv = csv.split(options.lineSeparator);
  81160. if (csv.length < 2) {
  81161. return;
  81162. }
  81163. titulos = csv[0];
  81164. csv.splice(0, 1);
  81165. csv = csv.join(options.lineSeparator);
  81166. titulos = titulos.trim().split(options.fieldSeparator);
  81167. for (let i = 0; i < titulos.length; i++) {
  81168. titulos[i] = _deleteDoubleQuotes(titulos[i]);
  81169. }
  81170. options.titles = titulos;
  81171. }
  81172. for (let i = 0; i < titulos.length; i++) {
  81173. let prop = titulos[i]
  81174. .toLowerCase()
  81175. .replace(/[^\w ]+/g, '')
  81176. .replace(/ +/g, '_');
  81177. if (prop === '' || prop === '_') {
  81178. prop = `prop-${i}`;
  81179. }
  81180. _propertiesNames[i] = prop;
  81181. }
  81182. csv = _csv2json(csv);
  81183. }
  81184. return csv;
  81185. function _deleteDoubleQuotes(cadena) {
  81186. if (options.deleteDoubleQuotes) {
  81187. cadena = cadena.trim().replace(/^"/, '').replace(/"$/, '');
  81188. }
  81189. return cadena;
  81190. }
  81191. function _csv2json(csv) {
  81192. const json = {};
  81193. json['type'] = 'FeatureCollection';
  81194. json['features'] = [];
  81195. const titulos = options.titles;
  81196. csv = csv.split(options.lineSeparator);
  81197. for (let num_linea = 0; num_linea < csv.length; num_linea++) {
  81198. const campos = csv[num_linea].trim().split(options.fieldSeparator),
  81199. lng = parseFloat(campos[titulos.indexOf(options.longitudeTitle)]),
  81200. lat = parseFloat(campos[titulos.indexOf(options.latitudeTitle)]);
  81201. const isInRange = lng < 180 && lng > -180 && lat < 90 && lat > -90;
  81202. if (!(campos.length === titulos.length && isInRange)) {
  81203. continue;
  81204. }
  81205. const feature = {};
  81206. feature['type'] = 'Feature';
  81207. feature['geometry'] = {};
  81208. feature['properties'] = {};
  81209. feature['geometry']['type'] = 'Point';
  81210. feature['geometry']['coordinates'] = [lng, lat];
  81211. for (let i = 0; i < titulos.length; i++) {
  81212. if (titulos[i] !== options.latitudeTitle && titulos[i] !== options.longitudeTitle) {
  81213. feature['properties'][_propertiesNames[i]] = _deleteDoubleQuotes(campos[i]);
  81214. }
  81215. }
  81216. json['features'].push(feature);
  81217. }
  81218. return json;
  81219. }
  81220. },
  81221. /**
  81222. * @function Util.createCanvasContext2D
  81223. * @description 创建 2D 画布。
  81224. * @param {number} opt_width - 画布宽度。
  81225. * @param {number} opt_height - 画布高度。
  81226. */
  81227. createCanvasContext2D(opt_width, opt_height) {
  81228. const canvas = document.createElement('CANVAS');
  81229. if (opt_width) {
  81230. canvas.width = opt_width;
  81231. }
  81232. if (opt_height) {
  81233. canvas.height = opt_height;
  81234. }
  81235. return canvas.getContext('2d');
  81236. },
  81237. /**
  81238. * @function Util.supportWebGL2
  81239. * @description 是否支持 webgl2。
  81240. */
  81241. supportWebGL2() {
  81242. const canvas = document.createElement('canvas');
  81243. return Boolean(canvas && canvas.getContext('webgl2'));
  81244. },
  81245. /**
  81246. * @function Util.isString
  81247. * @description 是否为字符串
  81248. * @param {string} str - 需要判断的内容
  81249. * @returns {boolean}
  81250. */
  81251. isString,
  81252. /**
  81253. * @function Util.isObject
  81254. * @description 是否为对象
  81255. * @param {any} obj - 需要判断的内容
  81256. * @returns {boolean}
  81257. */
  81258. isObject(obj) {
  81259. return Object.prototype.toString.call(obj) === '[object Object]';
  81260. },
  81261. /**
  81262. * @function Util.trim
  81263. * @description 字符串裁剪两边的空格
  81264. * @param {string} str - 需要裁剪的字符串
  81265. * @returns {boolean}
  81266. */
  81267. trim(str = '') {
  81268. return str.replace(/(^\s*)|(\s*$)/g, '');
  81269. },
  81270. /**
  81271. * @function Util.newGuid
  81272. * @description 随机生成id
  81273. * @param {string} attr - 几位数字的id
  81274. * @returns {string}
  81275. */
  81276. newGuid(attr) {
  81277. let len = attr || 32;
  81278. let guid = '';
  81279. for (let i = 1; i < len; i++) {
  81280. let n = Math.floor(Math.random() * 16.0).toString(16);
  81281. guid += n;
  81282. }
  81283. return guid;
  81284. },
  81285. /**
  81286. * @function Util.isNumber
  81287. * @description 检测数据是否为number
  81288. * @param {string} value - 值,未知数据类型
  81289. * @returns {boolean}
  81290. */
  81291. isNumber(value) {
  81292. if (value === '') {
  81293. return false;
  81294. }
  81295. let mdata = Number(value);
  81296. if (mdata === 0) {
  81297. return true;
  81298. }
  81299. return !isNaN(mdata);
  81300. },
  81301. /**
  81302. * @function Util.isMatchAdministrativeName
  81303. * @param {string} featureName 原始数据中的地名
  81304. * @param {string} fieldName 需要匹配的地名
  81305. * @returns {boolean} 是否匹配
  81306. */
  81307. isMatchAdministrativeName,
  81308. /**
  81309. * @function Util.getHighestMatchAdministration
  81310. * @param {string} featureName 初始匹配的要素数组
  81311. * @param {string} fieldName 要匹配的地名
  81312. * @returns {boolean} 是否匹配
  81313. */
  81314. getHighestMatchAdministration(features, fieldName) {
  81315. let filterFeatures = features.filter((item) => {
  81316. return isMatchAdministrativeName(item.properties.Name, fieldName);
  81317. });
  81318. let maxMatchPercent = 0,
  81319. maxMatchFeature = null;
  81320. filterFeatures.forEach((feature) => {
  81321. let count = 0;
  81322. Array.from(new Set(feature.properties.Name.split(''))).forEach((char) => {
  81323. if (fieldName.includes(char)) {
  81324. count++;
  81325. }
  81326. });
  81327. if (count > maxMatchPercent) {
  81328. maxMatchPercent = count;
  81329. maxMatchFeature = feature;
  81330. }
  81331. });
  81332. return maxMatchFeature;
  81333. },
  81334. /**
  81335. * @function Util.setMask
  81336. * @description 为图层设置掩膜。
  81337. * @version 10.1.0
  81338. * @param {ol.layer.Layer|Array.<ol.layer.Layer>} layers 图层
  81339. * @param {ol.geom.Geometry|ol.Feature} polygon 掩膜矢量要素,支持面类型的要素。
  81340. */
  81341. setMask(layers, polygon) {
  81342. if (!polygon) {
  81343. return;
  81344. }
  81345. const geo = polygon instanceof (external_ol_Feature_default()) ? polygon.getGeometry() : polygon;
  81346. if (!(geo instanceof (external_ol_geom_Geometry_default())) && ['MultiPolygon', 'Polygon'].indexOf(polygon.getType()) < 0) {
  81347. return;
  81348. }
  81349. const feature = polygon instanceof (external_ol_Feature_default()) ? polygon : new (external_ol_Feature_default())(polygon);
  81350. const style = new external_ol_style_namespaceObject.Style({
  81351. fill: new external_ol_style_namespaceObject.Fill({
  81352. color: 'black'
  81353. })
  81354. });
  81355. const clipLayer = new (external_ol_layer_Vector_default())({
  81356. source: new (external_ol_source_Vector_default())({
  81357. features: [feature],
  81358. wrapX: false
  81359. })
  81360. });
  81361. const clipRender = function (e) {
  81362. const vectorContext = (0,external_ol_render_namespaceObject.getVectorContext)(e);
  81363. e.context.globalCompositeOperation = 'destination-in';
  81364. clipLayer.getSource().forEachFeature(function (feature) {
  81365. vectorContext.drawFeature(feature, style);
  81366. e.context.globalCompositeOperation = 'source-over';
  81367. });
  81368. };
  81369. const todoLayers = Array.isArray(layers) ? layers : [layers];
  81370. unsetMask(todoLayers);
  81371. todoLayers.forEach((layer) => {
  81372. layer.classNameBak_ = layer.className_;
  81373. layer.className_ = `ol_mask_layer_${layer.ol_uid}`;
  81374. layer.clipRender = clipRender;
  81375. layer.extentBak_ = layer.getExtent();
  81376. layer.setExtent(clipLayer.getSource().getExtent());
  81377. layer.on('postrender', clipRender);
  81378. layer.changed();
  81379. });
  81380. },
  81381. /**
  81382. * @function Util.unsetMask
  81383. * @description 取消图层掩膜。
  81384. * @version 10.1.0
  81385. * @param {ol.layer.Layer|Array.<ol.layer.Layer>} layers 图层
  81386. */
  81387. unsetMask,
  81388. getZoomByResolution(scale, scales) {
  81389. return getZoomByResolution(scale, scales);
  81390. },
  81391. scalesToResolutions(scales, bounds, dpi, unit, mapobj, level) {
  81392. return scalesToResolutions(scales, bounds, dpi, unit, mapobj, level);
  81393. },
  81394. getProjection(prjCoordSys, extent) {
  81395. let projection = (0,external_ol_proj_namespaceObject.get)(`EPSG:${prjCoordSys.epsgCode}`);
  81396. if (prjCoordSys.type == 'PCS_NON_EARTH') {
  81397. projection = new (external_ol_proj_Projection_default())({
  81398. extent,
  81399. units: 'm',
  81400. code: '0'
  81401. });
  81402. }
  81403. if (!projection) {
  81404. console.error(`The projection of EPSG:${prjCoordSys.epsgCode} is missing, please register the projection of EPSG:${prjCoordSys.epsgCode} first, refer to the documentation: https://iclient.supermap.io/web/introduction/leafletDevelop.html#multiProjection`);
  81405. }
  81406. return projection;
  81407. }
  81408. }
  81409. function isString(str) {
  81410. return typeof str === 'string' && str.constructor === String;
  81411. }
  81412. function isArray(obj) {
  81413. return Object.prototype.toString.call(obj) === '[object Array]';
  81414. }
  81415. function unsetMask(layers) {
  81416. const todoLayers = Array.isArray(layers) ? layers : [layers];
  81417. for (let index = 0; index < todoLayers.length; index++) {
  81418. const layer = todoLayers[index];
  81419. if (!layer.clipRender) {
  81420. continue;
  81421. }
  81422. layer.un('postrender', layer.clipRender);
  81423. layer.className_ = layer.classNameBak_;
  81424. layer.setExtent(layer.extentBak);
  81425. delete layer.classNameBak_;
  81426. delete layer.clipRender;
  81427. delete layer.extentBak_;
  81428. layer.changed();
  81429. }
  81430. }
  81431. function isMatchAdministrativeName(featureName, fieldName) {
  81432. if (isString(fieldName)) {
  81433. let shortName = featureName.substr(0, 2);
  81434. // 张家口市和张家界市 特殊处理
  81435. if (shortName === '张家') {
  81436. shortName = featureName.substr(0, 3);
  81437. }
  81438. return !!fieldName.match(new RegExp(shortName));
  81439. }
  81440. return false;
  81441. }
  81442. ;// CONCATENATED MODULE: external "function(){try{return canvg}catch(e){return {}}}()"
  81443. const external_function_try_return_canvg_catch_e_return_namespaceObject = function(){try{return canvg}catch(e){return {}}}();
  81444. var external_function_try_return_canvg_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_canvg_catch_e_return_namespaceObject);
  81445. ;// CONCATENATED MODULE: external "ol.style.Style"
  81446. const external_ol_style_Style_namespaceObject = ol.style.Style;
  81447. var external_ol_style_Style_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Style_namespaceObject);
  81448. ;// CONCATENATED MODULE: external "ol.style.Icon"
  81449. const external_ol_style_Icon_namespaceObject = ol.style.Icon;
  81450. var external_ol_style_Icon_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Icon_namespaceObject);
  81451. ;// CONCATENATED MODULE: external "ol.style.Circle"
  81452. const external_ol_style_Circle_namespaceObject = ol.style.Circle;
  81453. var external_ol_style_Circle_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Circle_namespaceObject);
  81454. ;// CONCATENATED MODULE: external "ol.style.Fill"
  81455. const external_ol_style_Fill_namespaceObject = ol.style.Fill;
  81456. var external_ol_style_Fill_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Fill_namespaceObject);
  81457. ;// CONCATENATED MODULE: external "ol.style.Stroke"
  81458. const external_ol_style_Stroke_namespaceObject = ol.style.Stroke;
  81459. var external_ol_style_Stroke_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Stroke_namespaceObject);
  81460. ;// CONCATENATED MODULE: external "ol.style.Text"
  81461. const external_ol_style_Text_namespaceObject = ol.style.Text;
  81462. var external_ol_style_Text_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Text_namespaceObject);
  81463. ;// CONCATENATED MODULE: ./src/openlayers/core/StyleUtils.js
  81464. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81465. * This program are made available under the terms of the Apache License, Version 2.0
  81466. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81467. var padding = 8, doublePadding = padding * 2;
  81468. const ZERO = 0.0000001;
  81469. /**
  81470. * @class StyleUtils
  81471. * @classdesc 样式工具类。
  81472. * @private
  81473. */
  81474. class StyleUtils {
  81475. /**
  81476. * @function StyleUtils.getValidStyleFromLayerInfo
  81477. * @description 通过图层信息获取有效的样式。
  81478. * @param {Object} layerInfo - 图层信息。
  81479. * @param {ol.Feature} feature - 要素。
  81480. * @param {string} url - 图层数据地址。
  81481. * @returns {ol.style.Style} 返回图层样式。
  81482. */
  81483. static getValidStyleFromLayerInfo(layerInfo, feature, url) {
  81484. var type = feature.getGeometry().getType().toUpperCase(),
  81485. shader = layerInfo.layerStyle,
  81486. style = this.getDefaultStyle(type);
  81487. if ((type === "POINT" || type === 'MULTIPOINT') && !feature.getProperties().textStyle && layerInfo.type !== 'LABEL' && !feature.getProperties().TEXT_FEATURE_CONTENT) {
  81488. if (shader) {
  81489. var symbolParameters = {
  81490. "transparent": true,
  81491. "resourceType": "SYMBOLMARKER",
  81492. "picWidth": Math.ceil(shader.markerSize * DOTS_PER_INCH * INCHES_PER_UNIT["mm"]) || 13,
  81493. "picHeight": Math.ceil(shader.markerSize * DOTS_PER_INCH * INCHES_PER_UNIT["mm"]) || 13,
  81494. "style": JSON.stringify(shader)
  81495. };
  81496. var imageUrl = Util_Util.urlAppend(url + "/symbol.png", Util_Util.getParameterString(symbolParameters));
  81497. style.pointFile = imageUrl;
  81498. return new (external_ol_style_Style_default())({
  81499. image: new (external_ol_style_Icon_default())({
  81500. src: style.pointFile
  81501. })
  81502. });
  81503. }
  81504. return this.toOLPointStyle(style);
  81505. } else if ((type === "POINT" || type === 'MULTIPOINT') && (feature.getProperties().textStyle || layerInfo.type === 'LABEL' || feature.getProperties().TEXT_STYLE_INFO)) {
  81506. style = this.getDefaultStyle('TEXT');
  81507. if (feature.getProperties().textStyle) {
  81508. shader = feature.getProperties().textStyle;
  81509. }
  81510. if (feature.getProperties().TEXT_STYLE_INFO) {
  81511. shader = JSON.parse(feature.getProperties().TEXT_STYLE_INFO).textStyle;
  81512. }
  81513. if (shader && shader !== "{}") {
  81514. var fontStr = "";
  81515. //设置文本是否倾斜
  81516. style.fontStyle = shader.italic ? "italic" : "normal";
  81517. //设置文本是否使用粗体
  81518. style.fontWeight = shader.bold ? shader.fontWeight : "normal";
  81519. //设置文本的尺寸(对应fontHeight属性)和行高,行高iserver不支持,默认5像素
  81520. //固定大小的时候单位是毫米
  81521. var text_h = shader.fontHeight * DOTS_PER_INCH * INCHES_PER_UNIT["mm"] * 0.85; //毫米转像素,服务端的字体貌似要稍微小一点
  81522. style.fontSize = text_h + "px";
  81523. //设置文本字体类型
  81524. //在桌面字体钱加@时为了解决对联那种形式,但是在canvas不支持,并且添加了@会导致
  81525. //字体大小被固定,这里需要去掉
  81526. if (shader.fontName.indexOf("@")) {
  81527. fontStr = shader.fontName.replace(/@/g, "");
  81528. } else {
  81529. fontStr = shader.fontName
  81530. }
  81531. style.fontFamily = fontStr;
  81532. style.textHeight = text_h;
  81533. //设置对齐方式
  81534. var alignStr = shader.align.replace(/TOP|MIDDLE|BASELINE|BOTTOM/, "");
  81535. style.textAlign = alignStr.toLowerCase();
  81536. var baselineStr = shader.align.replace(/LEFT|RIGHT|CENTER/, "");
  81537. if (baselineStr === "BASELINE") {
  81538. baselineStr = "alphabetic";
  81539. }
  81540. style.textBaseline = baselineStr.toLowerCase();
  81541. /*//首先判定是否需要绘制阴影,如果需要绘制,阴影应该在最下面
  81542. if(shader.shadow)
  81543. {
  81544. //桌面里面的阴影没有做模糊处理,这里统一设置为0,
  81545. style.shadowBlur=0;
  81546. //和桌面统一,往右下角偏移阴影,默认3像素
  81547. style.shadowOffsetX=3;
  81548. style.shadowOffsetY=3;
  81549. //颜色取一个灰色,调成半透明
  81550. style.shadowColor="rgba(50,50,50,0.5)";
  81551. }else{
  81552. style.shadowOffsetX=0;
  81553. style.shadowOffsetY=0;
  81554. }*/
  81555. style.haloRadius = shader.outline ? shader.outlineWidth : 0;
  81556. style.backColor = "rgba(" + shader.backColor.red + "," + shader.backColor.green + "," + shader.backColor.blue + ",1)";
  81557. style.foreColor = "rgba(" + shader.foreColor.red + "," + shader.foreColor.green + "," + shader.foreColor.blue + ",1)";
  81558. style.rotation = shader.rotation;
  81559. }
  81560. var text;
  81561. if (feature.getProperties().textStyle && feature.getProperties().texts) {
  81562. text = feature.getProperties().texts[0];
  81563. }
  81564. if (layerInfo.type === 'LABEL') {
  81565. var textField = layerInfo.textField;
  81566. if (textField && textField.indexOf('.')) {
  81567. var arr = textField.split('.');
  81568. textField = arr && arr.length > 0 && arr[arr.length - 1];
  81569. }
  81570. text = feature.getProperties().attributes ? feature.getProperties().attributes[textField] : feature.getProperties()[textField];
  81571. }
  81572. if (feature.getProperties().TEXT_FEATURE_CONTENT) {
  81573. text = feature.getProperties().TEXT_FEATURE_CONTENT;
  81574. }
  81575. if (!text) {
  81576. return this.toOLPointStyle(this.getDefaultStyle('POINT'));
  81577. }
  81578. return this.toOLTextStyle(style, text);
  81579. } else if (shader) {
  81580. //目前只实现桌面系统默认的几种symbolID,非系统默认的面用颜色填充替代,线则用实线来替代
  81581. var fillSymbolID = shader["fillSymbolID"] > 7 ? 0 : shader["fillSymbolID"];
  81582. var lineSymbolID = shader["lineSymbolID"] > 5 ? 0 : shader["lineSymbolID"];
  81583. for (var attr in shader) {
  81584. var obj = StyleMap.ServerStyleMap[attr];
  81585. var canvasStyle = obj.canvasStyle;
  81586. if (canvasStyle && canvasStyle != "") {
  81587. var value;
  81588. switch (obj.type) {
  81589. case "number":
  81590. value = shader[attr];
  81591. if (obj.unit) {
  81592. //将单位转换为像素单位
  81593. value = value * DOTS_PER_INCH * INCHES_PER_UNIT[obj.unit] * 2.5;
  81594. }
  81595. style[canvasStyle] = value;
  81596. break;
  81597. case "color":
  81598. var color = shader[attr];
  81599. var backColor = shader["fillBackColor"];
  81600. var alpha = 1;
  81601. if (canvasStyle === "fillStyle") {
  81602. if (fillSymbolID === 0 || fillSymbolID === 1) {
  81603. //当fillSymbolID为0时,用颜色填充,为1是无填充,即为透明填充,alpha通道为0
  81604. alpha = 1 - fillSymbolID;
  81605. value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
  81606. } else {
  81607. //当fillSymbolID为2~7时,用的纹理填充,但要按照前景色修改其颜色
  81608. try {
  81609. var tempCvs = document.createElement("canvas");
  81610. tempCvs.height = 8;
  81611. tempCvs.width = 8;
  81612. var tempCtx = tempCvs.getContext("2d");
  81613. var image = new Image();
  81614. if (this.layer && this.layer.fillImages) {
  81615. tempCtx.drawImage(this.layer.fillImages["System " + fillSymbolID], 0, 0);
  81616. }
  81617. var imageData = tempCtx.getImageData(0, 0, tempCvs.width, tempCvs.height);
  81618. var pix = imageData.data;
  81619. for (var i = 0, len = pix.length; i < len; i += 4) {
  81620. var r = pix[i], g = pix[i + 1], b = pix[i + 2];
  81621. //将符号图片中的灰色或者黑色的部分替换为前景色,其余为后景色
  81622. if (r < 225 && g < 225 && b < 225) {
  81623. pix[i] = color.red;
  81624. pix[i + 1] = color.green;
  81625. pix[i + 2] = color.blue;
  81626. } else if (backColor) {
  81627. pix[i] = backColor.red;
  81628. pix[i + 1] = backColor.green;
  81629. pix[i + 2] = backColor.blue;
  81630. }
  81631. }
  81632. tempCtx.putImageData(imageData, 0, 0);
  81633. image.src = tempCvs.toDataURL();
  81634. if (this.context) {
  81635. value = this.context.createPattern(image, "repeat");
  81636. }
  81637. } catch (e) {
  81638. throw Error(e.message);
  81639. }
  81640. }
  81641. } else if (canvasStyle === "strokeStyle") {
  81642. if (lineSymbolID === 0 || lineSymbolID === 5) {
  81643. //对于lineSymbolID为0时,线为实线,为lineSymbolID为5时,为无线模式,即线为透明,即alpha通道为0
  81644. alpha = lineSymbolID === 0 ? 1 : 0;
  81645. } else {
  81646. //以下几种linePattern分别模拟了桌面的SymbolID为1~4几种符号的linePattern
  81647. var linePattern = [1, 0];
  81648. switch (lineSymbolID) {
  81649. case 1:
  81650. linePattern = [9.7, 3.7];
  81651. break;
  81652. case 2:
  81653. linePattern = [3.7, 3.7];
  81654. break;
  81655. case 3:
  81656. linePattern = [9.7, 3.7, 2.3, 3.7];
  81657. break;
  81658. case 4:
  81659. linePattern = [9.7, 3.7, 2.3, 3.7, 2.3, 3.7];
  81660. break;
  81661. default:
  81662. break
  81663. }
  81664. style.lineDasharray = linePattern;
  81665. }
  81666. value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
  81667. }
  81668. style[canvasStyle] = value;
  81669. break;
  81670. default:
  81671. break;
  81672. }
  81673. }
  81674. }
  81675. }
  81676. if (type === 'LINESTRING' || type === 'MULTILINESTRING') {
  81677. return this.toOLLineStyle(style);
  81678. }
  81679. if (type === 'POLYGON' || type === 'MULTIPOLYGON') {
  81680. return this.toOLPolygonStyle(style);
  81681. }
  81682. }
  81683. /**
  81684. * @function StyleUtils.getStyleFromCarto
  81685. * @description 从 Carto 中获取有效的样式。
  81686. * @param {number} zoom -缩放级别。
  81687. * @param {number} scale - 比例尺。
  81688. * @param {Array.<Object>} shader - 渲染器对象数组。
  81689. * @param {Object} feature - 要素。
  81690. * @param {string} fromServer - 服务源。
  81691. * @param {string} url - 地址。
  81692. */
  81693. static getStyleFromCarto(zoom, scale, shader, feature, fromServer, url) {
  81694. var type = feature.getGeometry().getType().toUpperCase(),
  81695. attributes = {},
  81696. style = this.getDefaultStyle(type);
  81697. attributes.FEATUREID = feature.getProperties().id;
  81698. attributes.SCALE = scale;
  81699. var cartoStyleType = feature.getProperties().type === "TEXT" ? "TEXT" : type;
  81700. var cartoStyleMap = StyleMap.CartoStyleMap[cartoStyleType];
  81701. var fontSize, fontName;
  81702. if (shader) {
  81703. for (var i = 0, len = shader.length; i < len; i++) {
  81704. var _shader = shader[i];
  81705. var prop = cartoStyleMap[_shader.property];
  81706. var value = _shader.getValue(attributes, zoom, true);
  81707. if ((value !== null) && prop) {
  81708. if (prop === "fontSize") {
  81709. if (fromServer) {
  81710. value *= 0.8;
  81711. }
  81712. //斜杠后面为行间距,默认为0.5倍行间距
  81713. fontSize = value + "px";
  81714. style.fontSize = fontSize;
  81715. } else if (prop === "fontName") {
  81716. fontName = value;
  81717. style.fontName = fontName;
  81718. } else {
  81719. if (prop === "globalCompositeOperation") {
  81720. value = StyleMap.CartoCompOpMap[value];
  81721. if (!value) {
  81722. continue;
  81723. }
  81724. } else if (fromServer && prop === 'pointFile') {
  81725. value = url + '/tileFeature/symbols/' + value.replace(/(___)/gi, '@');
  81726. value = value.replace(/(__0__0__)/gi, '__8__8__');
  81727. }
  81728. if (prop === 'lineWidth' && value < 1) {
  81729. value = Math.ceil(value);
  81730. }
  81731. style[prop] = value;
  81732. }
  81733. }
  81734. }
  81735. }
  81736. if (feature.getProperties().type === 'TEXT') {
  81737. var text;
  81738. if (feature.getProperties().texts) {
  81739. text = feature.getProperties().texts[0];
  81740. }
  81741. if (text == null && style.textName) {
  81742. var textName = style.textName.substring(1, style.textName.length - 1);
  81743. text = feature.getProperties().attributes ? feature.getProperties().attributes[textName] : feature.getProperties()[textName];
  81744. if (text != null) {
  81745. var texts = feature.getProperties().texts || [];
  81746. texts.push(text);
  81747. feature.setProperties({ texts: texts });
  81748. }
  81749. }
  81750. return this.toOLTextStyle(style, text)
  81751. }
  81752. if (type === 'POINT' || type === 'MULTIPOINT') {
  81753. return this.toOLPointStyle(style);
  81754. }
  81755. if (type === 'LINESTRING' || type === 'MULTILINESTRING') {
  81756. return this.toOLLineStyle(style);
  81757. }
  81758. if (type === 'POLYGON' || type === 'MULTIPOLYGON') {
  81759. return this.toOLPolygonStyle(style);
  81760. }
  81761. }
  81762. /**
  81763. * @function StyleUtils.toOLPointStyle
  81764. * @description 点样式。
  81765. * @param {Object} style - 样式参数。
  81766. * @returns {ol.style.Style} 获取点样式。
  81767. */
  81768. static toOLPointStyle(style) {
  81769. if (style.pointFile !== '') {
  81770. return new (external_ol_style_Style_default())({
  81771. image: new (external_ol_style_Icon_default())({
  81772. src: style.pointFile
  81773. })
  81774. });
  81775. }
  81776. return new (external_ol_style_Style_default())({
  81777. image: new (external_ol_style_Circle_default())({
  81778. radius: style.pointRadius,
  81779. fill: new (external_ol_style_Fill_default())({
  81780. color: style.fillStyle
  81781. }),
  81782. stroke: new (external_ol_style_Stroke_default())({
  81783. color: style.pointHaloColor,
  81784. width: style.pointHaloRadius
  81785. })
  81786. })
  81787. });
  81788. }
  81789. /**
  81790. * @function StyleUtils.toOLLineStyle
  81791. * @description 线样式。
  81792. * @param {Object} style - 样式参数。
  81793. * @returns {ol.style.Style} 获取线的样式。
  81794. */
  81795. static toOLLineStyle(style) {
  81796. return new (external_ol_style_Style_default())({
  81797. stroke: new (external_ol_style_Stroke_default())({
  81798. color: style.strokeStyle,
  81799. width: style.lineWidth,
  81800. lineCap: style.lineCap,
  81801. lineDash: style.lineDasharray,
  81802. lineDashOffset: style.lineDashOffset,
  81803. lineJoin: style.lineJoin,
  81804. miterLimit: style.miterLimit
  81805. })
  81806. });
  81807. }
  81808. /**
  81809. * @function StyleUtils.toOLPolygonStyle
  81810. * @description 面样式。
  81811. * @param {Object} style - 样式参数。
  81812. * @returns {ol.style.Style} 获取面的样式。
  81813. */
  81814. static toOLPolygonStyle(style) {
  81815. var fill = new (external_ol_style_Fill_default())({
  81816. color: style.fillStyle
  81817. });
  81818. var stroke = new (external_ol_style_Stroke_default())({
  81819. color: style.strokeStyle,
  81820. width: style.lineWidth,
  81821. lineCap: style.lineCap,
  81822. lineDash: style.lineDasharray,
  81823. lineDashOffset: style.lineDashOffset,
  81824. lineJoin: style.lineJoin,
  81825. miterLimit: style.miterLimit
  81826. });
  81827. return new (external_ol_style_Style_default())({
  81828. fill: fill,
  81829. stroke: stroke
  81830. });
  81831. }
  81832. /**
  81833. * @function StyleUtils.toOLTextStyle
  81834. * @description 文本样式。
  81835. * @param {Object} style - 样式对象。
  81836. * @param {string} text - 文本参数。
  81837. * @returns {ol.style.Style} 获取的文本样式。
  81838. */
  81839. static toOLTextStyle(style, text) {
  81840. return new (external_ol_style_Style_default())({
  81841. text: new (external_ol_style_Text_default())({
  81842. font: (style.fontStyle || '') + ' ' + (style.fontWeight || '') + ' ' + (style.fontSize || '') + ' ' + style.fontFamily,
  81843. text: text,
  81844. textAlign: style.textAlign,
  81845. textBaseline: style.textBaseline,
  81846. fill: new (external_ol_style_Fill_default())({
  81847. color: style.foreColor
  81848. }),
  81849. stroke: new (external_ol_style_Stroke_default())({
  81850. color: style.backColor
  81851. }),
  81852. offsetX: style.offsetX,
  81853. offsetY: style.offsetY
  81854. })
  81855. })
  81856. }
  81857. /**
  81858. * @function StyleUtils.dashStyle
  81859. * @description 符号样式。
  81860. * @param {Object} style - 样式参数。
  81861. * @param {number} widthFactor - 宽度系数。
  81862. */
  81863. static dashStyle(style, widthFactor) {
  81864. if (!style) {
  81865. return [];
  81866. }
  81867. var w = style.strokeWidth * widthFactor;
  81868. var str = style.strokeDashstyle || style.lineDash;
  81869. switch (str) {
  81870. case 'solid':
  81871. return [0];
  81872. case 'dot':
  81873. return [1, 4 * w];
  81874. case 'dash':
  81875. return [4 * w, 4 * w];
  81876. case 'dashdot':
  81877. return [4 * w, 4 * w, 1, 4 * w];
  81878. case 'longdash':
  81879. return [8 * w, 4 * w];
  81880. case 'longdashdot':
  81881. return [8 * w, 4 * w, 1, 4 * w];
  81882. default:
  81883. if (!str) {
  81884. return [];
  81885. }
  81886. if (Util_Util.isArray(str)) {
  81887. return str;
  81888. }
  81889. str = StringExt.trim(str).replace(/\s+/g, ",");
  81890. return str.replace(/\[|\]/gi, "").split(",");
  81891. }
  81892. }
  81893. /**
  81894. * @function StyleUtils.getStyleFromiPortalMarker
  81895. * @description 从 iPortal 标记获取样式。
  81896. * @param {Object} icon - 图标参数。
  81897. */
  81898. static getStyleFromiPortalMarker(icon) {
  81899. if (icon.indexOf("./") == 0) {
  81900. return null;
  81901. }
  81902. //兼容iportal示例的问题
  81903. // if (icon.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
  81904. // icon = icon.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
  81905. // }
  81906. return new (external_ol_style_Style_default())({
  81907. image: new (external_ol_style_Icon_default())({
  81908. src: icon,
  81909. opacity: 1,
  81910. size: [48, 43],
  81911. anchor: [0.5, 1]
  81912. })
  81913. });
  81914. }
  81915. /**
  81916. * @function StyleUtils.getStyleFromiPortalStyle
  81917. * @description 从 iPortal 标记获取样式。
  81918. * @param {Object} iPortalStyle - iportal 样式。
  81919. * @param {string} type - 样式类型。
  81920. * @param {Object} fStyle - 要素样式。
  81921. */
  81922. static getStyleFromiPortalStyle(iPortalStyle, type, fStyle) {
  81923. var featureStyle = fStyle ? JSON.parse(fStyle) : null;
  81924. var me = this;
  81925. if (type === 'Point' || type === 'MultiPoint') {
  81926. var pointStyle = featureStyle || iPortalStyle.pointStyle;
  81927. if (pointStyle.externalGraphic) {
  81928. if (pointStyle.externalGraphic.indexOf("./") == 0) {
  81929. return null;
  81930. }
  81931. //兼容iportal示例的问题
  81932. // if (pointStyle.externalGraphic.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
  81933. // pointStyle.externalGraphic = pointStyle.externalGraphic.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
  81934. // }
  81935. return new (external_ol_style_Style_default())({
  81936. image: new (external_ol_style_Icon_default())({
  81937. src: pointStyle.externalGraphic,
  81938. opacity: pointStyle.graphicOpacity,
  81939. size: [pointStyle.graphicWidth, pointStyle.graphicHeight]
  81940. //anchor: [-pointStyle.graphicXOffset / pointStyle.graphicWidth, -pointStyle.graphicYOffset / pointStyle.graphicHeight]
  81941. })
  81942. });
  81943. }
  81944. return new (external_ol_style_Style_default())({
  81945. image: new (external_ol_style_Circle_default())({
  81946. fill: new (external_ol_style_Fill_default())({
  81947. color: me.hexToRgba(pointStyle.fillColor, pointStyle.fillOpacity)
  81948. }),
  81949. stroke: new (external_ol_style_Stroke_default())({
  81950. color: me.hexToRgba(pointStyle.strokeColor, pointStyle.strokeOpacity),
  81951. lineCap: pointStyle.strokeLineCap,
  81952. lineDash: this.dashStyle(pointStyle, 1),
  81953. width: pointStyle.strokeWidth
  81954. }),
  81955. radius: pointStyle.pointRadius
  81956. })
  81957. });
  81958. }
  81959. if (type === 'LineString' || type === 'MultiLineString' || type === 'Box') {
  81960. var lineStyle = featureStyle || iPortalStyle.lineStyle;
  81961. return new (external_ol_style_Style_default())({
  81962. stroke: new (external_ol_style_Stroke_default())({
  81963. color: me.hexToRgba(lineStyle.strokeColor, lineStyle.strokeOpacity),
  81964. lineCap: lineStyle.strokeLineCap,
  81965. lineDash: this.dashStyle(lineStyle, 1),
  81966. width: lineStyle.strokeWidth
  81967. })
  81968. });
  81969. }
  81970. if (type === 'Polygon' || type === 'MultiPolygon') {
  81971. var polygonStyle = featureStyle || iPortalStyle.polygonStyle;
  81972. return new (external_ol_style_Style_default())({
  81973. fill: new (external_ol_style_Fill_default())({
  81974. color: me.hexToRgba(polygonStyle.fillColor, polygonStyle.fillOpacity)
  81975. }),
  81976. stroke: new (external_ol_style_Stroke_default())({
  81977. color: me.hexToRgba(polygonStyle.strokeColor, polygonStyle.strokeOpacity),
  81978. lineCap: polygonStyle.strokeLineCap,
  81979. lineDash: this.dashStyle(polygonStyle, 1),
  81980. width: polygonStyle.strokeWidth
  81981. })
  81982. });
  81983. }
  81984. }
  81985. /**
  81986. * @function StyleUtils.hexToRgba
  81987. * @description 十六进制转 RGBA 格式。
  81988. * @param {Object} hex - 十六进制格式参数。
  81989. * @param {number} opacity -Alpha 参数。
  81990. * @returns {string} 生成的 RGBA 格式。
  81991. */
  81992. static hexToRgba(hex, opacity) {
  81993. var color = [], rgba = [];
  81994. hex = hex.replace(/#/, "");
  81995. if (hex.length == 3) {
  81996. var tmp = [];
  81997. for (let i = 0; i < 3; i++) {
  81998. tmp.push(hex.charAt(i) + hex.charAt(i));
  81999. }
  82000. hex = tmp.join("");
  82001. }
  82002. for (let i = 0; i < 6; i += 2) {
  82003. color[i] = "0x" + hex.substr(i, 2);
  82004. rgba.push(parseInt(Number(color[i])));
  82005. }
  82006. rgba.push(opacity);
  82007. return "rgba(" + rgba.join(",") + ")";
  82008. }
  82009. /**
  82010. * @function StyleUtils.getDefaultStyle
  82011. * @description 获取默认风格
  82012. * @param {string} type - 类型参数。
  82013. * @returns {string}
  82014. */
  82015. static getDefaultStyle(type) {
  82016. var style = {};
  82017. var canvasStyle = DeafultCanvasStyle[type];
  82018. for (var prop in canvasStyle) {
  82019. var val = canvasStyle[prop];
  82020. style[prop] = val;
  82021. }
  82022. return style;
  82023. }
  82024. /**
  82025. * @function StyleUtils.getDefaultStyle
  82026. * @description 将样式对象转换成openlayer要求的ol.style
  82027. * @param {string} style - 样式对象
  82028. * @param {string} type - feature的类型
  82029. * @returns {Promise<ol.style.Style>}
  82030. */
  82031. static async toOpenLayersStyle(style, type) {
  82032. style = style || this.getDefaultStyle();
  82033. let olStyle = new (external_ol_style_Style_default())();
  82034. let newImage, newFill, newStroke;
  82035. let {
  82036. fillColor,
  82037. fillOpacity,
  82038. strokeColor,
  82039. strokeWidth,
  82040. strokeOpacity,
  82041. radius,
  82042. lineCap,
  82043. src,
  82044. scale,
  82045. offsetX,
  82046. offsetY,
  82047. //size,
  82048. //imgSize,
  82049. anchor
  82050. } = style;
  82051. let fillColorArray = this.hexToRgb(fillColor);
  82052. if (fillColorArray) {
  82053. fillColorArray.push(fillOpacity);
  82054. }
  82055. let strokeColorArray = this.hexToRgb(strokeColor);
  82056. if (strokeColorArray) {
  82057. strokeColorArray.push(strokeOpacity);
  82058. }
  82059. if (type === "POINT") {
  82060. if (src) {
  82061. if (/.+(\.svg$)/.test(src)) {
  82062. if (!this.svgDiv) {
  82063. this.svgDiv = document.createElement('div');
  82064. document.body.appendChild(this.svgDiv);
  82065. }
  82066. await this.getCanvasFromSVG(src, this.svgDiv, (canvas) => {
  82067. newImage = new (external_ol_style_Icon_default())({
  82068. img: canvas,
  82069. scale: radius / canvas.width,
  82070. imgSize: [canvas.width, canvas.height],
  82071. anchor: [0.5, 0.5]
  82072. })
  82073. })
  82074. } else {
  82075. newImage = new (external_ol_style_Icon_default())({
  82076. src: src,
  82077. scale: scale,
  82078. anchor: anchor
  82079. });
  82080. }
  82081. } else {
  82082. newImage = new (external_ol_style_Circle_default())({
  82083. radius,
  82084. fill: new (external_ol_style_Fill_default())({
  82085. color: fillColorArray
  82086. }),
  82087. stroke: new (external_ol_style_Stroke_default())({
  82088. width: strokeWidth || ZERO,
  82089. color: strokeColorArray
  82090. }),
  82091. displacement: this.getCircleDisplacement(radius, offsetX, offsetY)
  82092. });
  82093. }
  82094. olStyle.setImage(newImage);
  82095. } else if (type === "LINE" || type === "LINESTRING" || type === 'MULTILINESTRING' || type === 'LINEARRING') {
  82096. newStroke = new (external_ol_style_Stroke_default())({
  82097. width: strokeWidth || ZERO,
  82098. color: strokeColorArray,
  82099. lineCap: lineCap || 'round',
  82100. lineDash: this.dashStyle(style, 1)
  82101. });
  82102. olStyle.setStroke(newStroke);
  82103. } else if (type === 'POLYGON' ||
  82104. type === 'MULTIPOLYGON' || type === 'REGION') {
  82105. newFill = new (external_ol_style_Fill_default())({
  82106. color: fillColorArray
  82107. });
  82108. newStroke = new (external_ol_style_Stroke_default())({
  82109. width: strokeWidth || ZERO,
  82110. color: strokeColorArray,
  82111. lineCap: lineCap || 'round',
  82112. lineDash: this.dashStyle(style, 1)
  82113. });
  82114. olStyle.setFill(newFill);
  82115. olStyle.setStroke(newStroke);
  82116. } else {
  82117. let result = this.getCanvas(style);
  82118. newImage = new (external_ol_style_Icon_default())({
  82119. img: result.canvas,
  82120. imgSize: [result.width, result.height],
  82121. scale: 1,
  82122. anchor: [0.5, 0.5]
  82123. });
  82124. olStyle.setImage(newImage);
  82125. }
  82126. return olStyle;
  82127. }
  82128. /**
  82129. * @function StyleUtils.getIconAnchor
  82130. * @description 获取图标的锚点
  82131. * @param {number} offsetX - X方向偏移分数
  82132. * @param {number} offsetY - Y方向偏移分数
  82133. * @returns {Array.<number>}
  82134. */
  82135. static getIconAnchor(offsetX=0.5, offsetY=0.5) {
  82136. return [offsetX, offsetY];
  82137. }
  82138. /**
  82139. * @function StyleUtils.getCircleDisplacement
  82140. * @description 获取圆圈的偏移
  82141. * @param {number} radius - 圆圈半径
  82142. * @param {number} offsetX - X方向偏移分数
  82143. * @param {number} offsetY - Y方向偏移分数
  82144. * @returns {Array.<number>}
  82145. */
  82146. static getCircleDisplacement(radius, offsetX=0, offsetY=0) {
  82147. const dispX = radius*offsetX, dispY = radius*offsetY;
  82148. return [dispX, -dispY];
  82149. }
  82150. /**
  82151. * @function StyleUtils.getTextOffset
  82152. * @description 获取字体图标的偏移值
  82153. * @param {string} fontSize - 字体大小,如12px
  82154. * @param {number} offsetX - X方向偏移分数
  82155. * @param {number} offsetY - Y方向偏移分数
  82156. * @returns {Object}
  82157. */
  82158. static getTextOffset(fontSize, offsetX=0, offsetY=0) {
  82159. const radius = fontSize.substr(0, fontSize.length - 2) / 2;
  82160. return {
  82161. x: radius*offsetX,
  82162. y: radius*offsetY
  82163. };
  82164. }
  82165. /**
  82166. * 获取文字标注对应的canvas
  82167. * @param style
  82168. * @returns {{canvas: *, width: number, height: number}}
  82169. */
  82170. static getCanvas(style) {
  82171. let canvas;
  82172. if (style.canvas) {
  82173. if (document.querySelector("#" + style.canvas)) {
  82174. canvas = document.getElemntById(style.canvas);
  82175. } else {
  82176. canvas = this.createCanvas(style);
  82177. }
  82178. } else {
  82179. //不存在canvas,当前feature
  82180. canvas = this.createCanvas(style);
  82181. style.canvas = canvas.id;
  82182. }
  82183. canvas.style.display = "none";
  82184. var ctx = canvas.getContext("2d");
  82185. //行高
  82186. let lineHeight = Number(style.font.replace(/[^0-9]/ig, ""));
  82187. let textArray = style.text.split('\r\n');
  82188. let lenght = textArray.length;
  82189. //在改变canvas大小后再绘制。否则会被清除
  82190. ctx.font = style.font;
  82191. let size = this.drawRect(ctx, style, textArray, lineHeight, canvas);
  82192. this.positionY = padding;
  82193. if (lenght > 1) {
  82194. textArray.forEach(function (text, i) {
  82195. if (i !== 0) {
  82196. this.positionY = this.positionY + lineHeight;
  82197. }
  82198. this.canvasTextAutoLine(text, style, ctx, lineHeight, size.width);
  82199. }, this);
  82200. } else {
  82201. this.canvasTextAutoLine(textArray[0], style, ctx, lineHeight, size.width);
  82202. }
  82203. return {
  82204. canvas: canvas,
  82205. width: size.width,
  82206. height: size.height
  82207. };
  82208. }
  82209. /**
  82210. * 创建当前feature对应的canvas
  82211. * @param {Object} style
  82212. * @returns {HTMLElement}
  82213. */
  82214. static createCanvas(style) {
  82215. let div = document.createElement('div');
  82216. document.body.appendChild(div);
  82217. let canvas = document.createElement('canvas');
  82218. canvas.id = style.canvas ? style.canvas : 'textCanvas' + core_Util_Util.newGuid(8);
  82219. div.appendChild(canvas);
  82220. return canvas;
  82221. }
  82222. /**
  82223. * 绘制矩形边框背景
  82224. * @param ctx
  82225. * @param style
  82226. * @param textArray
  82227. * @param lineHeight
  82228. * @param canvas
  82229. * @returns {{width: number, height: number}}
  82230. */
  82231. static drawRect(ctx, style, textArray, lineHeight, canvas) {
  82232. let backgroundFill = style.backgroundFill, maxWidth = style.maxWidth - doublePadding;
  82233. let width, height = 0, lineCount = 0, lineWidths = [];
  82234. //100的宽度,去掉左右两边3padding
  82235. textArray.forEach(function (arrText) {
  82236. let line = '', isOverMax;
  82237. lineCount++;
  82238. for (var n = 0; n < arrText.length; n++) {
  82239. let textLine = line + arrText[n];
  82240. let metrics = ctx.measureText(textLine);
  82241. let textWidth = metrics.width;
  82242. if ((textWidth > maxWidth && n > 0) || arrText[n] === '\n') {
  82243. line = arrText[n];
  82244. lineCount++;
  82245. //有换行,记录当前换行的width
  82246. isOverMax = true;
  82247. } else {
  82248. line = textLine;
  82249. width = textWidth;
  82250. }
  82251. }
  82252. if (isOverMax) {
  82253. lineWidths.push(maxWidth);
  82254. } else {
  82255. lineWidths.push(width);
  82256. }
  82257. }, this);
  82258. width = this.getCanvasWidth(lineWidths, maxWidth);
  82259. height = lineCount * lineHeight;
  82260. height += doublePadding;
  82261. canvas.width = width;
  82262. canvas.height = height;
  82263. ctx.fillStyle = backgroundFill;
  82264. ctx.fillRect(0, 0, width, height);
  82265. return {
  82266. width: width,
  82267. height: height
  82268. }
  82269. }
  82270. /**
  82271. * 获取自适应的宽度(如果没有超过最大宽度,就用文字的宽度)
  82272. * @param lineWidths
  82273. * @param maxWidth
  82274. * @returns {number}
  82275. */
  82276. static getCanvasWidth(lineWidths, maxWidth) {
  82277. let width = 0;
  82278. for (let i = 0; i < lineWidths.length; i++) {
  82279. let lineW = lineWidths[i];
  82280. if (lineW >= maxWidth) {
  82281. //有任何一行超过最大高度,就用最大高度
  82282. return maxWidth + doublePadding;
  82283. } else if (lineW > width) {
  82284. //自己换行,就要比较每行的最大宽度
  82285. width = lineW;
  82286. }
  82287. }
  82288. return width + doublePadding;
  82289. }
  82290. /**
  82291. * 绘制文字,解决换行问题
  82292. * @param text
  82293. * @param style
  82294. * @param ctx
  82295. * @param lineHeight
  82296. */
  82297. static canvasTextAutoLine(text, style, ctx, lineHeight, canvasWidth) {
  82298. // 字符分隔为数组
  82299. ctx.font = style.font;
  82300. let textAlign = style.textAlign;
  82301. let x = this.getPositionX(textAlign, canvasWidth);
  82302. let arrText = text.split('');
  82303. let line = '', fillColor = style.fillColor;
  82304. //每一行限制的高度
  82305. let maxWidth = style.maxWidth - doublePadding;
  82306. for (var n = 0; n < arrText.length; n++) {
  82307. let testLine = line + arrText[n];
  82308. let metrics = ctx.measureText(testLine);
  82309. let testWidth = metrics.width;
  82310. if ((testWidth > maxWidth && n > 0) || arrText[n] === '\n') {
  82311. ctx.fillStyle = fillColor;
  82312. ctx.textAlign = textAlign;
  82313. ctx.textBaseline = "top";
  82314. ctx.fillText(line, x, this.positionY);
  82315. line = arrText[n];
  82316. this.positionY += lineHeight;
  82317. } else {
  82318. line = testLine;
  82319. }
  82320. }
  82321. ctx.fillStyle = fillColor;
  82322. ctx.textAlign = textAlign;
  82323. ctx.textBaseline = "top";
  82324. ctx.fillText(line, x, this.positionY);
  82325. }
  82326. /**
  82327. * 得到绘制的起点位置,根据align不同,位置也不同
  82328. * @param textAlign
  82329. * @returns {number}
  82330. */
  82331. static getPositionX(textAlign, canvasWidth) {
  82332. let x;
  82333. let width = canvasWidth - doublePadding; //减去padding
  82334. switch (textAlign) {
  82335. case 'center':
  82336. x = width / 2;
  82337. break;
  82338. case 'right':
  82339. x = width;
  82340. break;
  82341. default:
  82342. x = 8;
  82343. break;
  82344. }
  82345. return x;
  82346. }
  82347. /**
  82348. * @function StyleUtils.hexToRgb
  82349. * @description 将16进制的颜色,转换成rgb格式
  82350. * @param {string} hexColor 16进制颜色
  82351. * @returns {string} rgb格式的颜色
  82352. */
  82353. static hexToRgb(hexColor) {
  82354. if (!hexColor) {
  82355. return;
  82356. }
  82357. var s = hexColor.replace('#', '').split('');
  82358. var rgb = [s[0] + s[1], s[2] + s[3], s[4] + s[5]];
  82359. rgb = rgb.map(function (hex) {
  82360. return parseInt(hex, 16);
  82361. });
  82362. return rgb;
  82363. }
  82364. /**
  82365. * @function StyleUtils.formatRGB
  82366. * @description 将颜色数组转换成标准的rgb颜色格式
  82367. * @param {Array} colorArray - 颜色数组
  82368. * @returns {string} 'rgb(0,0,0)'或者 'rgba(0,0,0,0)'
  82369. */
  82370. static formatRGB(colorArray) {
  82371. let rgb;
  82372. if (colorArray.length === 3) {
  82373. rgb = 'rgb(';
  82374. colorArray.forEach(function (color, index) {
  82375. index === 2 ? rgb += color : rgb += color + ',';
  82376. });
  82377. } else {
  82378. rgb = 'rgba(';
  82379. colorArray.forEach(function (color, index) {
  82380. index === 3 ? rgb += color : rgb += color + ',';
  82381. });
  82382. }
  82383. rgb += ")"
  82384. return rgb;
  82385. }
  82386. /**
  82387. * @function StyleUtils.getCanvasFromSVG
  82388. * @description 将SVG转换成Canvas
  82389. * @param {string} svgUrl - 颜色数组
  82390. * @param {Object} divDom - div的dom对象
  82391. * @param {function} callBack - 转换成功执行的回调函数
  82392. */
  82393. static async getCanvasFromSVG(svgUrl, divDom, callBack) {
  82394. //一个图层对应一个canvas
  82395. const canvgs = window.canvg && window.canvg.default ? window.canvg.default : (external_function_try_return_canvg_catch_e_return_default());
  82396. let canvas = document.createElement('canvas');
  82397. canvas.id = 'dataviz-canvas-' + core_Util_Util.newGuid(8);
  82398. canvas.style.display = "none";
  82399. divDom.appendChild(canvas);
  82400. try {
  82401. const ctx = canvas.getContext('2d');
  82402. const v = await canvgs.from(ctx, svgUrl, {
  82403. ignoreMouse: true,
  82404. ignoreAnimation: true,
  82405. forceRedraw: () => false
  82406. })
  82407. v.start();
  82408. if (canvas.width > 300 || canvas.height > 300) {
  82409. return;
  82410. }
  82411. callBack(canvas);
  82412. } catch (e) {
  82413. return;
  82414. }
  82415. }
  82416. /**
  82417. * @function StyleUtils.stopCanvg
  82418. * @description 调用Canvg实例的stop();
  82419. */
  82420. static stopCanvg() {
  82421. this.canvgsV.forEach(v => v.stop());
  82422. this.canvgsV = [];
  82423. }
  82424. /**
  82425. * @function StyleUtils.getMarkerDefaultStyle 获取默认标注图层feature的样式
  82426. * @param {string} featureType feature的类型
  82427. * @param {string} server 当前地图前缀
  82428. * @returns {Object} style对象
  82429. */
  82430. static getMarkerDefaultStyle(featureType, server) {
  82431. let style;
  82432. switch (featureType) {
  82433. case 'POINT':
  82434. style = {
  82435. src: `${server}apps/dataviz/static/imgs/markers/mark_red.png`,
  82436. scale: 1,
  82437. anchor: [0.5, 1]
  82438. };
  82439. break;
  82440. case 'LINE':
  82441. case 'LINESTRING':
  82442. case 'MULTILINESTRING':
  82443. style = {
  82444. strokeColor: '#3498db',
  82445. strokeOpacity: 1,
  82446. strokeWidth: 5,
  82447. lineCap: 'round',
  82448. lineDash: 'solid'
  82449. };
  82450. break;
  82451. case 'REGION':
  82452. case 'POLYGON':
  82453. case 'MULTIPOLYGON':
  82454. style = {
  82455. fillColor: '#1abd9c',
  82456. fillOpacity: 1,
  82457. strokeColor: '#3498db',
  82458. strokeOpacity: 1,
  82459. strokeWidth: 3,
  82460. lineCap: 'round',
  82461. lineDash: 'solid'
  82462. };
  82463. break;
  82464. }
  82465. return style;
  82466. }
  82467. /**
  82468. * @function StyleUtils.getOpenlayerStyle 获取专题图对应的openlayers格式的style
  82469. * @param {string} styleParams 样式参数
  82470. * @param {string} featureType feature类型
  82471. * @param {boolean} isRank 是否为等级符号
  82472. * @returns {Promise<ol.style.Style>}
  82473. */
  82474. static async getOpenlayersStyle(styleParams, featureType, isRank) {
  82475. let style;
  82476. if (styleParams.type === "BASIC_POINT") {
  82477. style = await this.toOpenLayersStyle(styleParams, featureType);
  82478. } else if (styleParams.type === "SYMBOL_POINT") {
  82479. style = this.getSymbolStyle(styleParams, isRank);
  82480. } else if (styleParams.type === "SVG_POINT") {
  82481. style = await this.getSVGStyle(styleParams);
  82482. } else if (styleParams.type === 'IMAGE_POINT') {
  82483. style = this.getImageStyle(styleParams);
  82484. }
  82485. return style;
  82486. }
  82487. /**
  82488. * @function StyleUtils.getSymbolStyle 获取符号样式
  82489. * @param {Object} parameters - 样式参数
  82490. * @returns {Object} style对象
  82491. */
  82492. static getSymbolStyle(parameters, isRank) {
  82493. let text = '';
  82494. if (parameters.unicode) {
  82495. text = String.fromCharCode(parseInt(parameters.unicode.replace(/^&#x/, ''), 16));
  82496. }
  82497. // 填充色 + 透明度
  82498. let fillColor = StyleUtils.hexToRgb(parameters.fillColor);
  82499. fillColor.push(parameters.fillOpacity);
  82500. // 边框充色 + 透明度
  82501. let strokeColor = StyleUtils.hexToRgb(parameters.strokeColor);
  82502. strokeColor.push(parameters.strokeOpacity);
  82503. let fontSize = isRank ? 2 * parameters.radius + "px" : parameters.fontSize;
  82504. const {offsetX, offsetY, rotation=0} = parameters;
  82505. const offset = StyleUtils.getTextOffset(fontSize, offsetX, offsetY);
  82506. return new (external_ol_style_Style_default())({
  82507. text: new (external_ol_style_Text_default())({
  82508. text: text,
  82509. font: fontSize + " supermapol-icons",
  82510. placement: 'point',
  82511. textAlign: 'center',
  82512. fill: new (external_ol_style_Fill_default())({
  82513. color: fillColor
  82514. }),
  82515. backgroundFill: new (external_ol_style_Fill_default())({
  82516. color: [0, 0, 0, 0]
  82517. }),
  82518. stroke: new (external_ol_style_Stroke_default())({
  82519. width: parameters.strokeWidth || 0.000001,
  82520. color: strokeColor
  82521. }),
  82522. offsetX: offset.x,
  82523. offsetY: offset.y,
  82524. rotation
  82525. })
  82526. });
  82527. }
  82528. /**
  82529. * @function StyleUtils.getSVGStyle 获取svg的样式
  82530. * @param {Object} styleParams - 样式参数
  82531. * @returns {Promise<ol.style.Style>}
  82532. */
  82533. static async getSVGStyle(styleParams) {
  82534. let style, that = this;
  82535. if (!that.svgDiv) {
  82536. that.svgDiv = document.createElement('div');
  82537. document.body.appendChild(that.svgDiv);
  82538. }
  82539. const { url, radius, offsetX, offsetY, fillOpacity, rotation } = styleParams;
  82540. let anchor = this.getIconAnchor(offsetX, offsetY);
  82541. await StyleUtils.getCanvasFromSVG(url, that.svgDiv, function (canvas) {
  82542. style = new (external_ol_style_Style_default())({
  82543. image: new (external_ol_style_Icon_default())({
  82544. img: that.setColorToCanvas(canvas, styleParams),
  82545. scale: 2 * radius / canvas.width,
  82546. imgSize: [canvas.width, canvas.height],
  82547. anchor: anchor || [0.5, 0.5],
  82548. opacity: fillOpacity,
  82549. anchorOrigin: 'bottom-right',
  82550. rotation
  82551. })
  82552. });
  82553. });
  82554. return style;
  82555. }
  82556. /**
  82557. * @function StyleUtils.setColorToCanvas 将颜色,透明度等样式设置到canvas上
  82558. * @param {Object} canvas - 渲染的canvas对象
  82559. * @param {Object} parameters - 样式参数
  82560. * @returns {Object} style对象
  82561. */
  82562. static setColorToCanvas(canvas, parameters) {
  82563. let context = canvas.getContext('2d');
  82564. let fillColor = StyleUtils.hexToRgb(parameters.fillColor);
  82565. fillColor && fillColor.push(parameters.fillOpacity);
  82566. let strokeColor = StyleUtils.hexToRgb(parameters.strokeColor);
  82567. strokeColor && strokeColor.push(parameters.strokeOpacity);
  82568. context.fillStyle = StyleUtils.formatRGB(fillColor);
  82569. context.fill();
  82570. context.strokeStyle = StyleUtils.formatRGB(strokeColor);
  82571. context.lineWidth = parameters.strokeWidth;
  82572. context.stroke();
  82573. return canvas;
  82574. }
  82575. /**
  82576. * @function StyleUtils.getImageStyle 获取图片样式
  82577. * @param {Object} styleParams - 样式参数
  82578. * @returns {Object} style对象
  82579. */
  82580. static getImageStyle(styleParams) {
  82581. let size = styleParams.imageInfo.size,
  82582. scale = 2 * styleParams.radius / size.w;
  82583. let imageInfo = styleParams.imageInfo;
  82584. let imgDom = imageInfo.img;
  82585. if (!imgDom || !imgDom.src) {
  82586. imgDom = new Image();
  82587. //要组装成完整的url
  82588. imgDom.src = imageInfo.url;
  82589. }
  82590. const { offsetX, offsetY, rotation } = styleParams;
  82591. let anchor = this.getIconAnchor(offsetX, offsetY);
  82592. return new (external_ol_style_Style_default())({
  82593. image: new (external_ol_style_Icon_default())({
  82594. img: imgDom,
  82595. scale,
  82596. imgSize: [size.w, size.h],
  82597. anchor: anchor || [0.5, 0.5],
  82598. anchorOrigin: 'bottom-right',
  82599. rotation
  82600. })
  82601. });
  82602. }
  82603. /**
  82604. * @function StyleUtils.getRoadPath 获取道路样式
  82605. * @param {Object} style - 样式参数
  82606. * @param {Object} outlineStyle - 轮廓样式参数
  82607. * @returns {Object} style对象
  82608. */
  82609. static getRoadPath(style, outlineStyle) {
  82610. const { strokeWidth=ZERO, lineCap, strokeColor, strokeOpacity } = style;
  82611. // 道路线都是solid
  82612. let strokeColorArray = this.hexToRgb(strokeColor);
  82613. strokeColorArray && strokeColorArray.push(strokeOpacity);
  82614. var stroke = new (external_ol_style_Style_default())({
  82615. stroke: new (external_ol_style_Stroke_default())({
  82616. width: strokeWidth || ZERO,
  82617. color: strokeColorArray,
  82618. lineCap: lineCap || 'round',
  82619. lineDash: [0]
  82620. })
  82621. });
  82622. const { strokeColor: outlineColor } = outlineStyle;
  82623. let outlineColorArray = this.hexToRgb(outlineColor);
  82624. // opacity使用style的透明度。保持两根线透明度一致
  82625. outlineColorArray && outlineColorArray.push(strokeOpacity);
  82626. let outlineWidth = outlineStyle.strokeWidth || (strokeWidth === 0 ? ZERO : strokeWidth + 2); //外部宽度=内部样式宽度 + 2
  82627. var outlineStroke = new (external_ol_style_Style_default())({
  82628. stroke: new (external_ol_style_Stroke_default())({
  82629. width: outlineWidth, //外部宽度=内部样式宽度 + 2
  82630. color: outlineColorArray,
  82631. lineCap: lineCap || 'round',
  82632. lineDash: [0]
  82633. })
  82634. });
  82635. return [outlineStroke, stroke];
  82636. }
  82637. /**
  82638. * @function StyleUtils.getPathway 获取铁路样式
  82639. * @param {Object} style - 样式参数
  82640. * @param {Object} outlineStyle - 轮廓样式参数
  82641. * @returns {Object} style对象
  82642. */
  82643. static getPathway(style, outlineStyle) {
  82644. let { strokeWidth=ZERO, strokeColor, strokeOpacity } = style;
  82645. // 道路线都是solid, lineCap都是直角
  82646. const lineDash = (w => [w, w + strokeWidth * 2])(4 * strokeWidth), lineCap= 'square';
  82647. let strokeColorArray = this.hexToRgb(strokeColor);
  82648. strokeColorArray && strokeColorArray.push(strokeOpacity);
  82649. var stroke = new (external_ol_style_Style_default())({
  82650. stroke: new (external_ol_style_Stroke_default())({
  82651. width: strokeWidth*0.5 || ZERO,
  82652. color: strokeColorArray,
  82653. lineCap,
  82654. lineDash
  82655. })
  82656. });
  82657. const { strokeColor: outlineColor } = outlineStyle;
  82658. let outlineColorArray = this.hexToRgb(outlineColor);
  82659. // opacity使用style的透明度。保持两根线透明度一致
  82660. outlineColorArray && outlineColorArray.push(strokeOpacity);
  82661. var outlineStroke = new (external_ol_style_Style_default())({
  82662. stroke: new (external_ol_style_Stroke_default())({
  82663. width: strokeWidth || ZERO,
  82664. color: outlineColorArray,
  82665. lineCap
  82666. })
  82667. });
  82668. return [outlineStroke, stroke];
  82669. }
  82670. }
  82671. ;// CONCATENATED MODULE: external "ol.Map"
  82672. const external_ol_Map_namespaceObject = ol.Map;
  82673. var external_ol_Map_default = /*#__PURE__*/__webpack_require__.n(external_ol_Map_namespaceObject);
  82674. ;// CONCATENATED MODULE: external "ol.layer.Group"
  82675. const external_ol_layer_Group_namespaceObject = ol.layer.Group;
  82676. var external_ol_layer_Group_default = /*#__PURE__*/__webpack_require__.n(external_ol_layer_Group_namespaceObject);
  82677. ;// CONCATENATED MODULE: ./src/openlayers/core/MapExtend.js
  82678. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82679. * This program are made available under the terms of the Apache License, Version 2.0
  82680. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82681. /**
  82682. * @function MapExtend
  82683. * @description 扩展 OpenLayers 的一些原始方法。
  82684. * @private
  82685. */
  82686. var MapExtend = function () {
  82687. const fun = function (layer, coordinate, resolution, callback, pixel, e) {
  82688. if (layer instanceof (external_ol_layer_Group_default())) {
  82689. layer.getLayers().forEach(function (subLayer) {
  82690. fun(subLayer, coordinate, resolution, callback, pixel, e)
  82691. });
  82692. } else {
  82693. //当前高效率点图层满足筛选条件/并且可视时,可被选中:
  82694. if (layer.getSource()._forEachFeatureAtCoordinate) {
  82695. layer.getSource()._forEachFeatureAtCoordinate(coordinate, resolution, (feature) => {
  82696. callback(feature, layer)
  82697. }, pixel, e);
  82698. }
  82699. }
  82700. }
  82701. ;(external_ol_Map_default()).prototype.forEachFeatureAtPixelDefault = (external_ol_Map_default()).prototype.forEachFeatureAtPixel;
  82702. ;(external_ol_Map_default()).prototype.forEachFeatureAtPixel = (external_ol_Map_default()).prototype.Tc = function (pixel, callback, opt_options, e) {
  82703. //如果满足高效率图层选取要求优先返回高效率图层选中结果
  82704. const layerFilter = (opt_options && opt_options.layerFilter) ? opt_options.layerFilter : () => {
  82705. return true;
  82706. };
  82707. const layers = this.getLayers().getArray();
  82708. const resolution = this.getView().getResolution();
  82709. const coordinate = this.getCoordinateFromPixel(pixel);
  82710. for (let i = 0; i < layers.length; i++) {
  82711. const layer = layers[i];
  82712. if (layer.getVisible() && layerFilter.call(null, layer)) {
  82713. fun(layer, coordinate, resolution, callback, pixel, e)
  82714. }
  82715. }
  82716. return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options);
  82717. }
  82718. }();
  82719. ;// CONCATENATED MODULE: ./src/openlayers/core/index.js
  82720. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82721. * This program are made available under the terms of the Apache License, Version 2.0
  82722. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82723. ;// CONCATENATED MODULE: external "ol.source.TileImage"
  82724. const external_ol_source_TileImage_namespaceObject = ol.source.TileImage;
  82725. var external_ol_source_TileImage_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_TileImage_namespaceObject);
  82726. ;// CONCATENATED MODULE: external "ol.asserts"
  82727. const external_ol_asserts_namespaceObject = ol.asserts;
  82728. ;// CONCATENATED MODULE: external "ol.tilegrid.TileGrid"
  82729. const external_ol_tilegrid_TileGrid_namespaceObject = ol.tilegrid.TileGrid;
  82730. var external_ol_tilegrid_TileGrid_default = /*#__PURE__*/__webpack_require__.n(external_ol_tilegrid_TileGrid_namespaceObject);
  82731. ;// CONCATENATED MODULE: ./src/openlayers/mapping/BaiduMap.js
  82732. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82733. * This program are made available under the terms of the Apache License, Version 2.0
  82734. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82735. /**
  82736. * @class BaiduMap
  82737. * @browsernamespace ol.source
  82738. * @category ThirdPartyMap
  82739. * @classdesc 百度地图图层源。
  82740. * @modulecategory Mapping
  82741. * @param {Object} opt_options - 参数。
  82742. * @param {string} [opt_options.url='http://online1.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170408'] - 服务地址。
  82743. * @param {string} [opt_options.tileProxy] - 代理地址。
  82744. * @param {boolean} [hidpi = false] - 是否使用高分辨率地图。
  82745. * @extends {ol.source.TileImage}
  82746. * @usage
  82747. */
  82748. class BaiduMap extends (external_ol_source_TileImage_default()) {
  82749. constructor(opt_options) {
  82750. var options = opt_options || {};
  82751. var attributions =
  82752. options.attributions ||
  82753. "Map Data © 2018 Baidu - GS(2016)2089号 - Data © 长地万方 with <span>© SuperMap iClient</span>";
  82754. var tileGrid = BaiduMap.defaultTileGrid();
  82755. var crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous';
  82756. var url =
  82757. options.url !== undefined
  82758. ? options.url
  82759. : 'http://online1.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170408';
  82760. var hidpi =
  82761. options.hidpi || (window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI) > 1;
  82762. url = url.replace('{styles}', hidpi ? 'ph' : 'pl');
  82763. super({
  82764. attributions: attributions,
  82765. cacheSize: options.cacheSize,
  82766. crossOrigin: crossOrigin,
  82767. opaque: options.opaque !== undefined ? options.opaque : true,
  82768. maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
  82769. reprojectionErrorThreshold: options.reprojectionErrorThreshold,
  82770. tileLoadFunction: options.tileLoadFunction,
  82771. projection: 'EPSG:3857',
  82772. wrapX: options.wrapX,
  82773. tilePixelRatio: hidpi ? 2 : 1,
  82774. tileGrid: tileGrid,
  82775. tileUrlFunction: tileUrlFunction
  82776. });
  82777. if (options.tileProxy) {
  82778. this.tileProxy = options.tileProxy;
  82779. }
  82780. var me = this;
  82781. // eslint-disable-next-line no-unused-vars
  82782. function tileUrlFunction(tileCoord, pixelRatio, projection) {
  82783. var tempUrl = url
  82784. .replace('{z}', tileCoord[0].toString())
  82785. .replace('{x}', tileCoord[1].toString())
  82786. .replace('{y}', function() {
  82787. console.log(core_Util_Util.getOlVersion());
  82788. var y = ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? tileCoord[2] : -tileCoord[2] - 1;
  82789. return y.toString();
  82790. })
  82791. .replace('{-y}', function() {
  82792. var z = tileCoord[0];
  82793. var range = tileGrid.getFullTileRange(z);
  82794. external_ol_asserts_namespaceObject.assert(range, 55); // The {-y} placeholder requires a tile grid with extent
  82795. var y = range.getHeight() + tileCoord[2];
  82796. return y.toString();
  82797. });
  82798. //支持代理
  82799. if (me.tileProxy) {
  82800. tempUrl = me.tileProxy + encodeURIComponent(tempUrl);
  82801. }
  82802. return tempUrl;
  82803. }
  82804. }
  82805. // TODO 确认这个方法是否要开出去
  82806. /**
  82807. * @function BaiduMap.defaultTileGrid
  82808. * @description 获取默认瓦片格网。
  82809. * @returns {ol.tilegrid.TileGrid} 返回瓦片格网对象。
  82810. */
  82811. static defaultTileGrid() {
  82812. var tileGird = new (external_ol_tilegrid_TileGrid_default())({
  82813. extent: [-33554432, -33554432, 33554432, 33554432],
  82814. resolutions: [
  82815. 131072 * 2,
  82816. 131072,
  82817. 65536,
  82818. 32768,
  82819. 16284,
  82820. 8192,
  82821. 4096,
  82822. 2048,
  82823. 1024,
  82824. 512,
  82825. 256,
  82826. 128,
  82827. 64,
  82828. 32,
  82829. 16,
  82830. 8,
  82831. 4,
  82832. 2,
  82833. 1,
  82834. 0.5
  82835. ],
  82836. origin: [0, 0],
  82837. minZoom: 3
  82838. });
  82839. return tileGird;
  82840. }
  82841. }
  82842. ;// CONCATENATED MODULE: external "ol.source.Image"
  82843. const external_ol_source_Image_namespaceObject = ol.source.Image;
  82844. var external_ol_source_Image_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_Image_namespaceObject);
  82845. ;// CONCATENATED MODULE: external "ol.Image"
  82846. const external_ol_Image_namespaceObject = ol.Image;
  82847. var external_ol_Image_default = /*#__PURE__*/__webpack_require__.n(external_ol_Image_namespaceObject);
  82848. ;// CONCATENATED MODULE: external "ol.format.GeoJSON"
  82849. const external_ol_format_GeoJSON_namespaceObject = ol.format.GeoJSON;
  82850. var external_ol_format_GeoJSON_default = /*#__PURE__*/__webpack_require__.n(external_ol_format_GeoJSON_namespaceObject);
  82851. ;// CONCATENATED MODULE: external "ol.extent"
  82852. const external_ol_extent_namespaceObject = ol.extent;
  82853. ;// CONCATENATED MODULE: ./src/openlayers/mapping/ImageSuperMapRest.js
  82854. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82855. * This program are made available under the terms of the Apache License, Version 2.0
  82856. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82857. /**
  82858. * @class ImageSuperMapRest
  82859. * @browsernamespace ol.source
  82860. * @category iServer Map Tile
  82861. * @classdesc SuperMap iServer Image 图层源。
  82862. * @modulecategory Mapping
  82863. * @param {Object} options - 参数。
  82864. * @param {string} options.url - 地图服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
  82865. * @param {ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务类型 ISERVER|IPORTAL|ONLINE。
  82866. * @param {boolean} [options.redirect=false] - 是否重定向。
  82867. * @param {boolean} [options.transparent=true] - 瓦片是否透明。
  82868. * @param {boolean} [options.antialias=false] - 是否反走样地图。
  82869. * @param {boolean} [options.cacheEnabled=true] - 是否使用服务端的缓存,true 表示使用服务端的缓存。
  82870. * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。当此参数设置的坐标系统不同于地图的原有坐标系统时,系统会进行动态投影,并返回动态投影后的地图瓦片。例如:{"epsgCode":3857}。
  82871. * @param {string} [options.layersID] - 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合。
  82872. * @param {boolean} [options.clipRegionEnabled = false] - 是否地图只显示该区域覆盖的部分。true 表示地图只显示该区域覆盖的部分。
  82873. * @param {ol.geom.Geometry} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
  82874. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。如果为 true,则同一范围内的对象会直接压盖;如果为 false 则通过 overlapDisplayedOptions 控制对象不压盖显示。
  82875. * @param {OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项,当 overlapDisplayed 为 false 时有效,用来增强对地图对象压盖时的处理。
  82876. * @param {boolean} [options.markerAngleFixed=false] - 指定点状符号的角度是否固定。
  82877. * @param {boolean} [options.textAngleFixed=false] - 文本角度是否固定。
  82878. * @param {boolean} [options.textOrientationFixed=false] - 文本朝向是否固定。
  82879. * @param {boolean} [options.paintBackground=false] - 是否绘制地图背景。
  82880. * @param {boolean} [options.maxVisibleTextSize] - 文本的最大可见尺寸,单位为像素。
  82881. * @param {boolean} [options.maxVisibleVertex] - 最大几何对象可见节点数。如果几何对象的节点数超过指定的个数,则超过的那部分节点不显示。
  82882. * @param {boolean} [options.minVisibleTextSize] - 文本的最小可见尺寸,单位为像素。
  82883. * @param {string} [options.tileversion] - 切片版本名称,_cache 为 true 时有效。
  82884. * @param {string} [options.tileProxy] - 代理地址。
  82885. * @param {NDVIParameter|HillshadeParameter} [options.rasterfunction] - 栅格分析参数。
  82886. * @param {string} [options.format = 'png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、"gif" 等图片类型。
  82887. * @param {Function} [options.imageLoadFunction] - 加载图片的方法。默认为function(imageTile, src) {imageTile.getImage().src = src;};
  82888. * @param {string} [options.ratio=1.5] - 请求图片大小比例。 1 表示请求图片大小和地图视窗范围一致,2 表示请求图片大小是地图视窗范围的2倍,以此类推。
  82889. * @extends {ol.source.Image}
  82890. * @usage
  82891. */
  82892. class ImageSuperMapRest extends (external_ol_source_Image_default()) {
  82893. constructor(options) {
  82894. super({
  82895. attributions: options.attributions,
  82896. imageSmoothing: options.imageSmoothing,
  82897. projection: options.projection,
  82898. resolutions: options.resolutions
  82899. });
  82900. if (options.url === undefined) {
  82901. return;
  82902. }
  82903. this.imageLoadFunction_ =
  82904. options.imageLoadFunction !== undefined ? options.imageLoadFunction : external_ol_source_Image_namespaceObject.defaultImageLoadFunction;
  82905. this._image = null;
  82906. this.renderedRevision_ = 0;
  82907. this._crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : null;
  82908. this._url = options.url;
  82909. this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5;
  82910. options.attributions =
  82911. options.attributions ||
  82912. "Map Data <span>© SuperMap iServer</span> with © SuperMap iClient";
  82913. options.format = options.format ? options.format : 'png';
  82914. this._layerUrl = Util_Util.urlPathAppend(options.url, 'image.' + options.format);
  82915. //为url添加安全认证信息片段
  82916. this._layerUrl = SecurityManager.appendCredential(this._layerUrl);
  82917. const params = {};
  82918. //切片是否透明
  82919. const transparent = options.transparent !== undefined ? options.transparent : true;
  82920. params['transparent'] = transparent;
  82921. //是否使用缓存吗,默认为true
  82922. const cacheEnabled = options.cacheEnabled !== undefined ? options.cacheEnabled : true;
  82923. params['cacheEnabled'] = cacheEnabled;
  82924. //如果有layersID,则是在使用专题图
  82925. if (options.layersID !== undefined) {
  82926. params['layersID'] = options.layersID;
  82927. }
  82928. //是否重定向,默认为false
  82929. let redirect = false;
  82930. if (options.redirect !== undefined) {
  82931. redirect = options.redirect;
  82932. }
  82933. params['redirect'] = redirect;
  82934. if (options.prjCoordSys) {
  82935. params['prjCoordSys'] = JSON.stringify(options.prjCoordSys);
  82936. }
  82937. if (options.clipRegionEnabled && options.clipRegion instanceof (external_ol_geom_Geometry_default())) {
  82938. options.clipRegion = core_Util_Util.toSuperMapGeometry(new (external_ol_format_GeoJSON_default())().writeGeometryObject(options.clipRegion));
  82939. options.clipRegion = Util_Util.toJSON(ServerGeometry.fromGeometry(options.clipRegion));
  82940. params['clipRegionEnabled'] = options.clipRegionEnabled;
  82941. params['clipRegion'] = JSON.stringify(options.clipRegion);
  82942. }
  82943. if (!!options.overlapDisplayed && options.overlapDisplayedOptions) {
  82944. // options.overlapDisplayedOptions = options.overlapDisplayedOptions;
  82945. params['overlapDisplayed'] = options.overlapDisplayed;
  82946. params['overlapDisplayedOptions'] = options.overlapDisplayedOptions.toString();
  82947. }
  82948. if (cacheEnabled === true && options.tileversion) {
  82949. params['tileversion'] = options.tileversion;
  82950. }
  82951. if (options.rasterfunction) {
  82952. params['rasterfunction'] = JSON.stringify(options.rasterfunction);
  82953. }
  82954. //是否反走样地图,默认为false
  82955. if (options.antialias !== undefined) {
  82956. params['antialias'] = options.antialias;
  82957. }
  82958. if (options.markerAngleFixed !== undefined) {
  82959. params['markerAngleFixed'] = options.markerAngleFixed;
  82960. }
  82961. if (options.textAngleFixed !== undefined) {
  82962. params['textAngleFixed'] = options.textAngleFixed;
  82963. }
  82964. if (options.textOrientationFixed !== undefined) {
  82965. params['textOrientationFixed'] = options.textOrientationFixed;
  82966. }
  82967. if (options.paintBackground !== undefined) {
  82968. params['paintBackground'] = options.paintBackground;
  82969. }
  82970. if (!isNaN(options.maxVisibleTextSize)) {
  82971. params['maxVisibleTextSize'] = +options.maxVisibleTextSize;
  82972. }
  82973. if (!isNaN(options.minVisibleTextSize)) {
  82974. params['maxVisibleTextSize'] = +options.minVisibleTextSize;
  82975. }
  82976. if (!isNaN(options.maxVisibleVertex)) {
  82977. params['maxVisibleVertex'] = Math.round(+options.maxVisibleVertex);
  82978. }
  82979. this._layerUrl = Util_Util.urlAppend(this._layerUrl, Util_Util.getParameterString(params));
  82980. //存储一个cacheEnabled
  82981. this.cacheEnabled = cacheEnabled;
  82982. if (options.tileProxy) {
  82983. this.tileProxy = options.tileProxy;
  82984. }
  82985. }
  82986. getImageInternal(extent, resolution, pixelRatio) {
  82987. resolution = this.findNearestResolution(resolution);
  82988. const imageResolution = resolution / pixelRatio;
  82989. const center = (0,external_ol_extent_namespaceObject.getCenter)(extent);
  82990. const viewWidth = Math.ceil((0,external_ol_extent_namespaceObject.getWidth)(extent) / imageResolution);
  82991. const viewHeight = Math.ceil((0,external_ol_extent_namespaceObject.getHeight)(extent) / imageResolution);
  82992. const viewExtent = (0,external_ol_extent_namespaceObject.getForViewAndSize)(center, imageResolution, 0, [viewWidth, viewHeight]);
  82993. const requestWidth = Math.ceil((this.ratio_ * (0,external_ol_extent_namespaceObject.getWidth)(extent)) / imageResolution);
  82994. const requestHeight = Math.ceil((this.ratio_ * (0,external_ol_extent_namespaceObject.getHeight)(extent)) / imageResolution);
  82995. const requestExtent = (0,external_ol_extent_namespaceObject.getForViewAndSize)(center, imageResolution, 0, [requestWidth, requestHeight]);
  82996. const image = this._image;
  82997. if (
  82998. image &&
  82999. this.renderedRevision_ === this.getRevision() &&
  83000. image.getResolution() === resolution &&
  83001. image.getPixelRatio() === pixelRatio &&
  83002. (0,external_ol_extent_namespaceObject.containsExtent)(image.getExtent(), viewExtent)
  83003. ) {
  83004. return image;
  83005. }
  83006. const imageSize = [
  83007. Math.round((0,external_ol_extent_namespaceObject.getWidth)(requestExtent) / imageResolution),
  83008. Math.round((0,external_ol_extent_namespaceObject.getHeight)(requestExtent) / imageResolution)
  83009. ];
  83010. const imageUrl = this._getRequestUrl(requestExtent, imageSize);
  83011. this._image = new (external_ol_Image_default())(
  83012. requestExtent,
  83013. resolution,
  83014. pixelRatio,
  83015. imageUrl,
  83016. this._crossOrigin,
  83017. this.imageLoadFunction_
  83018. );
  83019. this.renderedRevision_ = this.getRevision();
  83020. this._image.addEventListener('change', this.handleImageChange.bind(this));
  83021. return this._image;
  83022. }
  83023. _getRequestUrl(extent, imageSize) {
  83024. const params = {
  83025. width: imageSize[0],
  83026. height: imageSize[1],
  83027. viewBounds: { leftBottom: { x: extent[0], y: extent[1] }, rightTop: { x: extent[2], y: extent[3] } }
  83028. };
  83029. //不启用缓存时启用时间戳
  83030. if (!this.cacheEnabled) {
  83031. params['_t'] = new Date().getTime();
  83032. }
  83033. let imageUrl = Util_Util.urlAppend(this._layerUrl, Util_Util.getParameterString(params));
  83034. //支持代理
  83035. if (this.tileProxy) {
  83036. imageUrl = this.tileProxy + encodeURIComponent(imageUrl);
  83037. }
  83038. return imageUrl;
  83039. }
  83040. /**
  83041. * @function ImageSuperMapRest.optionsFromMapJSON
  83042. * @param {string} url - 地址。
  83043. * @param {Object} mapJSONObj - 地图 JSON。
  83044. * @description 获取地图 JSON 信息。
  83045. */
  83046. static optionsFromMapJSON(url, mapJSONObj) {
  83047. var extent = [mapJSONObj.bounds.left, mapJSONObj.bounds.bottom, mapJSONObj.bounds.right, mapJSONObj.bounds.top];
  83048. var resolutions = getResolutions();
  83049. function getResolutions() {
  83050. var level = 28;
  83051. var dpi = 96;
  83052. var width = extent[2] - extent[0];
  83053. var height = extent[3] - extent[1];
  83054. var tileSize = width >= height ? width : height;
  83055. var maxReolution;
  83056. if (tileSize === width) {
  83057. maxReolution = tileSize / mapJSONObj.viewer.width;
  83058. } else {
  83059. maxReolution = tileSize / mapJSONObj.viewer.height;
  83060. }
  83061. var resolutions = [];
  83062. var unit = Unit.METER;
  83063. if (mapJSONObj.coordUnit === Unit.DEGREE) {
  83064. unit = Unit.DEGREE;
  83065. }
  83066. if (mapJSONObj.visibleScales.length > 0) {
  83067. for (let i = 0; i < mapJSONObj.visibleScales.length; i++) {
  83068. resolutions.push(core_Util_Util.scaleToResolution(mapJSONObj.visibleScales[i], dpi, unit));
  83069. }
  83070. } else {
  83071. for (let i = 0; i < level; i++) {
  83072. resolutions.push(maxReolution / Math.pow(2, i));
  83073. }
  83074. }
  83075. function sortNumber(a, b) {
  83076. return b - a;
  83077. }
  83078. return resolutions.sort(sortNumber);
  83079. }
  83080. return { url,resolutions };
  83081. }
  83082. }
  83083. ;// CONCATENATED MODULE: external "ol.source.XYZ"
  83084. const external_ol_source_XYZ_namespaceObject = ol.source.XYZ;
  83085. var external_ol_source_XYZ_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_XYZ_namespaceObject);
  83086. ;// CONCATENATED MODULE: ./src/openlayers/mapping/SuperMapCloud.js
  83087. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83088. * This program are made available under the terms of the Apache License, Version 2.0
  83089. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83090. /**
  83091. * @class SuperMapCloud
  83092. * @browsernamespace ol.source
  83093. * @category ThirdPartyMap
  83094. * @classdesc 超图云地图图层源。
  83095. * @modulecategory Mapping
  83096. * @param {Object} opt_options - 参数。
  83097. * @param {string} [opt_options.url='http://t2.dituhui.com/FileService/image?map={mapName}&type={type}&x={x}&y={y}&z={z}'] - 服务地址。
  83098. * @param {string} [opt_options.tileProxy] - 代理地址。
  83099. * @extends {ol.source.XYZ}
  83100. * @usage
  83101. */
  83102. class SuperMapCloud extends (external_ol_source_XYZ_default()) {
  83103. constructor(opt_options) {
  83104. var options = opt_options || {};
  83105. var attributions = options.attributions || "Map Data ©2014 SuperMap - GS(2014)6070号-data©Navinfo with <span>© SuperMap iClient</span>"
  83106. var mapName = options.mapName || 'quanguo';
  83107. var mapType = options.mapType || 'web';
  83108. var url = options.url || 'http://t2.dituhui.com/FileService/image?map={mapName}&type={type}&x={x}&y={y}&z={z}';
  83109. url = url.replace('{mapName}', mapName).replace('{type}', mapType);
  83110. var superOptions = {
  83111. attributions: attributions,
  83112. cacheSize: options.cacheSize,
  83113. crossOrigin: options.crossOrigin,
  83114. opaque: options.opaque === undefined ? true : options.opaque,
  83115. maxZoom: options.maxZoom || 18,
  83116. reprojectionErrorThreshold: options.reprojectionErrorThreshold,
  83117. url: url,
  83118. wrapX: options.wrapX
  83119. };
  83120. //需要代理时走自定义 tileLoadFunction,否则走默认的tileLoadFunction
  83121. if (options.tileProxy) {
  83122. superOptions.tileLoadFunction = tileLoadFunction;
  83123. }
  83124. super(superOptions);
  83125. if (options.tileProxy) {
  83126. this.tileProxy = options.tileProxy;
  83127. }
  83128. //需要代理时,走以下代码
  83129. var me = this;
  83130. function tileLoadFunction(imageTile, src) {
  83131. //支持代理
  83132. imageTile.getImage().src = me.tileProxy + encodeURIComponent(src);
  83133. }
  83134. }
  83135. }
  83136. ;// CONCATENATED MODULE: external "ol.source.WMTS"
  83137. const external_ol_source_WMTS_namespaceObject = ol.source.WMTS;
  83138. var external_ol_source_WMTS_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_WMTS_namespaceObject);
  83139. ;// CONCATENATED MODULE: external "ol.tilegrid.WMTS"
  83140. const external_ol_tilegrid_WMTS_namespaceObject = ol.tilegrid.WMTS;
  83141. var external_ol_tilegrid_WMTS_default = /*#__PURE__*/__webpack_require__.n(external_ol_tilegrid_WMTS_namespaceObject);
  83142. ;// CONCATENATED MODULE: ./src/openlayers/mapping/Tianditu.js
  83143. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83144. * This program are made available under the terms of the Apache License, Version 2.0
  83145. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83146. /**
  83147. * @class Tianditu
  83148. * @browsernamespace ol.source
  83149. * @category ThirdPartyMap
  83150. * @classdesc 天地图图层源。
  83151. * @modulecategory Mapping
  83152. * @param {Object} opt_options - 参数。
  83153. * @param {string} [opt_options.url='http://t{0-7}.tianditu.gov.cn/{layer}_{proj}/wmts?'] - 服务地址。
  83154. * @param {string} opt_options.key - 天地图服务密钥。详见{@link http://lbs.tianditu.gov.cn/server/MapService.html}
  83155. * @param {string} [opt_options.layerType='vec'] - 图层类型。(vec:矢量图层,img:影像图层,ter:地形图层)
  83156. * @param {string} [opt_options.attributions] - 版权描述信息。
  83157. * @param {number} [opt_options.cacheSize = 2048] - 缓冲大小。
  83158. * @param {function} [opt_options.tileLoadFunction] - 切片加载完成后执行函数。
  83159. * @param {string} [opt_options.style] - 图层风格。
  83160. * @param {string} [opt_options.format='tiles'] - 格式。
  83161. * @param {boolean} [opt_options.isLabel] - 是否是标注图层。
  83162. * @param {boolean} [opt_options.opaque=true] - 是否透明。
  83163. * @param {string} [opt_options.tileProxy] - 代理地址。
  83164. * @extends {ol.source.WMTS}
  83165. * @usage
  83166. */
  83167. class Tianditu extends (external_ol_source_WMTS_default()) {
  83168. constructor(opt_options) {
  83169. var layerLabelMap = {
  83170. "vec": "cva",
  83171. "ter": "cta",
  83172. "img": "cia"
  83173. }
  83174. var layerZoomMap = {
  83175. "vec": 18,
  83176. "ter": 14,
  83177. "img": 18
  83178. }
  83179. var options = opt_options || {};
  83180. var attributions = options.attributions || "Map Data <a href='http://www.tianditu.gov.cn' target='_blank'><img style='background-color:transparent;bottom:2px;opacity:1;' " +
  83181. "src='http://api.tianditu.gov.cn/img/map/logo.png' width='53px' height='22px' opacity='0'></a> with " +
  83182. "<span>© SuperMap iClient</span>"
  83183. options.layerType = options.layerType || "vec";
  83184. options.layerType = options.isLabel ? layerLabelMap[options.layerType] : options.layerType;
  83185. options.matrixSet = (options.projection === 'EPSG:4326' || options.projection === 'EPSG:4490') ? "c" : "w";
  83186. if (!options.url && !options.urls) {
  83187. options.url = "http://t{0-7}.tianditu.gov.cn/{layer}_{proj}/wmts?"
  83188. }
  83189. if (options.key) {
  83190. options.url = `${options.url}tk=${options.key}`;
  83191. }
  83192. options.url = options.url.replace("{layer}", options.layerType).replace("{proj}", options.matrixSet);
  83193. var tileGrid = options.tileGrid || Tianditu.getTileGrid(options.projection || 'EPSG:3857');
  83194. var crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous';
  83195. var superOptions = {
  83196. version: options.version || '1.0.0',
  83197. format: options.format || 'tiles',
  83198. dimensions: options.dimensions || {},
  83199. layer: options.layerType,
  83200. matrixSet: options.matrixSet,
  83201. tileGrid: tileGrid,
  83202. style: options.style || 'default',
  83203. attributions: attributions,
  83204. cacheSize: options.cacheSize,
  83205. crossOrigin: crossOrigin,
  83206. opaque: options.opaque === undefined ? true : options.opaque,
  83207. maxZoom: layerZoomMap[options.layerType],
  83208. reprojectionErrorThreshold: options.reprojectionErrorThreshold,
  83209. url: options.url,
  83210. urls: options.urls,
  83211. projection: options.projection || 'EPSG:3857',
  83212. wrapX: options.wrapX
  83213. };
  83214. //需要代理时走自定义 tileLoadFunction,否则走默认的tileLoadFunction
  83215. if (options.tileProxy) {
  83216. superOptions.tileLoadFunction = tileLoadFunction;
  83217. }
  83218. super(superOptions);
  83219. if (options.tileProxy) {
  83220. this.tileProxy = options.tileProxy;
  83221. }
  83222. //需要代理时,走以下代码
  83223. var me = this;
  83224. function tileLoadFunction(imageTile, src) {
  83225. //支持代理
  83226. imageTile.getImage().src = me.tileProxy + encodeURIComponent(src);
  83227. }
  83228. }
  83229. /**
  83230. * @function Tianditu.getTileGrid
  83231. * @description 获取瓦片网格。
  83232. * @param {string} projection - 投影参考对象。
  83233. * @returns {ol.tilegrid.WMTS} 返回瓦片网格对象。
  83234. */
  83235. static getTileGrid(projection) {
  83236. if (projection === "EPSG:4326" || projection === "EPSG:4490") {
  83237. return Tianditu.default4326TileGrid();
  83238. }
  83239. return Tianditu.default3857TileGrid();
  83240. }
  83241. /**
  83242. * @function Tianditu.default4326TileGrid
  83243. * @description 获取默认 4326 网格瓦片。
  83244. * @returns {ol.tilegrid.WMTS} 返回默认 4326 网格瓦片对象。
  83245. */
  83246. static default4326TileGrid() {
  83247. var tdt_WGS84_resolutions = [];
  83248. var matrixIds = [];
  83249. for (var i = 1; i < 19; i++) {
  83250. tdt_WGS84_resolutions.push(0.703125 * 2 / (Math.pow(2, i)));
  83251. matrixIds.push(i);
  83252. }
  83253. var tileGird = new (external_ol_tilegrid_WMTS_default())({
  83254. extent: [-180, -90, 180, 90],
  83255. resolutions: tdt_WGS84_resolutions,
  83256. origin: [-180, 90],
  83257. matrixIds: matrixIds,
  83258. minZoom: 1
  83259. });
  83260. return tileGird;
  83261. }
  83262. /**
  83263. * @function Tianditu.default3857TileGrid
  83264. * @description 获取默认 3857 网格瓦片。
  83265. * @returns {ol.tilegrid.WMTS} 返回默认 3857 网格瓦片对象。
  83266. */
  83267. static default3857TileGrid() {
  83268. var tdt_Mercator_resolutions = [];
  83269. var matrixIds = [];
  83270. for (var i = 1; i < 19; i++) {
  83271. tdt_Mercator_resolutions.push(78271.5169640203125 * 2 / (Math.pow(2, i)));
  83272. matrixIds.push(i);
  83273. }
  83274. var tileGird = new (external_ol_tilegrid_WMTS_default())({
  83275. extent: [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892],
  83276. resolutions: tdt_Mercator_resolutions,
  83277. matrixIds: matrixIds,
  83278. origin: [-20037508.3427892, 20037508.3427892],
  83279. minZoom: 1
  83280. });
  83281. return tileGird;
  83282. }
  83283. }
  83284. ;// CONCATENATED MODULE: external "ol.size"
  83285. const external_ol_size_namespaceObject = ol.size;
  83286. ;// CONCATENATED MODULE: external "ol.tilegrid"
  83287. const external_ol_tilegrid_namespaceObject = ol.tilegrid;
  83288. ;// CONCATENATED MODULE: ./src/openlayers/mapping/TileSuperMapRest.js
  83289. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83290. * This program are made available under the terms of the Apache License, Version 2.0
  83291. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83292. /**
  83293. * @class TileSuperMapRest
  83294. * @browsernamespace ol.source
  83295. * @category iServer Map Tile
  83296. * @modulecategory Mapping
  83297. * @classdesc SuperMap iServer TileImage 图层源。
  83298. * @param {Object} options - 参数。
  83299. * @param {string} options.url - 服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
  83300. * @param {ol.tilegrid.TileGrid} [options.tileGrid] - 瓦片网格对象。当不指定时,会通过 options.extent 或投影范围生成。
  83301. * @param {boolean} [options.redirect = false] - 是否重定向。
  83302. * @param {boolean} [options.transparent = true] - 瓦片是否透明。
  83303. * @param {boolean} [options.cacheEnabled = true] - 是否使用服务端的缓存。
  83304. * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。当此参数设置的坐标系统不同于地图的原有坐标系统时,系统会进行动态投影,并返回动态投影后的地图瓦片。例如:{"epsgCode":3857}。
  83305. * @param {string} [options.layersID] - 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合。
  83306. * @param {boolean} [options.clipRegionEnabled = false] - 是否只地图只显示该区域覆盖的部分。true 表示地图只显示该区域覆盖的部分。
  83307. * @param {ol.geom.Geometry} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
  83308. * @param {boolean} [options.overlapDisplayed = false] - 地图对象在同一范围内时,是否重叠显示。如果为 true,则同一范围内的对象会直接压盖;如果为 false 则通过 overlapDisplayedOptions 控制对象不压盖显示。
  83309. * @param {OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项,当 overlapDisplayed 为 false 时有效,用来增强对地图对象压盖时的处理。
  83310. * @param {string} [options.tileversion] - 切片版本名称,_cache 为 true 时有效。
  83311. * @param {string} [options.tileProxy] - 服务代理地址。
  83312. * @param {string} [options.format = 'png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、"gif" 等图片类型。
  83313. * @param {(NDVIParameter|HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
  83314. * @extends {ol.source.TileImage}
  83315. * @usage
  83316. */
  83317. class TileSuperMapRest extends (external_ol_source_TileImage_default()) {
  83318. constructor(options) {
  83319. options = options || {};
  83320. options.attributions =
  83321. options.attributions || "Map Data <span>© SuperMap iServer</span> with <span>© SuperMap iClient</span>";
  83322. options.format = options.format ? options.format : 'png';
  83323. super({
  83324. attributions: options.attributions,
  83325. cacheSize: options.cacheSize,
  83326. crossOrigin: options.crossOrigin,
  83327. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  83328. opaque: options.opaque,
  83329. projection: options.projection,
  83330. reprojectionErrorThreshold: options.reprojectionErrorThreshold,
  83331. state: options.state,
  83332. tileClass: options.tileClass,
  83333. tileGrid: options.tileGrid,
  83334. tileLoadFunction: options.tileLoadFunction,
  83335. tilePixelRatio: options.tilePixelRatio,
  83336. tileUrlFunction: tileUrlFunction,
  83337. wrapX: options.wrapX !== undefined ? options.wrapX : false,
  83338. cacheEnabled: options.cacheEnabled,
  83339. layersID: options.layersID
  83340. });
  83341. if (options.tileProxy) {
  83342. this.tileProxy = options.tileProxy;
  83343. }
  83344. this.options = options;
  83345. this._url = options.url;
  83346. //当前切片在切片集中的index
  83347. this.tileSetsIndex = -1;
  83348. this.tempIndex = -1;
  83349. this.dpi = this.options.dpi || 96;
  83350. var me = this;
  83351. var layerUrl = Util_Util.urlPathAppend(options.url, 'tileImage.' + options.format);
  83352. /**
  83353. * @function TileSuperMapRest.prototype.getAllRequestParams
  83354. * @description 获取全部请求参数。
  83355. */
  83356. function getAllRequestParams() {
  83357. var me = this,
  83358. params = {};
  83359. params['redirect'] = options.redirect !== undefined ? options.redirect : false;
  83360. //切片是否透明
  83361. params['transparent'] = options.transparent !== undefined ? options.transparent : true;
  83362. params['cacheEnabled'] = !(options.cacheEnabled === false);
  83363. //存储一个cacheEnabled参数
  83364. me.cacheEnabled = params['cacheEnabled'];
  83365. params['_cache'] = params['cacheEnabled'];
  83366. //设置切片原点
  83367. if (this.origin) {
  83368. params['origin'] = JSON.stringify({
  83369. x: this.origin[0],
  83370. y: this.origin[1]
  83371. });
  83372. }
  83373. if (options.prjCoordSys) {
  83374. params['prjCoordSys'] = JSON.stringify(options.prjCoordSys);
  83375. }
  83376. if (options.layersID) {
  83377. params['layersID'] = options.layersID.toString();
  83378. }
  83379. if (options.clipRegion instanceof (external_ol_geom_Geometry_default())) {
  83380. options.clipRegionEnabled = true;
  83381. options.clipRegion = core_Util_Util.toSuperMapGeometry(new (external_ol_format_GeoJSON_default())().writeGeometryObject(options.clipRegion));
  83382. options.clipRegion = Util_Util.toJSON(ServerGeometry.fromGeometry(options.clipRegion));
  83383. params['clipRegionEnabled'] = options.clipRegionEnabled;
  83384. params['clipRegion'] = JSON.stringify(options.clipRegion);
  83385. }
  83386. if (!options.overlapDisplayed) {
  83387. params['overlapDisplayed'] = false;
  83388. if (options.overlapDisplayedOptions) {
  83389. params['overlapDisplayedOptions'] = me.overlapDisplayedOptions.toString();
  83390. }
  83391. } else {
  83392. params['overlapDisplayed'] = true;
  83393. }
  83394. if (params.cacheEnabled && options.tileversion) {
  83395. params['tileversion'] = options.tileversion.toString();
  83396. }
  83397. if (options.rasterfunction) {
  83398. params['rasterfunction'] = JSON.stringify(options.rasterfunction);
  83399. }
  83400. return params;
  83401. }
  83402. /**
  83403. * @function TileSuperMapRest.prototype.getFullRequestUrl
  83404. * @description 获取完整的请求地址。
  83405. */
  83406. function getFullRequestUrl() {
  83407. if (this._paramsChanged) {
  83408. this._layerUrl = createLayerUrl.call(this);
  83409. this._paramsChanged = false;
  83410. }
  83411. return this._layerUrl || createLayerUrl.call(this);
  83412. }
  83413. /**
  83414. * @function TileSuperMapRest.prototype.createLayerUrl
  83415. * @description 获取新建图层地址。
  83416. */
  83417. function createLayerUrl() {
  83418. this.requestParams = this.requestParams || getAllRequestParams.call(this);
  83419. this._layerUrl = Util_Util.urlAppend(layerUrl, Util_Util.getParameterString(this.requestParams));
  83420. //为url添加安全认证信息片段
  83421. this._layerUrl = SecurityManager.appendCredential(this._layerUrl);
  83422. return this._layerUrl;
  83423. }
  83424. function tileUrlFunction(tileCoord, pixelRatio, projection) {
  83425. if (!me.tileGrid) {
  83426. if (options.extent) {
  83427. me.tileGrid = TileSuperMapRest.createTileGrid(options.extent);
  83428. if (me.resolutions) {
  83429. me.tileGrid.resolutions = me.resolutions;
  83430. }
  83431. } else {
  83432. if (projection.getCode() === 'EPSG:3857') {
  83433. me.tileGrid = TileSuperMapRest.createTileGrid([
  83434. -20037508.3427892,
  83435. -20037508.3427892,
  83436. 20037508.3427892,
  83437. 20037508.3427892
  83438. ]);
  83439. me.extent = [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892];
  83440. }
  83441. if (projection.getCode() === 'EPSG:4326') {
  83442. me.tileGrid = TileSuperMapRest.createTileGrid([-180, -90, 180, 90]);
  83443. me.extent = [-180, -90, 180, 90];
  83444. }
  83445. }
  83446. }
  83447. me.origin = me.tileGrid.getOrigin(0);
  83448. var z = tileCoord[0];
  83449. var x = tileCoord[1];
  83450. var y = ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? -tileCoord[2] - 1 : tileCoord[2];
  83451. var resolution = me.tileGrid.getResolution(z);
  83452. var dpi = me.dpi || 96;
  83453. var unit = projection.getUnits() || Unit.DEGREE;
  83454. // OGC WKT 解析出单位是 degree
  83455. if (unit === 'degrees' || unit === 'degree') {
  83456. unit = Unit.DEGREE;
  83457. }
  83458. //通过wkt方式自定义坐标系的时候,是meter
  83459. if (unit === 'm' || unit === 'meter') {
  83460. unit = Unit.METER;
  83461. }
  83462. var scale = core_Util_Util.resolutionToScale(resolution, dpi, unit);
  83463. var tileSize = external_ol_size_namespaceObject.toSize(me.tileGrid.getTileSize(z, me.tmpSize));
  83464. var layerUrl = getFullRequestUrl.call(me);
  83465. var url =
  83466. layerUrl +
  83467. encodeURI(
  83468. '&x=' + x + '&y=' + y + '&width=' + tileSize[0] + '&height=' + tileSize[1] + '&scale=' + scale
  83469. );
  83470. //支持代理
  83471. if (me.tileProxy) {
  83472. url = me.tileProxy + encodeURIComponent(url);
  83473. }
  83474. if (!me.cacheEnabled) {
  83475. url += '&_t=' + new Date().getTime();
  83476. }
  83477. return url;
  83478. }
  83479. }
  83480. /**
  83481. * @function TileSuperMapRest.prototype.setTileSetsInfo
  83482. * @description 设置瓦片集信息。
  83483. * @param {Object} tileSets - 瓦片集合。
  83484. */
  83485. setTileSetsInfo(tileSets) {
  83486. this.tileSets = tileSets;
  83487. if (core_Util_Util.isArray(this.tileSets)) {
  83488. this.tileSets = tileSets[0];
  83489. }
  83490. if (!this.tileSets) {
  83491. return;
  83492. }
  83493. this.dispatchEvent({
  83494. type: 'tilesetsinfoloaded',
  83495. value: {
  83496. tileVersions: this.tileSets.tileVersions
  83497. }
  83498. });
  83499. this.changeTilesVersion();
  83500. }
  83501. /**
  83502. * @function TileSuperMapRest.prototype.lastTilesVersion
  83503. * @description 请求上一个版本切片,并重新绘制。
  83504. */
  83505. lastTilesVersion() {
  83506. this.tempIndex = this.tileSetsIndex - 1;
  83507. this.changeTilesVersion();
  83508. }
  83509. /**
  83510. * @function TileSuperMapRest.prototype.nextTilesVersion
  83511. * @description 请求下一个版本切片,并重新绘制。
  83512. */
  83513. nextTilesVersion() {
  83514. this.tempIndex = this.tileSetsIndex + 1;
  83515. this.changeTilesVersion();
  83516. }
  83517. /**
  83518. * @function TileSuperMapRest.prototype.changeTilesVersion
  83519. * @description 切换到某一版本的切片,并重绘。通过 this.tempIndex 保存需要切换的版本索引。
  83520. */
  83521. changeTilesVersion() {
  83522. var me = this;
  83523. //切片版本集信息是否存在
  83524. if (me.tileSets == null) {
  83525. return;
  83526. }
  83527. if (me.tempIndex === me.tileSetsIndex || this.tempIndex < 0) {
  83528. return;
  83529. }
  83530. //检测index是否可用
  83531. var tileVersions = me.tileSets.tileVersions;
  83532. if (tileVersions && me.tempIndex < tileVersions.length && me.tempIndex >= 0) {
  83533. var name = tileVersions[me.tempIndex].name;
  83534. var result = me.mergeTileVersionParam(name);
  83535. if (result) {
  83536. me.tileSetsIndex = me.tempIndex;
  83537. me.dispatchEvent({
  83538. type: 'tileversionschanged',
  83539. value: {
  83540. tileVersion: tileVersions[me.tempIndex]
  83541. }
  83542. });
  83543. }
  83544. }
  83545. }
  83546. /**
  83547. * @function TileSuperMapRest.prototype.updateCurrentTileSetsIndex
  83548. * @description 更新当前切片集索引,目前主要提供给控件使用。
  83549. * @param {number} index - 索引号。
  83550. */
  83551. updateCurrentTileSetsIndex(index) {
  83552. this.tempIndex = index;
  83553. }
  83554. /**
  83555. * @function TileSuperMapRest.prototype.mergeTileVersionParam
  83556. * @description 更改 URL 请求参数中的切片版本号,并重绘。
  83557. * @param {Object} version - 版本信息。
  83558. * @returns {boolean} 是否成功。
  83559. */
  83560. mergeTileVersionParam(version) {
  83561. if (version) {
  83562. this.requestParams['tileversion'] = version;
  83563. this._paramsChanged = true;
  83564. this.refresh();
  83565. return true;
  83566. }
  83567. return false;
  83568. }
  83569. /**
  83570. * @function TileSuperMapRest.optionsFromMapJSON
  83571. * @description 从 MapJSON 中获取参数对象。
  83572. * @param {string} url - 服务地址。
  83573. * @param {Object} mapJSONObj - 地图 JSON 对象。
  83574. */
  83575. static optionsFromMapJSON(url, mapJSONObj) {
  83576. var options = {};
  83577. options.url = url;
  83578. options.crossOrigin = 'anonymous';
  83579. var extent = [mapJSONObj.bounds.left, mapJSONObj.bounds.bottom, mapJSONObj.bounds.right, mapJSONObj.bounds.top];
  83580. const { visibleScales, bounds, dpi, coordUnit } = mapJSONObj;
  83581. var resolutions = core_Util_Util.scalesToResolutions(visibleScales, bounds, dpi, coordUnit);
  83582. options.tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  83583. extent: extent,
  83584. resolutions: resolutions
  83585. });
  83586. return options;
  83587. }
  83588. /**
  83589. * @function TileSuperMapRest.createTileGrid
  83590. * @description 创建切片网格。
  83591. * @param {number} extent - 长度。
  83592. * @param {number} maxZoom - 最大的放大级别。
  83593. * @param {number} minZoom - 最小的放大级别。
  83594. * @param {number} tileSize - 瓦片的尺寸。
  83595. * @param {number} origin - 原点。
  83596. * */
  83597. static createTileGrid(extent, maxZoom, minZoom, tileSize, origin) {
  83598. var tilegrid = external_ol_tilegrid_namespaceObject.createXYZ({
  83599. extent: extent,
  83600. maxZoom: maxZoom,
  83601. minZoom: minZoom,
  83602. tileSize: tileSize
  83603. });
  83604. return new (external_ol_tilegrid_TileGrid_default())({
  83605. extent: extent,
  83606. minZoom: minZoom,
  83607. origin: origin,
  83608. resolutions: tilegrid.getResolutions(),
  83609. tileSize: tilegrid.getTileSize()
  83610. });
  83611. }
  83612. }
  83613. // EXTERNAL MODULE: ./node_modules/proj4/dist/proj4-src.js
  83614. var proj4_src = __webpack_require__(785);
  83615. var proj4_src_default = /*#__PURE__*/__webpack_require__.n(proj4_src);
  83616. ;// CONCATENATED MODULE: ./src/common/util/FilterCondition.js
  83617. function getParseSpecialCharacter() {
  83618. // 特殊字符字典
  83619. const directory = ['(', ')', '(', ')', ',', ','];
  83620. const res = {};
  83621. directory.forEach((item, index) => {
  83622. res[item] = `$${index}`
  83623. });
  83624. return res;
  83625. }
  83626. function parseSpecialCharacter(str) {
  83627. const directory = getParseSpecialCharacter();
  83628. for (let key in directory) {
  83629. const replaceValue = directory[key];
  83630. const pattern = new RegExp(`\\${key}`, 'g');
  83631. // eslint-disable-next-line
  83632. while (pattern.test(str)) {
  83633. str = str.replace(pattern, replaceValue);
  83634. }
  83635. }
  83636. return str;
  83637. }
  83638. function parseCondition(filterCondition, keys) {
  83639. const str = filterCondition.replace(/&|\||>|<|=|!/g, ' ');
  83640. const arr = str.split(' ').filter((item) => item);
  83641. let result = filterCondition;
  83642. arr.forEach((item) => {
  83643. const key = keys.find((val) => val === item);
  83644. if (startsWithNumber(item) && key) {
  83645. result = result.replace(key, '$' + key);
  83646. }
  83647. if (key) {
  83648. const res = parseSpecialCharacter(key);
  83649. result = result.replace(key, res);
  83650. }
  83651. });
  83652. return result;
  83653. }
  83654. // 处理jsonsqlfeature, 加前缀
  83655. function parseConditionFeature(feature) {
  83656. let copyValue = {};
  83657. for (let key in feature) {
  83658. let copyKey = key;
  83659. if (startsWithNumber(key)) {
  83660. copyKey = '$' + key;
  83661. }
  83662. copyKey = parseSpecialCharacter(copyKey);
  83663. copyValue[copyKey] = feature[key];
  83664. }
  83665. return copyValue;
  83666. }
  83667. function startsWithNumber(str) {
  83668. return /^\d/.test(str);
  83669. }
  83670. ;// CONCATENATED MODULE: external "ol.geom.Point"
  83671. const external_ol_geom_Point_namespaceObject = ol.geom.Point;
  83672. var external_ol_geom_Point_default = /*#__PURE__*/__webpack_require__.n(external_ol_geom_Point_namespaceObject);
  83673. ;// CONCATENATED MODULE: ./src/openlayers/services/QueryService.js
  83674. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83675. * This program are made available under the terms of the Apache License, Version 2.0
  83676. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83677. /**
  83678. * @class QueryService
  83679. * @category iServer Map QueryResults
  83680. * @classdesc 地图查询服务类。
  83681. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  83682. * @modulecategory Services
  83683. * @extends {ServiceBase}
  83684. * @param {string} url - 服务地址。
  83685. * @param {Object} options - 参数。
  83686. * @param {string} [options.proxy] - 服务代理地址。
  83687. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  83688. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  83689. * @param {Object} [options.headers] - 请求头。
  83690. * @example
  83691. * new QueryService(url)
  83692. * .queryByBounds(param,function(result){
  83693. * //doSomething
  83694. * })
  83695. * @usage
  83696. */
  83697. class QueryService extends ServiceBase {
  83698. constructor(url, options) {
  83699. super(url, options);
  83700. this._queryService = new QueryService_QueryService(url, options);
  83701. }
  83702. /**
  83703. * @function QueryService.prototype.queryByBounds
  83704. * @description bounds 查询地图服务。
  83705. * @param {QueryByBoundsParameters} params - Bounds 查询参数类。
  83706. * @param {RequestCallback} callback - 回调函数。
  83707. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  83708. * @returns {QueryService}
  83709. */
  83710. queryByBounds(params, callback, resultFormat) {
  83711. params = this._processParams(params);
  83712. this._queryService.queryByBounds(params, callback, resultFormat);
  83713. }
  83714. /**
  83715. * @function QueryService.prototype.queryByDistance
  83716. * @description 地图距离查询服务。
  83717. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  83718. * @param {RequestCallback} callback 回调函数。
  83719. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  83720. */
  83721. queryByDistance(params, callback, resultFormat) {
  83722. params = this._processParams(params);
  83723. this._queryService.queryByDistance(params, callback, resultFormat);
  83724. }
  83725. /**
  83726. * @function QueryService.prototype.queryBySQL
  83727. * @description 地图 SQL 查询服务。
  83728. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  83729. * @param {RequestCallback} callback 回调函数。
  83730. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  83731. */
  83732. queryBySQL(params, callback, resultFormat) {
  83733. params = this._processParams(params);
  83734. this._queryService.queryBySQL(params, callback, resultFormat);
  83735. }
  83736. /**
  83737. * @function QueryService.prototype.queryByGeometry
  83738. * @description 地图几何查询服务。
  83739. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  83740. * @param {RequestCallback} callback 回调函数。
  83741. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  83742. */
  83743. queryByGeometry(params, callback, resultFormat) {
  83744. params = this._processParams(params);
  83745. this._queryService.queryByGeometry(params, callback, resultFormat);
  83746. }
  83747. _processParams(params) {
  83748. if (!params) {
  83749. return {};
  83750. }
  83751. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  83752. if (params.queryParams && !core_Util_Util.isArray(params.queryParams)) {
  83753. params.queryParams = [params.queryParams];
  83754. }
  83755. if (params.bounds) {
  83756. params.bounds = new Bounds(
  83757. params.bounds[0],
  83758. params.bounds[1],
  83759. params.bounds[2],
  83760. params.bounds[3]
  83761. );
  83762. }
  83763. if (params.geometry) {
  83764. if (params.geometry instanceof (external_ol_geom_Point_default())) {
  83765. params.geometry = new Point(params.geometry.getCoordinates()[0], params.geometry.getCoordinates()[1]);
  83766. } else {
  83767. params.geometry = core_Util_Util.toSuperMapGeometry(JSON.parse((new (external_ol_format_GeoJSON_default())()).writeGeometry(params.geometry)));
  83768. }
  83769. }
  83770. return params;
  83771. }
  83772. }
  83773. ;// CONCATENATED MODULE: ./src/common/iServer/FeatureService.js
  83774. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83775. * This program are made available under the terms of the Apache License, Version 2.0
  83776. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83777. /**
  83778. * @class FeatureService
  83779. * @constructs FeatureService
  83780. * @category iServer Data Feature
  83781. * @classdesc 数据集类。提供:ID 查询,范围查询,SQL查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  83782. * @example
  83783. * new FeatureService(url).getFeaturesByIDs(param,function(result){
  83784. * //doSomething
  83785. * })
  83786. * @param {string} url - 服务地址。
  83787. * @param {Object} options - 参数。
  83788. * @param {string} [options.proxy] - 服务代理地址。
  83789. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  83790. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  83791. * @param {Object} [options.headers] - 请求头。
  83792. * @extends {ServiceBase}
  83793. * @usage
  83794. */
  83795. class FeatureService_FeatureService {
  83796. constructor(url, options) {
  83797. this.url = url;
  83798. this.options = options || {};
  83799. }
  83800. /**
  83801. * @function FeatureService.prototype.getFeaturesByIDs
  83802. * @description 数据集 ID 查询服务。
  83803. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  83804. * @param {RequestCallback} callback - 回调函数。
  83805. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83806. */
  83807. getFeaturesByIDs(params, callback, resultFormat) {
  83808. var me = this;
  83809. var getFeaturesByIDsService = new GetFeaturesByIDsService(me.url, {
  83810. proxy: me.options.proxy,
  83811. withCredentials: me.options.withCredentials,
  83812. crossOrigin: me.options.crossOrigin,
  83813. headers: me.options.headers,
  83814. eventListeners: {
  83815. processCompleted: callback,
  83816. processFailed: callback
  83817. },
  83818. format: resultFormat
  83819. });
  83820. getFeaturesByIDsService.processAsync(params);
  83821. }
  83822. /**
  83823. * @function FeatureService.prototype.getFeaturesByBounds
  83824. * @description 数据集 Bounds 查询服务。
  83825. * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
  83826. * @param {RequestCallback} callback - 回调函数。
  83827. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83828. */
  83829. getFeaturesByBounds(params, callback, resultFormat) {
  83830. var me = this;
  83831. var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.url, {
  83832. proxy: me.options.proxy,
  83833. withCredentials: me.options.withCredentials,
  83834. crossOrigin: me.options.crossOrigin,
  83835. headers: me.options.headers,
  83836. eventListeners: {
  83837. processCompleted: callback,
  83838. processFailed: callback
  83839. },
  83840. format: me._processFormat(resultFormat)
  83841. });
  83842. getFeaturesByBoundsService.processAsync(params);
  83843. }
  83844. /**
  83845. * @function FeatureService.prototype.getFeaturesByBuffer
  83846. * @description 数据集 Buffer 查询服务。
  83847. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  83848. * @param {RequestCallback} callback - 回调函数。
  83849. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83850. */
  83851. getFeaturesByBuffer(params, callback, resultFormat) {
  83852. var me = this;
  83853. var getFeatureService = new GetFeaturesByBufferService(me.url, {
  83854. proxy: me.options.proxy,
  83855. withCredentials: me.options.withCredentials,
  83856. crossOrigin: me.options.crossOrigin,
  83857. headers: me.options.headers,
  83858. eventListeners: {
  83859. processCompleted: callback,
  83860. processFailed: callback
  83861. },
  83862. format: me._processFormat(resultFormat)
  83863. });
  83864. getFeatureService.processAsync(params);
  83865. }
  83866. /**
  83867. * @function FeatureService.prototype.getFeaturesBySQL
  83868. * @description 数据集 SQL 查询服务。
  83869. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
  83870. * @param {RequestCallback} callback - 回调函数。
  83871. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83872. */
  83873. getFeaturesBySQL(params, callback, resultFormat) {
  83874. var me = this;
  83875. var getFeatureBySQLService = new GetFeaturesBySQLService(me.url, {
  83876. proxy: me.options.proxy,
  83877. withCredentials: me.options.withCredentials,
  83878. crossOrigin: me.options.crossOrigin,
  83879. headers: me.options.headers,
  83880. eventListeners: {
  83881. processCompleted: callback,
  83882. processFailed: callback
  83883. },
  83884. format: me._processFormat(resultFormat)
  83885. });
  83886. getFeatureBySQLService.processAsync(params);
  83887. }
  83888. /**
  83889. * @function FeatureService.prototype.getFeaturesByGeometry
  83890. * @description 数据集几何查询服务类。
  83891. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  83892. * @param {RequestCallback} callback - 回调函数。
  83893. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83894. */
  83895. getFeaturesByGeometry(params, callback, resultFormat) {
  83896. var me = this;
  83897. var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.url, {
  83898. proxy: me.options.proxy,
  83899. withCredentials: me.options.withCredentials,
  83900. crossOrigin: me.options.crossOrigin,
  83901. headers: me.options.headers,
  83902. eventListeners: {
  83903. processCompleted: callback,
  83904. processFailed: callback
  83905. },
  83906. format: me._processFormat(resultFormat)
  83907. });
  83908. getFeaturesByGeometryService.processAsync(params);
  83909. }
  83910. /**
  83911. * @function FeatureService.prototype.editFeatures
  83912. * @description 地物编辑服务。
  83913. * @param {EditFeaturesParameters} params - 数据服务中数据集添加、修改、删除参数类。
  83914. * @param {RequestCallback} callback - 回调函数。
  83915. */
  83916. editFeatures(params, callback) {
  83917. if (!params || !params.dataSourceName || !params.dataSetName) {
  83918. return;
  83919. }
  83920. var me = this,
  83921. url = me.url,
  83922. dataSourceName = params.dataSourceName,
  83923. dataSetName = params.dataSetName;
  83924. url = Util_Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
  83925. var editFeatureService = new EditFeaturesService(url, {
  83926. proxy: me.options.proxy,
  83927. withCredentials: me.options.withCredentials,
  83928. crossOrigin: me.options.crossOrigin,
  83929. headers: me.options.headers,
  83930. eventListeners: {
  83931. processCompleted: callback,
  83932. processFailed: callback
  83933. }
  83934. });
  83935. editFeatureService.processAsync(params);
  83936. }
  83937. _processFormat(resultFormat) {
  83938. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  83939. }
  83940. }
  83941. ;// CONCATENATED MODULE: ./src/openlayers/services/FeatureService.js
  83942. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83943. * This program are made available under the terms of the Apache License, Version 2.0
  83944. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83945. /**
  83946. * @class FeatureService
  83947. * @constructs FeatureService
  83948. * @category iServer Data Feature
  83949. * @classdesc 数据集类。提供:ID 查询,范围查询,SQL查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  83950. * @modulecategory Services
  83951. * @example
  83952. * new FeatureService(url).getFeaturesByIDs(param,function(result){
  83953. * //doSomething
  83954. * })
  83955. * @param {string} url - 服务地址。
  83956. * @param {Object} options - 参数。
  83957. * @param {string} [options.proxy] - 服务代理地址。
  83958. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  83959. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  83960. * @param {Object} [options.headers] - 请求头。
  83961. * @extends {ServiceBase}
  83962. * @usage
  83963. */
  83964. class FeatureService extends ServiceBase {
  83965. constructor(url, options) {
  83966. super(url, options);
  83967. this._featureService = new FeatureService_FeatureService(url, options);
  83968. }
  83969. /**
  83970. * @function FeatureService.prototype.getFeaturesByIDs
  83971. * @description 数据集 ID 查询服务。
  83972. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  83973. * @param {RequestCallback} callback - 回调函数。
  83974. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83975. */
  83976. getFeaturesByIDs(params, callback, resultFormat) {
  83977. params = this._processParams(params);
  83978. this._featureService.getFeaturesByIDs(params, callback, resultFormat);
  83979. }
  83980. /**
  83981. * @function FeatureService.prototype.getFeaturesByBounds
  83982. * @description 数据集 Bounds 查询服务。
  83983. * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
  83984. * @param {RequestCallback} callback - 回调函数。
  83985. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83986. */
  83987. getFeaturesByBounds(params, callback, resultFormat) {
  83988. params = this._processParams(params);
  83989. this._featureService.getFeaturesByBounds(params, callback, resultFormat);
  83990. }
  83991. /**
  83992. * @function FeatureService.prototype.getFeaturesByBuffer
  83993. * @description 数据集 Buffer 查询服务。
  83994. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  83995. * @param {RequestCallback} callback - 回调函数。
  83996. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  83997. */
  83998. getFeaturesByBuffer(params, callback, resultFormat) {
  83999. params = this._processParams(params);
  84000. this._featureService.getFeaturesByBuffer(params, callback, resultFormat);
  84001. }
  84002. /**
  84003. * @function FeatureService.prototype.getFeaturesBySQL
  84004. * @description 数据集 SQL 查询服务。
  84005. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
  84006. * @param {RequestCallback} callback - 回调函数。
  84007. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  84008. */
  84009. getFeaturesBySQL(params, callback, resultFormat) {
  84010. params = this._processParams(params);
  84011. this._featureService.getFeaturesBySQL(params, callback, resultFormat);
  84012. }
  84013. /**
  84014. * @function FeatureService.prototype.getFeaturesByGeometry
  84015. * @description 数据集几何查询服务类。
  84016. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  84017. * @param {RequestCallback} callback - 回调函数。
  84018. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  84019. */
  84020. getFeaturesByGeometry(params, callback, resultFormat) {
  84021. params = this._processParams(params);
  84022. this._featureService.getFeaturesByGeometry(params, callback, resultFormat);
  84023. }
  84024. /**
  84025. * @function FeatureService.prototype.editFeatures
  84026. * @description 地物编辑服务。
  84027. * @param {EditFeaturesParameters} params - 数据服务中数据集添加、修改、删除参数类。
  84028. * @param {RequestCallback} callback - 回调函数。
  84029. */
  84030. editFeatures(params, callback) {
  84031. if (!params || !params.dataSourceName || !params.dataSetName) {
  84032. return;
  84033. }
  84034. var me = this,
  84035. url = me.url,
  84036. dataSourceName = params.dataSourceName,
  84037. dataSetName = params.dataSetName;
  84038. url = Util_Util.urlPathAppend(url, 'datasources/' + dataSourceName + '/datasets/' + dataSetName);
  84039. var editFeatureService = new EditFeaturesService(url, {
  84040. proxy: me.options.proxy,
  84041. withCredentials: me.options.withCredentials,
  84042. crossOrigin: me.options.crossOrigin,
  84043. headers: me.options.headers,
  84044. eventListeners: {
  84045. processCompleted: callback,
  84046. processFailed: callback
  84047. }
  84048. });
  84049. editFeatureService.processAsync(me._processParams(params));
  84050. }
  84051. _processParams(params) {
  84052. if (!params) {
  84053. return {};
  84054. }
  84055. var me = this;
  84056. params.returnContent = params.returnContent == null ? true : params.returnContent;
  84057. params.fromIndex = params.fromIndex ? params.fromIndex : 0;
  84058. params.toIndex = params.toIndex ? params.toIndex : -1;
  84059. if (params.bounds) {
  84060. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  84061. }
  84062. if (params.geometry) {
  84063. params.geometry = core_Util_Util.toSuperMapGeometry(JSON.parse(new (external_ol_format_GeoJSON_default())().writeGeometry(params.geometry)));
  84064. }
  84065. if (params.editType) {
  84066. params.editType = params.editType.toLowerCase();
  84067. }
  84068. if (params.features) {
  84069. var features = [];
  84070. if (core_Util_Util.isArray(params.features)) {
  84071. params.features.map(function (feature) {
  84072. features.push(me._createServerFeature(feature));
  84073. return feature;
  84074. });
  84075. } else {
  84076. features.push(me._createServerFeature(params.features));
  84077. }
  84078. params.features = features;
  84079. }
  84080. return params;
  84081. }
  84082. _createServerFeature(geoFeature) {
  84083. var feature = {},
  84084. fieldNames = [],
  84085. fieldValues = [];
  84086. var properties = geoFeature.getProperties();
  84087. for (var key in properties) {
  84088. if (key === geoFeature.getGeometryName()) {
  84089. continue;
  84090. }
  84091. fieldNames.push(key);
  84092. fieldValues.push(properties[key]);
  84093. }
  84094. feature.fieldNames = fieldNames;
  84095. feature.fieldValues = fieldValues;
  84096. if (geoFeature.getId()) {
  84097. feature.id = geoFeature.getId();
  84098. }
  84099. feature.geometry = core_Util_Util.toSuperMapGeometry(new (external_ol_format_GeoJSON_default())().writeFeatureObject(geoFeature));
  84100. return feature;
  84101. }
  84102. _processFormat(resultFormat) {
  84103. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  84104. }
  84105. }
  84106. ;// CONCATENATED MODULE: ./src/openlayers/mapping/webmap/Util.js
  84107. function getFeatureProperties(features) {
  84108. let properties = [];
  84109. if (Util_isArray(features) && features.length) {
  84110. features.forEach((feature) => {
  84111. let property = feature.get('attributes');
  84112. property && properties.push(property);
  84113. });
  84114. }
  84115. return properties;
  84116. }
  84117. function getFeatureBySQL(url, datasetNames, serviceOptions, processCompleted, processFaild, targetEpsgCode, restDataSingleRequestCount) {
  84118. getFeatureBySQLWithConcurrent(url, datasetNames, processCompleted, processFaild, serviceOptions, targetEpsgCode, restDataSingleRequestCount);
  84119. }
  84120. function queryFeatureBySQL(
  84121. url,
  84122. layerName,
  84123. attributeFilter,
  84124. fields,
  84125. epsgCode,
  84126. processCompleted,
  84127. processFaild,
  84128. startRecord,
  84129. recordLength,
  84130. onlyAttribute
  84131. ) {
  84132. const queryParam = new FilterParameter({
  84133. name: layerName,
  84134. attributeFilter: attributeFilter
  84135. });
  84136. if (fields) {
  84137. queryParam.fields = fields;
  84138. }
  84139. const params = {
  84140. queryParams: [queryParam]
  84141. };
  84142. if (onlyAttribute) {
  84143. params.queryOption = QueryOption.ATTRIBUTE;
  84144. }
  84145. startRecord && (params.startRecord = startRecord);
  84146. recordLength && (params.expectCount = recordLength);
  84147. if (epsgCode) {
  84148. params.prjCoordSys = {
  84149. epsgCode: epsgCode
  84150. };
  84151. }
  84152. const queryBySQLParams = new QueryBySQLParameters(params);
  84153. const queryBySQLService = new QueryService(url);
  84154. queryBySQLService.queryBySQL(queryBySQLParams, function (data) {
  84155. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  84156. });
  84157. }
  84158. function getFeatureBySQLWithConcurrent(
  84159. url,
  84160. datasetNames,
  84161. processCompleted,
  84162. processFailed,
  84163. serviceOptions,
  84164. targetEpsgCode,
  84165. restDataSingleRequestCount
  84166. ) {
  84167. let queryParameter = new FilterParameter({
  84168. name: datasetNames.join().replace(':', '@')
  84169. });
  84170. let maxFeatures = restDataSingleRequestCount || 1000, // 每次请求数据量
  84171. firstResult, // 存储每次请求的结果
  84172. allRequest = []; // 存储发出的请求Promise
  84173. // 发送请求获取获取总数据量
  84174. _getReasult(url, queryParameter, datasetNames, 0, 1, 1, serviceOptions, targetEpsgCode)
  84175. .then((result) => {
  84176. firstResult = result;
  84177. let totalCount = result.result.totalCount;
  84178. if (totalCount > 1) {
  84179. // 开始并发请求
  84180. for (let i = 1; i < totalCount; ) {
  84181. allRequest.push(
  84182. _getReasult(
  84183. url,
  84184. queryParameter,
  84185. datasetNames,
  84186. i,
  84187. i + maxFeatures,
  84188. maxFeatures,
  84189. serviceOptions,
  84190. targetEpsgCode
  84191. )
  84192. );
  84193. i += maxFeatures;
  84194. }
  84195. // 所有请求结束
  84196. Promise.all(allRequest)
  84197. .then((results) => {
  84198. // 结果合并
  84199. results.forEach((result) => {
  84200. if (result.type === 'processCompleted' && result.result.features && result.result.features.features) {
  84201. result.result.features.features.forEach((feature) => {
  84202. firstResult.result.features.features.push(feature);
  84203. });
  84204. } else {
  84205. // todo 提示 部分数据请求失败
  84206. firstResult.someRequestFailed = true;
  84207. }
  84208. });
  84209. processCompleted(firstResult);
  84210. })
  84211. .catch((error) => {
  84212. processFailed(error);
  84213. });
  84214. } else {
  84215. processCompleted(result);
  84216. }
  84217. })
  84218. .catch((error) => {
  84219. processFailed(error);
  84220. });
  84221. }
  84222. function _getFeaturesBySQLParameters(
  84223. queryParameter,
  84224. datasetNames,
  84225. fromIndex,
  84226. toIndex,
  84227. maxFeatures,
  84228. targetEpsgCode
  84229. ) {
  84230. return new GetFeaturesBySQLParameters({
  84231. queryParameter,
  84232. datasetNames,
  84233. fromIndex,
  84234. toIndex,
  84235. maxFeatures,
  84236. returnContent: true,
  84237. targetEpsgCode
  84238. });
  84239. }
  84240. function _getReasult(
  84241. url,
  84242. queryParameter,
  84243. datasetNames,
  84244. fromIndex,
  84245. toIndex,
  84246. maxFeatures,
  84247. serviceOptions,
  84248. targetEpsgCode
  84249. ) {
  84250. return new Promise((resolve, reject) => {
  84251. new FeatureService(url, serviceOptions).getFeaturesBySQL(
  84252. _getFeaturesBySQLParameters(queryParameter, datasetNames, fromIndex, toIndex, maxFeatures, targetEpsgCode),
  84253. (result) => {
  84254. let featuresResult = result.result;
  84255. //[bug] wt任务编号: 5223
  84256. if (result.type === 'processCompleted' && featuresResult && featuresResult.features) {
  84257. resolve(result);
  84258. } else {
  84259. reject(result);
  84260. }
  84261. }
  84262. );
  84263. });
  84264. }
  84265. function Util_isArray(obj) {
  84266. return Object.prototype.toString.call(obj) === '[object Array]';
  84267. }
  84268. ;// CONCATENATED MODULE: ./src/openlayers/services/DataFlowService.js
  84269. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84270. * This program are made available under the terms of the Apache License, Version 2.0
  84271. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84272. /**
  84273. * @class DataFlowService
  84274. * @category iServer DataFlow
  84275. * @classdesc 数据流服务。
  84276. * @modulecategory Services
  84277. * @extends {ServiceBase}
  84278. * @example
  84279. * new DataFlowService(url).queryChart(param,function(result){
  84280. * //doSomething
  84281. * })
  84282. * @param {string} url - 服务地址。
  84283. * @param {Object} options - 参数。
  84284. * @param {string} [options.proxy] - 服务代理地址。
  84285. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  84286. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  84287. * @param {Object} [options.headers] - 请求头。
  84288. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  84289. * @param {Object} [options.excludeField] - 排除字段。
  84290. * @usage
  84291. */
  84292. class DataFlowService extends ServiceBase {
  84293. constructor(url, options) {
  84294. options = options || {};
  84295. if (options.projection) {
  84296. options.prjCoordSys = options.projection;
  84297. }
  84298. super(url, options);
  84299. this.dataFlow = new DataFlowService_DataFlowService(url, options);
  84300. this.dataFlow.events.on({
  84301. "broadcastSocketConnected": this._defaultEvent,
  84302. "broadcastSocketError": this._defaultEvent,
  84303. "broadcastFailed": this._defaultEvent,
  84304. "broadcastSucceeded": this._defaultEvent,
  84305. "subscribeSocketConnected": this._defaultEvent,
  84306. "subscribeSocketError": this._defaultEvent,
  84307. "messageSucceeded": this._defaultEvent,
  84308. "setFilterParamSucceeded": this._defaultEvent,
  84309. scope: this
  84310. });
  84311. }
  84312. /**
  84313. * @function DataFlowService.prototype.initBroadcast
  84314. * @description 初始化广播。
  84315. * @returns {DataFlowService}
  84316. */
  84317. initBroadcast() {
  84318. this.dataFlow.initBroadcast();
  84319. return this;
  84320. }
  84321. /**
  84322. * @function DataFlowService.prototype.broadcast
  84323. * @description 加载广播数据。
  84324. * @param {JSONObject} obj - JSON 格式的要素数据。
  84325. */
  84326. broadcast(obj) {
  84327. this.dataFlow.broadcast(obj);
  84328. }
  84329. /**
  84330. * @function DataFlowService.prototype.initSubscribe
  84331. * @description 初始化订阅数据。
  84332. */
  84333. initSubscribe() {
  84334. this.dataFlow.initSubscribe();
  84335. return this;
  84336. }
  84337. /**
  84338. * @function DataFlowService.prototype.setExcludeField
  84339. * @description 设置排除字段。
  84340. * @param {Object} excludeField - 排除字段。
  84341. */
  84342. setExcludeField(excludeField) {
  84343. this.dataFlow.setExcludeField(excludeField);
  84344. this.options.excludeField = excludeField;
  84345. return this;
  84346. }
  84347. /**
  84348. * @function DataFlowService.prototype.setGeometry
  84349. * @description 设置添加的几何要素数据。
  84350. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  84351. */
  84352. setGeometry(geometry) {
  84353. this.dataFlow.setGeometry(geometry);
  84354. this.options.geometry = geometry;
  84355. return this;
  84356. }
  84357. /**
  84358. * @function DataFlowService.prototype.unSubscribe
  84359. * @description 结束订阅数据。
  84360. */
  84361. unSubscribe() {
  84362. this.dataFlow.unSubscribe();
  84363. }
  84364. /**
  84365. * @function DataFlowService.prototype.unBroadcast
  84366. * @description 结束加载广播。
  84367. */
  84368. unBroadcast() {
  84369. this.dataFlow.unBroadcast();
  84370. }
  84371. _defaultEvent(e) {
  84372. this.dispatchEvent({type: e.eventType || e.type, value: e});
  84373. }
  84374. }
  84375. ;// CONCATENATED MODULE: ./src/openlayers/overlay/DataFlow.js
  84376. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84377. * This program are made available under the terms of the Apache License, Version 2.0
  84378. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84379. /**
  84380. * @class DataFlow
  84381. * @browsernamespace ol.source
  84382. * @category iServer DataFlow
  84383. * @classdesc 数据流图层源。订阅SuperMap iServer 数据流服务,并将订阅得到的数据根据 `options.idField` 自动更新。与 {@link ol.layer.Vector} 结合使用可以实现SuperMap iServer 数据流上图、根据`options.idField`自动更新。
  84384. * @param {Object} opt_options - 参数。
  84385. * @param {string} opt_options.ws - SuperMap iServer 数据流服务地址,例如:http://localhost:8090/iserver/services/dataflowTest/dataflow。
  84386. * @param {string} [opt_options.idField = 'id'] - 要素属性中表示唯一标识的字段。
  84387. * @param {GeoJSONObject} [opt_options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  84388. * @param {Object} [opt_options.prjCoordSys] - 请求的地图的坐标参考系统。当此参数设置的坐标系统不同于地图的原有坐标系统时,系统会进行动态投影,并返回动态投影后的地图瓦片。例如:{"epsgCode":3857}。
  84389. * @param {Object} [opt_options.excludeField] - 排除字段。
  84390. * @extends {ol.source.Vector}
  84391. * @example
  84392. * var source = new DataFlow({
  84393. * ws: urlDataFlow,
  84394. * idField:"objectId"
  84395. * });
  84396. * var layer = new ol.layer.Vector({
  84397. * source: source,
  84398. * });
  84399. * @usage
  84400. */
  84401. class DataFlow extends (external_ol_source_Vector_default()) {
  84402. constructor(opt_options) {
  84403. var options = opt_options ? opt_options : {};
  84404. super(options);
  84405. this.idField = options.idField || "id";
  84406. this.dataService = new DataFlowService(options.ws, {
  84407. geometry: options.geometry,
  84408. prjCoordSys: options.prjCoordSys,
  84409. excludeField: options.excludeField
  84410. }).initSubscribe();
  84411. var me = this;
  84412. me.dataService.on("subscribeSocketConnected", function(e) {
  84413. me.dispatchEvent({
  84414. type: "subscribeSucceeded",
  84415. value: e
  84416. });
  84417. });
  84418. me.dataService.on("messageSucceeded", function(msg) {
  84419. me._onMessageSuccessed(msg);
  84420. });
  84421. me.dataService.on("setFilterParamSucceeded", function(msg) {
  84422. me.dispatchEvent({
  84423. type: "setFilterParamSucceeded",
  84424. value: msg
  84425. });
  84426. });
  84427. this.featureCache = {};
  84428. }
  84429. // /**
  84430. // * @function DataFlow.prototype.setPrjCoordSys
  84431. // * @description 设置坐标参考系。
  84432. // * @param {Object} prjCoordSys - 参考系。
  84433. // */
  84434. // setPrjCoordSys(prjCoordSys) {
  84435. // this.dataService.setPrjCoordSys(prjCoordSys);
  84436. // this.prjCoordSys = prjCoordSys;
  84437. // return this;
  84438. // }
  84439. /**
  84440. * @function DataFlow.prototype.setExcludeField
  84441. * @description 设置唯一字段。
  84442. * @param {Object} excludeField - 排除字段。
  84443. */
  84444. setExcludeField(excludeField) {
  84445. this.dataService.setExcludeField(excludeField);
  84446. this.excludeField = excludeField;
  84447. return this;
  84448. }
  84449. /**
  84450. * @function DataFlow.prototype.setGeometry
  84451. * @description 设置几何图形。
  84452. * @param {Object} geometry - 要素图形。
  84453. */
  84454. setGeometry(geometry) {
  84455. this.dataService.setGeometry(geometry);
  84456. this.geometry = geometry;
  84457. return this;
  84458. }
  84459. _onMessageSuccessed(msg) {
  84460. //this.clear();
  84461. var feature = new (external_ol_format_GeoJSON_default())().readFeature(msg.value.featureResult);
  84462. var geoID = feature.get(this.idField);
  84463. if (geoID !== undefined && this.featureCache[geoID]) {
  84464. this.featureCache[geoID].setGeometry(feature.getGeometry());
  84465. this.featureCache[geoID].setProperties(feature.getProperties());
  84466. this.changed();
  84467. } else {
  84468. this.addFeature(feature);
  84469. this.featureCache[geoID] = feature;
  84470. }
  84471. this.dispatchEvent({
  84472. type: "dataupdated",
  84473. value: {
  84474. source: this,
  84475. data: feature
  84476. }
  84477. });
  84478. }
  84479. }
  84480. ;// CONCATENATED MODULE: ./src/openlayers/overlay/theme/ThemeFeature.js
  84481. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84482. * This program are made available under the terms of the Apache License, Version 2.0
  84483. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84484. /**
  84485. * @class ThemeFeature
  84486. * @category Visualization Theme
  84487. * @classdesc 专题图要素类。
  84488. * @modulecategory Overlay
  84489. * @param {Object} geometry - 要量算的几何对象,支持 {@link ol.geom.Geometry} 和 GeometryGeoText 标签数组类型 geometry = [x,y,text]。
  84490. * @param {Object} [attributes] - 属性。
  84491. * @usage
  84492. */
  84493. class ThemeFeature {
  84494. constructor(geometry, attributes) {
  84495. this.geometry = geometry;
  84496. this.attributes = attributes;
  84497. }
  84498. /**
  84499. * @function ThemeFeature.prototype.toFeature
  84500. * @description 转为矢量要素。
  84501. */
  84502. toFeature() {
  84503. var geometry = this.geometry;
  84504. if (geometry instanceof (external_ol_geom_Geometry_default())) {
  84505. //先把数据属性与要素合并
  84506. let featureOption = this.attributes;
  84507. featureOption.geometry = geometry;
  84508. let olFeature = new (external_ol_Feature_default())(featureOption);
  84509. return new GeoJSON().read((new (external_ol_format_GeoJSON_default())()).writeFeature(olFeature), "Feature");
  84510. } else if (geometry.length === 3) {
  84511. geometry = new GeoText(geometry[0], geometry[1], geometry[2]);
  84512. return new Vector(geometry, this.attributes);
  84513. }
  84514. }
  84515. }
  84516. ;// CONCATENATED MODULE: external "ol.source.ImageCanvas"
  84517. const external_ol_source_ImageCanvas_namespaceObject = ol.source.ImageCanvas;
  84518. var external_ol_source_ImageCanvas_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_ImageCanvas_namespaceObject);
  84519. ;// CONCATENATED MODULE: ./src/openlayers/overlay/theme/Theme.js
  84520. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  84521. * This program are made available under the terms of the Apache License, Version 2.0
  84522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84523. /**
  84524. * @class Theme
  84525. * @browsernamespace ol.source
  84526. * @category Visualization Theme
  84527. * @classdesc 专题图基类。
  84528. * @modulecategory Overlay
  84529. * @param {string} name - 专题图图层名称。
  84530. * @param {Object} opt_option - 参数。
  84531. * @param {ol.Map} opt_option.map - 当前 openlayers 的 Map 对象。
  84532. * @param {string} [opt_option.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  84533. * @param {number} [opt_option.opacity=1] - 图层透明度。
  84534. * @param {string} [opt_option.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  84535. * @param {ol.proj.Projection} [opt_option.projection] - 投影信息。
  84536. * @param {number} [opt_option.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
  84537. * @param {Array} [opt_option.resolutions] - 分辨率数组。
  84538. * @param {ol.source.State} [opt_option.state] - 资源状态。
  84539. * @param {(string|Object)} [opt_option.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  84540. * @extends {ol.source.ImageCanvas}
  84541. * @usage
  84542. */
  84543. class theme_Theme_Theme extends (external_ol_source_ImageCanvas_default()) {
  84544. constructor(name, opt_options) {
  84545. var options = opt_options ? opt_options : {};
  84546. super({
  84547. attributions: options.attributions || "Map Data <span>© SuperMap iServer</span> with <span>© SuperMap iClient</span>",
  84548. canvasFunction: canvasFunctionInternal_,
  84549. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  84550. projection: options.projection,
  84551. ratio: options.ratio,
  84552. resolutions: options.resolutions,
  84553. state: options.state
  84554. });
  84555. /**
  84556. * @function Theme.prototype.on
  84557. * @description 添加专题要素事件监听。支持的事件包括: click、mousedown、mousemove、mouseout、mouseover、mouseup。
  84558. * @param {string} event - 事件名称。
  84559. * @param {RequestCallback} callback - 事件回调函数。
  84560. */
  84561. this.on = this.onInternal;
  84562. this.id = options.id ? options.id : Util_Util.createUniqueID("themeLayer_");
  84563. function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  84564. var mapWidth = size[0] * pixelRatio;
  84565. var mapHeight = size[1] * pixelRatio;
  84566. if (!this.context) {
  84567. this.context = core_Util_Util.createCanvasContext2D(mapWidth, mapHeight);
  84568. }
  84569. if (!this.features) {
  84570. return this.context.canvas;
  84571. }
  84572. this.pixelRatio = pixelRatio;
  84573. var width = this.map.getSize()[0] * pixelRatio;
  84574. var height = this.map.getSize()[1] * pixelRatio;
  84575. this.offset = [(mapWidth - width) / 2 / pixelRatio, (mapHeight - height) / 2 / pixelRatio];
  84576. if (!this.notFirst) {
  84577. this.redrawThematicFeatures(extent);
  84578. this.notFirst = true;
  84579. }
  84580. this.div.id = this.id;
  84581. this.div.className = "themeLayer";
  84582. this.div.style.width = mapWidth + "px";
  84583. this.div.style.height = mapHeight + "px";
  84584. this.map.getViewport().appendChild(this.div);
  84585. this.renderer.resize();
  84586. this.map.getViewport().removeChild(this.div);
  84587. this.themeCanvas = this.renderer.painter.root.getElementsByTagName('canvas')[0];
  84588. this.themeCanvas.width = mapWidth;
  84589. this.themeCanvas.height = mapHeight;
  84590. this.themeCanvas.style.width = mapWidth + "px";
  84591. this.themeCanvas.style.height = mapHeight + "px";
  84592. this.themeCanvas.getContext('2d').clearRect(0, 0, mapWidth, mapHeight);
  84593. var highLightContext = this.renderer.painter._layers.hover.ctx;
  84594. var highlightCanvas = highLightContext.canvas;
  84595. var copyHighLightContext = core_Util_Util.createCanvasContext2D(mapWidth, mapHeight);
  84596. copyHighLightContext.drawImage(highlightCanvas, 0, 0, highlightCanvas.width, highlightCanvas.height, 0, 0, mapWidth, mapHeight);
  84597. this.redrawThematicFeatures(extent);
  84598. var canvas = this.context.canvas;
  84599. this.context.clearRect(0, 0, canvas.width, canvas.height);
  84600. canvas.width = mapWidth;
  84601. canvas.height = mapHeight;
  84602. canvas.style.width = mapWidth + "px";
  84603. canvas.style.height = mapHeight + "px";
  84604. this.context.drawImage(this.themeCanvas, 0, 0);
  84605. this.context.drawImage(copyHighLightContext.canvas, 0, 0);
  84606. return this.context.canvas;
  84607. }
  84608. this.canvasFunctionInternal_ = canvasFunctionInternal_;
  84609. this.EVENT_TYPES = ["loadstart", "loadend", "loadcancel",
  84610. "visibilitychanged", "move", "moveend", "added", "removed",
  84611. "tileloaded", "beforefeaturesadded", "featuresadded", "featuresremoved"];
  84612. this.features = [];
  84613. this.TFEvents = options.TFEvents || [];
  84614. this.map = options.map;
  84615. var size = this.map.getSize();
  84616. this.div = document.createElement('div');
  84617. this.map.getViewport().appendChild(this.div);
  84618. this.div.style.width = size[0] + "px";
  84619. this.div.style.height = size[1] + "px";
  84620. this.setOpacity(options.opacity);
  84621. this.levelRenderer = new LevelRenderer();
  84622. this.movingOffset = [0, 0];
  84623. this.renderer = this.levelRenderer.init(this.div);
  84624. this.map.getViewport().removeChild(this.div);
  84625. this.renderer.clear();
  84626. //处理用户预先(在图层添加到 map 前)监听的事件
  84627. this.addTFEvents();
  84628. }
  84629. /**
  84630. * @function Theme.prototype.destroy
  84631. * @description 释放资源,将引用资源的属性置空。
  84632. */
  84633. destroy() {
  84634. this.EVENT_TYPES = null;
  84635. this.isBaseLayer = null;
  84636. this.TFEvents = null;
  84637. this.destroyFeatures();
  84638. this.features = null;
  84639. if (this.renderer) {
  84640. this.renderer.dispose();
  84641. }
  84642. this.renderer = null;
  84643. this.levelRenderer = null;
  84644. this.movingOffset = null;
  84645. this.currentMousePosition = null;
  84646. }
  84647. /**
  84648. * @function Theme.prototype.destroyFeatures
  84649. * @description 销毁要素。
  84650. * @param {Array.<FeatureVector>|FeatureVector} features - 将被销毁的要素。
  84651. */
  84652. destroyFeatures(features) {
  84653. var all = (features == undefined);
  84654. if (all) {
  84655. features = this.features;
  84656. }
  84657. if (features) {
  84658. this.removeFeatures(features);
  84659. if (!Array.isArray(features)) {
  84660. features = [features];
  84661. }
  84662. for (var i = features.length - 1; i >= 0; i--) {
  84663. features[i].destroy();
  84664. }
  84665. }
  84666. }
  84667. /**
  84668. * @function Theme.prototype.setOpacity
  84669. * @description 设置图层的不透明度,取值[0-1]之间。
  84670. * @param {number} opacity - 不透明度。
  84671. */
  84672. setOpacity(opacity) {
  84673. if (opacity !== this.opacity) {
  84674. this.opacity = opacity;
  84675. var element = this.div;
  84676. Util_Util.modifyDOMElement(element, null, null, null,
  84677. null, null, null, opacity);
  84678. if (this.map !== null) {
  84679. this.dispatchEvent({type: 'changelayer', value: {layer: this, property: "opacity"}});
  84680. }
  84681. }
  84682. }
  84683. /**
  84684. * @function Theme.prototype.addFeatures
  84685. * @param {(Array.<ThemeFeature>|Array.<GeoJSONObject>|Array.<ol.Feature>|ThemeFeature|GeoJSONObject|ol.Feature)} features - 待添加要素。
  84686. * @description 抽象方法,可实例化子类必须实现此方法。向专题图图层中添加数据,
  84687. * 专题图仅接收 FeatureVector 类型数据,
  84688. * feature 将储存于 features 属性中,其存储形式为数组。
  84689. */
  84690. addFeatures(features) { // eslint-disable-line no-unused-vars
  84691. }
  84692. /**
  84693. * @function Theme.prototype.removeFeatures
  84694. * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 要删除 feature 的数组或用来过滤的回调函数。
  84695. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  84696. * 参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature,
  84697. * 如果无法确定 feature 数组,则可以调用 removeAllFeatures 来删除所有 feature。
  84698. * 如果要删除的 feature 数组中的元素特别多,推荐使用 removeAllFeatures,
  84699. * 删除所有 feature 后再重新添加。这样效率会更高。
  84700. */
  84701. removeFeatures(features) {
  84702. var me = this;
  84703. if (!features) {
  84704. return;
  84705. }
  84706. if (features === me.features) {
  84707. return me.removeAllFeatures();
  84708. }
  84709. if (!Util_Util.isArray(features) && !(typeof features === 'function')) {
  84710. features = [features];
  84711. }
  84712. var featuresFailRemoved = [];
  84713. for (var i = 0; i < me.features.length; i++) {
  84714. var feature = me.features[i];
  84715. //如果我们传入的feature在features数组中没有的话,则不进行删除,
  84716. //并将其放入未删除的数组中。
  84717. if (features && typeof features === 'function') {
  84718. if (features(feature)) {
  84719. me.features.splice(i--, 1);
  84720. }
  84721. } else {
  84722. var findex = Util_Util.indexOf(features, feature);
  84723. if (findex === -1) {
  84724. featuresFailRemoved.push(feature);
  84725. } else {
  84726. me.features.splice(i--, 1);
  84727. }
  84728. }
  84729. }
  84730. var drawFeatures = [];
  84731. for (var hex = 0, len = this.features.length; hex < len; hex++) {
  84732. feature = this.features[hex];
  84733. drawFeatures.push(feature);
  84734. }
  84735. this.features = [];
  84736. this.addFeatures(drawFeatures);
  84737. //绘制专题要素
  84738. if (this.renderer) {
  84739. this.redrawThematicFeatures(this.map.getView().calculateExtent());
  84740. }
  84741. var succeed = featuresFailRemoved.length == 0 ? true : false;
  84742. this.dispatchEvent({type: "featuresremoved", value: {features: featuresFailRemoved, succeed: succeed}});
  84743. }
  84744. /**
  84745. * @function Theme.prototype.removeAllFeatures
  84746. * @description 清除当前图层所有的矢量要素。
  84747. */
  84748. removeAllFeatures() {
  84749. if (this.renderer) {
  84750. this.renderer.clear();
  84751. }
  84752. this.features = [];
  84753. this.dispatchEvent({type: 'featuresremoved', value: {features: [], succeed: true}});
  84754. }
  84755. /**
  84756. * @function Theme.prototype.getFeatures
  84757. * @description 查看当前图层中的有效数据。
  84758. * @param {Function} [filter] - 根据条件过滤要素的回调函数。
  84759. * @returns {Array.<FeatureVector>} 用户加入图层的有效数据。
  84760. */
  84761. getFeatures(filter) {
  84762. var len = this.features.length;
  84763. var clonedFeatures = [];
  84764. for (var i = 0; i < len; ++i) {
  84765. if (!filter || (filter && typeof filter === 'function' && filter(this.features[i]))) {
  84766. clonedFeatures.push(this.features[i]);
  84767. }
  84768. }
  84769. return clonedFeatures;
  84770. }
  84771. /**
  84772. * @function Theme.prototype.getFeatureBy
  84773. * @description 在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,
  84774. * 返回此 feature(并且只返回第一个)。
  84775. * @param {string} property - feature 的某个属性名称。
  84776. * @param {string} value - property 所对应的值。
  84777. * @returns {FeatureVector} 第一个匹配属性和值的矢量要素。
  84778. */
  84779. getFeatureBy(property, value) {
  84780. var feature = null;
  84781. for (var id in this.features) {
  84782. if (this.features[id][property] === value) {
  84783. feature = this.features[id];
  84784. //feature = this.features[id].clone();
  84785. break;
  84786. }
  84787. }
  84788. return feature;
  84789. }
  84790. /**
  84791. * @function Theme.prototype.getFeatureById
  84792. * @description 通过给定一个 ID,返回对应的矢量要素。
  84793. * @param {string} featureId - 矢量要素的属性 ID。
  84794. * @returns {FeatureVector} 对应 ID 的 feature,如果不存在则返回 null。
  84795. */
  84796. getFeatureById(featureId) {
  84797. return this.getFeatureBy('id', featureId);
  84798. }
  84799. /**
  84800. * @function Theme.prototype.getFeaturesByAttribute
  84801. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  84802. * @param {string} attrName - 属性的 key。
  84803. * @param {string} attrValue - 矢量要素的属性 ID。
  84804. * @returns {Array.<FeatureVector>} 一个匹配的 feature 数组。
  84805. */
  84806. getFeaturesByAttribute(attrName, attrValue) {
  84807. var feature,
  84808. foundFeatures = [];
  84809. for (var id in this.features) {
  84810. feature = this.features[id];
  84811. //feature = this.features[id].clone();
  84812. if (feature && feature.attributes) {
  84813. if (feature.attributes[attrName] === attrValue) {
  84814. foundFeatures.push(feature);
  84815. }
  84816. }
  84817. }
  84818. return foundFeatures;
  84819. }
  84820. /**
  84821. * @function Theme.prototype.redrawThematicFeatures
  84822. * @description 抽象方法,可实例化子类必须实现此方法。重绘专题要素。
  84823. * @param {Array} extent - 当前级别下计算出的地图范围。
  84824. */
  84825. redrawThematicFeatures(extent) { //eslint-disable-line no-unused-vars
  84826. }
  84827. /**
  84828. * @private
  84829. * @function Theme.prototype.onInternal
  84830. * @description 添加专题要素事件监听。支持的事件包括: click、mousedown、mousemove、mouseout、mouseover、mouseup。
  84831. * @param {string} event - 事件名称。
  84832. * @param {RequestCallback} callback - 事件回调函数。
  84833. */
  84834. onInternal(event, callback) {
  84835. var cb = callback;
  84836. if (!this.renderer) {
  84837. var evn = [];
  84838. evn.push(event);
  84839. evn.push(cb);
  84840. this.TFEvents.push(evn);
  84841. } else {
  84842. this.renderer.on(event, cb);
  84843. }
  84844. }
  84845. /**
  84846. * @function Theme.prototype.fire
  84847. * @description 添加专题要素事件监听。
  84848. * @param {string} type - 事件类型。
  84849. * @param {string} event - 事件名称。
  84850. */
  84851. fire(type, event) {
  84852. if (!this.offset) {
  84853. return;
  84854. }
  84855. event = event.originalEvent;
  84856. var x = this.getX(event);
  84857. var y = this.getY(event);
  84858. var rotation = -this.map.getView().getRotation();
  84859. var center = this.map.getPixelFromCoordinate(this.map.getView().getCenter());
  84860. var scaledP = this.scale([x, y], center, this.pixelRatio);
  84861. var rotatedP = this.rotate(scaledP, rotation, center);
  84862. var resultP = [rotatedP[0] + this.offset[0], rotatedP[1] + this.offset[1]];
  84863. var offsetEvent = document.createEvent('Event');
  84864. offsetEvent.initEvent('pointermove', true, true);
  84865. offsetEvent.offsetX = resultP[0];
  84866. offsetEvent.offsetY = resultP[1];
  84867. offsetEvent.layerX = resultP[0];
  84868. offsetEvent.layerY = resultP[1];
  84869. offsetEvent.clientX = resultP[0];
  84870. offsetEvent.clientY = resultP[1];
  84871. offsetEvent.x = x;
  84872. offsetEvent.y = y;
  84873. if (type === 'click') {
  84874. this.renderer.handler._clickHandler(offsetEvent);
  84875. }
  84876. if (type === 'dblclick') {
  84877. this.renderer.handler._dblclickHandler(offsetEvent);
  84878. }
  84879. if (type === 'onmousewheel') {
  84880. this.renderer.handler._mousewheelHandler(offsetEvent);
  84881. }
  84882. if (type === 'mousemove') {
  84883. this.renderer.handler._mousemoveHandler(offsetEvent);
  84884. this.changed();
  84885. }
  84886. if (type === 'onmouseout') {
  84887. this.renderer.handler._mouseoutHandler(offsetEvent);
  84888. }
  84889. if (type === 'onmousedown') {
  84890. this.renderer.handler._mousedownHandler(offsetEvent);
  84891. }
  84892. if (type === 'onmouseup') {
  84893. this.renderer.handler._mouseupHandler(offsetEvent);
  84894. }
  84895. }
  84896. getX(e) {
  84897. return typeof e.zrenderX != 'undefined' && e.zrenderX
  84898. || typeof e.offsetX != 'undefined' && e.offsetX
  84899. || typeof e.layerX != 'undefined' && e.layerX
  84900. || typeof e.clientX != 'undefined' && e.clientX;
  84901. }
  84902. getY(e) {
  84903. return typeof e.zrenderY != 'undefined' && e.zrenderY
  84904. || typeof e.offsetY != 'undefined' && e.offsetY
  84905. || typeof e.layerY != 'undefined' && e.layerY
  84906. || typeof e.clientY != 'undefined' && e.clientY;
  84907. }
  84908. /**
  84909. * @function Theme.prototype.un
  84910. * @description 移除专题要素事件监听。
  84911. * @param {string} event - 事件名称。
  84912. * @param {RequestCallback} callback - 事件回调函数。
  84913. */
  84914. un(event, callback) {
  84915. var cb = callback;
  84916. if (!this.renderer) {
  84917. var tfEs = this.TFEvents;
  84918. var len = tfEs.length;
  84919. var newtfEs = [];
  84920. for (var i = 0; i < len; i++) {
  84921. var tfEs_i = tfEs[i];
  84922. if (!(tfEs_i[0] === event && tfEs_i[1] === cb)) {
  84923. newtfEs.push(tfEs_i)
  84924. }
  84925. }
  84926. this.TFEvents = newtfEs;
  84927. } else {
  84928. this.renderer.un(event, cb);
  84929. }
  84930. }
  84931. /**
  84932. * @function Theme.prototype.addTFEvents
  84933. * @description 将图层添加到地图上之前用户要求添加的事件监听添加到图层。
  84934. * @private
  84935. */
  84936. addTFEvents() {
  84937. var tfEs = this.TFEvents;
  84938. var len = tfEs.length;
  84939. for (var i = 0; i < len; i++) {
  84940. this.renderer.on(tfEs[i][0], tfEs[i][1]);
  84941. }
  84942. }
  84943. /**
  84944. * @function Theme.prototype.getLocalXY
  84945. * @description 获取坐标系统。
  84946. * @param {Object} coordinate - 坐标位置。
  84947. * @returns {Array.<number>} 像素坐标数组。
  84948. */
  84949. getLocalXY(coordinate) {
  84950. var pixelP, map = this.map;
  84951. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  84952. pixelP = map.getPixelFromCoordinate([coordinate.x, coordinate.y]);
  84953. }
  84954. if (coordinate instanceof LonLat) {
  84955. pixelP = map.getPixelFromCoordinate([coordinate.lon, coordinate.lat]);
  84956. }
  84957. var rotation = -map.getView().getRotation();
  84958. var center = map.getPixelFromCoordinate(map.getView().getCenter());
  84959. var rotatedP = pixelP;
  84960. if (this.pixelRatio) {
  84961. rotatedP = this.scale(pixelP, center, this.pixelRatio);
  84962. }
  84963. if (pixelP && center) {
  84964. rotatedP = this.rotate(rotatedP, rotation, center);
  84965. }
  84966. if (this.offset && rotatedP) {
  84967. return [rotatedP[0] + this.offset[0], rotatedP[1] + this.offset[1]];
  84968. }
  84969. return rotatedP;
  84970. }
  84971. /**
  84972. * @function Theme.prototype.rotate
  84973. * @description 获取某像素坐标点 pixelP 绕中心 center 逆时针旋转 rotation 弧度后的像素点坐标。
  84974. * @param {number} pixelP - 像素坐标点位置。
  84975. * @param {number} rotation - 旋转角度。
  84976. * @param {number} center - 中心位置。
  84977. * @returns {Array.<number>} 旋转后的像素坐标数组。
  84978. */
  84979. rotate(pixelP, rotation, center) {
  84980. var x = Math.cos(rotation) * (pixelP[0] - center[0]) - Math.sin(rotation) * (pixelP[1] - center[1]) + center[0];
  84981. var y = Math.sin(rotation) * (pixelP[0] - center[0]) + Math.cos(rotation) * (pixelP[1] - center[1]) + center[1];
  84982. return [x, y];
  84983. }
  84984. /**
  84985. * @function Theme.prototype.scale
  84986. * @description 获取某像素坐标点 pixelP 相对于中心 center 进行缩放 scaleRatio 倍后的像素点坐标。
  84987. * @param {Object} pixelP - 像素点。
  84988. * @param {Object} center - 中心点。
  84989. * @param {number} scaleRatio - 缩放倍数。
  84990. * @returns {Array.<number>} 返回数组型比例。
  84991. */
  84992. scale(pixelP, center, scaleRatio) {
  84993. var x = (pixelP[0] - center[0]) * scaleRatio + center[0];
  84994. var y = (pixelP[1] - center[1]) * scaleRatio + center[1];
  84995. return [x, y];
  84996. }
  84997. /**
  84998. * @function Theme.prototype.toiClientFeature
  84999. * @description 转为 iClient 要素。
  85000. * @param {(Array.<ThemeFeature>|Array.<GeoJSONObject>|Array.<ol.Feature>|ThemeFeature|GeoJSONObject|ol.Feature)} features - 待转要素。
  85001. * @returns {Array.<FeatureVector>} 转换后的 iClient 要素。
  85002. */
  85003. toiClientFeature(features) {
  85004. if (!Util_Util.isArray(features)) {
  85005. features = [features];
  85006. }
  85007. let featuresTemp = [];
  85008. for (let i = 0; i < features.length; i++) {
  85009. if (features[i] instanceof ThemeFeature) {
  85010. // ThemeFeature 类型
  85011. featuresTemp.push(features[i].toFeature());
  85012. continue;
  85013. } else if (features[i] instanceof (external_ol_Feature_default())) {
  85014. //ol.Feature 数据类型
  85015. //_toFeature 统一处理 ol.Feature 所有 geometry 类型
  85016. featuresTemp.push(this._toFeature(features[i]));
  85017. continue;
  85018. } else if (features[i] instanceof Vector) {
  85019. // 若是 FeatureVector 直接返回
  85020. featuresTemp.push(features[i]);
  85021. continue;
  85022. } else if (features[i].geometry && features[i].geometry.parts) {
  85023. //iServer服务器返回数据格式
  85024. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  85025. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  85026. //GeoJSON 规范数据类型
  85027. const format = new GeoJSON();
  85028. featuresTemp = featuresTemp.concat(format.read(features[i]));
  85029. } else {
  85030. throw new Error(`features[${i}]'s type is not be supported.`);
  85031. }
  85032. }
  85033. return featuresTemp;
  85034. }
  85035. /**
  85036. * @function Theme.prototype.toFeature
  85037. * @deprecated
  85038. * @description 转为 iClient 要素,该方法将被弃用,由 {@link Theme#toiClientFeature} 代替。
  85039. * @param {(Array.<ThemeFeature>|Array.<GeoJSONObject>|Array.<ol.Feature>|ThemeFeature|GeoJSONObject|ol.Feature)} features - 待转要素。
  85040. * @returns {Array.<FeatureVector>} 转换后的 iClient 要素。
  85041. */
  85042. toFeature(features) {
  85043. return this.toiClientFeature(features);
  85044. }
  85045. //统一处理 ol.feature所有 geometry 类型
  85046. _toFeature(feature) {
  85047. let geoFeature = (new (external_ol_format_GeoJSON_default())()).writeFeature(feature);
  85048. return new GeoJSON().read(geoFeature, "Feature");
  85049. }
  85050. }
  85051. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Graph.js
  85052. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85053. * This program are made available under the terms of the Apache License, Version 2.0
  85054. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85055. /**
  85056. * @class Graph
  85057. * @browsernamespace ol.source
  85058. * @category Visualization Theme
  85059. * @classdesc 统计专题图图层基类。
  85060. * @modulecategory Overlay
  85061. * @param {string} chartsType - 图表类别。
  85062. * @param {string} name - 图层名称。
  85063. * @param {Object} opt_options - 参数。
  85064. * @param {ol.Map} opt_options.map - 当前 Map 对象。
  85065. * @param {string} opt_options.chartsType - 图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。
  85066. * @param {Object} opt_options.chartsSetting - 各类型图表的 chartsSetting 对象可设属性请参考具体图表模型类的注释中对 chartsSetting 对象可设属性的描述。chartsSetting 对象通常都具有以下几个基础可设属性。
  85067. * @param {number} opt_options.chartsSetting.width - 专题要素(图表)宽度。
  85068. * @param {number} opt_options.chartsSetting.height - 专题要素(图表)高度。
  85069. * @param {Array.<number>} opt_options.chartsSetting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  85070. * @param {number} [opt_options.chartsSetting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  85071. * @param {number} [opt_options.chartsSetting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  85072. * @param {Array.<number>} [opt_options.chartsSetting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox(由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值,长度为 4 的一维数组。
  85073. * @param {number} [opt_options.chartsSetting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  85074. * @param {string} opt_options.themeFields - 指定创建专题图字段。
  85075. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  85076. * @param {number} [opt_options.opacity = 1] - 图层透明度。
  85077. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  85078. * @param {ol.proj.Projection} [opt_options.projection] - {@link ol.proj.Projection} 投影信息。
  85079. * @param {number} [opt_options.ratio=1.5] - 视图比, 1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
  85080. * @param {Array.<number>} [opt_options.resolutions] - 分辨率数组。
  85081. * @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  85082. * @param {ol.source.State} [opt_options.state] - 资源状态。
  85083. * @param {(string|Object)} [opt_options.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  85084. * @extends {Theme}
  85085. * @usage
  85086. */
  85087. class Graph_Graph extends theme_Theme_Theme {
  85088. constructor(name, chartsType, opt_options) {
  85089. super(name, opt_options);
  85090. this.chartsSetting = opt_options.chartsSetting || {};
  85091. this.themeFields = opt_options.themeFields || null;
  85092. this.overlayWeightField = opt_options.overlayWeightField || null;
  85093. this.isOverLay = opt_options.isOverLay === undefined ? true : opt_options.isOverLay;
  85094. this.charts = opt_options.charts || [];
  85095. this.cache = opt_options.cache || {};
  85096. this.chartsType = chartsType;
  85097. }
  85098. /**
  85099. * @function Graph.prototype.destroy
  85100. * @description 释放资源,将引用资源的属性置空。
  85101. */
  85102. destroy() {
  85103. this.chartsType = null;
  85104. this.chartsSetting = null;
  85105. this.themeFields = null;
  85106. this.overlayWeightField = null;
  85107. this.isOverLay = null;
  85108. theme_Theme_Theme.prototype.destroy.apply(this, arguments);
  85109. // charts cache 为缓存,需要在父类destory后置为null(父类destory中有方法会初始化缓存参数)
  85110. this.charts = null;
  85111. this.cache = null;
  85112. }
  85113. /**
  85114. * @function Graph.prototype.setChartsType
  85115. * @description 设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。
  85116. * @param {string} chartsType - 图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。
  85117. */
  85118. setChartsType(chartsType) {
  85119. this.chartsType = chartsType;
  85120. this.redraw();
  85121. }
  85122. /**
  85123. * @function Graph.prototype.addFeatures
  85124. * @description 向专题图图层中添加数据。
  85125. * @param {(ServerFeature|ThemeFeature)} features - 待添加的要素。
  85126. */
  85127. addFeatures(features) {
  85128. var ret = this.dispatchEvent({
  85129. type: 'beforefeaturesadded',
  85130. value: {
  85131. features: features
  85132. }
  85133. });
  85134. if (ret === false) {
  85135. return;
  85136. }
  85137. //转换 features 形式
  85138. this.features = this.toiClientFeature(features);
  85139. //绘制专题要素
  85140. if (this.renderer) {
  85141. this.changed();
  85142. }
  85143. }
  85144. /**
  85145. * @function Graph.prototype.redrawThematicFeatures
  85146. * @description 重绘所有专题要素。
  85147. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  85148. * 地图漫游时调用此方法进行图层刷新。
  85149. * @param {Object} extent - 重绘的范围。
  85150. *
  85151. */
  85152. redrawThematicFeatures(extent) {
  85153. //清除当前所有可视元素
  85154. this.renderer.clearAll();
  85155. var features = this.features;
  85156. for (var i = 0, len = features.length; i < len; i++) {
  85157. var feature = features[i];
  85158. // 要素范围判断
  85159. var feaBounds = feature.geometry.getBounds();
  85160. //剔除当前视图(地理)范围以外的数据
  85161. if (extent) {
  85162. var bounds = new Bounds(extent[0], extent[1], extent[2], extent[3]);
  85163. if (!bounds.intersectsBounds(feaBounds)) {
  85164. continue;
  85165. }
  85166. }
  85167. var cache = this.cache;
  85168. // 用 feature id 做缓存标识
  85169. var cacheField = feature.id;
  85170. // 数据对应的图表是否已缓存,没缓存则重新创建图表
  85171. if (cache[cacheField]) {
  85172. continue;
  85173. }
  85174. cache[cacheField] = cacheField;
  85175. var chart = this.createThematicFeature(feature);
  85176. // 压盖处理权重值
  85177. if (chart && this.overlayWeightField) {
  85178. if (feature.attributes[this.overlayWeightField] && !isNaN(feature.attributes[this.overlayWeightField])) {
  85179. chart["__overlayWeight"] = feature.attributes[this.overlayWeightField];
  85180. }
  85181. }
  85182. if (chart) {
  85183. this.charts.push(chart);
  85184. }
  85185. }
  85186. this.drawCharts();
  85187. }
  85188. /**
  85189. * @function Graph.prototype.createThematicFeature
  85190. * @description 向专题图图层中添加数据, 支持的 feature 类型为:iServer 返回的 feature JSON 对象。
  85191. * @param {ServerFeature} feature - 待添加的要素。
  85192. *
  85193. */
  85194. createThematicFeature(feature) {
  85195. var thematicFeature;
  85196. // 检查图表创建条件并创建图形
  85197. if (Theme_Theme[this.chartsType] && this.themeFields && this.chartsSetting) {
  85198. thematicFeature = new Theme_Theme[this.chartsType](feature, this, this.themeFields, this.chartsSetting);
  85199. }
  85200. // thematicFeature 是否创建成功
  85201. if (!thematicFeature) {
  85202. return false;
  85203. }
  85204. // 对专题要素执行图形装载
  85205. thematicFeature.assembleShapes();
  85206. return thematicFeature;
  85207. }
  85208. /**
  85209. * @function Graph.prototype.drawCharts
  85210. * @description 绘制图表。包含压盖处理。
  85211. *
  85212. */
  85213. drawCharts() {
  85214. // 判断 rendere r就绪
  85215. if (!this.renderer) {
  85216. return;
  85217. }
  85218. var charts = this.charts;
  85219. // 图表权重值处理
  85220. if (this.overlayWeightField) {
  85221. charts.sort(function (cs, ce) {
  85222. if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  85223. return 0;
  85224. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  85225. return -1;
  85226. } else if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  85227. return 1;
  85228. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  85229. if (parseFloat(cs["__overlayWeight"]) < parseFloat(ce["__overlayWeight"])) {
  85230. return 1;
  85231. } else {
  85232. return -1;
  85233. }
  85234. }
  85235. return 0;
  85236. });
  85237. }
  85238. // 不进行避让
  85239. if (!this.isOverLay) {
  85240. for (var m = 0, len_m = charts.length; m < len_m; m++) {
  85241. var chart_m = charts[m];
  85242. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  85243. var shapeROP_m = chart_m.resetLocation();
  85244. // 添加图形
  85245. var shapes_m = chart_m.shapes;
  85246. for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
  85247. shapes_m[n].refOriginalPosition = shapeROP_m;
  85248. this.renderer.addShape(shapes_m[n]);
  85249. }
  85250. }
  85251. } else {
  85252. // 压盖判断所需 chartsBounds 集合
  85253. var chartsBounds = [];
  85254. var extent = this.map.getView().calculateExtent();
  85255. var mapBounds = new Bounds(extent[0], extent[1], extent[2], extent[3]);
  85256. // 获取地图像素 bounds
  85257. var mapPxLT = this.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
  85258. var mapPxRB = this.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
  85259. var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
  85260. // 压盖处理 & 添加图形
  85261. for (var i = 0, len = charts.length; i < len; i++) {
  85262. var chart = charts[i];
  85263. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  85264. var shapeROP = chart.resetLocation();
  85265. // 图表框
  85266. var cbs = chart.chartBounds;
  85267. var cBounds = [{
  85268. "x": cbs.left,
  85269. "y": cbs.top
  85270. }, {
  85271. "x": cbs.left,
  85272. "y": cbs.bottom
  85273. }, {
  85274. "x": cbs.right,
  85275. "y": cbs.bottom
  85276. }, {
  85277. "x": cbs.right,
  85278. "y": cbs.top
  85279. }, {
  85280. "x": cbs.left,
  85281. "y": cbs.top
  85282. }];
  85283. // 地图范围外不绘制
  85284. if (mBounds) {
  85285. if (!this.isChartInMap(mBounds, cBounds)) {
  85286. continue;
  85287. }
  85288. }
  85289. // 是否压盖
  85290. var isOL = false;
  85291. if (i !== 0) {
  85292. for (let j = 0; j < chartsBounds.length; j++) {
  85293. //压盖判断
  85294. if (this.isQuadrilateralOverLap(cBounds, chartsBounds[j])) {
  85295. isOL = true;
  85296. break;
  85297. }
  85298. }
  85299. }
  85300. if (isOL) {
  85301. continue;
  85302. } else {
  85303. chartsBounds.push(cBounds);
  85304. }
  85305. // 添加图形
  85306. var shapes = chart.shapes;
  85307. for (let j = 0, slen = shapes.length; j < slen; j++) {
  85308. shapes[j].refOriginalPosition = shapeROP;
  85309. this.renderer.addShape(shapes[j]);
  85310. }
  85311. }
  85312. }
  85313. // 绘制图形
  85314. this.renderer.render();
  85315. }
  85316. /**
  85317. * @function Graph.prototype.getShapesByFeatureID
  85318. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  85319. * @param {number} featureID - 要素 ID。
  85320. */
  85321. getShapesByFeatureID(featureID) {
  85322. var list = [];
  85323. var shapeList = this.renderer.getAllShapes();
  85324. if (!featureID) {
  85325. return shapeList
  85326. }
  85327. for (var i = 0, len = shapeList.length; i < len; i++) {
  85328. var si = shapeList[i];
  85329. if (si.refDataID && featureID === si.refDataID) {
  85330. list.push(si);
  85331. }
  85332. }
  85333. return list;
  85334. }
  85335. /**
  85336. * @function Graph.prototype.isQuadrilateralOverLap
  85337. * @description 判断两个四边形是否有压盖。
  85338. * @param {Array.<Object>} quadrilateral - 四边形节点数组。
  85339. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  85340. */
  85341. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  85342. var quadLen = quadrilateral.length,
  85343. quad2Len = quadrilateral2.length;
  85344. if (quadLen !== 5 || quad2Len !== 5) {
  85345. return null;
  85346. } //不是四边形
  85347. var OverLap = false;
  85348. //如果两四边形互不包含对方的节点,则两个四边形不相交
  85349. for (let i = 0; i < quadLen; i++) {
  85350. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  85351. OverLap = true;
  85352. break;
  85353. }
  85354. }
  85355. for (let i = 0; i < quad2Len; i++) {
  85356. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  85357. OverLap = true;
  85358. break;
  85359. }
  85360. }
  85361. //加上两矩形十字相交的情况
  85362. for (let i = 0; i < quadLen - 1; i++) {
  85363. if (OverLap) {
  85364. break;
  85365. }
  85366. for (let j = 0; j < quad2Len - 1; j++) {
  85367. var isLineIn = Util_Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  85368. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  85369. OverLap = true;
  85370. break;
  85371. }
  85372. }
  85373. }
  85374. return OverLap;
  85375. }
  85376. /**
  85377. * @function Graph.prototype.isPointInPoly
  85378. * @description 判断一个点是否在多边形里面(射线法)。
  85379. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  85380. * @param {Array.<Object>} poly - 多边形节点数组。
  85381. */
  85382. isPointInPoly(pt, poly) {
  85383. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  85384. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  85385. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  85386. (isIn = !isIn);
  85387. }
  85388. return isIn;
  85389. }
  85390. /**
  85391. * @function Graph.prototype.isChartInMap
  85392. * @description 判断图表是否在地图里。
  85393. * @param {Bounds} mapPxBounds - 地图像素范围。
  85394. * @param {Array.<Object>} chartPxBounds - 图表范围的四边形节点数组。
  85395. */
  85396. isChartInMap(mapPxBounds, chartPxBounds) {
  85397. var mb = mapPxBounds;
  85398. var isIn = false;
  85399. for (var i = 0, len = chartPxBounds.length; i < len; i++) {
  85400. var cb = chartPxBounds[i];
  85401. if (cb.x >= mb.left && cb.x <= mb.right && cb.y >= mb.top && cb.y <= mb.bottom) {
  85402. isIn = true;
  85403. break;
  85404. }
  85405. }
  85406. return isIn;
  85407. }
  85408. /**
  85409. * @function Graph.prototype.clearCache
  85410. * @description 清除缓存。
  85411. */
  85412. clearCache() {
  85413. this.cache = {};
  85414. this.charts = [];
  85415. }
  85416. /**
  85417. * @function Graph.prototype.removeFeatures
  85418. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
  85419. * @param {Array.<FeatureVector>|FeatureVector|Function} features - 要删除的要素。
  85420. */
  85421. removeFeatures(features) {
  85422. this.clearCache();
  85423. super.removeFeatures(features);
  85424. }
  85425. /**
  85426. * @function Graph.prototype.removeAllFeatures
  85427. * @description 移除所有的要素。
  85428. */
  85429. removeAllFeatures() {
  85430. this.clearCache();
  85431. super.removeAllFeatures();
  85432. }
  85433. /**
  85434. * @function Graph.prototype.redraw
  85435. * @description 重绘该图层。
  85436. */
  85437. redraw() {
  85438. this.clearCache();
  85439. if (this.renderer) {
  85440. this.redrawThematicFeatures(this.map.getView().calculateExtent());
  85441. return true;
  85442. }
  85443. return false
  85444. }
  85445. /**
  85446. * @function Graph.prototype.clear
  85447. * @description 清除的内容包括数据(features)、专题要素、缓存。
  85448. */
  85449. clear() {
  85450. if (this.renderer) {
  85451. this.renderer.clearAll();
  85452. this.renderer.refresh();
  85453. }
  85454. this.removeAllFeatures();
  85455. this.clearCache();
  85456. }
  85457. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  85458. return theme_Theme_Theme.prototype.canvasFunctionInternal_.apply(this, arguments);
  85459. }
  85460. }
  85461. ;// CONCATENATED MODULE: external "ol.style.RegularShape"
  85462. const external_ol_style_RegularShape_namespaceObject = ol.style.RegularShape;
  85463. var external_ol_style_RegularShape_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_RegularShape_namespaceObject);
  85464. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/CloverShape.js
  85465. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85466. * This program are made available under the terms of the Apache License, Version 2.0
  85467. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85468. /**
  85469. * @class CloverShape
  85470. * @browsernamespace ol.style
  85471. * @category Visualization Graphic
  85472. * @classdesc 三叶草要素风格。
  85473. * @modulecategory Overlay
  85474. * @extends {ol.style.RegularShape}
  85475. * @param {Object} options - 三叶草形要素风格参数。
  85476. * @param {number} [options.angle=30] - 三叶草每个扇叶的圆心角,单位弧度。
  85477. * @param {number} [options.count=3] - 扇叶数量。
  85478. * @param {ol.style.Fill} [options.fill] - 填充样式。
  85479. * @param {number} [options.strokeOpacity] - 透明度。
  85480. * @param {number} [options.fillOpacity] - 填充透明度。
  85481. * @param {number} [options.radius] - 半径。
  85482. * @param {ol.style.Stroke} [options.stroke] - 边框样式。
  85483. * @param {string} [options.stroke.color='#3388ff'] - 边框颜色。
  85484. * @param {number} [options.stroke.width=1] - 边框宽度。
  85485. * @usage
  85486. */
  85487. class CloverShape extends (external_ol_style_RegularShape_default()) {
  85488. constructor(options) {
  85489. if (options.stroke) {
  85490. options.stroke.color = options.stroke.getColor() || "#3388ff";
  85491. options.stroke.width = options.stroke.getWidth() || 1;
  85492. } else {
  85493. options.stroke = new (external_ol_style_Stroke_default())({
  85494. color: "#3388ff",
  85495. width: 1
  85496. })
  85497. }
  85498. if (options.fill) {
  85499. options.fill.color = options.fill.getColor() || "#66ccff";
  85500. } else {
  85501. options.fill = new (external_ol_style_Fill_default())({
  85502. color: "#66ccff"
  85503. })
  85504. }
  85505. super({
  85506. angle: options.angle || 60,
  85507. stroke: options.stroke,
  85508. fill: options.fill,
  85509. radius: options.radius || 10,
  85510. rotation: options.rotation || 0
  85511. });
  85512. this.count_ = options.count || 3;
  85513. this.strokeOpacity = options.strokeOpacity || 1;
  85514. this.fillOpacity = options.fillOpacity || 1;
  85515. this._pixelRatio = window ? window.devicePixelRatio : 1;
  85516. this._canvas = this.getImage(this._pixelRatio);
  85517. this._ctx = this._canvas.getContext('2d');
  85518. this._render();
  85519. }
  85520. _render() {
  85521. //起始角度
  85522. var sAngle = 0;
  85523. var eAngle = this.getAngle();
  85524. this.spaceAngle = 360 / this.count_ - this.getAngle();
  85525. if (this.spaceAngle < 0) {
  85526. return;
  85527. }
  85528. this._ctx.setTransform(this._pixelRatio, 0, 0, this._pixelRatio, 0, 0);
  85529. this._ctx.translate(0, 0);
  85530. this._ctx.beginPath();
  85531. for (var i = 0; i < this.count_; i++) {
  85532. this._drawSector(this._ctx, this.getAnchor()[0], this.getAnchor()[1], this.getRadius(), sAngle, eAngle);
  85533. sAngle = eAngle + this.spaceAngle;
  85534. eAngle = sAngle + this.getAngle();
  85535. }
  85536. this._fillStroke();
  85537. this._ctx.closePath();
  85538. }
  85539. /**
  85540. * @function CloverShape.prototype.drawSector
  85541. * @description 绘制扇形。
  85542. * @param {CanvasRenderingContext2D} ctx - context 对象。
  85543. * @param {number} x - 中心点 x。
  85544. * @param {number} y - 中心点 y。
  85545. * @param {number} r - 中心点 r。
  85546. * @param {number} sAngle - 扇叶起始角度。
  85547. * @param {number} eAngle - 扇叶终止角度。
  85548. */
  85549. _drawSector(ctx, x, y, r, sAngle, eAngle) {
  85550. //角度转换
  85551. sAngle = sAngle / 180 * Math.PI;
  85552. eAngle = eAngle / 180 * Math.PI;
  85553. ctx.moveTo(x, y);
  85554. ctx.lineTo(x + r * Math.cos(sAngle), y + r * Math.sin(sAngle));
  85555. ctx.arc(x, y, r, sAngle, eAngle);
  85556. ctx.lineTo(x, y);
  85557. }
  85558. _fillStroke() {
  85559. if (this.getFill()) {
  85560. this._ctx.globalAlpha = this.fillOpacity;
  85561. this._ctx.fillStyle = this.getFill().color;
  85562. this._ctx.fill();
  85563. }
  85564. if (this.getStroke() && this.weight !== 0) {
  85565. this._ctx.globalAlpha = this.strokeOpacity;
  85566. this._ctx.lineWidth = this.getStroke().width;
  85567. this._ctx.strokeStyle = this.getStroke().color;
  85568. this._ctx.lineCap = this.getStroke().lineCap;
  85569. this._ctx.lineJoin = this.getStroke().lineJoin;
  85570. this._ctx.stroke();
  85571. }
  85572. }
  85573. /**
  85574. * @function CloverShape.prototype.getCount
  85575. * @description 获取扇叶数量。
  85576. */
  85577. getCount() {
  85578. return this.count_;
  85579. }
  85580. /**
  85581. * @function CloverShape.prototype.getSpaceAngle
  85582. * @description 获取扇叶间隔角度。
  85583. */
  85584. getSpaceAngle() {
  85585. return this.spaceAngle;
  85586. }
  85587. }
  85588. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/HitCloverShape.js
  85589. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85590. * This program are made available under the terms of the Apache License, Version 2.0
  85591. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85592. /**
  85593. * @class HitCloverShape
  85594. * @browsernamespace ol.style
  85595. * @category Visualization Graphic
  85596. * @classdesc 三叶草要素高亮风格。
  85597. * @modulecategory Overlay
  85598. * @extends {CloverShape}
  85599. * @param {Object} options - 三叶草形要素风格参数。
  85600. * @param {number} options.sAngle - 扇叶起始角度。
  85601. * @param {number} options.eAngle - 扇叶终止角度。
  85602. * @param {number} [options.angle = 30] - 三叶草每个扇叶的圆心角,单位弧度。
  85603. * @param {ol.style.Fill} [options.fill] - 填充样式。
  85604. * @param {ol.style.Stroke} [options.stroke] - 边框样式。
  85605. * @param {number} [options.strokeOpacity] - 透明度。
  85606. * @param {number} [options.fillOpacity] - 填充透明度。
  85607. * @param {number} [options.radius] - 半径。
  85608. * @usage
  85609. */
  85610. class HitCloverShape extends CloverShape {
  85611. constructor(options) {
  85612. super(options);
  85613. this.sAngle = options.sAngle;
  85614. this.eAngle = options.eAngle;
  85615. this._render();
  85616. }
  85617. _render() {
  85618. // draw the circle on the canvas
  85619. this._ctx.clearRect(0, 0, this.getImage().width, this.getImage().height);
  85620. // reset transform
  85621. this._ctx.setTransform(this._pixelRatio, 0, 0, this._pixelRatio, 0, 0);
  85622. this._ctx.translate(0, 0);
  85623. this._ctx.beginPath();
  85624. this._drawSector(this._ctx, this.getAnchor()[0], this.getAnchor()[1], this.getRadius(), this.sAngle, this.eAngle);
  85625. this._fillStroke();
  85626. this._ctx.closePath();
  85627. }
  85628. /**
  85629. * @function HitCloverShape.prototype.getSAngle
  85630. * @description 获取扇叶起始角度。
  85631. */
  85632. getSAngle() {
  85633. return this.sAngle;
  85634. }
  85635. /**
  85636. * @function HitCloverShape.prototype.getEAngle
  85637. * @description 获取扇叶终止角度。
  85638. */
  85639. getEAngle() {
  85640. return this.eAngle;
  85641. }
  85642. }
  85643. ;// CONCATENATED MODULE: external "ol.Object"
  85644. const external_ol_Object_namespaceObject = ol.Object;
  85645. var external_ol_Object_default = /*#__PURE__*/__webpack_require__.n(external_ol_Object_namespaceObject);
  85646. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/WebGLRenderer.js
  85647. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85648. * This program are made available under the terms of the Apache License, Version 2.0
  85649. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85650. const emptyFunc = () => false;
  85651. const CSS_TRANSFORM = (function () {
  85652. let div = document.createElement('div');
  85653. let props = [
  85654. 'transform',
  85655. 'WebkitTransform',
  85656. 'MozTransform',
  85657. 'OTransform',
  85658. 'msTransform'
  85659. ];
  85660. for (let i = 0; i < props.length; i++) {
  85661. let prop = props[i];
  85662. if (div.style[prop] !== undefined) {
  85663. return prop;
  85664. }
  85665. }
  85666. return props[0];
  85667. })();
  85668. /**
  85669. * @private
  85670. * @class GraphicWebGLRenderer
  85671. * @classdesc 高效率点图层 webgl 渲染器。
  85672. * @category Visualization Graphic
  85673. * @extends {ol.Object}
  85674. * @param {ol.source.Graphic} layer - 高效率点图层。
  85675. * @param {Object} options - 图层参数。
  85676. * @param {number} options.width - 地图宽度。
  85677. * @param {number} options.height - 地图高度。
  85678. * @param {HTMLElement} options.container - 放置渲染器的父元素。
  85679. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  85680. * @param {number} [options.radius=10] - 半径。
  85681. * @param {number} [options.opacity=0.8] - 不透明度。
  85682. * @param {Array} [options.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  85683. * @param {number} [options.radiusScale = 1] - 点放大倍数。
  85684. * @param {number} [options.radiusMinPixels = 0] - 半径最小值(像素)。
  85685. * @param {number} [options.radiusMaxPixels = Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  85686. * @param {number} [options.strokeWidth = 1] - 边框大小。
  85687. * @param {boolean} [options.outline = false] - 是否显示边框。
  85688. * @param {function} [options.onClick] - 点击事件。
  85689. * @param {function} [options.onHover] - 悬停事件。
  85690. */
  85691. class GraphicWebGLRenderer extends (external_ol_Object_default()) {
  85692. constructor(layer, options) {
  85693. super();
  85694. this.layer = layer;
  85695. this.map = layer.map;
  85696. let opt = options || {};
  85697. Util_Util.extend(this, opt);
  85698. let pixelRatio = this.pixelRatio = window ? window.devicePixelRatio : 1;
  85699. this.width = this.map.getSize()[0] * pixelRatio;
  85700. this.height = this.map.getSize()[1] * pixelRatio;
  85701. this.center = this.map.getView().getCenter();
  85702. this._initContainer();
  85703. this._registerEvents();
  85704. }
  85705. _registerEvents() {
  85706. let map = this.map;
  85707. let view = map.getView();
  85708. map.on('change:size', this._resizeEvent.bind(this), this);
  85709. view.on('change:resolution', this._moveEndEvent.bind(this), this);
  85710. view.on('change:center', this._moveEvent.bind(this), this);
  85711. view.on('change:rotation', this._moveEndEvent.bind(this), this);
  85712. map.on('moveend', this._moveEndEvent.bind(this), this)
  85713. }
  85714. _resizeEvent() {
  85715. this._resize();
  85716. this._clearAndRedraw();
  85717. }
  85718. _moveEvent() {
  85719. let oldCenterPixel = this.map.getPixelFromCoordinate(this.center);
  85720. let newCenterPixel = this.map.getPixelFromCoordinate(this.map.getView().getCenter());
  85721. let offset = [oldCenterPixel[0] - newCenterPixel[0], oldCenterPixel[1] - newCenterPixel[1]];
  85722. this._canvas.style[CSS_TRANSFORM] = 'translate(' + Math.round(offset[0]) + 'px,' + Math.round(offset[1]) + 'px)';
  85723. }
  85724. _moveEndEvent() {
  85725. this._canvas.style[CSS_TRANSFORM] = 'translate(0,0)';
  85726. this.center = this.map.getView().getCenter();
  85727. this._clearAndRedraw();
  85728. }
  85729. _clearAndRedraw() {
  85730. this._clearBuffer();
  85731. this.layer.changed();
  85732. }
  85733. _resize() {
  85734. const size = this.map.getSize();
  85735. const width = size[0] * this.pixelRatio;
  85736. const height = size[1] * this.pixelRatio;
  85737. this._canvas.width = width;
  85738. this._canvas.height = height;
  85739. this._canvas.style.width = width + 'px';
  85740. this._canvas.style.height = height + 'px';
  85741. }
  85742. _clearBuffer() {
  85743. if (!this.deckGL) {
  85744. return;
  85745. }
  85746. let lm = this.deckGL.layerManager;
  85747. lm && lm.context.gl.clear(lm.context.gl.COLOR_BUFFER_BIT);
  85748. return this;
  85749. }
  85750. /**
  85751. * @private
  85752. * @function GraphicWebGLRenderer.prototype.getCanvas
  85753. * @description 返回画布。
  85754. * @returns {HTMLCanvasElement} canvas 对象。
  85755. */
  85756. getCanvas() {
  85757. return this._canvas;
  85758. }
  85759. /**
  85760. * @private
  85761. * @function GraphicWebGLRenderer.prototype.update
  85762. * @description 更新图层,数据或者样式改变后调用。
  85763. */
  85764. update(graphics) {
  85765. if (graphics && graphics.length > -1) {
  85766. this._data = graphics;
  85767. }
  85768. if (!this._renderLayer) {
  85769. return;
  85770. }
  85771. this._renderLayer.setChangeFlags({
  85772. dataChanged: true,
  85773. propsChanged: true,
  85774. viewportChanged: true,
  85775. updateTriggersChanged: true
  85776. });
  85777. this._refreshData();
  85778. let state = this._getLayerState();
  85779. state.data = this._data || [];
  85780. this._renderLayer.setNeedsRedraw(true);
  85781. this._renderLayer.setState(state);
  85782. }
  85783. /**
  85784. * @private
  85785. * @function GraphicWebGLRenderer.prototype.drawGraphics
  85786. * @description 绘制点要素。
  85787. */
  85788. drawGraphics(graphics) {
  85789. this._data = graphics ? graphics : this._data ? this._data : [];
  85790. if (!this._renderLayer) {
  85791. this._createInnerRender();
  85792. }
  85793. this._clearBuffer();
  85794. this._draw();
  85795. }
  85796. _initContainer() {
  85797. this._canvas = this._createCanvas(this.width, this.height);
  85798. this._layerContainer = this.container;
  85799. this._wrapper = document.createElement('div');
  85800. this._wrapper.className = "deck-wrapper";
  85801. this._wrapper.style.position = "absolute";
  85802. this._wrapper.style.top = "0";
  85803. this._wrapper.style.left = "0";
  85804. this._wrapper.appendChild(this._canvas);
  85805. this._layerContainer && this._layerContainer.appendChild(this._wrapper);
  85806. }
  85807. _createCanvas(width, height) {
  85808. let canvas = document.createElement('canvas');
  85809. canvas.oncontextmenu = emptyFunc;
  85810. canvas.width = width;
  85811. canvas.height = height;
  85812. canvas.style.width = width + "px";
  85813. canvas.style.height = height + "px";
  85814. return canvas;
  85815. }
  85816. _createInnerRender() {
  85817. let me = this;
  85818. let state = this._getLayerState();
  85819. let {
  85820. color,
  85821. radius,
  85822. opacity,
  85823. highlightColor,
  85824. radiusScale,
  85825. radiusMinPixels,
  85826. radiusMaxPixels,
  85827. strokeWidth,
  85828. outline
  85829. } = state;
  85830. radius = this._pixelToMeter(radius);
  85831. let innerLayerOptions = {
  85832. id: 'scatter-plot',
  85833. data: [],
  85834. pickable: Boolean(this.onClick) || Boolean(this.onHover),
  85835. autoHighlight: true,
  85836. color: color,
  85837. opacity: opacity,
  85838. radius: radius,
  85839. radiusScale: radiusScale,
  85840. highlightColor: highlightColor,
  85841. radiusMinPixels: radiusMinPixels,
  85842. radiusMaxPixels: radiusMaxPixels,
  85843. strokeWidth: strokeWidth,
  85844. outline: outline,
  85845. getPosition(point) {
  85846. if (!point) {
  85847. return [0, 0, 0];
  85848. }
  85849. let geometry = point.getGeometry();
  85850. let coordinates = geometry && geometry.getCoordinates();
  85851. coordinates = me._project(coordinates);
  85852. return coordinates && [coordinates[0], coordinates[1], 0];
  85853. },
  85854. getColor(point) {
  85855. let defaultStyle = me._getLayerDefaultStyle();
  85856. let style = point && point.getStyle();
  85857. return style && style.getColor && style.getColor() || defaultStyle.color
  85858. },
  85859. getRadius(point) {
  85860. let defaultStyle = me._getLayerDefaultStyle();
  85861. let style = point && point.getStyle();
  85862. return style && style.getRadius && style.getRadius() || defaultStyle.radius
  85863. },
  85864. updateTriggers: {
  85865. getColor: [color],
  85866. getRadius: [radius]
  85867. }
  85868. };
  85869. me._renderLayer = new window.DeckGL.ScatterplotLayer(innerLayerOptions);
  85870. }
  85871. _getLayerDefaultStyle() {
  85872. let {
  85873. color,
  85874. opacity,
  85875. radius,
  85876. radiusScale,
  85877. radiusMinPixels,
  85878. radiusMaxPixels,
  85879. strokeWidth,
  85880. outline
  85881. } = this._getLayerState();
  85882. radius = this._pixelToMeter(radius);
  85883. return {
  85884. color,
  85885. opacity,
  85886. radius,
  85887. radiusScale,
  85888. radiusMinPixels,
  85889. radiusMaxPixels,
  85890. strokeWidth,
  85891. outline
  85892. }
  85893. }
  85894. _getLayerState() {
  85895. let state = this.layer.getLayerState();
  85896. let view = this.map.getView();
  85897. let projection = view.getProjection().getCode();
  85898. let center = external_ol_proj_namespaceObject.transform([state.longitude, state.latitude], projection, 'EPSG:4326')
  85899. state.longitude = center[0];
  85900. state.latitude = center[1];
  85901. state.zoom = state.zoom - 1;
  85902. return state;
  85903. }
  85904. _draw() {
  85905. this._refreshData();
  85906. let state = this._getLayerState();
  85907. state.data = this._data || [];
  85908. let deckOptions = {};
  85909. for (let key in state) {
  85910. deckOptions[key] = state[key];
  85911. }
  85912. this._renderLayer.setNeedsRedraw(true);
  85913. deckOptions.layers = [this._renderLayer];
  85914. deckOptions.canvas = this._canvas;
  85915. if (this.onBeforeRender) {
  85916. deckOptions.onBeforeRender = this.onBeforeRender.bind(this);
  85917. }
  85918. if (this.onAfterRender) {
  85919. deckOptions.onAfterRender = this.onAfterRender.bind(this);
  85920. }
  85921. if (!this.deckGL) {
  85922. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  85923. } else {
  85924. this.deckGL.setProps(deckOptions);
  85925. }
  85926. }
  85927. _refreshData() {
  85928. let graphics = this._data || [];
  85929. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  85930. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  85931. if (!this._renderLayer.props.data) {
  85932. this._renderLayer.props.data = [];
  85933. }
  85934. this._renderLayer.props.data.length = 0;
  85935. for (let j = 0; j < sGraphics.length; j++) {
  85936. this._renderLayer.props.data.push(sGraphics[j]);
  85937. }
  85938. this._data = this._renderLayer.props.data;
  85939. }
  85940. _project(coordinates) {
  85941. let view = this.map.getView();
  85942. let projection = view.getProjection().getCode();
  85943. if ("EPSG:4326" === projection) {
  85944. return coordinates;
  85945. }
  85946. return external_ol_proj_namespaceObject.transform(coordinates, projection, 'EPSG:4326');
  85947. }
  85948. _pixelToMeter(pixel) {
  85949. let view = this.map.getView();
  85950. let projection = view.getProjection();
  85951. let unit = projection.getUnits() || 'degrees';
  85952. if (unit === 'degrees') {
  85953. unit = Unit.DEGREE;
  85954. }
  85955. if (unit === 'm') {
  85956. unit = Unit.METER;
  85957. }
  85958. const res = view.getResolution();
  85959. if (unit === Unit.DEGREE) {
  85960. let meterRes= res*(Math.PI * 6378137 / 180);
  85961. return pixel * meterRes;
  85962. }else{
  85963. return pixel * res;
  85964. }
  85965. }
  85966. }
  85967. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/CanvasRenderer.js
  85968. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  85969. * This program are made available under the terms of the Apache License, Version 2.0
  85970. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85971. //获取某像素坐标点pixelP相对于中心center进行缩放scaleRatio倍后的像素点坐标。
  85972. function scale(pixelP, center, scaleRatio) {
  85973. let x = (pixelP[0] - center[0]) * scaleRatio + center[0];
  85974. let y = (pixelP[1] - center[1]) * scaleRatio + center[1];
  85975. return [x, y];
  85976. }
  85977. /**
  85978. * @private
  85979. * @class GraphicCanvasRenderer
  85980. * @classdesc 高效率点图层 canvas 渲染器。
  85981. * @category Visualization Graphic
  85982. * @extends {ol.Object}
  85983. * @param {Graphic} layer - 高效率点图层。
  85984. * @param {Object} options - 图层参数。
  85985. * @param {number} options.width - 地图宽度。
  85986. * @param {number} options.height - 地图高度。
  85987. * @param {HTMLElement} options.container - 放置渲染器的父元素。
  85988. * @param {Array.<number>} [options.colo=[0, 0, 0, 255]] - 颜色,目前只支持rgba数组。默认[0, 0, 0, 255],
  85989. * @param {number} [options.radius=10] - 半径。
  85990. * @param {number} [options.opacity=0.8] - 不透明度。
  85991. * @param {Array} [options.highlightColor] - 高亮颜色,目前只支持rgba数组。
  85992. * @param {number} [options.radiusScale] - 点放大倍数。
  85993. * @param {number} [options.radiusMinPixels] - 半径最小值(像素)。
  85994. * @param {number} [options.radiusMaxPixels] - 半径最大值(像素)。
  85995. * @param {number} [options.strokeWidth] - 边框大小。
  85996. * @param {boolean} [options.outline] - 是否显示边框。
  85997. * @param {function} [options.onClick] - 点击事件。
  85998. * @param {function} [options.onHover] - 悬停事件。
  85999. */
  86000. class GraphicCanvasRenderer extends (external_ol_Object_default()) {
  86001. constructor(layer, options) {
  86002. super();
  86003. this.layer = layer;
  86004. this.map = layer.map;
  86005. let opt = options || {};
  86006. Util_Util.extend(this, opt);
  86007. this.highLightStyle = this.layer.highLightStyle;
  86008. this.mapWidth = this.size[0] / this.pixelRatio;
  86009. this.mapHeight = this.size[1] / this.pixelRatio;
  86010. this.width = this.map.getSize()[0];
  86011. this.height = this.map.getSize()[1];
  86012. this.context = core_Util_Util.createCanvasContext2D(this.mapWidth, this.mapHeight);
  86013. this.context.scale(this.pixelRatio, this.pixelRatio);
  86014. this.canvas = this.context.canvas;
  86015. this.canvas.style.width = this.width + 'px';
  86016. this.canvas.style.height = this.height + 'px';
  86017. this._registerEvents();
  86018. }
  86019. _registerEvents() {
  86020. this.map.on('change:size', this._resizeEvent.bind(this), this);
  86021. }
  86022. _resizeEvent() {
  86023. this._resize();
  86024. this._clearAndRedraw();
  86025. }
  86026. _resize() {
  86027. let size = this.map.getSize();
  86028. let width = size[0];
  86029. let height = size[1];
  86030. let xRatio = width / this.width;
  86031. let yRatio = height / this.height;
  86032. this.width = width;
  86033. this.height = height;
  86034. this.mapWidth = this.mapWidth * xRatio;
  86035. this.mapHeight = this.mapHeight * yRatio;
  86036. this.canvas.width = this.mapWidth;
  86037. this.canvas.height = this.mapHeight;
  86038. this.canvas.style.width = this.width + 'px';
  86039. this.canvas.style.height = this.height + 'px';
  86040. }
  86041. _clearAndRedraw() {
  86042. this._clearBuffer();
  86043. this.layer.changed();
  86044. }
  86045. update() {
  86046. this.layer.changed();
  86047. }
  86048. _clearBuffer() {}
  86049. /**
  86050. * @private
  86051. * @function GraphicCanvasRenderer.prototype.getCanvas
  86052. * @description 返回画布。
  86053. * @returns {HTMLCanvasElement} canvas 对象。
  86054. */
  86055. getCanvas() {
  86056. return this.canvas;
  86057. }
  86058. /**
  86059. * @private
  86060. * @function GraphicCanvasRenderer.prototype.drawGraphics
  86061. * @description 绘制点要素。
  86062. */
  86063. drawGraphics(graphics) {
  86064. this.graphics_ = graphics || [];
  86065. let mapWidth = this.mapWidth;
  86066. let mapHeight = this.mapHeight;
  86067. let vectorContext = external_ol_render_namespaceObject.toContext(this.context, {
  86068. size: [mapWidth, mapHeight],
  86069. pixelRatio: this.pixelRatio
  86070. });
  86071. let defaultStyle = this.layer._getDefaultStyle();
  86072. let me = this,
  86073. layer = me.layer,
  86074. map = layer.map;
  86075. graphics.map(function (graphic) {
  86076. let style = graphic.getStyle() || defaultStyle;
  86077. if (me.selected === graphic) {
  86078. let defaultHighLightStyle = style;
  86079. if (style instanceof external_ol_style_namespaceObject.Circle) {
  86080. defaultHighLightStyle = new external_ol_style_namespaceObject.Circle({
  86081. radius: style.getRadius(),
  86082. fill: new external_ol_style_namespaceObject.Fill({
  86083. color: 'rgba(0, 153, 255, 1)'
  86084. }),
  86085. stroke: style.getStroke(),
  86086. snapToPixel: core_Util_Util.getOlVersion() === '4' ? style.getSnapToPixel() : null
  86087. });
  86088. } else if (style instanceof external_ol_style_namespaceObject.RegularShape) {
  86089. defaultHighLightStyle = new external_ol_style_namespaceObject.RegularShape({
  86090. radius: style.getRadius(),
  86091. radius2: style.getRadius2(),
  86092. points: style.getPoints(),
  86093. angle: style.getAngle(),
  86094. snapToPixel: core_Util_Util.getOlVersion() === '4' ? style.getSnapToPixel() : null,
  86095. rotation: style.getRotation(),
  86096. rotateWithView: style.getRotateWithView(),
  86097. fill: new external_ol_style_namespaceObject.Fill({
  86098. color: 'rgba(0, 153, 255, 1)'
  86099. }),
  86100. stroke: style.getStroke()
  86101. });
  86102. }
  86103. style = me.highLightStyle || defaultHighLightStyle;
  86104. }
  86105. vectorContext.setStyle(
  86106. new external_ol_style_namespaceObject.Style({
  86107. image: style
  86108. })
  86109. );
  86110. let geometry = graphic.getGeometry();
  86111. let coordinate = geometry.getCoordinates();
  86112. let center = map.getView().getCenter();
  86113. let mapCenterPx = map.getPixelFromCoordinate(center);
  86114. let resolution = map.getView().getResolution();
  86115. let x = (coordinate[0] - center[0]) / resolution;
  86116. let y = (center[1] - coordinate[1]) / resolution;
  86117. let scaledP = [x + mapCenterPx[0], y + mapCenterPx[1]];
  86118. scaledP = scale(scaledP, mapCenterPx, 1);
  86119. //处理放大或缩小级别*/
  86120. let result = [scaledP[0] + me.offset[0], scaledP[1] + me.offset[1]];
  86121. let pixelGeometry = new (external_ol_geom_Point_default())(result);
  86122. vectorContext.drawGeometry(pixelGeometry);
  86123. return graphic;
  86124. });
  86125. }
  86126. }
  86127. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/Graphic.js
  86128. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86129. * This program are made available under the terms of the Apache License, Version 2.0
  86130. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86131. /**
  86132. * @class OverlayGraphic
  86133. * @browsernamespace ol
  86134. * @aliasclass Graphic
  86135. * @category Visualization Graphic
  86136. * @classdesc 高效率点图层点要素类。
  86137. * @modulecategory Overlay
  86138. * @param {ol.geom.Point} geometry - 几何对象。
  86139. * @param {Object} [attributes] - 要素属性。
  86140. * @extends {ol.Object}
  86141. * @usage
  86142. */
  86143. class Graphic_Graphic extends (external_ol_Object_default()) {
  86144. constructor(geometry, attributes) {
  86145. super();
  86146. if (geometry instanceof (external_ol_geom_Geometry_default())) {
  86147. this.geometry_ = geometry;
  86148. }
  86149. this.attributes = attributes;
  86150. this.setStyle();
  86151. }
  86152. /**
  86153. * @function OverlayGraphic.prototype.clone
  86154. * @description 克隆当前要素。
  86155. * @returns {OverlayGraphic} 克隆后的要素。
  86156. */
  86157. clone() {
  86158. var clone = new Graphic_Graphic();
  86159. clone.setId(this.id);
  86160. clone.setGeometry(this.geometry_);
  86161. clone.setAttributes(this.attributes);
  86162. clone.setStyle(this.style_);
  86163. return clone;
  86164. }
  86165. /**
  86166. * @function OverlayGraphic.prototype.getId
  86167. * @description 获取当前 ID。
  86168. * @returns {string} ID。
  86169. */
  86170. getId() {
  86171. return this.id;
  86172. }
  86173. /**
  86174. * @function OverlayGraphic.prototype.setId
  86175. * @description 设置当前要素 ID。
  86176. * @param {string} id - 要素 ID。
  86177. */
  86178. setId(id) {
  86179. this.id = id;
  86180. }
  86181. /**
  86182. * @function OverlayGraphic.prototype.getGeometry
  86183. * @description 获取当前要素几何信息。
  86184. * @returns {ol.geom.Point} 要素几何信息。
  86185. */
  86186. getGeometry() {
  86187. return this.geometry_;
  86188. }
  86189. /**
  86190. * @function OverlayGraphic.prototype.setGeometry
  86191. * @description 设置当前要素几何信息。
  86192. * @param {ol.geom.Point} geometry - 要素几何信息。
  86193. */
  86194. setGeometry(geometry) {
  86195. this.geometry_ = geometry;
  86196. }
  86197. /**
  86198. * @function OverlayGraphic.prototype.setAttributes
  86199. * @description 设置要素属性。
  86200. * @param {Object} attributes - 属性对象。
  86201. */
  86202. setAttributes(attributes) {
  86203. this.attributes = attributes;
  86204. }
  86205. /**
  86206. * @function OverlayGraphic.prototype.getAttributes
  86207. * @description 获取要素属性。
  86208. * @returns {Object} 要素属性。
  86209. */
  86210. getAttributes() {
  86211. return this.attributes;
  86212. }
  86213. /**
  86214. * @function OverlayGraphic.prototype.getStyle
  86215. * @description 获取样式。
  86216. * @returns {ol.style.Image} ol.style.Image 子类样式对象。
  86217. */
  86218. getStyle() {
  86219. return this.style_;
  86220. }
  86221. /**
  86222. * @function OverlayGraphic.prototype.setStyle
  86223. * @description 设置样式。
  86224. * @param {ol.style.Image} style - 样式,ol/style/Image 子类样式对象。
  86225. */
  86226. setStyle(style) {
  86227. if (!this.style && !style) {
  86228. return;
  86229. }
  86230. this.style_ = style;
  86231. this.styleFunction_ = !style ?
  86232. undefined : Graphic_Graphic.createStyleFunction(new (external_ol_style_Style_default())({
  86233. image: style
  86234. }));
  86235. this.changed();
  86236. }
  86237. /**
  86238. * @function OverlayGraphic.prototype.getStyleFunction
  86239. * @description 获取样式函数。
  86240. * @returns {function} 样式函数。
  86241. */
  86242. getStyleFunction() {
  86243. return this.styleFunction_;
  86244. }
  86245. /**
  86246. * @function OverlayGraphic.createStyleFunction
  86247. * @description 新建样式函数。
  86248. * @param {Object} obj - 对象参数。
  86249. */
  86250. static createStyleFunction(obj) {
  86251. var styleFunction;
  86252. if (typeof obj === 'function') {
  86253. if (obj.length == 2) {
  86254. styleFunction = function (resolution) {
  86255. return (obj)(this, resolution);
  86256. };
  86257. } else {
  86258. styleFunction = obj;
  86259. }
  86260. } else {
  86261. var styles;
  86262. if (Array.isArray(obj)) {
  86263. styles = obj;
  86264. } else {
  86265. styles = [obj];
  86266. }
  86267. styleFunction = function () {
  86268. return styles;
  86269. };
  86270. }
  86271. return styleFunction;
  86272. }
  86273. /**
  86274. * @function OverlayGraphic.prototype.destroy
  86275. * @description 清除参数值。
  86276. */
  86277. destroy() {
  86278. this.id = null;
  86279. this.geometry_ = null;
  86280. this.attributes = null;
  86281. this.style_ = null;
  86282. }
  86283. }
  86284. ;// CONCATENATED MODULE: external "ol.geom.Polygon"
  86285. const external_ol_geom_Polygon_namespaceObject = ol.geom.Polygon;
  86286. var external_ol_geom_Polygon_default = /*#__PURE__*/__webpack_require__.n(external_ol_geom_Polygon_namespaceObject);
  86287. ;// CONCATENATED MODULE: external "ol.layer.Image"
  86288. const external_ol_layer_Image_namespaceObject = ol.layer.Image;
  86289. var external_ol_layer_Image_default = /*#__PURE__*/__webpack_require__.n(external_ol_layer_Image_namespaceObject);
  86290. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Graphic.js
  86291. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86292. * This program are made available under the terms of the Apache License, Version 2.0
  86293. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86294. const defaultProps = {
  86295. color: [0, 0, 0, 255],
  86296. opacity: 0.8,
  86297. radius: 10,
  86298. radiusScale: 1,
  86299. radiusMinPixels: 0,
  86300. radiusMaxPixels: Number.MAX_SAFE_INTEGER,
  86301. strokeWidth: 1,
  86302. outline: false
  86303. };
  86304. const Renderer = ['canvas', 'webgl'];
  86305. /**
  86306. * @class Graphic
  86307. * @browsernamespace ol.source
  86308. * @category Visualization Graphic
  86309. * @classdesc 高效率点图层源。
  86310. * @param {Object} options - 参数。
  86311. * @param {ol.Map} options.map - openlayers 地图对象。
  86312. * @param {OverlayGraphic} options.graphics - 高效率点图层点要素。
  86313. * @param {string} [options.render ='canvas'] - 指定使用的渲染器。可选值:"webgl","canvas"(webgl 渲染目前只支持散点)。
  86314. * @param {boolean} [options.isHighLight=true] - 事件响应是否支持要素高亮。
  86315. * @param {ol.style.Style} [options.highLightStyle=defaultHighLightStyle] - 高亮风格。
  86316. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 要素颜色。当 {@link OverlayGraphic} 的 style 参数传入设置了 fill 的 {@link HitCloverShape} 或 {@link CloverShape},此参数无效。
  86317. * @param {Array.<number>} [options.highlightColor] - webgl 渲染时要素高亮颜色。
  86318. * @param {number} [options.opacity=0.8] - 要素透明度。当 {@link OverlayGraphic} 的 style 参数传入设置了 fillOpacity 或 strokeOpacity 的 {@link HitCloverShape} 或 {@link CloverShape},此参数无效。
  86319. * @param {number} [options.radius=10] - 要素半径,单位像素。当 {@link OverlayGraphic} 的 style 参数传入设置了 radius 的 {@link HitCloverShape} 或 {@link CloverShape},此参数无效。
  86320. * @param {number} [options.radiusScale=1] - webgl 渲染时的要素放大倍数。
  86321. * @param {number} [options.radiusMinPixels=0] - webgl 渲染时的要素半径最小值(像素)。
  86322. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - webgl 渲染时的要素半径最大值(像素)。
  86323. * @param {number} [options.strokeWidth=1] - 边框大小。
  86324. * @param {boolean} [options.outline=false] - 是否显示边框。
  86325. * @param {function} [options.onHover] - 图层鼠标悬停响应事件(只有 webgl 渲染时有用)。
  86326. * @param {function} [options.onClick] - 图层鼠标点击响应事件(webgl、canvas 渲染时都有用)。
  86327. * @extends {ol.source.ImageCanvas}
  86328. * @usage
  86329. */
  86330. class Graphic extends (external_ol_source_ImageCanvas_default()) {
  86331. constructor(options) {
  86332. super({
  86333. attributions: options.attributions,
  86334. canvasFunction: canvasFunctionInternal_,
  86335. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  86336. projection: options.projection,
  86337. ratio: options.ratio,
  86338. resolutions: options.resolutions,
  86339. state: options.state
  86340. });
  86341. this.graphics = [].concat(options.graphics);
  86342. this.map = options.map;
  86343. Util_Util.extend(this, options);
  86344. this.render = options.render || Renderer[0];
  86345. if (!core_Util_Util.supportWebGL2()) {
  86346. this.render = Renderer[0];
  86347. }
  86348. this.highLightStyle = options.highLightStyle;
  86349. //是否支持高亮,默认支持
  86350. this.isHighLight = typeof options.isHighLight === 'undefined' ? true : options.isHighLight;
  86351. this.hitGraphicLayer = null;
  86352. this._forEachFeatureAtCoordinate = _forEachFeatureAtCoordinate;
  86353. this._options = options;
  86354. const me = this;
  86355. if (options.onClick) {
  86356. me.map.on('click', function(e) {
  86357. if (me.isDeckGLRender) {
  86358. const params = me.renderer.deckGL.pickObject({ x: e.pixel[0], y: e.pixel[1] });
  86359. options.onClick(params);
  86360. return;
  86361. }
  86362. const graphic = me.findGraphicByPixel(e, me);
  86363. if (graphic) {
  86364. options.onClick(graphic, e);
  86365. if (me.isHighLight) {
  86366. me._highLight(
  86367. graphic.getGeometry().getCoordinates(),
  86368. new (external_ol_style_Style_default())({
  86369. image: graphic.getStyle()
  86370. }).getImage(),
  86371. graphic,
  86372. e.pixel
  86373. );
  86374. }
  86375. }
  86376. });
  86377. }
  86378. me.map.on('pointermove', function(e) {
  86379. if (me.isDeckGLRender) {
  86380. const params = me.renderer.deckGL.pickObject({ x: e.pixel[0], y: e.pixel[1] });
  86381. if (options.onHover) {
  86382. options.onHover(params);
  86383. }
  86384. }
  86385. });
  86386. //eslint-disable-next-line no-unused-vars
  86387. function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) {
  86388. var mapWidth = size[0] / pixelRatio;
  86389. var mapHeight = size[1] / pixelRatio;
  86390. var width = me.map.getSize()[0];
  86391. var height = me.map.getSize()[1];
  86392. if (!me.renderer) {
  86393. me.renderer = createRenderer(size, pixelRatio);
  86394. }
  86395. me.renderer.mapWidth = mapWidth;
  86396. me.renderer.mapHeight = mapHeight;
  86397. me.renderer.pixelRatio = pixelRatio;
  86398. me.renderer.offset = [(mapWidth - width) / 2, (mapHeight - height) / 2];
  86399. let graphics = this.getGraphicsInExtent(extent);
  86400. me.renderer._clearBuffer();
  86401. me.renderer.selected = this.selected;
  86402. me.renderer.drawGraphics(graphics);
  86403. me.isDeckGLRender = me.renderer instanceof GraphicWebGLRenderer;
  86404. if(me.isDeckGLRender){
  86405. if (!me.context) {
  86406. me.context = core_Util_Util.createCanvasContext2D(mapWidth, mapHeight);
  86407. }
  86408. return me.context.canvas;
  86409. }
  86410. return me.renderer.getCanvas();
  86411. }
  86412. function createRenderer(size, pixelRatio) {
  86413. let renderer;
  86414. if (me.render === Renderer[0]) {
  86415. renderer = new GraphicCanvasRenderer(me, {
  86416. size,
  86417. pixelRatio
  86418. });
  86419. } else {
  86420. let optDefault = Util_Util.extend({}, defaultProps);
  86421. let opt = Util_Util.extend(optDefault, {
  86422. color: me.color,
  86423. opacity: me.opacity,
  86424. radius: me.radius,
  86425. radiusScale: me.radiusScale,
  86426. radiusMinPixels: me.radiusMinPixels,
  86427. radiusMaxPixels: me.radiusMaxPixels,
  86428. strokeWidth: me.strokeWidth,
  86429. outline: me.outline,
  86430. onClick: me.onClick,
  86431. onHover: me.onHover
  86432. });
  86433. opt = Util_Util.extend(me, opt);
  86434. opt.pixelRatio = pixelRatio;
  86435. opt.container = me.map.getViewport().getElementsByClassName('ol-overlaycontainer')[0];
  86436. opt.onBeforeRender = function() {
  86437. return false;
  86438. };
  86439. opt.onAfterRender = function() {
  86440. return false;
  86441. };
  86442. renderer = new GraphicWebGLRenderer(me, opt);
  86443. }
  86444. return renderer;
  86445. }
  86446. /**
  86447. * @private
  86448. * @function Graphic.prototype._forEachFeatureAtCoordinate
  86449. * @description 获取在视图上的要素。
  86450. * @param {string} coordinate -坐标。
  86451. * @param {number} resolution -分辨率。
  86452. * @param {RequestCallback} callback -回调函数。
  86453. * @param {ol.Pixel} evtPixel - 当前选中的屏幕像素坐标。
  86454. */
  86455. function _forEachFeatureAtCoordinate(coordinate, resolution, callback, evtPixel, e) {
  86456. let graphics = me.getGraphicsInExtent();
  86457. // FIX 无法高亮元素
  86458. me._highLightClose();
  86459. for (let i = graphics.length - 1; i >= 0; i--) {
  86460. let style = graphics[i].getStyle();
  86461. if (!style) {
  86462. return;
  86463. }
  86464. //已经被高亮的graphics 不被选选中
  86465. if (style instanceof HitCloverShape) {
  86466. continue;
  86467. }
  86468. let center = graphics[i].getGeometry().getCoordinates();
  86469. let image = new (external_ol_style_Style_default())({
  86470. image: style
  86471. }).getImage();
  86472. let contain = false;
  86473. //icl-1047 当只有一个叶片的时候,判断是否选中的逻辑处理的更准确一点
  86474. if (image instanceof CloverShape && image.getCount() === 1) {
  86475. const ratation = (image.getRotation() * 180) / Math.PI;
  86476. const angle = Number.parseFloat(image.getAngle());
  86477. const r = image.getRadius() * resolution;
  86478. //if(image.getAngle() )
  86479. let geo = null;
  86480. if (angle > 355) {
  86481. geo = new (external_ol_style_Circle_default())(center, r);
  86482. } else {
  86483. const coors = [];
  86484. coors.push(center);
  86485. const perAngle = angle / 8;
  86486. for (let index = 0; index < 8; index++) {
  86487. const radian = ((ratation + index * perAngle) / 180) * Math.PI;
  86488. coors.push([center[0] + r * Math.cos(radian), center[1] - r * Math.sin(radian)]);
  86489. }
  86490. coors.push(center);
  86491. geo = new (external_ol_geom_Polygon_default())([coors]);
  86492. }
  86493. if (geo.intersectsCoordinate(this.map.getCoordinateFromPixel(evtPixel))) {
  86494. contain = true;
  86495. }
  86496. } else {
  86497. let extent = [];
  86498. extent[0] = center[0] - image.getAnchor()[0] * resolution;
  86499. extent[2] = center[0] + image.getAnchor()[0] * resolution;
  86500. extent[1] = center[1] - image.getAnchor()[1] * resolution;
  86501. extent[3] = center[1] + image.getAnchor()[1] * resolution;
  86502. if (external_ol_extent_namespaceObject.containsCoordinate(extent, coordinate)) {
  86503. contain = true;
  86504. }
  86505. }
  86506. if (contain === true) {
  86507. if (callback) {
  86508. callback(graphics[i], e);
  86509. }
  86510. continue;
  86511. }
  86512. // if (me.isHighLight) {
  86513. // // me._highLightClose();
  86514. // }
  86515. }
  86516. return undefined;
  86517. }
  86518. }
  86519. findGraphicByPixel(e, me) {
  86520. const features = me.map.getFeaturesAtPixel(e.pixel) || [];
  86521. for (let index = 0; index < features.length; index++) {
  86522. const graphic = features[index];
  86523. if (me.graphics.indexOf(graphic) > -1) {
  86524. return graphic;
  86525. }
  86526. }
  86527. return undefined;
  86528. }
  86529. /**
  86530. * @function Graphic.prototype.setGraphics
  86531. * @description 设置绘制的点要素,会覆盖之前的所有要素。
  86532. * @param {Array.<OverlayGraphic>} graphics - 点要素对象数组。
  86533. */
  86534. setGraphics(graphics) {
  86535. this.graphics = this.graphics || [];
  86536. this.graphics.length = 0;
  86537. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  86538. this.graphics = [].concat(sGraphics);
  86539. this.update();
  86540. }
  86541. /**
  86542. * @function Graphic.prototype.addGraphics
  86543. * @description 追加点要素,不会覆盖之前的要素。
  86544. * @param {Array.<OverlayGraphic>} graphics - 点要素对象数组。
  86545. */
  86546. addGraphics(graphics) {
  86547. this.graphics = this.graphics || [];
  86548. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  86549. this.graphics = this.graphics.concat(sGraphics);
  86550. this.update();
  86551. }
  86552. /**
  86553. * @function Graphic.prototype.getGraphicBy
  86554. * @description 在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
  86555. * @param {string} property - graphic 的属性名称。
  86556. * @param {string} value - property 所对应的值。
  86557. * @returns {OverlayGraphic} 一个匹配的 graphic。
  86558. */
  86559. getGraphicBy(property, value) {
  86560. let graphic = null;
  86561. for (let index in this.graphics) {
  86562. if (this.graphics[index][property] === value) {
  86563. graphic = this.graphics[index];
  86564. break;
  86565. }
  86566. }
  86567. return graphic;
  86568. }
  86569. /**
  86570. * @function Graphic.prototype.getGraphicById
  86571. * @description 通过给定一个 ID,返回对应的矢量要素。
  86572. * @param {string} graphicId - 矢量要素的属性 ID。
  86573. * @returns {OverlayGraphic} 一个匹配的 graphic。
  86574. */
  86575. getGraphicById(graphicId) {
  86576. return this.getGraphicBy('id', graphicId);
  86577. }
  86578. /**
  86579. * @function Graphic.prototype.getGraphicsByAttribute
  86580. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  86581. * @param {string} attrName - graphic 的某个属性名称。
  86582. * @param {string} attrValue - property 所对应的值。
  86583. * @returns {Array.<OverlayGraphic>} 一个匹配的 graphic 数组。
  86584. */
  86585. getGraphicsByAttribute(attrName, attrValue) {
  86586. var graphic,
  86587. foundgraphics = [];
  86588. for (let index in this.graphics) {
  86589. graphic = this.graphics[index];
  86590. if (graphic && graphic.attributes) {
  86591. if (graphic.attributes[attrName] === attrValue) {
  86592. foundgraphics.push(graphic);
  86593. }
  86594. }
  86595. }
  86596. return foundgraphics;
  86597. }
  86598. /**
  86599. * @function Graphic.prototype.removeGraphics
  86600. * @description 删除要素数组,默认将删除所有要素。
  86601. * @param {Array.<OverlayGraphic>} [graphics] - 删除的 graphics 数组。
  86602. */
  86603. removeGraphics(graphics = null) {
  86604. //当 graphics 为 null 、为空数组,或 === this.graphics,则清除所有要素
  86605. if (!graphics || graphics.length === 0 || graphics === this.graphics) {
  86606. this.graphics.length = 0;
  86607. this.update();
  86608. return;
  86609. }
  86610. if (!Util_Util.isArray(graphics)) {
  86611. graphics = [graphics];
  86612. }
  86613. for (let i = graphics.length - 1; i >= 0; i--) {
  86614. let graphic = graphics[i];
  86615. //如果我们传入的grapchic在graphics数组中没有的话,则不进行删除,
  86616. //并将其放入未删除的数组中。
  86617. let findex = Util_Util.indexOf(this.graphics, graphic);
  86618. if (findex === -1) {
  86619. continue;
  86620. }
  86621. this.graphics.splice(findex, 1);
  86622. }
  86623. //删除完成后重新设置 setGraphics,以更新
  86624. this.update();
  86625. }
  86626. /**
  86627. * @function Graphic.prototype.clear
  86628. * @description 释放图层资源。
  86629. */
  86630. clear() {
  86631. this.removeGraphics();
  86632. }
  86633. /**
  86634. * @function Graphic.prototype.update
  86635. * @description 更新图层。
  86636. */
  86637. update() {
  86638. this.renderer.update(this.graphics, this._getDefaultStyle());
  86639. }
  86640. _getDefaultStyle() {
  86641. const target = {};
  86642. if (this.color) {
  86643. target.fill = new (external_ol_style_Fill_default())({
  86644. color: this.toRGBA(this.color)
  86645. });
  86646. }
  86647. if (this.radius) {
  86648. target.radius = this.radius;
  86649. }
  86650. if (this.outline) {
  86651. target.stroke = new (external_ol_style_Fill_default())({
  86652. color: this.toRGBA(this.color),
  86653. width: this.strokeWidth
  86654. });
  86655. }
  86656. return new (external_ol_style_Circle_default())(target);
  86657. }
  86658. toRGBA(colorArray) {
  86659. return `rgba(${colorArray[0]},${colorArray[1]},${colorArray[2]},${(colorArray[3] || 255) / 255})`;
  86660. }
  86661. /**
  86662. * @function Graphic.prototype.setStyle
  86663. * @description 设置图层要素整体样式(接口仅在 webgl 渲染时有用)。
  86664. * @param {Object} styleOptions - 样式对象。
  86665. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  86666. * @param {number} [styleOptions.radius=10] - 点半径。
  86667. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  86668. * @param {Array} [styleOptions.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  86669. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  86670. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  86671. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  86672. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  86673. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  86674. */
  86675. setStyle(styleOptions) {
  86676. let self = this;
  86677. let styleOpt = {
  86678. color: self.color,
  86679. radius: self.radius,
  86680. opacity: self.opacity,
  86681. highlightColor: self.highlightColor,
  86682. radiusScale: self.radiusScale,
  86683. radiusMinPixels: self.radiusMinPixels,
  86684. radiusMaxPixels: self.radiusMaxPixels,
  86685. strokeWidth: self.strokeWidth,
  86686. outline: self.outline
  86687. };
  86688. Util_Util.extend(self, Util_Util.extend(styleOpt, styleOptions));
  86689. self.update();
  86690. }
  86691. /**
  86692. * @function Graphic.prototype.getLayerState
  86693. * @description 获取当前地图及图层状态。
  86694. * @returns {Object} 地图及图层状态,包含地图状态信息和本图层相关状态。
  86695. */
  86696. getLayerState() {
  86697. let map = this.map;
  86698. let width = map.getSize()[0];
  86699. let height = map.getSize()[1];
  86700. let view = map.getView();
  86701. let center = view.getCenter();
  86702. let longitude = center[0];
  86703. let latitude = center[1];
  86704. let zoom = view.getZoom();
  86705. let maxZoom = view.getMaxZoom();
  86706. let rotationRadians = view.getRotation();
  86707. let rotation = (-rotationRadians * 180) / Math.PI;
  86708. let mapViewport = {
  86709. longitude: longitude,
  86710. latitude: latitude,
  86711. zoom: zoom,
  86712. maxZoom: maxZoom,
  86713. pitch: 0,
  86714. bearing: rotation
  86715. };
  86716. let state = {};
  86717. for (let key in mapViewport) {
  86718. state[key] = mapViewport[key];
  86719. }
  86720. state.width = width;
  86721. state.height = height;
  86722. state.color = this.color;
  86723. state.radius = this.radius;
  86724. state.opacity = this.opacity;
  86725. state.highlightColor = this.highlightColor;
  86726. state.radiusScale = this.radiusScale;
  86727. state.radiusMinPixels = this.radiusMinPixels;
  86728. state.radiusMaxPixels = this.radiusMaxPixels;
  86729. state.strokeWidth = this.strokeWidth;
  86730. state.outline = this.outline;
  86731. return state;
  86732. }
  86733. /**
  86734. * @function Graphic.prototype._highLightClose
  86735. * @description 关闭高亮要素显示。
  86736. * @private
  86737. */
  86738. _highLightClose() {
  86739. this.selected = null;
  86740. if (this.hitGraphicLayer) {
  86741. this.map.removeLayer(this.hitGraphicLayer);
  86742. this.hitGraphicLayer = null;
  86743. }
  86744. this.changed();
  86745. }
  86746. /**
  86747. * @function Graphic.prototype._highLight
  86748. * @description 高亮显示选中要素。
  86749. * @param {Array.<number>} center - 中心点。
  86750. * @param {ol.style.Style} image - 点样式。
  86751. * @param {OverlayGraphic} selectGraphic - 高效率点图层点要素。
  86752. * @param {ol.Pixel} evtPixel - 当前选中的屏幕像素坐标。
  86753. * @private
  86754. */
  86755. _highLight(center, image, selectGraphic, evtPixel) {
  86756. if (selectGraphic.getStyle() instanceof CloverShape) {
  86757. if (this.hitGraphicLayer) {
  86758. this.map.removeLayer(this.hitGraphicLayer);
  86759. this.hitGraphicLayer = null;
  86760. }
  86761. var pixel = this.map.getPixelFromCoordinate([center[0], center[1]]);
  86762. //点击点与中心点的角度
  86763. evtPixel = evtPixel || [0, 0];
  86764. var angle = (Math.atan2(evtPixel[1] - pixel[1], evtPixel[0] - pixel[0]) / Math.PI) * 180;
  86765. angle = angle > 0 ? angle : 360 + angle;
  86766. //确定扇叶
  86767. var index = Math.ceil(angle / (image.getAngle() + image.getSpaceAngle()));
  86768. //扇叶的起始角度
  86769. var sAngle = (index - 1) * (image.getAngle() + image.getSpaceAngle());
  86770. //渲染参数
  86771. var opts = {
  86772. stroke: new (external_ol_style_Stroke_default())({
  86773. color: '#ff0000',
  86774. width: 1
  86775. }),
  86776. fill: new (external_ol_style_Fill_default())({
  86777. color: '#0099ff'
  86778. }),
  86779. radius: image.getRadius(),
  86780. angle: image.getAngle(),
  86781. eAngle: sAngle + image.getAngle(),
  86782. sAngle: sAngle,
  86783. rotation: image.getRotation()
  86784. };
  86785. if (this.highLightStyle && this.highLightStyle instanceof HitCloverShape) {
  86786. opts.stroke = this.highLightStyle.getStroke();
  86787. opts.fill = this.highLightStyle.getFill();
  86788. opts.radius = this.highLightStyle.getRadius();
  86789. opts.angle = this.highLightStyle.getAngle();
  86790. }
  86791. var hitGraphic = new Graphic_Graphic(new (external_ol_geom_Point_default())(center));
  86792. hitGraphic.setStyle(new HitCloverShape(opts));
  86793. this.hitGraphicLayer = new (external_ol_layer_Image_default())({
  86794. source: new Graphic({
  86795. map: this.map,
  86796. graphics: [hitGraphic]
  86797. })
  86798. });
  86799. this.map.addLayer(this.hitGraphicLayer);
  86800. } else {
  86801. this.selected = selectGraphic;
  86802. this.changed();
  86803. }
  86804. }
  86805. /**
  86806. * @function Graphic.prototype.getGraphicsInExtent
  86807. * @description 在指定范围中获取几何要素面积。
  86808. * @param {Object} extent - 长度范围。
  86809. */
  86810. getGraphicsInExtent(extent) {
  86811. var graphics = [];
  86812. if (!extent) {
  86813. this.graphics.forEach(graphic => {
  86814. graphics.push(graphic);
  86815. });
  86816. return graphics;
  86817. }
  86818. this.graphics.forEach(graphic => {
  86819. if (external_ol_extent_namespaceObject.containsExtent(extent, graphic.getGeometry().getExtent())) {
  86820. graphics.push(graphic);
  86821. }
  86822. });
  86823. return graphics;
  86824. }
  86825. }
  86826. ;// CONCATENATED MODULE: ./src/openlayers/overlay/theme/GeoFeature.js
  86827. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  86828. * This program are made available under the terms of the Apache License, Version 2.0
  86829. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  86830. /**
  86831. * @class GeoFeature
  86832. * @browsernamespace ol.source
  86833. * @category Visualization Theme
  86834. * @classdesc 地理几何专题要素型专题图层基类。
  86835. * @param {string} name - 图层名称。
  86836. * @param {Object} opt_options - 参数。
  86837. * @param {ol.Map} opt_options.map - 当前 OpenLayers Map 对象。
  86838. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  86839. * @param {number} [opt_options.opacity=1] - 图层透明度。
  86840. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  86841. * @param {ol.proj.Projection} [opt_options.projection] - 投影信息。
  86842. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
  86843. * @param {Array} [opt_options.resolutions] - 分辨率数组。
  86844. * @param {ol.source.State} [opt_options.state] - 资源状态。
  86845. * @param {Object} [opt_options.style] - 专题图样式。
  86846. * @param {Object} [opt_options.styleGroups] - 各专题类型样式组。
  86847. * @param {boolean} [opt_options.isHoverAble=false] - 是否开启 hover 事件。
  86848. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  86849. * @param {(string|Object)} [opt_options.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  86850. * @extends {Theme}
  86851. * @usage
  86852. */
  86853. class GeoFeature extends theme_Theme_Theme {
  86854. constructor(name, opt_options) {
  86855. super(name, opt_options);
  86856. this.cache = opt_options.cache || {};
  86857. this.cacheFields = opt_options.cacheFields || [];
  86858. this.style = opt_options.style || {};
  86859. this.maxCacheCount = opt_options.maxCacheCount || 0;
  86860. this.isCustomSetMaxCacheCount = opt_options.isCustomSetMaxCacheCount === undefined ? false : opt_options.isCustomSetMaxCacheCount;
  86861. this.nodesClipPixel = opt_options.nodesClipPixel || 2;
  86862. this.isHoverAble = opt_options.isHoverAble === undefined ? false : opt_options.isHoverAble;
  86863. this.isMultiHover = opt_options.isMultiHover === undefined ? false : opt_options.isMultiHover;
  86864. this.isClickAble = opt_options.isClickAble === undefined ? true : opt_options.isClickAble;
  86865. this.highlightStyle = opt_options.highlightStyle || null;
  86866. this.isAllowFeatureStyle = opt_options.isAllowFeatureStyle === undefined ? false : opt_options.isAllowFeatureStyle;
  86867. }
  86868. /**
  86869. * @function GeoFeature.prototype.destroy
  86870. * @description 释放资源,将引用资源的属性置空。
  86871. */
  86872. destroy() {
  86873. this.maxCacheCount = null;
  86874. this.isCustomSetMaxCacheCount = null;
  86875. this.nodesClipPixel = null;
  86876. this.isHoverAble = null;
  86877. this.isMultiHover = null;
  86878. this.isClickAble = null;
  86879. this.cache = null;
  86880. this.cacheFields = null;
  86881. this.style = null;
  86882. this.highlightStyle = null;
  86883. this.isAllowFeatureStyle = null;
  86884. }
  86885. /**
  86886. * @function GeoFeature.prototype.addFeatures
  86887. * @description 添加要素。
  86888. * @param {(Array.<ThemeFeature>|Array.<GeoJSONObject>|Array.<ol.Feature>|ThemeFeature|GeoJSONObject|ol.Feature)} features - 要素对象。
  86889. */
  86890. addFeatures(features) {
  86891. this.dispatchEvent({type: 'beforefeaturesadded', value: {features: features}});
  86892. //转换 features 形式
  86893. this.features = this.toiClientFeature(features);
  86894. if (!this.isCustomSetMaxCacheCount) {
  86895. this.maxCacheCount = this.features.length * 5;
  86896. }
  86897. //绘制专题要素
  86898. if (this.renderer) {
  86899. this.changed();
  86900. }
  86901. }
  86902. /**
  86903. * @function GeoFeature.prototype.removeFeatures
  86904. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  86905. * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 待删除的要素对象或用于过滤的回调函数。
  86906. */
  86907. removeFeatures(features) { // eslint-disable-line no-unused-vars
  86908. this.clearCache();
  86909. theme_Theme_Theme.prototype.removeFeatures.call(this, features);
  86910. }
  86911. /**
  86912. * @function GeoFeature.prototype.removeAllFeatures
  86913. * @description 清除当前图层所有的矢量要素。
  86914. */
  86915. removeAllFeatures() {
  86916. this.clearCache();
  86917. theme_Theme_Theme.prototype.removeAllFeatures.apply(this, arguments);
  86918. }
  86919. /**
  86920. * @function GeoFeature.prototype.redrawThematicFeatures
  86921. * @description 重绘所有专题要素。
  86922. * @param {Object} extent - 视图范围数据。
  86923. */
  86924. redrawThematicFeatures(extent) {
  86925. //获取高亮专题要素对应的用户 id
  86926. var hoverone = this.renderer.getHoverOne();
  86927. var hoverFid = null;
  86928. if (hoverone && hoverone.refDataID) {
  86929. hoverFid = hoverone.refDataID;
  86930. }
  86931. //清除当前所有可视元素
  86932. this.renderer.clearAll();
  86933. var features = this.features;
  86934. var cache = this.cache;
  86935. var cacheFields = this.cacheFields;
  86936. var cmZoom = this.map.getView().getZoom();
  86937. var maxCC = this.maxCacheCount;
  86938. for (var i = 0, len = features.length; i < len; i++) {
  86939. var feature = features[i];
  86940. if (!feature.geometry) {
  86941. continue;
  86942. }
  86943. var feaBounds = feature.geometry.getBounds();
  86944. //剔除当前视图(地理)范围以外的数据
  86945. if (extent) {
  86946. var bounds = new Bounds(extent[0], extent[1], extent[2], extent[3]);
  86947. if (!bounds.intersectsBounds(feaBounds)) {
  86948. continue;
  86949. }
  86950. }
  86951. //缓存字段
  86952. var fields = feature.id + "_zoom_" + cmZoom.toString();
  86953. var thematicFeature;
  86954. //判断专题要素缓存是否存在
  86955. if (cache[fields]) {
  86956. cache[fields].updateAndAddShapes();
  86957. } else {
  86958. //如果专题要素缓存不存在,创建专题要素
  86959. thematicFeature = this.createThematicFeature(features[i]);
  86960. //检查 thematicFeature 是否有可视化图形
  86961. if (thematicFeature.getShapesCount() < 1) {
  86962. continue;
  86963. }
  86964. //加入缓存
  86965. cache[fields] = thematicFeature;
  86966. cacheFields.push(fields);
  86967. //缓存数量限制
  86968. if (cacheFields.length > maxCC) {
  86969. var fieldsTemp = cacheFields[0];
  86970. cacheFields.splice(0, 1);
  86971. delete cache[fieldsTemp];
  86972. }
  86973. }
  86974. }
  86975. this.renderer.render();
  86976. //地图漫游后,重新高亮图形
  86977. if (hoverFid && this.isHoverAble && this.isMultiHover) {
  86978. var hShapes = this.getShapesByFeatureID(hoverFid);
  86979. this.renderer.updateHoverShapes(hShapes);
  86980. }
  86981. }
  86982. /**
  86983. * @function GeoFeature.prototype.createThematicFeature
  86984. * @description 创建专题要素。
  86985. * @param {Object} feature - 要素对象。
  86986. * @returns {Array.<FeatureVector>} 返回矢量要素。
  86987. */
  86988. createThematicFeature(feature) {
  86989. var style = Util_Util.copyAttributesWithClip(this.style);
  86990. if (feature.style && this.isAllowFeatureStyle === true) {
  86991. style = Util_Util.copyAttributesWithClip(feature.style);
  86992. }
  86993. //创建专题要素时的可选参数
  86994. var options = {};
  86995. options.nodesClipPixel = this.nodesClipPixel;
  86996. options.isHoverAble = this.isHoverAble;
  86997. options.isMultiHover = this.isMultiHover;
  86998. options.isClickAble = this.isClickAble;
  86999. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  87000. //将数据转为专题要素(Vector)
  87001. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  87002. //直接添加图形到渲染器
  87003. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  87004. this.renderer.addShape(thematicFeature.shapes[m]);
  87005. }
  87006. return thematicFeature;
  87007. }
  87008. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  87009. return theme_Theme_Theme.prototype.canvasFunctionInternal_.apply(this, arguments);
  87010. }
  87011. /**
  87012. * @function GeoFeature.prototype.clearCache
  87013. * @description 清除缓存。
  87014. */
  87015. clearCache() {
  87016. this.cache = {};
  87017. this.cacheFields = [];
  87018. }
  87019. /**
  87020. * @function GeoFeature.prototype.clear
  87021. * @description 清除的内容包括数据(features)、专题要素、缓存。
  87022. */
  87023. clear() {
  87024. this.renderer.clearAll();
  87025. this.renderer.refresh();
  87026. this.removeAllFeatures();
  87027. this.clearCache();
  87028. }
  87029. /**
  87030. * @function GeoFeature.prototype.getCacheCount
  87031. * @description 获取当前缓存数量。
  87032. * @returns {number} 返回当前缓存数量。
  87033. */
  87034. getCacheCount() {
  87035. return this.cacheFields.length;
  87036. }
  87037. /**
  87038. * @function GeoFeature.prototype.setMaxCacheCount
  87039. * @param {number} cacheCount - 缓存总数。
  87040. * @description 设置最大缓存条数。
  87041. */
  87042. setMaxCacheCount(cacheCount) {
  87043. if (!isNaN(cacheCount)) {
  87044. this.maxCacheCount = cacheCount;
  87045. this.isCustomSetMaxCacheCount = true;
  87046. }
  87047. }
  87048. /**
  87049. * @function GeoFeature.prototype.getShapesByFeatureID
  87050. * @param {number} featureID - 要素 ID。
  87051. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  87052. * @returns {Array} 返回图形数组。
  87053. */
  87054. getShapesByFeatureID(featureID) {
  87055. var list = [];
  87056. var shapeList = this.renderer.getAllShapes();
  87057. if (!featureID) {
  87058. return shapeList
  87059. }
  87060. for (var i = 0, len = shapeList.length; i < len; i++) {
  87061. var si = shapeList[i];
  87062. if (si.refDataID && featureID === si.refDataID) {
  87063. list.push(si);
  87064. }
  87065. }
  87066. return list;
  87067. }
  87068. }
  87069. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Label.js
  87070. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87071. * This program are made available under the terms of the Apache License, Version 2.0
  87072. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87073. /**
  87074. * @class Label
  87075. * @browsernamespace ol.source
  87076. * @category Visualization Theme
  87077. * @classdesc 标签专题图图层源。
  87078. * @modulecategory Overlay
  87079. * @param {string} name - 名称。
  87080. * @param {Object} opt_options - 参数。
  87081. * @param {ol.Map} opt_options.map - 当前 Map 对象。
  87082. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  87083. * @param {number} [opt_options.opacity=1] - 图层透明度。
  87084. * @param {string|Object} [opt_options.attributions] - 版权信息。
  87085. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  87086. * @param {ol.proj.Projection} [opt_options.projection] - 投影信息。
  87087. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是1或更高。
  87088. * @param {Array.<number>} [opt_options.resolutions] - 分辨率数组。
  87089. * @param {ol.source.State} [opt_options.state] - 资源状态。
  87090. * @param {string} [opt_options.themeField] - 指定创建专题图字段。
  87091. * @param {Object} [opt_options.style] - 专题图样式。
  87092. * @param {Object} [opt_options.styleGroups] - 各专题类型样式组。
  87093. * @param {boolean} [opt_options.isHoverAble = false] - 是否开启 hover 事件。
  87094. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  87095. * @extends {GeoFeature}
  87096. * @usage
  87097. */
  87098. class Label_Label extends GeoFeature {
  87099. constructor(name, opt_options) {
  87100. super(name, opt_options);
  87101. this.isOverLay = opt_options.isOverLay != null ? opt_options.isOverLay : true;
  87102. this.isAvoid = opt_options.isAvoid != null ? opt_options.isAvoid : true;
  87103. this.style = opt_options.style;
  87104. this.themeField = opt_options.themeField;
  87105. this.styleGroups = opt_options.styleGroups;
  87106. this.defaultStyle = {
  87107. //默认文本样式
  87108. fontColor: "#000000",
  87109. fontOpacity: 1,
  87110. fontSize: "12px",
  87111. fontStyle: "normal",
  87112. fontWeight: "normal",
  87113. labelAlign: "cm",
  87114. labelXOffset: 0,
  87115. labelYOffset: 0,
  87116. labelRotation: 0,
  87117. //默认背景框样式
  87118. fill: false,
  87119. fillColor: "#ee9900",
  87120. fillOpacity: 0.4,
  87121. stroke: false,
  87122. strokeColor: "#ee9900",
  87123. strokeOpacity: 1,
  87124. strokeWidth: 1,
  87125. strokeLinecap: "round",
  87126. strokeDashstyle: "solid",
  87127. //对用户隐藏但必须保持此值的属性
  87128. //cursor: "pointer",
  87129. labelSelect: true,
  87130. //用 _isGeoTextStrategyStyle 标记此style,携带此类style的要素特指GeoText策略中的标签要素
  87131. _isGeoTextStrategyStyle: true
  87132. };
  87133. //获取标签像素 bounds 的方式。0 - 表示通过文本类容和文本风格计算获取像素范围,现在支持中文、英文; 1 - 表示通过绘制的文本标签获取像素范围,支持各个语种的文字范围获取,但性能消耗较大(尤其是采用SVG渲染)。默认值为0。
  87134. this.getPxBoundsMode = 0;
  87135. this.labelFeatures = [];
  87136. }
  87137. /**
  87138. * @function Label.prototype.destroy
  87139. * @description 释放资源,将引用资源的属性置空。
  87140. */
  87141. destroy() {
  87142. this.style = null;
  87143. this.themeField = null;
  87144. this.styleGroups = null;
  87145. super.destroy();
  87146. }
  87147. /**
  87148. * @private
  87149. * @function Label.prototype.createThematicFeature
  87150. * @description 创建专题要素。
  87151. * @param {FeatureVector} feature - 矢量要素。
  87152. * @returns {FeatureThemeVector} 专题图矢量要素。
  87153. */
  87154. createThematicFeature(feature) {
  87155. //赋 style
  87156. var style = this.getStyleByData(feature);
  87157. //创建专题要素时的可选参数
  87158. var options = {};
  87159. options.nodesClipPixel = this.nodesClipPixel;
  87160. options.isHoverAble = this.isHoverAble;
  87161. options.isMultiHover = this.isMultiHover;
  87162. options.isClickAble = this.isClickAble;
  87163. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  87164. //将数据转为专题要素(Vector)
  87165. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  87166. //直接添加图形到渲染器
  87167. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  87168. this.renderer.addShape(thematicFeature.shapes[m]);
  87169. }
  87170. return thematicFeature;
  87171. }
  87172. /**
  87173. * @function Label.prototype.redrawThematicFeatures
  87174. * @description 重绘所有专题要素。
  87175. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  87176. * 地图漫游时调用此方法进行图层刷新。
  87177. * @param {Array.<number>} bounds - 重绘范围。
  87178. */
  87179. redrawThematicFeatures(bounds) {
  87180. if (this.features.length > 0 && this.labelFeatures.length === 0) {
  87181. var feats = this.setLabelsStyle(this.features);
  87182. for (var i = 0, len = feats.length; i < len; i++) {
  87183. this.labelFeatures.push(feats[i]);
  87184. }
  87185. }
  87186. this.features = this.getDrawnLabels(this.labelFeatures);
  87187. super.redrawThematicFeatures.call(this, bounds);
  87188. }
  87189. /**
  87190. * @function Label.prototype.removeFeatures
  87191. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  87192. * @param {(Array.<FeatureVector>|FeatureVector|Function)} features - 待删除的要素对象或用于过滤的回调函数。
  87193. */
  87194. removeFeatures(features) { // eslint-disable-line no-unused-vars
  87195. this.labelFeatures = [];
  87196. super.removeFeatures.call(this, features);
  87197. }
  87198. /**
  87199. * @function Label.prototype.removeAllFeatures
  87200. * @description 清除当前图层所有的矢量要素。
  87201. */
  87202. removeAllFeatures() {
  87203. this.labelFeatures = [];
  87204. super.removeAllFeatures.call(this, arguments);
  87205. }
  87206. /**
  87207. * @function Label.prototype.getDrawnLabels
  87208. * @description 获取经(压盖)处理后将要绘制在图层上的标签要素。
  87209. * @param {Array.<FeatureVector>} labelFeatures - 所有标签要素的数组。
  87210. * @returns {Array.<FeatureVector>} 最终要绘制的标签要素数组。
  87211. */
  87212. getDrawnLabels(labelFeatures) {
  87213. var feas = [], //最终要绘制的标签要素集
  87214. fea, //最终要绘制的标签要素
  87215. fi, //临时标签要素,用户的第i个标签
  87216. labelsB = [], //不产生压盖的标签要素范围集
  87217. styTmp, //用于临时存储要素style的变量
  87218. feaSty, //标签要素最终的style
  87219. // styleTemp用于屏蔽文本style中带有偏移性质style属性,偏移已经在计算bounds的过程中参与了运算,
  87220. // 所以在最终按照bounds来绘制标签时,需屏蔽style中带有偏移性质属性,否则文本的偏移量将扩大一倍。
  87221. styleTemp = {
  87222. labelAlign: "cm",
  87223. labelXOffset: 0,
  87224. labelYOffset: 0
  87225. };
  87226. var map = this.map;
  87227. var mapSize = map.getSize();
  87228. mapSize = {
  87229. x: mapSize[0],
  87230. y: mapSize[1]
  87231. };
  87232. var zoom = map.getView().getZoom();
  87233. //对用户的每个标签要素进行处理与判断
  87234. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  87235. fi = labelFeatures[i];
  87236. //检查fi的style在避让中是否被改变,如果改变,重新设置要素的style
  87237. if (fi.isStyleChange) {
  87238. fi = this.setStyle(fi);
  87239. }
  87240. //标签最终的中心点像素位置 (偏移后)
  87241. var loc = this.getLabelPxLocation(fi);
  87242. //过滤掉地图范围外的标签 (偏移后)
  87243. if ((loc.x >= 0 && loc.x <= mapSize.x) && (loc.y >= 0 && loc.y <= mapSize.y)) {
  87244. //根据当前地图缩放级别过滤标签
  87245. if (fi.style.minZoomLevel > -1) {
  87246. if (zoom <= fi.style.minZoomLevel) {
  87247. continue;
  87248. }
  87249. }
  87250. if (fi.style.maxZoomLevel > -1) {
  87251. if (zoom > fi.style.maxZoomLevel) {
  87252. continue;
  87253. }
  87254. }
  87255. //计算标签bounds
  87256. var boundsQuad = null;
  87257. if (fi.isStyleChange) {
  87258. fi.isStyleChange = null;
  87259. boundsQuad = this.calculateLabelBounds(fi, loc);
  87260. } else {
  87261. if (fi.geometry.bsInfo.w && fi.geometry.bsInfo.h) {
  87262. //使用calculateLabelBounds2可以提高bounds的计算效率,尤其是在getPxBoundsMode = 1时
  87263. boundsQuad = this.calculateLabelBounds2(fi, loc);
  87264. } else {
  87265. boundsQuad = this.calculateLabelBounds(fi, loc);
  87266. }
  87267. }
  87268. //避让处理 -start
  87269. var mapViewBounds = new Bounds(0, mapSize.y, mapSize.x, 0), //地图像素范围
  87270. quadlen = boundsQuad.length;
  87271. if (this.isAvoid) {
  87272. var avoidInfo = this.getAvoidInfo(mapViewBounds, boundsQuad); //避让信息
  87273. if (avoidInfo) {
  87274. //横向(x方向)上的避让
  87275. if (avoidInfo.aspectW === "left") {
  87276. fi.style.labelXOffset += avoidInfo.offsetX;
  87277. for (let j = 0; j < quadlen; j++) {
  87278. boundsQuad[j].x += avoidInfo.offsetX;
  87279. }
  87280. } else if (avoidInfo.aspectW === "right") {
  87281. fi.style.labelXOffset += (-avoidInfo.offsetX);
  87282. for (let j = 0; j < quadlen; j++) {
  87283. boundsQuad[j].x += (-avoidInfo.offsetX);
  87284. }
  87285. }
  87286. //纵向(y方向)上的避让
  87287. if (avoidInfo.aspectH === "top") {
  87288. fi.style.labelYOffset += avoidInfo.offsetY;
  87289. for (let j = 0; j < quadlen; j++) {
  87290. boundsQuad[j].y += avoidInfo.offsetY;
  87291. }
  87292. } else if (avoidInfo.aspectH === "bottom") {
  87293. fi.style.labelYOffset += (-avoidInfo.offsetY);
  87294. for (let j = 0; j < quadlen; j++) {
  87295. boundsQuad[j].y += (-avoidInfo.offsetY);
  87296. }
  87297. }
  87298. //如果style发生变化,记录下来
  87299. fi.isStyleChange = true;
  87300. }
  87301. }
  87302. //避让处理 -end
  87303. //压盖处理 -start
  87304. if (this.isOverLay) {
  87305. //是否压盖
  87306. var isOL = false;
  87307. if (i != 0) {
  87308. for (let j = 0; j < labelsB.length; j++) {
  87309. //压盖判断
  87310. if (this.isQuadrilateralOverLap(boundsQuad, labelsB[j])) {
  87311. isOL = true;
  87312. break;
  87313. }
  87314. }
  87315. }
  87316. if (isOL) {
  87317. continue;
  87318. } else {
  87319. labelsB.push(boundsQuad);
  87320. }
  87321. }
  87322. //压盖处理 -end
  87323. //将标签像素范围转为地理范围
  87324. var geoBs = [];
  87325. for (let j = 0; j < quadlen - 1; j++) {
  87326. geoBs.push(map.getCoordinateFromPixel([boundsQuad[j].x, boundsQuad[j].y]));
  87327. }
  87328. //屏蔽有偏移性质的style属性,偏移量在算bounds时已经加入计算
  87329. var bounds = new Bounds(geoBs[3][0], geoBs[3][1], geoBs[1][0], [geoBs[1][1]]);
  87330. var center = bounds.getCenterLonLat();
  87331. var label = new GeoText(center.lon, center.lat, fi.attributes[this.themeField]);
  87332. label.calculateBounds();
  87333. styTmp = Util_Util.cloneObject(fi.style);
  87334. feaSty = Util_Util.cloneObject(Util_Util.copyAttributes(styTmp, styleTemp));
  87335. fea = new Vector(label, fi.attributes, feaSty);
  87336. //赋予id
  87337. fea.id = fi.id;
  87338. fea.fid = fi.fid;
  87339. feas.push(fea);
  87340. }
  87341. }
  87342. //返回最终要绘制的标签要素
  87343. return feas;
  87344. }
  87345. /**
  87346. * @function Label.prototype.getStyleByData
  87347. * @description 根据用户数据(feature)设置专题要素的 Style。
  87348. * @param {FeatureVector} feat - 矢量要素对象。
  87349. * @returns {Array.<ThemeStyle>} 专题要素的 Style。
  87350. */
  87351. getStyleByData(feat) {
  87352. var feature = feat;
  87353. feature.style = Util_Util.copyAttributes(feature.style, this.defaultStyle);
  87354. //将style赋给标签
  87355. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  87356. this.style.fontSize = "12px";
  87357. }
  87358. feature.style = Util_Util.copyAttributes(feature.style, this.style);
  87359. if (this.themeField && this.styleGroups && feature.attributes) {
  87360. var Sf = this.themeField;
  87361. var attributes = feature.attributes;
  87362. var groups = this.styleGroups;
  87363. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  87364. var attr = null; //属性值
  87365. for (var property in attributes) {
  87366. if (Sf === property) {
  87367. isSfInAttrs = true;
  87368. attr = attributes[property];
  87369. break;
  87370. }
  87371. }
  87372. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  87373. if (isSfInAttrs) {
  87374. for (var i = 0, len = groups.length; i < len; i++) {
  87375. if ((attr >= groups[i].start) && (attr < groups[i].end)) {
  87376. var sty1 = groups[i].style;
  87377. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  87378. sty1.fontSize = "12px";
  87379. }
  87380. feature.style = Util_Util.copyAttributes(feature.style, sty1);
  87381. }
  87382. }
  87383. }
  87384. feature.style.label = feature.attributes[this.themeField]
  87385. }
  87386. return feature.style;
  87387. }
  87388. /**
  87389. * @function Label.prototype.setLabelsStyle
  87390. * @description 设置标签要素的 Style。
  87391. * @param {Array.<FeatureVector>} labelFeatures - 需要设置 Style 的标签要素数组。
  87392. * @returns {Array.<FeatureVector>} 赋予 Style 后的标签要素数组。
  87393. */
  87394. setLabelsStyle(labelFeatures) {
  87395. var fea, labelFeas = [];
  87396. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  87397. var feature = labelFeatures[i];
  87398. if (feature.geometry.CLASS_NAME === "SuperMap.Geometry.GeoText") {
  87399. //设置标签的Style
  87400. if (feature.geometry.bsInfo.w || feature.geometry.bsInfo.h) {
  87401. feature.geometry.bsInfo.w = null;
  87402. feature.geometry.bsInfo.h = null;
  87403. feature.geometry.labelWTmp = null;
  87404. }
  87405. fea = this.setStyle(feature);
  87406. //为标签要素指定图层
  87407. fea.layer = this.layer;
  87408. labelFeas.push(fea);
  87409. } else {
  87410. return labelFeatures;
  87411. }
  87412. }
  87413. return labelFeas;
  87414. }
  87415. /**
  87416. * @function Label.prototype.setStyle
  87417. * @description 设置标签要素的 Style。
  87418. * @param {FeatureVector} feat - 需要赋予 style 的要素。
  87419. */
  87420. setStyle(feat) {
  87421. var feature = feat;
  87422. feature.style = Util_Util.copyAttributes(feature.style, this.defaultStyle);
  87423. //将style赋给标签
  87424. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  87425. this.style.fontSize = "12px";
  87426. }
  87427. feature.style = Util_Util.copyAttributes(feature.style, this.style);
  87428. if (this.groupField && this.styleGroups && feature.attributes) {
  87429. var Sf = this.groupField;
  87430. var attributes = feature.attributes;
  87431. var groups = this.styleGroups;
  87432. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  87433. var attr = null; //属性值
  87434. for (var property in attributes) {
  87435. if (Sf === property) {
  87436. isSfInAttrs = true;
  87437. attr = attributes[property];
  87438. break;
  87439. }
  87440. }
  87441. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  87442. if (isSfInAttrs) {
  87443. for (var i = 0, len = groups.length; i < len; i++) {
  87444. if ((attr >= groups[i].start) && (attr < groups[i].end)) {
  87445. var sty1 = groups[i].style;
  87446. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  87447. sty1.fontSize = "12px";
  87448. }
  87449. feature.style = Util_Util.copyAttributes(feature.style, sty1);
  87450. }
  87451. }
  87452. }
  87453. }
  87454. //将文本内容赋到标签要素的style上
  87455. feature.style.label = feature.geometry.text;
  87456. return feature;
  87457. }
  87458. /**
  87459. * @function Label.prototype.getLabelPxLocation
  87460. * @description 获取标签要素的像素坐标。
  87461. * @param {FeatureVector} feature - 标签要素。
  87462. * @returns {Object} 标签位置,例如:{"x":1,"y":1}。
  87463. */
  87464. getLabelPxLocation(feature) {
  87465. var geoText = feature.geometry;
  87466. var styleTmp = feature.style;
  87467. //将标签的地理位置转为像素位置
  87468. var locationTmp = geoText.getCentroid();
  87469. var locTmp = this.map.getPixelFromCoordinate([locationTmp.x, locationTmp.y]);
  87470. var loc = new (external_ol_geom_Point_default())([locTmp[0], locTmp[1]]);
  87471. //偏移处理
  87472. if (styleTmp.labelXOffset || styleTmp.labelYOffset) {
  87473. var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
  87474. var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
  87475. loc.translate(xOffset, -yOffset);
  87476. }
  87477. return {
  87478. x: loc.getCoordinates()[0],
  87479. y: loc.getCoordinates()[1]
  87480. };
  87481. }
  87482. /**
  87483. * @function Label.prototype.calculateLabelBounds
  87484. * @description 获得标签要素的最终范围。
  87485. * @param {FeatureVector} feature - 需要计算bounds的标签要素数。
  87486. * @param {Object} loc - 标签位置,例如:{"x":1,"y":1}。
  87487. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  87488. */
  87489. calculateLabelBounds(feature, loc) {
  87490. var geoText = feature.geometry;
  87491. //标签范围(未旋转前)
  87492. var labB = null;
  87493. var labelInfo = null;
  87494. //获取bounds的方式
  87495. if (this.getPxBoundsMode == 0) {
  87496. labB = geoText.getLabelPxBoundsByText(loc, feature.style);
  87497. } else if (this.getPxBoundsMode === 1) {
  87498. //canvas
  87499. labelInfo = this.getLabelInfo(feature.geometry.getCentroid(), feature.style);
  87500. labB = geoText.getLabelPxBoundsByLabel(loc, labelInfo.w, labelInfo.h, feature.style);
  87501. } else {
  87502. return null;
  87503. }
  87504. //旋转Bounds
  87505. var boundsQuad = [];
  87506. if ((feature.style.labelRotation % 180) == 0) {
  87507. boundsQuad = [{
  87508. "x": labB.left,
  87509. "y": labB.top
  87510. },
  87511. {
  87512. "x": labB.right,
  87513. "y": labB.top
  87514. },
  87515. {
  87516. "x": labB.right,
  87517. "y": labB.bottom
  87518. },
  87519. {
  87520. "x": labB.left,
  87521. "y": labB.bottom
  87522. },
  87523. {
  87524. "x": labB.left,
  87525. "y": labB.top
  87526. }
  87527. ];
  87528. } else {
  87529. boundsQuad = this.rotationBounds(labB, loc, feature.style.labelRotation);
  87530. }
  87531. //重置GeoText的bounds
  87532. geoText.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  87533. return boundsQuad;
  87534. }
  87535. /**
  87536. * @function Label.prototype.calculateLabelBounds2
  87537. * @description 获得标签要素的最终范围的另一种算法(通过记录下的标签宽高),提高计算 bounds 的效率。
  87538. * @param {FeatureVector} feature - 需要计算 bounds 的标签要素数。
  87539. * @param {Object} loc - 标签位置,例如:{"x":1,"y":1}。
  87540. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  87541. */
  87542. calculateLabelBounds2(feature, loc) {
  87543. var labB, left, bottom, top, right;
  87544. var labelSize = feature.geometry.bsInfo;
  87545. var style = feature.style;
  87546. var locationPx = Util_Util.cloneObject(loc);
  87547. //处理文字对齐
  87548. if (style.labelAlign && style.labelAlign !== "cm") {
  87549. switch (style.labelAlign) {
  87550. case "lt":
  87551. locationPx.x += labelSize.w / 2;
  87552. locationPx.y += labelSize.h / 2;
  87553. break;
  87554. case "lm":
  87555. locationPx.x += labelSize.w / 2;
  87556. break;
  87557. case "lb":
  87558. locationPx.x += labelSize.w / 2;
  87559. locationPx.y -= labelSize.h / 2;
  87560. break;
  87561. case "ct":
  87562. locationPx.y += labelSize.h / 2;
  87563. break;
  87564. case "cb":
  87565. locationPx.y -= labelSize.h / 2;
  87566. break;
  87567. case "rt":
  87568. locationPx.x -= labelSize.w / 2;
  87569. locationPx.y += labelSize.h / 2;
  87570. break;
  87571. case "rm":
  87572. locationPx.x -= labelSize.w / 2;
  87573. break;
  87574. case "rb":
  87575. locationPx.x -= labelSize.w / 2;
  87576. locationPx.y -= labelSize.h / 2;
  87577. break;
  87578. default:
  87579. break;
  87580. }
  87581. }
  87582. left = locationPx.x - labelSize.w / 2;
  87583. bottom = locationPx.y + labelSize.h / 2;
  87584. //处理斜体字
  87585. if (style.fontStyle && style.fontStyle === "italic") {
  87586. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  87587. } else {
  87588. right = locationPx.x + labelSize.w / 2;
  87589. }
  87590. top = locationPx.y - labelSize.h / 2;
  87591. labB = new Bounds(left, bottom, right, top);
  87592. //旋转Bounds
  87593. var boundsQuad = [];
  87594. if ((style.labelRotation % 180) == 0) {
  87595. boundsQuad = [{
  87596. "x": labB.left,
  87597. "y": labB.top
  87598. },
  87599. {
  87600. "x": labB.right,
  87601. "y": labB.top
  87602. },
  87603. {
  87604. "x": labB.right,
  87605. "y": labB.bottom
  87606. },
  87607. {
  87608. "x": labB.left,
  87609. "y": labB.bottom
  87610. },
  87611. {
  87612. "x": labB.left,
  87613. "y": labB.top
  87614. }
  87615. ];
  87616. } else {
  87617. boundsQuad = this.rotationBounds(labB, loc, style.labelRotation);
  87618. }
  87619. //重置GeoText的bounds
  87620. feature.geometry.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  87621. return boundsQuad;
  87622. }
  87623. /**
  87624. * @function Label.prototype.getLabelInfo
  87625. * @description 根据当前位置获取绘制后的标签信息,包括标签的宽,高和行数等。
  87626. * @returns {Object} 绘制后的标签信息。
  87627. */
  87628. getLabelInfo(location, style) {
  87629. var LABEL_ALIGN = {
  87630. "l": "left",
  87631. "r": "right",
  87632. "t": "top",
  87633. "b": "bottom"
  87634. },
  87635. LABEL_FACTOR = {
  87636. "l": 0,
  87637. "r": -1,
  87638. "t": 0,
  87639. "b": -1
  87640. };
  87641. style = Util_Util.extend({
  87642. fontColor: "#000000",
  87643. labelAlign: "cm"
  87644. }, style);
  87645. var pt = this.getLocalXY(location);
  87646. var labelWidth = 0;
  87647. if (style.labelXOffset || style.labelYOffset) {
  87648. var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
  87649. var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
  87650. pt[0] += xOffset;
  87651. pt[1] -= yOffset;
  87652. }
  87653. var canvas = document.createElement('canvas');
  87654. canvas.globalAlpha = 0;
  87655. canvas.lineWidth = 1;
  87656. var ctx = canvas.getContext("2d");
  87657. ctx.fillStyle = style.fontColor;
  87658. ctx.globalAlpha = style.fontOpacity || 1.0;
  87659. var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
  87660. "normal",
  87661. style.fontWeight ? style.fontWeight : "normal",
  87662. style.fontSize ? style.fontSize : "1em",
  87663. style.fontFamily ? style.fontFamily : "sans-serif"
  87664. ].join(" ");
  87665. var labelRows = style.label.split('\n');
  87666. var numRows = labelRows.length;
  87667. var vfactor, lineHeight, labelWidthTmp;
  87668. if (ctx.fillText) {
  87669. // HTML5
  87670. ctx.font = fontStyle;
  87671. ctx.textAlign = LABEL_ALIGN[style.labelAlign[0]] ||
  87672. "center";
  87673. ctx.textBaseline = LABEL_ALIGN[style.labelAlign[1]] ||
  87674. "middle";
  87675. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  87676. if (vfactor == null) {
  87677. vfactor = -.5;
  87678. }
  87679. lineHeight = ctx.measureText('Mg').height ||
  87680. ctx.measureText('xx').width;
  87681. pt[1] += lineHeight * vfactor * (numRows - 1);
  87682. for (let i = 0; i < numRows; i++) {
  87683. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  87684. if (labelWidth < labelWidthTmp) {
  87685. labelWidth = labelWidthTmp;
  87686. }
  87687. }
  87688. } else if (ctx.mozDrawText) {
  87689. // Mozilla pre-Gecko1.9.1 (<FF3.1)
  87690. ctx.mozTextStyle = fontStyle;
  87691. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  87692. if (vfactor == null) {
  87693. vfactor = -.5;
  87694. }
  87695. lineHeight = ctx.mozMeasureText('xx');
  87696. pt[1] += lineHeight * (1 + (vfactor * numRows));
  87697. for (let i = 0; i < numRows; i++) {
  87698. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  87699. if (labelWidth < labelWidthTmp) {
  87700. labelWidth = labelWidthTmp;
  87701. }
  87702. }
  87703. }
  87704. var labelInfo = {}; //标签信息
  87705. if (labelWidth) {
  87706. labelInfo.w = labelWidth; //标签的宽
  87707. } else {
  87708. return null;
  87709. }
  87710. labelInfo.h = style.fontSize; //一行标签的高
  87711. labelInfo.rows = labelRows.length; //标签的行数
  87712. return labelInfo;
  87713. }
  87714. /**
  87715. * @function Label.prototype.rotationBounds
  87716. * @description 旋转 bounds。
  87717. * @param {Bounds} bounds - 要旋转的 bounds。
  87718. * @param {Object} rotationCenterPoi - 旋转中心点对象,此对象含有属性 x(横坐标),属性 y(纵坐标)。
  87719. * @param {number} angle - 旋转角度(顺时针)。
  87720. * @returns {Array.<Object>} bounds 旋转后形成的多边形节点数组。是一个四边形,形如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  87721. */
  87722. rotationBounds(bounds, rotationCenterPoi, angle) {
  87723. var ltPoi = new (external_ol_geom_Point_default())([bounds.left, bounds.top]);
  87724. var rtPoi = new (external_ol_geom_Point_default())([bounds.right, bounds.top]);
  87725. var rbPoi = new (external_ol_geom_Point_default())([bounds.right, bounds.bottom]);
  87726. var lbPoi = new (external_ol_geom_Point_default())([bounds.left, bounds.bottom]);
  87727. var ver = [];
  87728. ver.push(this.getRotatedLocation(ltPoi.getCoordinates()[0], ltPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle));
  87729. ver.push(this.getRotatedLocation(rtPoi.getCoordinates()[0], rtPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle));
  87730. ver.push(this.getRotatedLocation(rbPoi.getCoordinates()[0], rbPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle));
  87731. ver.push(this.getRotatedLocation(lbPoi.getCoordinates()[0], lbPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle));
  87732. //bounds旋转后形成的多边形节点数组
  87733. var quad = [];
  87734. for (var i = 0; i < ver.length; i++) {
  87735. quad.push({
  87736. "x": ver[i].x,
  87737. "y": ver[i].y
  87738. });
  87739. }
  87740. quad.push({
  87741. "x": ver[0].x,
  87742. "y": ver[0].y
  87743. });
  87744. return quad;
  87745. }
  87746. /**
  87747. * @function Label.prototype.getRotatedLocation
  87748. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)。
  87749. * @param {number} x - 旋转点横坐标。
  87750. * @param {number} y - 旋转点纵坐标。
  87751. * @param {number} rx - 旋转中心点横坐标。
  87752. * @param {number} ry - 旋转中心点纵坐标。
  87753. * @param {number} angle - 旋转角度
  87754. * @returns {Object} 旋转后的坐标位置对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  87755. */
  87756. getRotatedLocation(x, y, rx, ry, angle) {
  87757. var loc = {},
  87758. x0, y0;
  87759. y = -y;
  87760. ry = -ry;
  87761. angle = -angle; //顺时针旋转
  87762. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  87763. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  87764. loc.x = x0;
  87765. loc.y = -y0;
  87766. return loc;
  87767. }
  87768. /**
  87769. * @function Label.prototype.getAvoidInfo
  87770. * @description 获取避让的信息。
  87771. * @param {Bounds} bounds - 地图像素范围。
  87772. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  87773. * @returns {Object} 避让的信息。
  87774. */
  87775. getAvoidInfo(bounds, quadrilateral) {
  87776. if (quadrilateral.length !== 5) {
  87777. return null;
  87778. } //不是四边形
  87779. //将bound序列化为点数组形式
  87780. var bounddQuad = [{
  87781. "x": bounds.left,
  87782. "y": bounds.top
  87783. },
  87784. {
  87785. "x": bounds.right,
  87786. "y": bounds.top
  87787. },
  87788. {
  87789. "x": bounds.right,
  87790. "y": bounds.bottom
  87791. },
  87792. {
  87793. "x": bounds.left,
  87794. "y": bounds.bottom
  87795. },
  87796. {
  87797. "x": bounds.left,
  87798. "y": bounds.top
  87799. }
  87800. ];
  87801. var isIntersection = false,
  87802. bqLen = bounddQuad.length,
  87803. quadLen = quadrilateral.length;
  87804. var offsetX = 0,
  87805. offsetY = 0,
  87806. aspectH = "",
  87807. aspectW = "";
  87808. for (var i = 0; i < bqLen - 1; i++) {
  87809. for (var j = 0; j < quadLen - 1; j++) {
  87810. var isLineIn = Util_Util.lineIntersection(bounddQuad[i], bounddQuad[i + 1], quadrilateral[j], quadrilateral[j + 1]);
  87811. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  87812. //设置避让信息
  87813. setInfo(quadrilateral[j]);
  87814. setInfo(quadrilateral[j + 1]);
  87815. isIntersection = true;
  87816. }
  87817. }
  87818. }
  87819. if (isIntersection) {
  87820. //组织避让操作所需的信息
  87821. return {
  87822. "aspectW": aspectW,
  87823. "aspectH": aspectH,
  87824. "offsetX": offsetX,
  87825. "offsetY": offsetY
  87826. };
  87827. } else {
  87828. return null;
  87829. }
  87830. //内部函数:设置避让信息
  87831. //参数:vec-{Object} quadrilateral四边形单个节点。如:{"x":1,"y":1}。
  87832. function setInfo(vec) {
  87833. //四边形不在bounds内的节点
  87834. if (!bounds.contains(vec.x, vec.y)) {
  87835. //bounds的Top边
  87836. if (vec.y < bounds.top) {
  87837. let oY = Math.abs(bounds.top - vec.y);
  87838. if (oY > offsetY) {
  87839. offsetY = oY;
  87840. aspectH = "top";
  87841. }
  87842. }
  87843. //bounds的Bottom边
  87844. if (vec.y > bounds.bottom) {
  87845. let oY = Math.abs(vec.y - bounds.bottom);
  87846. if (oY > offsetY) {
  87847. offsetY = oY;
  87848. aspectH = "bottom";
  87849. }
  87850. }
  87851. //bounds的left边
  87852. if (vec.x < bounds.left) {
  87853. let oX = Math.abs(bounds.left - vec.x);
  87854. if (oX > offsetX) {
  87855. offsetX = oX;
  87856. aspectW = "left";
  87857. }
  87858. }
  87859. //bounds的right边
  87860. if (vec.x > bounds.right) {
  87861. let oX = Math.abs(vec.x - bounds.right);
  87862. if (oX > offsetX) {
  87863. offsetX = oX;
  87864. aspectW = "right";
  87865. }
  87866. }
  87867. }
  87868. }
  87869. }
  87870. /**
  87871. * @function Label.prototype.isQuadrilateralOverLap
  87872. * @description 判断两个四边形是否有压盖。
  87873. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  87874. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  87875. * @returns {boolean} 是否压盖,true 表示压盖。
  87876. */
  87877. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  87878. var quadLen = quadrilateral.length,
  87879. quad2Len = quadrilateral2.length;
  87880. if (quadLen !== 5 || quad2Len !== 5) {
  87881. return null;
  87882. } //不是四边形
  87883. var OverLap = false;
  87884. //如果两四边形互不包含对方的节点,则两个四边形不相交
  87885. for (let i = 0; i < quadLen; i++) {
  87886. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  87887. OverLap = true;
  87888. break;
  87889. }
  87890. }
  87891. for (let i = 0; i < quad2Len; i++) {
  87892. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  87893. OverLap = true;
  87894. break;
  87895. }
  87896. }
  87897. //加上两矩形十字相交的情况
  87898. for (let i = 0; i < quadLen - 1; i++) {
  87899. if (OverLap) {
  87900. break;
  87901. }
  87902. for (var j = 0; j < quad2Len - 1; j++) {
  87903. var isLineIn = Util_Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  87904. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  87905. OverLap = true;
  87906. break;
  87907. }
  87908. }
  87909. }
  87910. return OverLap;
  87911. }
  87912. /**
  87913. * @function Label.prototype.isPointInPoly
  87914. * @description 判断一个点是否在多边形里面(射线法)。
  87915. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  87916. * @param {Array.<Object>} poly - 多边形节点数组。例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  87917. * @returns {boolean} 点是否在多边形内。
  87918. */
  87919. isPointInPoly(pt, poly) {
  87920. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  87921. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  87922. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  87923. (isIn = !isIn);
  87924. }
  87925. return isIn;
  87926. }
  87927. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  87928. return super.canvasFunctionInternal_.apply(this, arguments);
  87929. }
  87930. }
  87931. ;// CONCATENATED MODULE: ./src/openlayers/overlay/mapv/MapvCanvasLayer.js
  87932. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  87933. * This program are made available under the terms of the Apache License, Version 2.0
  87934. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  87935. /**
  87936. * @class MapvCanvasLayer
  87937. * @classdesc Mapv 渲染器。
  87938. * @private
  87939. * @param {Object} options - 参数。
  87940. * @param {number} options.width - 画布宽。
  87941. * @param {number} options.height - 画布高。
  87942. * @param {string} [options.paneName='mapPane'] - 窗口名。
  87943. * @param {string} [options.context='2d'] - 内容。
  87944. * @param {number} [options.zIndex=2] - 层级。
  87945. * @param {string} [options.mixBlendMode] - 最小混合模式。
  87946. */
  87947. class MapvCanvasLayer {
  87948. constructor(options) {
  87949. this.options = options || {};
  87950. this.enableMassClear = this.options.enableMassClear;
  87951. this._map = options.map;
  87952. this.paneName = this.options.paneName || 'mapPane';
  87953. this.context = this.options.context || '2d';
  87954. this.zIndex = this.options.zIndex || 2;
  87955. this.mixBlendMode = this.options.mixBlendMode || null;
  87956. this.width = options.width;
  87957. this.height = options.height;
  87958. this.initialize();
  87959. }
  87960. initialize() {
  87961. var canvas = this.canvas = document.createElement("canvas");
  87962. canvas.style.cssText = "position:absolute;" + "left:0;" + "top:0;" + "z-index:" + this.zIndex + ";user-select:none;";
  87963. canvas.style.mixBlendMode = this.mixBlendMode;
  87964. canvas.className = "mapvClass";
  87965. var global$2 = typeof window === 'undefined' ? {} : window;
  87966. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  87967. canvas.width = parseInt(this.width) * devicePixelRatio;
  87968. canvas.height = parseInt(this.height) * devicePixelRatio;
  87969. if (this.context === '2d') {
  87970. canvas.getContext(this.context).scale(devicePixelRatio, devicePixelRatio);
  87971. }
  87972. canvas.style.width = this.width + "px";
  87973. canvas.style.height = this.height + "px";
  87974. if (this.context === 'webgl') {
  87975. this.canvas.getContext(this.context).viewport(0, 0, canvas.width, canvas.height)
  87976. }
  87977. }
  87978. /**
  87979. * @function MapvCanvasLayer.prototype.draw
  87980. * @description 生成地图。
  87981. */
  87982. draw() {
  87983. this.options.update && this.options.update.call(this);
  87984. }
  87985. /**
  87986. * @function MapvCanvasLayer.prototype.resize
  87987. * @param {number} mapWidth - 地图宽度。
  87988. * @param {number} mapHeight - 地图高度。
  87989. * @description 调整地图大小。
  87990. */
  87991. resize(mapWidth, mapHeight) {
  87992. var global$2 = typeof window === 'undefined' ? {} : window;
  87993. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  87994. this.canvas.width = mapWidth * devicePixelRatio;
  87995. this.canvas.height = mapHeight * devicePixelRatio;
  87996. if (this.context === '2d') {
  87997. this.canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  87998. }
  87999. this.canvas.style.width = mapWidth + "px";
  88000. this.canvas.style.height = mapHeight + "px";
  88001. if (this.context === 'webgl') {
  88002. this.canvas.getContext(this.context).viewport(0, 0, this.canvas.width, this.canvas.height)
  88003. }
  88004. }
  88005. /**
  88006. * @function MapvCanvasLayer.prototype.getContainer
  88007. * @description 获取容器。
  88008. * @returns {HTMLElement} 包含 Mapv 图层的 DOM 对象。
  88009. */
  88010. getContainer() {
  88011. return this.canvas;
  88012. }
  88013. /**
  88014. * @function MapvCanvasLayer.prototype.setZIndex
  88015. * @param {number} zIndex - 层级参数。
  88016. * @description 设置图层层级。
  88017. */
  88018. setZIndex(zIndex) {
  88019. this.canvas.style.zIndex = zIndex;
  88020. }
  88021. /**
  88022. * @function MapvCanvasLayer.prototype.getZIndex
  88023. * @description 获取图层层级。
  88024. */
  88025. getZIndex() {
  88026. return this.zIndex;
  88027. }
  88028. }
  88029. ;// CONCATENATED MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  88030. const external_function_try_return_mapv_catch_e_return_namespaceObject = function(){try{return mapv}catch(e){return {}}}();
  88031. ;// CONCATENATED MODULE: external "ol.interaction.Pointer"
  88032. const external_ol_interaction_Pointer_namespaceObject = ol.interaction.Pointer;
  88033. var external_ol_interaction_Pointer_default = /*#__PURE__*/__webpack_require__.n(external_ol_interaction_Pointer_namespaceObject);
  88034. ;// CONCATENATED MODULE: ./src/openlayers/overlay/mapv/MapvLayer.js
  88035. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88036. * This program are made available under the terms of the Apache License, Version 2.0
  88037. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88038. var BaiduMapLayer = external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer ? external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer.__proto__ : Function;
  88039. /**
  88040. * @class MapvLayer
  88041. * @classdesc MapV 图层类。
  88042. * @private
  88043. * @param {Object} map - 地图。
  88044. * @param {Mapv.DataSet} [dataSet] - 数据集。
  88045. * @param {Object} options - 参数。
  88046. * @param {number} mapWidth - 地图宽度。
  88047. * @param {number} mapHeight - 地图高度。
  88048. * @param {Object} source - 资源。
  88049. * @param {number} options.width - 画布宽。
  88050. * @param {number} options.height - 画布高。
  88051. * @param {string} [options.paneName='mapPane'] - 窗口名。
  88052. * @param {string} [options.context] - 内容。
  88053. * @param {number} [options.zIndex] - 层级。
  88054. * @param {string} [options.mixBlendMode] - 最小混合模式。
  88055. * @extends {Mapv.BaiduMapLayer}
  88056. */
  88057. class MapvLayer extends BaiduMapLayer {
  88058. constructor(map, dataSet, options, mapWidth, mapHeight, source) {
  88059. super(map, dataSet, options);
  88060. this.dataSet = dataSet;
  88061. this.mapWidth = mapWidth;
  88062. this.mapHeight = mapHeight;
  88063. var self = this;
  88064. options = options || {};
  88065. this.source = source;
  88066. self.animator = null;
  88067. self.map = map;
  88068. self.init(options);
  88069. self.argCheck(options);
  88070. this.canvasLayer = new MapvCanvasLayer({
  88071. map: map,
  88072. context: this.context,
  88073. paneName: options.paneName,
  88074. mixBlendMode: options.mixBlendMode,
  88075. enableMassClear: options.enableMassClear,
  88076. zIndex: options.zIndex,
  88077. width: mapWidth,
  88078. height: mapHeight,
  88079. update: function update() {
  88080. self._canvasUpdate();
  88081. }
  88082. });
  88083. this.clickEvent = this.clickEvent.bind(this);
  88084. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  88085. map.on('movestart', this.moveStartEvent.bind(this));
  88086. map.on('moveend', this.moveEndEvent.bind(this));
  88087. map.getView().on('change:center', this.zoomEvent.bind(this));
  88088. map.getView().on('change:size', this.sizeEvent.bind(this));
  88089. map.on('pointerdrag', this.dragEvent.bind(this));
  88090. this.bindEvent();
  88091. }
  88092. /**
  88093. * @function MapvLayer.prototype.init
  88094. * @param {Object} options - 参数。
  88095. * @description 初始化参数。
  88096. */
  88097. init(options) {
  88098. var self = this;
  88099. self.options = options;
  88100. this.initDataRange(options);
  88101. this.context = self.options.context || '2d';
  88102. if (self.options.zIndex) {
  88103. this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
  88104. }
  88105. this.initAnimator();
  88106. }
  88107. /**
  88108. * @function MapvLayer.prototype.clickEvent
  88109. * @param {Object} e - 事件参数。
  88110. * @description 点击事件。
  88111. */
  88112. clickEvent(e) {
  88113. var pixel = e.pixel;
  88114. super.clickEvent({
  88115. x: pixel[0] + this.offset[0],
  88116. y: pixel[1] + this.offset[1]
  88117. }, e);
  88118. }
  88119. /**
  88120. * @function MapvLayer.prototype.mousemoveEvent
  88121. * @param {Object} e - 事件参数。
  88122. * @description 鼠标移动事件。
  88123. */
  88124. mousemoveEvent(e) {
  88125. var pixel = e.pixel;
  88126. super.mousemoveEvent({
  88127. x: pixel[0],
  88128. y: pixel[1]
  88129. }, e);
  88130. }
  88131. /**
  88132. * @function MapvLayer.prototype.dragEvent
  88133. * @description 鼠标拖动事件。
  88134. */
  88135. dragEvent() {
  88136. this.clear(this.getContext());
  88137. }
  88138. /**
  88139. * @function MapvLayer.prototype.zoomEvent
  88140. * @description 缩放事件。
  88141. */
  88142. zoomEvent() {
  88143. this.clear(this.getContext());
  88144. }
  88145. /**
  88146. * @function MapvLayer.prototype.sizeEvent
  88147. * @description 地图窗口大小发生变化时触发。
  88148. */
  88149. sizeEvent() {
  88150. this.canvasLayer.resize();
  88151. }
  88152. /**
  88153. * @function MapvLayer.prototype.moveStartEvent
  88154. * @description 开始移动事件。
  88155. */
  88156. moveStartEvent() {
  88157. var animationOptions = this.options.animation;
  88158. if (this.isEnabledTime() && this.animator) {
  88159. this.steps.step = animationOptions.stepsRange.start;
  88160. }
  88161. }
  88162. /**
  88163. * @function MapvLayer.prototype.moveEndEvent
  88164. * @description 结束移动事件。
  88165. */
  88166. moveEndEvent() {
  88167. this.canvasLayer.draw();
  88168. }
  88169. /**
  88170. * @function MapvLayer.prototype.bindEvent
  88171. * @description 绑定事件。
  88172. */
  88173. bindEvent() {
  88174. var me = this;
  88175. var map = me.map;
  88176. if (me.options.methods) {
  88177. if (me.options.methods.click) {
  88178. map.on('click', me.clickEvent);
  88179. }
  88180. if (me.options.methods.mousemove) {
  88181. me.pointerInteraction = new (external_ol_interaction_Pointer_default())();
  88182. me.pointerInteraction.handleMoveEvent_ = function (event) {
  88183. me.mousemoveEvent(event);
  88184. };
  88185. map.addInteraction(me.pointerInteraction);
  88186. }
  88187. }
  88188. }
  88189. /**
  88190. * @function MapvLayer.prototype.unbindEvent
  88191. * @description 解除绑定事件。
  88192. */
  88193. unbindEvent() {
  88194. var map = this.map;
  88195. if (this.options.methods) {
  88196. if (this.options.methods.click) {
  88197. map.un('click', this.clickEvent);
  88198. }
  88199. if (this.options.methods.mousemove) {
  88200. map.removeInteraction(this.pointerInteraction)
  88201. }
  88202. }
  88203. }
  88204. /**
  88205. * @function MapvLayer.prototype.addData
  88206. * @description 添加数据。
  88207. * @param {Object} data - 待添加的数据。
  88208. * @param {Object} options - 待添加的数据信息。
  88209. */
  88210. addData(data, options) {
  88211. var _data = data;
  88212. if (data && data.get) {
  88213. _data = data.get();
  88214. }
  88215. this.dataSet.add(_data);
  88216. this.update({
  88217. options: options
  88218. });
  88219. }
  88220. /**
  88221. * @function MapvLayer.prototype.update
  88222. * @description 更新图层。
  88223. * @param {Object} opt - 待更新的数据。
  88224. * @param {Object} opt.data - mapv 数据集。
  88225. */
  88226. update(opt) {
  88227. var update = opt || {};
  88228. var _data = update.data;
  88229. if (_data && _data.get) {
  88230. _data = _data.get();
  88231. }
  88232. if (_data != undefined) {
  88233. this.dataSet.set(_data);
  88234. }
  88235. super.update({
  88236. options: update.options
  88237. });
  88238. }
  88239. draw() {
  88240. this.canvasLayer.draw();
  88241. }
  88242. /**
  88243. * @function MapvLayer.prototype.getData
  88244. * @description 获取数据。
  88245. */
  88246. getData() {
  88247. return this.dataSet;
  88248. }
  88249. /**
  88250. * @function MapvLayer.prototype.removeData
  88251. * @description 删除符合过滤条件的数据。
  88252. * @param {function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  88253. */
  88254. removeData(filter) {
  88255. if (!this.dataSet) {
  88256. return;
  88257. }
  88258. var newData = this.dataSet.get({
  88259. filter: function (data) {
  88260. return (filter != null && typeof filter === "function") ? !filter(data) : true;
  88261. }
  88262. });
  88263. this.dataSet.set(newData);
  88264. this.update({
  88265. options: null
  88266. });
  88267. }
  88268. /**
  88269. * @function MapvLayer.prototype.clearData
  88270. * @description 清除数据。
  88271. */
  88272. clearData() {
  88273. this.dataSet && this.dataSet.clear();
  88274. this.update({
  88275. options: null
  88276. });
  88277. }
  88278. _canvasUpdate(time) {
  88279. if (!this.canvasLayer) {
  88280. return;
  88281. }
  88282. var self = this;
  88283. var animationOptions = self.options.animation;
  88284. var map = self.map;
  88285. var context = self.canvasLayer.canvas.getContext(self.context);
  88286. if (self.isEnabledTime()) {
  88287. if (time === undefined) {
  88288. self.clear(context);
  88289. return;
  88290. }
  88291. if (!self.context || self.context === '2d') {
  88292. context.save();
  88293. context.globalCompositeOperation = 'destination-out';
  88294. context.fillStyle = 'rgba(0, 0, 0, .1)';
  88295. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  88296. context.restore();
  88297. }
  88298. } else {
  88299. this.clear(context);
  88300. }
  88301. if (!self.context || self.context === '2d') {
  88302. for (var key in self.options) {
  88303. context[key] = self.options[key];
  88304. }
  88305. } else {
  88306. context.clear(context.COLOR_BUFFER_BIT);
  88307. }
  88308. var ext = map.getView().calculateExtent();
  88309. var topLeftPx = map.getPixelFromCoordinate([ext[0], ext[3]]);
  88310. self._mapCenter = map.getView().getCenter();
  88311. self._mapCenterPx = map.getPixelFromCoordinate(self._mapCenter);
  88312. self._reselutions = map.getView().getResolution();
  88313. self._rotation = -map.getView().getRotation();
  88314. var zoomUnit = self._reselutions;
  88315. var scaleRatio = 1;
  88316. if (this.context != '2d') {
  88317. var global$2 = typeof window === 'undefined' ? {} : window;
  88318. var devicePixelRatio = global$2.devicePixelRatio || 1;
  88319. scaleRatio = devicePixelRatio;
  88320. }
  88321. var dataGetOptions = {
  88322. transferCoordinate: function (coordinate) {
  88323. var x = (coordinate[0] - self._mapCenter[0]) / self._reselutions,
  88324. y = (self._mapCenter[1] - coordinate[1]) / self._reselutions;
  88325. var scaledP = [x + self._mapCenterPx[0], y + self._mapCenterPx[1]];
  88326. scaledP = scale(scaledP, self._mapCenterPx, 1);
  88327. /*//有旋转量的时候处理旋转
  88328. if (self._rotation !== 0) {
  88329. var rotatedP = rotate(scaledP, self._rotation, self._mapCenterPx);
  88330. return [rotatedP[0] + self.offset[0], rotatedP[1] + self.offset[1]];
  88331. }
  88332. //处理放大或缩小级别*/
  88333. return [(scaledP[0] + self.offset[0]) * scaleRatio, (scaledP[1] + self.offset[1]) * scaleRatio];
  88334. }
  88335. };
  88336. // //获取某像素坐标点pixelP绕中心center逆时针旋转rotation弧度后的像素点坐标。
  88337. // function rotate(pixelP, rotation, center) {
  88338. // var x = Math.cos(rotation) * (pixelP[0] - center[0]) - Math.sin(rotation) * (pixelP[1] - center[1]) + center[0];
  88339. // var y = Math.sin(rotation) * (pixelP[0] - center[0]) + Math.cos(rotation) * (pixelP[1] - center[1]) + center[1];
  88340. // return [x, y];
  88341. // }
  88342. //获取某像素坐标点pixelP相对于中心center进行缩放scaleRatio倍后的像素点坐标。
  88343. function scale(pixelP, center, scaleRatio) {
  88344. var x = (pixelP[0] - center[0]) * scaleRatio + center[0];
  88345. var y = (pixelP[1] - center[1]) * scaleRatio + center[1];
  88346. return [x, y];
  88347. }
  88348. if (time !== undefined) {
  88349. dataGetOptions.filter = function (item) {
  88350. var trails = animationOptions.trails || 10;
  88351. return (time && item.time > (time - trails) && item.time < time);
  88352. };
  88353. }
  88354. if (self.isEnabledTime() && !self.notFirst) {
  88355. self.canvasLayer.resize(self.mapWidth, self.mapHeight);
  88356. self.notFirst = true;
  88357. }
  88358. var data = self.dataSet.get(dataGetOptions);
  88359. self.processData(data);
  88360. // 兼容unit为'm'的情况
  88361. if (self.options.unit === 'm') {
  88362. if (self.options.size) {
  88363. self.options._size = self.options.size / zoomUnit;
  88364. }
  88365. if (self.options.width) {
  88366. self.options._width = self.options.width / zoomUnit;
  88367. }
  88368. if (self.options.height) {
  88369. self.options._height = self.options.height / zoomUnit;
  88370. }
  88371. } else {
  88372. self.options._size = self.options.size;
  88373. self.options._height = self.options.height;
  88374. self.options._width = self.options.width;
  88375. }
  88376. var pixel = map.getPixelFromCoordinate([0, 0]);
  88377. pixel = [pixel[0] - topLeftPx[0], pixel[1] - topLeftPx[1]];
  88378. this.drawContext(context, data, self.options, {
  88379. x: pixel[0],
  88380. y: pixel[1]
  88381. });
  88382. if (self.isEnabledTime()) {
  88383. this.source.changed();
  88384. }
  88385. self.options.updateCallback && self.options.updateCallback(time);
  88386. }
  88387. isEnabledTime() {
  88388. var animationOptions = this.options.animation;
  88389. return animationOptions && !(animationOptions.enabled === false);
  88390. }
  88391. argCheck(options) {
  88392. if (options.draw === 'heatmap') {
  88393. if (options.strokeStyle) {
  88394. console.warn('[heatmap] options.strokeStyle is discard, pleause use options.strength [eg: options.strength = 0.1]');
  88395. }
  88396. }
  88397. }
  88398. getContext() {
  88399. return this.canvasLayer.canvas.getContext(this.context);
  88400. }
  88401. clear(context) {
  88402. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  88403. }
  88404. }
  88405. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Mapv.js
  88406. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88407. * This program are made available under the terms of the Apache License, Version 2.0
  88408. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88409. /**
  88410. * @class Mapv
  88411. * @browsernamespace ol.source
  88412. * @category Visualization MapV
  88413. * @classdesc MapV 图层源。
  88414. * @modulecategory Overlay
  88415. * @param {Object} opt_options - 参数。
  88416. * @param {ol.Map} opt_options.map - 当前 Map 对象。
  88417. * @param {Mapv.DataSet} opt_options.dataSet - MapV 的数据集。
  88418. * @param {Object} opt_options.mapvOptions - MapV 的配置对象。
  88419. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  88420. * @param {ol.proj.Projection} [opt_options.projection] - 投影信息。
  88421. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
  88422. * @param {Array} [opt_options.resolutions] - 分辨率数组。
  88423. * @param {ol.source.State} [opt_options.state] - 资源状态。
  88424. * @param {(string|Object)} [opt_options.attributions='© 2018 百度 MapV with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  88425. * @extends {ol.source.ImageCanvas}
  88426. * @usage
  88427. */
  88428. class Mapv extends (external_ol_source_ImageCanvas_default()) {
  88429. constructor(opt_options) {
  88430. var options = opt_options ? opt_options : {};
  88431. super({
  88432. attributions: options.attributions || "© 2018 百度 MapV with <span>© SuperMap iClient</span>",
  88433. canvasFunction: canvasFunctionInternal_,
  88434. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  88435. projection: options.projection,
  88436. ratio: options.ratio,
  88437. resolutions: options.resolutions,
  88438. state: options.state
  88439. });
  88440. this.map = opt_options.map;
  88441. this.dataSet = opt_options.dataSet;
  88442. this.mapvOptions = opt_options.mapvOptions;
  88443. function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  88444. var mapWidth = size[0] / pixelRatio;
  88445. var mapHeight = size[1] / pixelRatio;
  88446. var width = this.map.getSize()[0];
  88447. var height = this.map.getSize()[1];
  88448. if (!this.layer) {
  88449. this.layer = new MapvLayer(this.map, this.dataSet, this.mapvOptions, mapWidth, mapHeight, this);
  88450. }
  88451. this.layer.pixelRatio = pixelRatio;
  88452. this.layer.offset = [(mapWidth - width) / 2 , (mapHeight - height) / 2 ];
  88453. if (!this.rotate) {
  88454. this.rotate = this.map.getView().getRotation();
  88455. } else {
  88456. if (this.rotate !== this.map.getView().getRotation()) {
  88457. this.layer.canvasLayer.resize(mapWidth, mapHeight);
  88458. this.rotate = this.map.getView().getRotation()
  88459. }
  88460. }
  88461. var canvas = this.layer.canvasLayer.canvas;
  88462. if (!this.layer.isEnabledTime()) {
  88463. this.layer.canvasLayer.resize(mapWidth, mapHeight);
  88464. this.layer.canvasLayer.draw();
  88465. }
  88466. if (!this.context) {
  88467. this.context = core_Util_Util.createCanvasContext2D(mapWidth, mapHeight);
  88468. }
  88469. var canvas2 = this.context.canvas;
  88470. this.context.clearRect(0, 0, canvas2.width, canvas2.height);
  88471. canvas2.width = size[0];
  88472. canvas2.height = size[1];
  88473. canvas2.style.width = size[0] + "px";
  88474. canvas2.style.height = size[1] + "px";
  88475. this.context.drawImage(canvas, 0, 0);
  88476. if (this.resolution !== resolution || JSON.stringify(this.extent) !== JSON.stringify(extent)) {
  88477. this.resolution = resolution;
  88478. this.extent = extent;
  88479. }
  88480. return this.context.canvas;
  88481. }
  88482. }
  88483. /**
  88484. * @function Mapv.prototype.addData
  88485. * @description 追加数据。
  88486. * @param {Object} data - 要追加的数据。
  88487. * @param {Object} options - 要追加的值。
  88488. */
  88489. addData(data, options) {
  88490. this.layer.addData(data, options);
  88491. }
  88492. /**
  88493. * @function Mapv.prototype.getData
  88494. * @description 获取数据。
  88495. * @returns {Mapv.DataSet} MapV 数据集。
  88496. */
  88497. getData() {
  88498. if (this.layer) {
  88499. this.dataSet = this.layer.getData();
  88500. }
  88501. return this.dataSet;
  88502. }
  88503. /**
  88504. * @function Mapv.prototype.removeData
  88505. * @description 删除符合过滤条件的数据。
  88506. * @param {function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  88507. * @example
  88508. * filter=function(data){
  88509. * if(data.id=="1"){
  88510. * return true
  88511. * }
  88512. * return false;
  88513. * }
  88514. */
  88515. removeData(filter) {
  88516. this.layer && this.layer.removeData(filter);
  88517. }
  88518. /**
  88519. * @function Mapv.prototype.clearData
  88520. * @description 清除数据。
  88521. */
  88522. clearData() {
  88523. this.layer.clearData();
  88524. }
  88525. /**
  88526. * @function Mapv.prototype.update
  88527. * @description 更新数据。
  88528. * @param {Object} options - 待更新的数据。
  88529. * @param {Object} options.data - mapv 数据集。
  88530. */
  88531. update(options) {
  88532. this.layer.update(options);
  88533. this.changed();
  88534. }
  88535. }
  88536. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Range.js
  88537. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88538. * This program are made available under the terms of the Apache License, Version 2.0
  88539. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88540. /**
  88541. * @class Range
  88542. * @browsernamespace ol.source
  88543. * @category Visualization Theme
  88544. * @classdesc 分段专题图图层源。
  88545. * @param {string} name - 名称
  88546. * @param {Object} opt_options - 参数。
  88547. * @param {ol.Map} opt_options.map - 当前map对象。
  88548. * @param {string} opt_options.themeField - 指定创建专题图字段。
  88549. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  88550. * @param {number} [opt_options.opacity = 1] - 图层透明度。
  88551. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  88552. * @param {ol.proj.Projection} [opt_options.projection] - 投影信息。
  88553. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
  88554. * @param {Array} [opt_options.resolutions] - 分辨率数组。
  88555. * @param {ol.source.State} [opt_options.state] - 资源状态。
  88556. * @param {Object} [opt_options.style] - 专题图样式。
  88557. * @param {Object} [opt_options.styleGroups] - 各专题类型样式组。
  88558. * @param {boolean} [opt_options.isHoverAble = false] - 是否开启 hover 事件。
  88559. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  88560. * @param {(string|Object)} [opt_options.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  88561. * @extends {GeoFeature}
  88562. * @usage
  88563. */
  88564. class Range extends GeoFeature {
  88565. constructor(name, opt_options) {
  88566. super(name, opt_options);
  88567. this.style = opt_options.style;
  88568. this.isHoverAble = opt_options.isHoverAble;
  88569. this.highlightStyle = opt_options.highlightStyle;
  88570. this.themeField = opt_options.themeField;
  88571. this.styleGroups = opt_options.styleGroups;
  88572. }
  88573. /**
  88574. * @function Range.prototype.destroy
  88575. * @description 释放资源,将引用资源的属性置空。
  88576. */
  88577. destroy() {
  88578. this.style = null;
  88579. this.themeField = null;
  88580. this.styleGroups = null;
  88581. GeoFeature.prototype.destroy.apply(this, arguments);
  88582. }
  88583. /**
  88584. * @private
  88585. * @function Range.prototype.createThematicFeature
  88586. * @description 创建专题图要素。
  88587. * @param {Object} feature - 要创建的专题图形要素。
  88588. */
  88589. createThematicFeature(feature) {
  88590. //赋 style
  88591. var style = this.getStyleByData(feature);
  88592. //创建专题要素时的可选参数
  88593. var options = {};
  88594. options.nodesClipPixel = this.nodesClipPixel;
  88595. options.isHoverAble = this.isHoverAble;
  88596. options.isMultiHover = this.isMultiHover;
  88597. options.isClickAble = this.isClickAble;
  88598. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  88599. //将数据转为专题要素(ThemeVector)
  88600. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  88601. //直接添加图形到渲染器
  88602. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  88603. this.renderer.addShape(thematicFeature.shapes[m]);
  88604. }
  88605. return thematicFeature;
  88606. }
  88607. /**
  88608. * @private
  88609. * @function Range.prototype.getStyleByData
  88610. * @description 通过数据获取 style。
  88611. * @param {Object} fea - 要素数据。
  88612. */
  88613. getStyleByData(fea) {
  88614. var style = {};
  88615. var feature = fea;
  88616. style = Util_Util.copyAttributesWithClip(style, this.style);
  88617. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  88618. var Sf = this.themeField;
  88619. var Attrs = feature.attributes;
  88620. var Gro = this.styleGroups;
  88621. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  88622. var attr = null; //属性值
  88623. for (var property in Attrs) {
  88624. if (Sf === property) {
  88625. isSfInAttrs = true;
  88626. attr = Attrs[property];
  88627. break;
  88628. }
  88629. }
  88630. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  88631. if (isSfInAttrs) {
  88632. for (var i = 0, len = Gro.length; i < len; i++) {
  88633. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  88634. //feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  88635. var sty1 = Gro[i].style;
  88636. style = Util_Util.copyAttributesWithClip(style, sty1);
  88637. }
  88638. }
  88639. }
  88640. }
  88641. if (feature.style && this.isAllowFeatureStyle === true) {
  88642. style = Util_Util.copyAttributesWithClip(feature.style);
  88643. }
  88644. return style;
  88645. }
  88646. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  88647. return GeoFeature.prototype.canvasFunctionInternal_.apply(this, arguments);
  88648. }
  88649. }
  88650. ;// CONCATENATED MODULE: ./src/openlayers/overlay/RankSymbol.js
  88651. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88652. * This program are made available under the terms of the Apache License, Version 2.0
  88653. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88654. /**
  88655. * @class RankSymbol
  88656. * @browsernamespace ol.source
  88657. * @category Visualization Theme
  88658. * @classdesc 等级符号专题图图层源。
  88659. * @modulecategory Overlay
  88660. * @param {string} name - 专题图层名。
  88661. * @param {string} symbolType - 标志类型。
  88662. * @param {Object} opt_options - 参数。
  88663. * @param {ol.Map} opt_options.map - 当前 Map 对象。
  88664. * @param {string} opt_options.themeFields - 指定创建专题图字段。
  88665. * @param {Object} opt_options.symbolSetting - 符号 Circle 配置对象 symbolSetting(<{@link SuperMap.Layer.RankSymbol}>)。
  88666. * @param {Array.<number>} opt_options.symbolSetting.codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  88667. * @param {number} [opt_options.symbolSetting.maxR] - 圆形的最大半径。
  88668. * @param {number} [opt_options.symbolSetting.minR] - 圆形的最小半径。
  88669. * @param {string} [opt_options.symbolSetting.fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
  88670. * @param {Object} [opt_options.symbolSetting.circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  88671. * @param {number} [opt_options.symbolSetting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  88672. * @param {Object} [opt_options.symbolSetting.circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  88673. * @param {boolean} [opt_options.symbolSetting.circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  88674. * @param {boolean} [opt_options.symbolSetting.circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  88675. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  88676. * @param {number} [opt_options.opacity=1] - 图层透明度。
  88677. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  88678. * @param {ol.proj.Projection} [opt_options.projection] - 投影信息。
  88679. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
  88680. * @param {Array} [opt_options.resolutions] - 分辨率数组。
  88681. * @param {ol.source.State} [opt_options.state] - 资源状态。
  88682. * @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  88683. * @param {(string|Object)} [opt_options.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  88684. * @extends {Graph}
  88685. * @usage
  88686. */
  88687. class RankSymbol_RankSymbol extends Graph_Graph {
  88688. constructor(name, symbolType, opt_options) {
  88689. super(name, symbolType, opt_options);
  88690. this.symbolType = symbolType;
  88691. this.symbolSetting = opt_options.symbolSetting;
  88692. this.themeField = opt_options.themeField;
  88693. }
  88694. /**
  88695. * @function RankSymbol.prototype.destroy
  88696. * @description 释放资源,将引用资源的属性置空。
  88697. */
  88698. destroy() {
  88699. this.symbolType = null;
  88700. this.symbolSetting = null;
  88701. this.themeField = null;
  88702. Graph_Graph.prototype.destroy.apply(this, arguments);
  88703. }
  88704. /**
  88705. * @function RankSymbol.prototype.setSymbolType
  88706. * @description 设置标志符号。
  88707. * @param {string} symbolType - 符号类型。
  88708. */
  88709. setSymbolType(symbolType) {
  88710. this.symbolType = symbolType;
  88711. this.redraw();
  88712. }
  88713. /**
  88714. * @private
  88715. * @function RankSymbol.prototype.createThematicFeature
  88716. * @description 创建专题图形要素。
  88717. * @param {Object} feature - 要创建的专题图形要素。
  88718. */
  88719. createThematicFeature(feature) {
  88720. var thematicFeature;
  88721. // 检查图形创建条件并创建图形
  88722. if (Theme_Theme[this.symbolType] && this.themeField && this.symbolSetting) {
  88723. thematicFeature = new Theme_Theme[this.symbolType](feature, this, [this.themeField], this.symbolSetting);
  88724. }
  88725. // thematicFeature 是否创建成功
  88726. if (!thematicFeature) {
  88727. return false;
  88728. }
  88729. // 对专题要素执行图形装载
  88730. thematicFeature.assembleShapes();
  88731. return thematicFeature;
  88732. }
  88733. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  88734. return Graph_Graph.prototype.canvasFunctionInternal_.apply(this, arguments);
  88735. }
  88736. }
  88737. ;// CONCATENATED MODULE: external "function(){try{return turf}catch(e){return {}}}()"
  88738. const external_function_try_return_turf_catch_e_return_namespaceObject = function(){try{return turf}catch(e){return {}}}();
  88739. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Turf.js
  88740. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  88741. * This program are made available under the terms of the Apache License, Version 2.0
  88742. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  88743. /**
  88744. * @class Turf
  88745. * @browsernamespace ol.source
  88746. * @category Visualization Turf
  88747. * @classdesc Turf.js 图层源。
  88748. * @modulecategory Overlay
  88749. * @param {Object} opt_options - 参数。
  88750. * @extends {ol.source.Vector}
  88751. * @usage
  88752. */
  88753. class Turf extends (external_ol_source_Vector_default()) {
  88754. constructor(opt_options) {
  88755. var options = opt_options ? opt_options : {};
  88756. super({
  88757. attributions: options.attributions || "<span>© turfjs</span> with <span>© SuperMap iClient</span>",
  88758. features: options.features,
  88759. format: options.format,
  88760. extent: options.extent,
  88761. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  88762. projection: options.projection,
  88763. wrapX: options.wrapX
  88764. });
  88765. this.turfMap = {
  88766. "Measurement.along": ["line", "distance", "units"],
  88767. "Measurement.area": ["geojson"],
  88768. "Measurement.bbox": ["geojson"],
  88769. "Measurement.bboxPolygon": ["bbox"],
  88770. "Measurement.bearing": ["start", "end", "final"],
  88771. "Measurement.center": ["geojson", "properties"],
  88772. "Measurement.centerOfMass": ["geojson", "properties"],
  88773. "Measurement.centroid": ["geojson", "properties"],
  88774. "Measurement.destination": ["origin", "distance", "bearing", "units"],
  88775. "Measurement.distance": ["from", "to", "units"],
  88776. "Measurement.envelope": ["geojson"],
  88777. "Measurement.length": ["geojson", "units"],
  88778. "Measurement.midpoint": ["point1", "point2"],
  88779. "Measurement.pointOnFeature": ["geojson"],
  88780. "Measurement.polygonTangents": ["point", "polygon"],
  88781. "Measurement.rhumbBearing": ["start", "end", "final"],
  88782. "Measurement.rhumbDestination": ["origin", "distance", "bearing", "units"],
  88783. "Measurement.rhumbDistance": ["from", "to", "units"],
  88784. "Measurement.square": ["bbox"],
  88785. "Measurement.greatCircle": ["start", "end", "properties", "npoints", "offset"],
  88786. "CoordinateMutation.cleanCoords":["geojson","mutate"],
  88787. "CoordinateMutation.flip": ["geojson", "mutate"],
  88788. "CoordinateMutation.rewind": ["geojson", "reverse", "mutate"],
  88789. "CoordinateMutation.round": ["num", "precision"],
  88790. "CoordinateMutation.truncate": ["geojson", "precision", "coordinates", "mutate"],
  88791. "Transformation.bboxClip": ["feature", "bbox"],
  88792. "Transformation.bezierSpline": ["line", "resolution", "sharpness"],
  88793. "Transformation.buffer": ["geojson", "radius", "units", "steps"],
  88794. "Transformation.circle": ["center", "radius", "steps", "units", "properties"],
  88795. "Transformation.clone": ["geojson"],
  88796. "Transformation.concave": ["points", "maxEdge", "units"],
  88797. "Transformation.convex": ["geojson","concavity"],
  88798. "Transformation.difference": ["polygon1", "polygon2"],
  88799. "Transformation.dissolve": ["featureCollection", "propertyName"],
  88800. "Transformation.intersect": ["poly1", "poly2"],
  88801. "Transformation.lineOffset": ["geojson", "distance", "units"],
  88802. "Transformation.simplify": ["feature", "tolerance", "highQuality"],
  88803. "Transformation.tesselate": ["poly"],
  88804. "Transformation.transformRotate": ["geojson", "angle", "pivot", "mutate"],
  88805. "Transformation.transformTranslate": ["geojson", "distance", "direction", "units", "zTranslation", "mutate"],
  88806. "Transformation.transformScale": ["geojson", "factor", "origin", "mutate"],
  88807. "Transformation.union": ["A"],
  88808. "Transformation.voronoi": ["points","bbox"],
  88809. "featureConversion.combine": ["fc"],
  88810. "featureConversion.explode": ["geojson"],
  88811. "featureConversion.flatten": ["geojson"],
  88812. "featureConversion.lineStringToPolygon": ["lines", "properties", "autoComplete", "orderCoords"],
  88813. "featureConversion.polygonize": ["geojson"],
  88814. "featureConversion.polygonToLineString": ["polygon", "properties"],
  88815. "Misc.kinks": ["featureIn"],
  88816. "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
  88817. "Misc.lineChunk": ["geojson", "segmentLength", "units", "reverse"],
  88818. "Misc.lineIntersect": ["line1", "line2"],
  88819. "Misc.lineOverlap": ["line1", "line2"],
  88820. "Misc.lineSegment": ["geojson"],
  88821. "Misc.lineSlice": ["startPt", "stopPt", "line"],
  88822. "Misc.lineSliceAlong": ["line", "startDist", "stopDist", "units"],
  88823. "Misc.lineSplit": ["line", "splitter"],
  88824. "Misc.mask": ["polygon", "mask"],
  88825. "Misc.pointOnLine": ["lines", "pt", "units"],
  88826. "Misc.sector": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
  88827. "Misc.shortestPath": ["start", "end", "obstacles", "units","resolution"],
  88828. "Misc.unkinkPolygon": ["geojson"],
  88829. "Helper.featureCollection": ["features","bbox","id"],
  88830. "Helper.feature": ["geometry", "properties","bbox","id"],
  88831. "Helper.geometryCollection": ["geometries", "properties","bbox","id"],
  88832. "Helper.lineString": ["coordinates", "properties","bbox","id"],
  88833. "Helper.multiLineString": ["coordinates", "properties","bbox","id"],
  88834. "Helper.multiPoint": ["coordinates", "properties","bbox","id"],
  88835. "Helper.multiPolygon": ["coordinates", "properties","bbox","id"],
  88836. "Helper.point": ["coordinates", "properties","bbox","id"],
  88837. "Helper.polygon": ["coordinates", "properties","bbox","id"],
  88838. "Data.sample": ["featurecollection", "num"],
  88839. "Interpolation.interpolate": ["points", "cellSize", "gridType", "property", "units", "weight"],
  88840. "Interpolation.isobands": ["pointGrid", "breaks", "zProperty", "commonProperties","breaksProperties"],
  88841. "Interpolation.isolines": ["pointGrid", "breaks", "zProperty", "commonProperties", "breaksProperties"],
  88842. "Interpolation.planepoint": ["point", "triangle"],
  88843. "Interpolation.tin": ["points", "z"],
  88844. "Joins.pointsWithinPolygon": ["points", "polygons"],
  88845. "Joins.tag": ["points", "polygons", "field", "outField","mask","properties"],
  88846. "Grids.hexGrid": ["bbox", "cellSide", "units", "triangles"],
  88847. "Grids.pointGrid": ["bbox", "cellSide", "units", "mask","properties"],
  88848. "Grids.squareGrid": ["bbox", "cellSide", "units", "mask","properties"],
  88849. "Grids.triangleGrid": ["bbox", "cellSide", "units", "mask","properties"],
  88850. "Classification.nearestPoint": ["targetPoint", "points"],
  88851. "Aggregation.collect": ["polygons", "points", "inProperty", "outProperty"],
  88852. "Aggregation.clustersDbscan": ["points", "maxDistance", "units", "minPoints","mutate"],
  88853. "Aggregation.clustersKmeans": ["points", "numberOfClusters", "mutate"],
  88854. "Meta.coordAll": ["geojson"],
  88855. "Meta.coordEach": ["geojson", "callback", "excludeWrapCoord"],
  88856. "Meta.coordReduce": ["geojson", "callback", "initialValue", "excludeWrapCoord"],
  88857. "Meta.featureEach": ["geojson", "callback"],
  88858. "Meta.featureReduce": ["geojson", "callback", "initialValue"],
  88859. "Meta.flattenEach": ["geojson", "callback"],
  88860. "Meta.flattenReduce": ["geojson", "callback", "initialValue"],
  88861. "Meta.getCoord": ["coord"],
  88862. "Meta.getCoords": ["coords"],
  88863. "Meta.getGeom": ["geojson"],
  88864. "Meta.getGeomType": ["geojson","name"],
  88865. "Meta.geomEach": ["geojson", "callback"],
  88866. "Meta.geomReduce": ["geojson", "callback", "initialValue"],
  88867. "Meta.propEach": ["geojson", "callback"],
  88868. "Meta.propReduce": ["geojson", "callback", "initialValue"],
  88869. "Meta.segmentEach": ["geojson", "callback"],
  88870. "Meta.segmentReduce": ["geojson", "callback", "initialValue"],
  88871. "Meta.getCluster": ["geojson", "filter"],
  88872. "Meta.clusterEach": ["geojson", "property", "callback"],
  88873. "Meta.clusterReduce": ["geojson", "property", "callback", "initialValue"],
  88874. "Assertions.collectionOf": ["featureCollection", "type", "name"],
  88875. "Assertions.containsNumber": ["coordinates"],
  88876. "Assertions.geojsonType": ["value", "type", "name"],
  88877. "Assertions.featureOf": ["feature", "type", "name"],
  88878. "Booleans.booleanClockwise": ["line"],
  88879. "Booleans.booleanContains": ["feature1", "feature2"],
  88880. "Booleans.booleanCrosses": ["feature1", "feature2"],
  88881. "Booleans.booleanDisjoint": ["feature1", "feature2"],
  88882. "Booleans.booleanEqual": ["feature1", "feature2"],
  88883. "Booleans.booleanOverlap": ["feature1", "feature2"],
  88884. "Booleans.booleanParallel": ["feature1", "feature2"],
  88885. "Booleans.booleanPointInPolygon": ["point", "polygon", "ignoreBoundary"],
  88886. "Booleans.booleanPointOnLine": ["point", "linestring", "ignoreEndVertices"],
  88887. "UnitConversion.bearingToAngle": ["bearing"],
  88888. "UnitConversion.convertArea": ["area", "originalUnit", "finalUnit"],
  88889. "UnitConversion.convertLength": ["length", "originalUnit", "finalUnit"],
  88890. "UnitConversion.degreesToradians": ["degrees"],
  88891. "UnitConversion.lengthToRadians": ["distance", "units"],
  88892. "UnitConversion.lengthToDegrees": ["distance", "units"],
  88893. "UnitConversion.radiansToLength": ["radians", "units"],
  88894. "UnitConversion.radiansToDegrees": ["radians"],
  88895. "UnitConversion.toMercator": ["geojson","mutate"],
  88896. "UnitConversion.toWgs84": ["geojson","mutate"]
  88897. };
  88898. // 5.0.0 及以上版本参数配置
  88899. this.turfOptionMap={
  88900. "Measurement.along": ["line", "distance", {units:""}],
  88901. "Measurement.bboxPolygon": ["bbox",{properties:"",id:""}],
  88902. "Measurement.bearing": ["start", "end", {final:""}],
  88903. "Measurement.center": ["geojson", {properties:""}],
  88904. "Measurement.destination": ["origin", "distance", "bearing", {units:"",properties:""}],
  88905. "Measurement.distance": ["from", "to", {units:""}],
  88906. "Measurement.length": ["geojson", {units:""}],
  88907. "Measurement.rhumbBearing": ["start", "end", {final:""}],
  88908. "Measurement.rhumbDestination": ["origin", "distance", "bearing", {units:"",properties:""}],
  88909. "Measurement.rhumbDistance": ["from", "to", {units:""}],
  88910. "Measurement.greatCircle": ["start", "end", {properties:"", npoints:"", offset:""}],
  88911. "CoordinateMutation.cleanCoords":["geojson",{mutate:""}],
  88912. "CoordinateMutation.flip": ["geojson", {mutate:""}],
  88913. "CoordinateMutation.rewind": ["geojson",{mutate:"",reverse:""}],
  88914. "CoordinateMutation.truncate": ["geojson", {precision:"", coordinates:"", mutate:""}],
  88915. "Transformation.bezierSpline": ["line", {resolution:"", sharpness:""}],
  88916. "Transformation.buffer": ["geojson", "radius", {units:"", steps:""}],
  88917. "Transformation.circle": ["center", "radius", {units:"", steps:"",properties:""}],
  88918. "Transformation.concave": ["points", {maxEdge:"", units:""}],
  88919. "Transformation.convex": ["geojson",{concavity:""}],
  88920. "Transformation.dissolve": ["featureCollection", {propertyName:""}],
  88921. "Transformation.lineOffset": ["geojson", "distance", {units:""}],
  88922. "Transformation.simplify": ["geojson", {tolerance:"", highQuality:""}],
  88923. "Transformation.transformRotate": ["geojson", "angle", {pivot:"", mutate:""}],
  88924. "Transformation.transformTranslate": ["geojson", "distance", "direction", {units:"", zTranslation:"", mutate:""}],
  88925. "Transformation.transformScale": ["geojson", "factor", {origin:"", mutate:""}],
  88926. "Transformation.voronoi": ["points",{bbox:""}],
  88927. "featureConversion.lineStringToPolygon": ["lines",{properties:"", autoComplete:"", orderCoords:""}],
  88928. "featureConversion.polygonToLineString": ["polygon", {properties:""}],
  88929. "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", {steps:"", units:""}],
  88930. "Misc.lineChunk": ["geojson", "segmentLength", {units:"", reverse:""}],
  88931. "Misc.lineOverlap": ["line1", "line2",{tolerance:""}],
  88932. "Misc.lineSliceAlong": ["line", "startDist", "stopDist", {units:""}],
  88933. "Misc.pointOnLine": ["lines", "pt", {units:""}],
  88934. "Misc.sector": ["center", "radius", "bearing1", "bearing2", {units:"",steps:"",properties:""}],
  88935. "Misc.shortestPath": ["start", "end", {obstacles:"", units:"",resolution:""}],
  88936. "Helper.feature": ["geometry", "properties",{bbox:"",id:""}],
  88937. "Helper.geometryCollection": ["geometries", "properties",{bbox:"",id:""}],
  88938. "Helper.lineString": ["coordinates", "properties",{bbox:"",id:""}],
  88939. "Helper.multiLineString": ["coordinates", "properties",{bbox:"",id:""}],
  88940. "Helper.multiPoint": ["coordinates", "properties",{bbox:"",id:""}],
  88941. "Helper.multiPolygon": ["coordinates", "properties",{bbox:"",id:""}],
  88942. "Helper.point": ["coordinates", "properties",{bbox:"",id:""}],
  88943. "Helper.polygon": ["coordinates", "properties",{bbox:"",id:""}],
  88944. "Interpolation.interpolate": ["points", "cellSize", {gridType:"", property:"", units:"", weight:""}],
  88945. "Interpolation.isobands": ["pointGrid", "breaks", {zProperty:"", commonProperties:"",breaksProperties:""}],
  88946. "Interpolation.isolines": ["pointGrid", "breaks", {zProperty:"", commonProperties:"", breaksProperties:""}],
  88947. "Grids.hexGrid": ["bbox", "cellSide", {units:"", triangles:"",properties:"",mask:""}],
  88948. "Grids.pointGrid": ["bbox", "cellSide", {units:"", mask:"",properties:""}],
  88949. "Grids.squareGrid": ["bbox", "cellSide", {units:"", mask:"",properties:""}],
  88950. "Grids.triangleGrid": ["bbox", "cellSide", {units:"", mask:"",properties:""}],
  88951. "Aggregation.clustersDbscan": ["points", "maxDistance", {units:"", minPoints:"",mutate:""}],
  88952. "Aggregation.clustersKmeans": ["points", {numberOfClusters:"", mutate:""}],
  88953. "Booleans.booleanPointInPolygon": ["point", "polygon", {ignoreBoundary:""}],
  88954. "Booleans.booleanPointOnLine": ["point", "linestring", {ignoreEndVertices:""}],
  88955. "UnitConversion.toMercator": ["geojson",{mutate:""}],
  88956. "UnitConversion.toWgs84": ["geojson",{mutate:""}]
  88957. }
  88958. }
  88959. /**
  88960. * @function Turf.prototype.process
  88961. * @description 执行 Turf.js 提供的相关空间分析方法。
  88962. * @param {string} type - Turf.js 提供的空间分析方法名。
  88963. * @param {Object} args - Turf.js 提供的空间分析方法对应的参数对象。
  88964. * @param {function} callback - 空间分析完成执行的回调函数,返回执行的结果。
  88965. * @param {boolean} addFeaturesToMap - 是否添加到 Map。
  88966. */
  88967. process(type, args, callback, addFeaturesToMap) {
  88968. var result;
  88969. // 兼容版本4到5
  88970. try{
  88971. result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parse(type, args));
  88972. }catch(e){
  88973. result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parseOption(type, args));
  88974. }
  88975. var features = null;
  88976. try {
  88977. features = (new (external_ol_format_GeoJSON_default())()).readFeatures(result);
  88978. } catch (e) {
  88979. if (callback) {
  88980. callback(result);
  88981. }
  88982. return;
  88983. }
  88984. addFeaturesToMap = addFeaturesToMap == null ? true : addFeaturesToMap;
  88985. if (addFeaturesToMap) {
  88986. this.addFeatures(features);
  88987. }
  88988. if (callback) {
  88989. callback(result);
  88990. }
  88991. }
  88992. parse(type, args) {
  88993. if (type === 'Transformation.union') {
  88994. return args['A'];
  88995. }
  88996. var result = [];
  88997. var tempArgs = this.turfMap[type];
  88998. if (tempArgs) {
  88999. tempArgs.map(function (key) {
  89000. result.push(args[key]);
  89001. return args[key];
  89002. });
  89003. }
  89004. return result;
  89005. }
  89006. parseOption(type,args){
  89007. var result = [];
  89008. var tempArgs = this.turfOptionMap[type];
  89009. tempArgs.map(function(key){
  89010. if(key instanceof Object){
  89011. var options = key;
  89012. Object.keys(options).forEach(function(k){
  89013. options[k]=args[k]
  89014. })
  89015. result.push(options);
  89016. }else{
  89017. result.push(args[key])
  89018. }
  89019. return args;
  89020. })
  89021. return result;
  89022. }
  89023. }
  89024. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Unique.js
  89025. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89026. * This program are made available under the terms of the Apache License, Version 2.0
  89027. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89028. /**
  89029. * @class Unique
  89030. * @browsernamespace ol.source
  89031. * @category Visualization Theme
  89032. * @classdesc 单值专题图图层源。
  89033. * @modulecategory Overlay
  89034. * @param {string} name - 图层名称。
  89035. * @param {Object} opt_options - 参数。
  89036. * @param {ol.Map} opt_options.map - 当前 Map 对象。
  89037. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层ID。
  89038. * @param {number} [opt_options.opacity=1] - 图层透明度。
  89039. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  89040. * @param {ol.proj.Projection} [opt_options.projection] - 投影信息。
  89041. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是1 或更高。
  89042. * @param {Array} [opt_options.resolutions] - 分辨率数组。
  89043. * @param {ol.source.State} [opt_options.state] - 资源状态。
  89044. * @param {string} [opt_options.themeField] - 指定创建专题图字段。
  89045. * @param {Object} [opt_options.style] - 专题图样式。
  89046. * @param {Object} [opt_options.styleGroups] - 各专题类型样式组。
  89047. * @param {boolean} [opt_options.isHoverAble=false] - 是否开启 hover 事件。
  89048. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  89049. * @param {(string|Object)} [opt_options.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  89050. * @extends {GeoFeature}
  89051. * @usage
  89052. */
  89053. class Unique extends GeoFeature {
  89054. constructor(name, opt_options) {
  89055. super(name, opt_options);
  89056. this.themeField = opt_options.themeField;
  89057. this.style = opt_options.style;
  89058. this.styleGroups = opt_options.styleGroups;
  89059. this.isHoverAble = opt_options.isHoverAble;
  89060. this.highlightStyle = opt_options.highlightStyle;
  89061. }
  89062. /**
  89063. * @function Unique.prototype.destroy
  89064. * @description 释放资源,将引用资源的属性置空。
  89065. */
  89066. destroy() {
  89067. this.style = null;
  89068. this.themeField = null;
  89069. this.styleGroups = null;
  89070. GeoFeature.prototype.destroy.apply(this, arguments);
  89071. }
  89072. /**
  89073. * @private
  89074. * @function Unique.prototype.createThematicFeature
  89075. * @description 创建专题要素。
  89076. * @param {Object} feature - 要素。
  89077. */
  89078. createThematicFeature(feature) {
  89079. var style = this.getStyleByData(feature);
  89080. //创建专题要素时的可选参数
  89081. var options = {};
  89082. options.nodesClipPixel = this.nodesClipPixel;
  89083. options.isHoverAble = this.isHoverAble;
  89084. options.isMultiHover = this.isMultiHover;
  89085. options.isClickAble = this.isClickAble;
  89086. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  89087. //将数据转为专题要素(ThemeVector)
  89088. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  89089. //直接添加图形到渲染器
  89090. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  89091. this.renderer.addShape(thematicFeature.shapes[m]);
  89092. }
  89093. return thematicFeature;
  89094. }
  89095. /**
  89096. * @private
  89097. * @function Unique.prototype.getStyleByData
  89098. * @description 根据用户数据(feature)设置专题要素的 Style。
  89099. * @param {Object} fea - 用户要素数据。
  89100. */
  89101. getStyleByData(fea) {
  89102. var style = {};
  89103. var feature = fea;
  89104. style = Util_Util.copyAttributesWithClip(style, this.style);
  89105. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  89106. var tf = this.themeField;
  89107. var Attrs = feature.attributes;
  89108. var Gro = this.styleGroups;
  89109. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  89110. var attr = null; //属性值
  89111. for (var property in Attrs) {
  89112. if (tf === property) {
  89113. isSfInAttrs = true;
  89114. attr = Attrs[property];
  89115. break;
  89116. }
  89117. }
  89118. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  89119. if (isSfInAttrs) {
  89120. for (var i = 0, len = Gro.length; i < len; i++) {
  89121. if ((attr).toString() === ( Gro[i].value).toString()) {
  89122. //feature.style = CommonUtil.copyAttributes(feature.style, this.defaultStyle);
  89123. var sty1 = Gro[i].style;
  89124. style = Util_Util.copyAttributesWithClip(style, sty1);
  89125. }
  89126. }
  89127. }
  89128. }
  89129. if (feature.style && this.isAllowFeatureStyle === true) {
  89130. style = Util_Util.copyAttributesWithClip(feature.style);
  89131. }
  89132. return style;
  89133. }
  89134. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  89135. return GeoFeature.prototype.canvasFunctionInternal_.apply(this, arguments);
  89136. }
  89137. }
  89138. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/VectorTileStyles.js
  89139. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89140. * This program are made available under the terms of the Apache License, Version 2.0
  89141. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89142. /**
  89143. * @class VectorTileStyles
  89144. * @classdesc 矢量瓦片风格。
  89145. * @modulecategory Overlay
  89146. * @category Visualization VectorTile
  89147. * @param {Object} options - 交互时所需可选参数。
  89148. * @extends {ol.Observable}
  89149. * @usage
  89150. */
  89151. class VectorTileStyles extends (external_ol_Observable_default()) {
  89152. constructor(options) {
  89153. super();
  89154. if (!options) {
  89155. return;
  89156. }
  89157. var donotNeedServerCartoCss = false;
  89158. if (options.donotNeedServerCartoCss !== undefined) {
  89159. donotNeedServerCartoCss = options.donotNeedServerCartoCss
  89160. }
  89161. VectorTileStyles.setDonotNeedServerCartoCss(donotNeedServerCartoCss);
  89162. if (options.view) {
  89163. VectorTileStyles.setView(options.view);
  89164. }
  89165. if (options.url) {
  89166. VectorTileStyles.setUrl(options.url);
  89167. }
  89168. if (options.cartoCss) {
  89169. VectorTileStyles.setCartoCss(options.cartoCss);
  89170. }
  89171. var selectedPointStyle = getDefaultSelectedPointStyle();
  89172. if (options.selectedPointStyle) {
  89173. selectedPointStyle = options.selectedPointStyle;
  89174. }
  89175. VectorTileStyles.setSelectedPointStyle(selectedPointStyle);
  89176. var selectedLineStyle = getDefaultSelectedLineStyle();
  89177. if (options.selectedLineStyle) {
  89178. selectedLineStyle = options.selectedLineStyle;
  89179. }
  89180. VectorTileStyles.setSelectedLineStyle(selectedLineStyle);
  89181. var selectedRegionStyle = getDefaultSelectedRegionStyle();
  89182. if (options.selectedRegionStyle) {
  89183. selectedRegionStyle = options.selectedRegionStyle;
  89184. }
  89185. VectorTileStyles.setSelectedRegionStyle(selectedRegionStyle);
  89186. var selectedTextStyle = getDefaultSelectedTextStyle();
  89187. if (options.selectedTextStyle) {
  89188. selectedTextStyle = options.selectedTextStyle;
  89189. }
  89190. VectorTileStyles.setSelectedTextStyle(selectedTextStyle);
  89191. var layersXHR = new XMLHttpRequest();
  89192. layersXHR.onreadystatechange = function () {
  89193. if (layersXHR.readyState == 4) {
  89194. var result = JSON.parse(layersXHR.responseText);
  89195. var layersInfo = {};
  89196. for (var i = 0, len = result.length; i < len; i++) {
  89197. var layers = result[i].subLayers.layers;
  89198. for (var j = 0, len1 = layers.length; j < len1; j++) {
  89199. layers[j].layerIndex = len1 - j;
  89200. layersInfo[layers[j].name] = layers[j];
  89201. }
  89202. }
  89203. VectorTileStyles.setLayersInfo(layersInfo);
  89204. if (!VectorTileStyles.getDonotNeedServerCartoCss()) {
  89205. var vectorStylesXHR = new XMLHttpRequest();
  89206. vectorStylesXHR.open("GET", Util_Util.urlPathAppend(VectorTileStyles.getUrl(), "tileFeature/vectorstyles.json"), false);
  89207. vectorStylesXHR.onreadystatechange = function () {
  89208. if (vectorStylesXHR.readyState == 4) {
  89209. var vectorStyles = new JSONFormat().read(vectorStylesXHR.responseText);
  89210. var cartoCss;
  89211. if (vectorStyles.style && vectorStyles.type === 'cartoCSS') {
  89212. cartoCss = vectorStyles.style;
  89213. cartoCss = cartoCss.replace(/[@]/gi, "___");
  89214. cartoCss = cartoCss.replace(/\\#/gi, "___");
  89215. //替换一些关键符号
  89216. var cachedLayer = {};
  89217. layersInfo && Object.keys(layersInfo).sort().forEach(function (attr) {
  89218. var newAttr = attr.replace(/[@#\s]/gi, "___");
  89219. var to = attr;
  89220. var keys = Object.keys(cachedLayer);
  89221. for (let index = keys.length; index > -1; index--) {
  89222. if (attr.indexOf(keys[index]) > -1) {
  89223. to = attr.replace(keys[index], cachedLayer[keys[index]]);
  89224. break;
  89225. }
  89226. }
  89227. to = to.replace(/[#]/gi, "\#");
  89228. cachedLayer[attr] = newAttr;
  89229. cartoCss = cartoCss.replace(new RegExp(to, "g"), newAttr);
  89230. })
  89231. cartoCss = cartoCss.replace(/[#]/gi, "\n#");
  89232. //将zoom转化为scale,以免引起混淆
  89233. cartoCss = cartoCss.replace(/\[zoom/gi, "[scale");
  89234. }
  89235. var cartoShadersArray = new CartoCSS(cartoCss).getShaders();
  89236. var cartoShaders = {};
  89237. cartoShadersArray.forEach(function (cartoShader) {
  89238. cartoShaders[cartoShader.elements[0].clean] = cartoShaders[cartoShader.elements[0].clean] || {};
  89239. cartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] = cartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] || [];
  89240. cartoShaders[cartoShader.elements[0].clean][cartoShader.attachment].push(cartoShader);
  89241. return cartoShader;
  89242. });
  89243. VectorTileStyles.setCartoShaders(cartoShaders);
  89244. }
  89245. };
  89246. vectorStylesXHR.send(null);
  89247. }
  89248. if (VectorTileStyles.getCartoCss()) {
  89249. var clientCartoShadersArray = new CartoCSS(VectorTileStyles.getCartoCss()).getShaders();
  89250. var clientCartoShaders = {};
  89251. clientCartoShadersArray.forEach(function (cartoShader) {
  89252. clientCartoShaders[cartoShader.elements[0].clean] = clientCartoShaders[cartoShader.elements[0].clean] || {};
  89253. clientCartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] = clientCartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] || [];
  89254. clientCartoShaders[cartoShader.elements[0].clean][cartoShader.attachment].push(cartoShader);
  89255. return cartoShader;
  89256. });
  89257. VectorTileStyles.setClientCartoShaders(clientCartoShaders);
  89258. }
  89259. }
  89260. };
  89261. layersXHR.open("GET", Util_Util.urlPathAppend(VectorTileStyles.getUrl(), "layers.json"), false);
  89262. layersXHR.send(null);
  89263. this.on('featureSelected', function (e) {
  89264. VectorTileStyles.setSelectedId(e.selectedId);
  89265. VectorTileStyles.setLayerName(e.layerName);
  89266. });
  89267. /**
  89268. * @function VectorTileStyles.prototype.getDefaultSelectedPointStyle
  89269. * @description 设置默认选择后的点样式。
  89270. */
  89271. function getDefaultSelectedPointStyle() {
  89272. return new (external_ol_style_Style_default())({
  89273. image: new (external_ol_style_Circle_default())({
  89274. radius: 5,
  89275. fill: new (external_ol_style_Fill_default())({
  89276. color: 'blue'
  89277. })
  89278. })
  89279. })
  89280. }
  89281. /**
  89282. * @function VectorTileStyles.prototype.getDefaultSelectedLineStyle
  89283. * @description 设置默认选择后的线样式。
  89284. */
  89285. function getDefaultSelectedLineStyle() {
  89286. return new (external_ol_style_Style_default())({
  89287. stroke: new (external_ol_style_Stroke_default())({
  89288. color: 'blue',
  89289. width: 3
  89290. })
  89291. })
  89292. }
  89293. /**
  89294. * @function VectorTileStyles.prototype.getDefaultSelectedRegionStyle
  89295. * @description 设置默认选择后的面样式。
  89296. */
  89297. function getDefaultSelectedRegionStyle() {
  89298. return new (external_ol_style_Style_default())({
  89299. fill: new (external_ol_style_Fill_default())({
  89300. color: [0, 0, 255, 0.5]
  89301. }),
  89302. stroke: new (external_ol_style_Stroke_default())({
  89303. color: 'blue',
  89304. width: 3
  89305. })
  89306. })
  89307. }
  89308. /**
  89309. * @function VectorTileStyles.prototype.getDefaultSelectedTextStyle
  89310. * @description 设置默认选择后的文本样式。
  89311. */
  89312. function getDefaultSelectedTextStyle() {
  89313. return new (external_ol_style_Style_default())({
  89314. text: new (external_ol_style_Text_default())({
  89315. font: '15px Microsoft YaHei',
  89316. fill: new (external_ol_style_Fill_default())({
  89317. color: 'blue'
  89318. }),
  89319. stroke: new (external_ol_style_Stroke_default())({
  89320. color: 'white',
  89321. width: 1
  89322. })
  89323. })
  89324. });
  89325. }
  89326. }
  89327. /**
  89328. * @function VectorTileStyles.setCartoShaders
  89329. * @description 设置服务端 Carto 的阴影。
  89330. * @param {Array} cartoShaders - 服务端 Carto 阴影。
  89331. */
  89332. static setCartoShaders(cartoShaders) {
  89333. this.cartoShaders = cartoShaders;
  89334. }
  89335. /**
  89336. * @function VectorTileStyles.getCartoShaders
  89337. * @description 获取服务端 Carto 的阴影。
  89338. */
  89339. static getCartoShaders() {
  89340. return this.cartoShaders;
  89341. }
  89342. /**
  89343. * @function VectorTileStyles.setClientCartoShaders
  89344. * @description 设置客户端 Carto 的阴影。
  89345. * @param {Array} clientCartoShaders - 客户端 Carto 阴影。
  89346. */
  89347. static setClientCartoShaders(clientCartoShaders) {
  89348. this.clientCartoShaders = clientCartoShaders;
  89349. }
  89350. /**
  89351. * @function VectorTileStyles.getClientCartoShaders
  89352. * @description 获取客户端 Carto 的阴影。
  89353. */
  89354. static getClientCartoShaders() {
  89355. return this.clientCartoShaders;
  89356. }
  89357. /**
  89358. * @function VectorTileStyles.setCartoCss
  89359. * @description 设置 CartoCSS 的样式。
  89360. * @param {Object} cartoCss - CartoCSS 的样式。
  89361. */
  89362. static setCartoCss(cartoCss) {
  89363. this.cartoCss = cartoCss;
  89364. }
  89365. /**
  89366. * @function VectorTileStyles.getCartoCss
  89367. * @description 获取 CartoCSS 的样式。
  89368. */
  89369. static getCartoCss() {
  89370. return this.cartoCss;
  89371. }
  89372. /**
  89373. * @function VectorTileStyles.setDonotNeedServerCartoCss
  89374. * @description 设置是否需要 CartoCss 服务。
  89375. * @param {Object} donotNeedServerCartoCss - 是否需要 CartoCss 服务。
  89376. */
  89377. static setDonotNeedServerCartoCss(donotNeedServerCartoCss) {
  89378. this.donotNeedServerCartoCss = donotNeedServerCartoCss;
  89379. }
  89380. /**
  89381. * @function VectorTileStyles.getDonotNeedServerCartoCss
  89382. * @description 获取是否需要 CartoCss 服务。
  89383. */
  89384. static getDonotNeedServerCartoCss() {
  89385. return this.donotNeedServerCartoCss;
  89386. }
  89387. /**
  89388. * @function VectorTileStyles.setLayersInfo
  89389. * @description 设置图层信息服务。
  89390. * @param {Object} layersInfo - 图层信息。
  89391. */
  89392. static setLayersInfo(layersInfo) {
  89393. this.layersInfo = layersInfo;
  89394. }
  89395. /**
  89396. * @function VectorTileStyles.getLayersInfo
  89397. * @description 获取图层信息服务。
  89398. */
  89399. static getLayersInfo() {
  89400. return this.layersInfo;
  89401. }
  89402. /**
  89403. * @function VectorTileStyles.setUrl
  89404. * @description 设置地址。
  89405. * @param {string} url - 地址。
  89406. */
  89407. static setUrl(url) {
  89408. this.url = url;
  89409. }
  89410. /**
  89411. * @function VectorTileStyles.getUrl
  89412. * @description 获取地址。
  89413. */
  89414. static getUrl() {
  89415. return this.url;
  89416. }
  89417. /**
  89418. * @function VectorTileStyles.setView
  89419. * @description 设置视图。
  89420. * @param {Object} view - 视图。
  89421. */
  89422. static setView(view) {
  89423. this.view = view;
  89424. }
  89425. /**
  89426. * @function VectorTileStyles.getView
  89427. * @description 获取视图。
  89428. */
  89429. static getView() {
  89430. return this.view;
  89431. }
  89432. /**
  89433. * @function VectorTileStyles.setSelectedId
  89434. * @description 设置选择序号。
  89435. * @param {number} selectedId - 选择序号。
  89436. */
  89437. static setSelectedId(selectedId) {
  89438. this.selectedId = selectedId;
  89439. }
  89440. /**
  89441. * @function VectorTileStyles.getSelectedId
  89442. * @description 获取选择序号。
  89443. */
  89444. static getSelectedId() {
  89445. return this.selectedId;
  89446. }
  89447. /**
  89448. * @function VectorTileStyles.setLayerName
  89449. * @description 设置图层名称。
  89450. * @param {string} layerName - 图层名称。
  89451. */
  89452. static setLayerName(layerName) {
  89453. this.layerName = layerName;
  89454. }
  89455. /**
  89456. * @function VectorTileStyles.getLayerName
  89457. * @description 获取图层名称。
  89458. */
  89459. static getLayerName() {
  89460. return this.layerName;
  89461. }
  89462. /**
  89463. * @function VectorTileStyles.setSelectedPointStyle
  89464. * @description 设置选择后点样式。
  89465. * @param {Object} selectedPointStyle - 选择后点样式。
  89466. */
  89467. static setSelectedPointStyle(selectedPointStyle) {
  89468. this.selectedPointStyle = selectedPointStyle;
  89469. }
  89470. /**
  89471. * @function VectorTileStyles.setSelectedLineStyle
  89472. * @description 设置选择后线样式。
  89473. * @param {Object} selectedLineStyle - 选择后线样式。
  89474. */
  89475. static setSelectedLineStyle(selectedLineStyle) {
  89476. this.selectedLineStyle = selectedLineStyle;
  89477. }
  89478. /**
  89479. * @function VectorTileStyles.setSelectedRegionStyle
  89480. * @description 设置选择后面样式。
  89481. * @param {Object} selectedRegionStyle - 选择后面样式。
  89482. */
  89483. static setSelectedRegionStyle(selectedRegionStyle) {
  89484. this.selectedRegionStyle = selectedRegionStyle;
  89485. }
  89486. /**
  89487. * @function VectorTileStyles.setSelectedTextStyle
  89488. * @description 设置选择后文本样式。
  89489. * @param {Object} selectedTextStyle - 选择后文本样式。
  89490. */
  89491. static setSelectedTextStyle(selectedTextStyle) {
  89492. this.selectedTextStyle = selectedTextStyle;
  89493. }
  89494. /**
  89495. * @function VectorTileStyles.getSelectedStyle
  89496. * @description 设置选择后的样式。
  89497. * @param {string} type - 选择后的样式。
  89498. */
  89499. static getSelectedStyle(type) {
  89500. if (type === 'POINT' || type === 'MULTIPOINT') {
  89501. return this.selectedPointStyle;
  89502. }
  89503. if (type === 'LINESTRING' || type === 'MULTILINESTRING') {
  89504. return this.selectedLineStyle;
  89505. }
  89506. if (type === 'POLYGON' || type === 'MULTIPOLYGON') {
  89507. return this.selectedRegionStyle;
  89508. }
  89509. if (type === 'TEXT') {
  89510. return this.selectedTextStyle;
  89511. }
  89512. }
  89513. /**
  89514. * @function VectorTileStyles.getLayerInfo
  89515. * @description 获取图层的信息。
  89516. * @param {string} layerName - 图层名。
  89517. */
  89518. static getLayerInfo(layerName) {
  89519. var layersInfo = VectorTileStyles.getLayersInfo();
  89520. if (layersInfo === undefined) {
  89521. return null;
  89522. }
  89523. var layerInfo = layersInfo[layerName];
  89524. if (!layerInfo) {
  89525. return null;
  89526. }
  89527. var layerInfo_simple = {layerIndex: layerInfo.layerIndex, ugcLayerType: layerInfo.ugcLayerType};
  89528. switch (layerInfo.ugcLayerType) {
  89529. case "VECTOR":
  89530. layerInfo_simple.layerStyle = layerInfo.style ? layerInfo.style : null;
  89531. break;
  89532. case "THEME":
  89533. var theme = layerInfo.theme;
  89534. layerInfo_simple.layerStyle = theme ? theme.defaultStyle : null;
  89535. if (theme && theme.type === "LABEL") {
  89536. layerInfo_simple.type = theme.type;
  89537. layerInfo_simple.textField = theme.labelExpression;
  89538. }
  89539. break;
  89540. default :
  89541. //SVTile发布出来的地图没有ugcLayerType属性
  89542. if (layerInfo.style) {
  89543. layerInfo_simple.layerStyle = layerInfo.style;
  89544. }
  89545. break;
  89546. }
  89547. return layerInfo_simple;
  89548. }
  89549. /**
  89550. * @function VectorTileStyles.getStyle
  89551. * @description 获取样式。
  89552. * @param {string} originalLayerName - 原始图层信息。
  89553. * @param {Object} feature - 要素对象。
  89554. */
  89555. static getStyle(originalLayerName, feature) {
  89556. var url = VectorTileStyles.getUrl(),
  89557. view = VectorTileStyles.getView(),
  89558. zoom = view.getZoom(),
  89559. dpi = 96,
  89560. scale = core_Util_Util.resolutionToScale(view.getResolution(), dpi, Unit.METER),
  89561. layerName = originalLayerName.replace(/(@)/gi, '___').replace(/(#)/gi, '___');
  89562. // feature对象样式的配置遵循以下优先级:
  89563. // 客户端CartoCSS > 服务器端CartoCSS > 服务器端layer样式 > 客户端默认样式。
  89564. if (VectorTileStyles.getCartoCss() && VectorTileStyles.getClientCartoShaders()[layerName]) {
  89565. return getStyleArray(VectorTileStyles.getClientCartoShaders()[layerName]);
  89566. }
  89567. var layerInfo = VectorTileStyles.getLayerInfo(originalLayerName);
  89568. if (!VectorTileStyles.getDonotNeedServerCartoCss() && VectorTileStyles.getCartoShaders()[layerName]) {
  89569. //如果是文本,这里特殊处理。
  89570. if (feature.getProperties().textStyle || feature.getProperties().TEXT_FEATURE_CONTENT || layerInfo.type == 'LABEL' && layerInfo.textField) {
  89571. var featureStyle = StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, url);
  89572. if (feature.getGeometry().getType().toUpperCase() === "POINT") {
  89573. featureStyle = mergeTextFeatureStyle(layerInfo, feature, url);
  89574. }
  89575. return featureStyle;
  89576. }
  89577. return getStyleArray(VectorTileStyles.getCartoShaders()[layerName]);
  89578. }
  89579. if (layerInfo) {
  89580. return StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, url);
  89581. }
  89582. function getStyleArray(shaderAttachment) {
  89583. var styleArray = [];
  89584. for (var j in shaderAttachment) {
  89585. shaderAttachment[j].map(function (shader) {
  89586. styleArray.push(StyleUtils.getStyleFromCarto(zoom, scale, shader, feature, true, url))
  89587. return shader;
  89588. })
  89589. }
  89590. return styleArray;
  89591. }
  89592. /**
  89593. * @function VectorTileStyles.prototype.mergeTextFeatureStyle
  89594. * @description 合并文本要素样式。
  89595. * @param {string} layerInfo - 图层信息。
  89596. * @param {Object} feature - 获取的要素。
  89597. * @param {string} url - 服务地址。
  89598. */
  89599. function mergeTextFeatureStyle(layerInfo, feature, url) {
  89600. var textFeatureStyle = StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, url);
  89601. if (layerInfo.type == 'LABEL') {
  89602. feature.setProperties({type: "TEXT"});
  89603. var cartoTextStyles = getStyleArray(VectorTileStyles.getCartoShaders()[layerName]);
  89604. var textStyle = textFeatureStyle.getText();
  89605. for (var i = 0; i < cartoTextStyles.length; i++) {
  89606. if (!textStyle) {
  89607. textStyle = cartoTextStyles[i].getText();
  89608. } else {
  89609. textStyle.setText(cartoTextStyles[i].getText().getText());
  89610. }
  89611. }
  89612. textFeatureStyle.setText(textStyle);
  89613. return textFeatureStyle;
  89614. }
  89615. return textFeatureStyle;
  89616. }
  89617. }
  89618. /**
  89619. * @function VectorTileStyles.prototype.getFeatureStyle
  89620. * @description 获取要素样式。
  89621. * @param {Object} feature - 要素。
  89622. */
  89623. getFeatureStyle(feature) {
  89624. var selectedStyle;
  89625. var layerName = feature.getProperties().layerName || feature.getProperties().layer;
  89626. var id = feature.getProperties().id || parseInt(feature.getProperties().SmID);
  89627. if (feature.getProperties().type && feature.getProperties().type.toUpperCase() === 'TEXT') {
  89628. selectedStyle = VectorTileStyles.getSelectedStyle(feature.getProperties().type.toUpperCase());
  89629. if (feature.getProperties().texts) {
  89630. selectedStyle.getText().text_ = feature.getProperties().texts[0];
  89631. } else {
  89632. selectedStyle.getText().text_ = "";
  89633. }
  89634. } else {
  89635. selectedStyle = VectorTileStyles.getSelectedStyle(feature.getGeometry().getType().toUpperCase());
  89636. }
  89637. if (selectedStyle) {
  89638. var selectedLayerName = VectorTileStyles.getLayerName();
  89639. var selectedId = VectorTileStyles.getSelectedId();
  89640. if (selectedLayerName === layerName && id === selectedId) {
  89641. return selectedStyle;
  89642. }
  89643. }
  89644. return VectorTileStyles.getStyle(layerName, feature);
  89645. }
  89646. }
  89647. ;// CONCATENATED MODULE: external "ol.source.VectorTile"
  89648. const external_ol_source_VectorTile_namespaceObject = ol.source.VectorTile;
  89649. var external_ol_source_VectorTile_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_VectorTile_namespaceObject);
  89650. ;// CONCATENATED MODULE: external "ol.format.MVT"
  89651. const external_ol_format_MVT_namespaceObject = ol.format.MVT;
  89652. var external_ol_format_MVT_default = /*#__PURE__*/__webpack_require__.n(external_ol_format_MVT_namespaceObject);
  89653. ;// CONCATENATED MODULE: ./src/openlayers/overlay/VectorTileSuperMapRest.js
  89654. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  89655. * This program are made available under the terms of the Apache License, Version 2.0
  89656. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  89657. /**
  89658. * @class VectorTileSuperMapRest
  89659. * @browsernamespace ol.source
  89660. * @category Visualization VectorTile
  89661. * @classdesc 矢量瓦片图层源。
  89662. * @modulecategory Overlay
  89663. * @param {Object} options - 参数。
  89664. * @param {(string|undefined)} options.url - 服务地址。
  89665. * @param {(string|Object|undefined)} options.style - Mapbox Style JSON 对象或获取 Mapbox Style JSON 对象的 URL。当 `options.format` 为 {@link ol.format.MVT} 且 `options.source` 不为空时有效,优先级高于 `options.url`。
  89666. * @param {(string|undefined)} options.source - Mapbox Style JSON 对象中的source名称。当 `options.style` 设置时有效。当不配置时,默认为 Mapbox Style JSON 的 `sources` 对象中的第一个。
  89667. * @param {(string|Object)} [options.attributions='Tile Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  89668. * @param {Object} [options.format] - 瓦片的要素格式化。
  89669. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  89670. * @extends {ol.source.VectorTile}
  89671. * @usage
  89672. */
  89673. class VectorTileSuperMapRest extends (external_ol_source_VectorTile_default()) {
  89674. constructor(options) {
  89675. if (options.url === undefined && options.style === undefined) {
  89676. console.error("one of 'options.style' or 'options.style' is required");
  89677. }
  89678. var zRegEx = /\{z\}/g;
  89679. var xRegEx = /\{x\}/g;
  89680. var yRegEx = /\{y\}/g;
  89681. var dashYRegEx = /\{-y\}/g;
  89682. options.attributions =
  89683. options.attributions ||
  89684. "Tile Data <span>© SuperMap iServer</span> with <span>© SuperMap iClient</span>";
  89685. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) < 0) {
  89686. options.tileSize = options.format instanceof (external_ol_format_MVT_default()) && options.style ? 512 : 256;
  89687. }
  89688. super({
  89689. attributions: options.attributions,
  89690. cacheSize: options.cacheSize,
  89691. format: options.format || new (external_ol_format_GeoJSON_default())(),
  89692. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  89693. overlaps: options.overlaps,
  89694. projection: options.projection,
  89695. state:
  89696. options.format instanceof (external_ol_format_MVT_default()) &&
  89697. options.style &&
  89698. Object.prototype.toString.call(options.style) == '[object String]'
  89699. ? 'loading'
  89700. : options.state,
  89701. tileClass: options.tileClass,
  89702. tileGrid: options.tileGrid,
  89703. tilePixelRatio: options.tilePixelRatio,
  89704. tileUrlFunction: options.tileUrlFunction || (options.format instanceof (external_ol_format_MVT_default()) && options.style ? zxyTileUrlFunction : tileUrlFunction),
  89705. tileLoadFunction: options.tileLoadFunction || (options.format instanceof (external_ol_format_MVT_default()) ? mvtTileLoadFunction : tileLoadFunction),
  89706. wrapX: options.wrapX !== undefined ? options.wrapX : false,
  89707. tileSize: options.tileSize || null,
  89708. zDirection: ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? null : 0
  89709. });
  89710. var me = this;
  89711. me.withCredentials = options.withCredentials;
  89712. me._tileType = options.tileType || 'ScaleXY';
  89713. this.vectorTileStyles = new VectorTileStyles();
  89714. if (options.format instanceof (external_ol_format_MVT_default()) && options.style) {
  89715. if (Object.prototype.toString.call(options.style) == '[object String]') {
  89716. var url = SecurityManager.appendCredential(options.style);
  89717. FetchRequest.get(url, null, { withCredentials: options.withCredentials })
  89718. .then((response) => response.json())
  89719. .then((mbStyle) => {
  89720. this._fillByStyleJSON(mbStyle, options.source);
  89721. this.setState('ready');
  89722. });
  89723. } else {
  89724. this._fillByStyleJSON(options.style, options.source);
  89725. }
  89726. } else {
  89727. this._fillByRestMapOptions(options.url, options);
  89728. }
  89729. function tileUrlFunction(tileCoord, pixelRatio, projection) {
  89730. if (!me.tileGrid) {
  89731. me.tileGrid = me.getTileGridForProjection(projection);
  89732. }
  89733. var z = tileCoord[0];
  89734. var x = tileCoord[1];
  89735. var y = ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? -tileCoord[2] - 1 : tileCoord[2];
  89736. var tileSize = external_ol_size_namespaceObject.toSize(me.tileGrid.getTileSize(z, me.tmpSize));
  89737. var params = '';
  89738. if (me.tileType === 'ZXY') {
  89739. params = '&width=' + tileSize[0] + '&height=' + tileSize[1] + '&x=' + x + '&y=' + y + '&z=' + z;
  89740. } else if (me.tileType === 'ViewBounds') {
  89741. var tileExtent = me.tileGrid.getTileCoordExtent(tileCoord);
  89742. params =
  89743. '&width=' +
  89744. tileSize[0] +
  89745. '&height=' +
  89746. tileSize[1] +
  89747. '&viewBounds=' +
  89748. tileExtent[0] +
  89749. ',' +
  89750. tileExtent[1] +
  89751. ',' +
  89752. tileExtent[2] +
  89753. ',' +
  89754. tileExtent[3];
  89755. } else {
  89756. var origin = me.tileGrid.getOrigin(z);
  89757. var resolution = me.tileGrid.getResolution(z);
  89758. var dpi = 96;
  89759. var unit = projection.getUnits() || 'degrees';
  89760. if (unit === 'degrees') {
  89761. unit = Unit.DEGREE;
  89762. }
  89763. if (unit === 'm') {
  89764. unit = Unit.METER;
  89765. }
  89766. var scale = core_Util_Util.resolutionToScale(resolution, dpi, unit);
  89767. params =
  89768. '&x=' +
  89769. x +
  89770. '&y=' +
  89771. y +
  89772. '&width=' +
  89773. tileSize[0] +
  89774. '&height=' +
  89775. tileSize[1] +
  89776. '&scale=' +
  89777. scale +
  89778. "&origin={'x':" +
  89779. origin[0] +
  89780. ",'y':" +
  89781. origin[1] +
  89782. '}';
  89783. }
  89784. return me._tileUrl + encodeURI(params);
  89785. }
  89786. function zxyTileUrlFunction(tileCoord) {
  89787. if (!tileCoord) {
  89788. return undefined;
  89789. } else {
  89790. return me._tileUrl
  89791. .replace(zRegEx, tileCoord[0].toString())
  89792. .replace(xRegEx, tileCoord[1].toString())
  89793. .replace(yRegEx, function () {
  89794. var y = ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? -tileCoord[2] - 1 : tileCoord[2];
  89795. return y.toString();
  89796. })
  89797. .replace(dashYRegEx, function () {
  89798. var z = tileCoord[0];
  89799. var range = me.tileGrid.getFullTileRange(z);
  89800. var y = range.getHeight() + tileCoord[2];
  89801. return y.toString();
  89802. });
  89803. }
  89804. }
  89805. /**
  89806. * @private
  89807. * @function VectorTileSuperMapRest.prototype.tileLoadFunction
  89808. * @description 加载瓦片。
  89809. * @param {Object} tile -瓦片类。
  89810. * @param {string} tileUrl - 瓦片地址。
  89811. */
  89812. function tileLoadFunction(tile, tileUrl) {
  89813. var regWidth = new RegExp('(^|\\?|&)' + 'width' + '=([^&]*)(\\s|&|$)');
  89814. var regHeight = new RegExp('(^|\\?|&)' + 'height' + '=([^&]*)(\\s|&|$)');
  89815. var width = Number(tileUrl.match(regWidth)[2]);
  89816. var height = Number(tileUrl.match(regHeight)[2]);
  89817. tile.setLoader(function (extent, resolution, projection) {
  89818. FetchRequest.get(tileUrl)
  89819. .then(function (response) {
  89820. if (tile.getFormat() instanceof (external_ol_format_GeoJSON_default())) {
  89821. return response.json();
  89822. }
  89823. })
  89824. .then(function (tileFeatureJson) {
  89825. var features = [];
  89826. if (tile.getFormat() instanceof (external_ol_format_GeoJSON_default())) {
  89827. tileFeatureJson.recordsets.map(function (recordset) {
  89828. recordset.features.map(function (feature) {
  89829. var points = [];
  89830. var startIndex = 0;
  89831. for (var i = 0; i < feature.geometry.parts.length; i++) {
  89832. var partPointsLength = feature.geometry.parts[i] * 2;
  89833. for (var j = 0, index = startIndex; j < partPointsLength; j += 2, index += 2) {
  89834. points.push(
  89835. new Point(
  89836. feature.geometry.points[index],
  89837. feature.geometry.points[index + 1]
  89838. )
  89839. );
  89840. }
  89841. startIndex += partPointsLength;
  89842. }
  89843. feature.geometry.points = points;
  89844. return feature;
  89845. });
  89846. return recordset;
  89847. });
  89848. tileFeatureJson.recordsets.map(function (recordset) {
  89849. recordset.features.map(function (feature) {
  89850. feature.layerName = recordset.layerName;
  89851. feature.type = feature.geometry.type;
  89852. features.push(feature);
  89853. return feature;
  89854. });
  89855. return recordset;
  89856. });
  89857. let dataProjection = new (external_ol_proj_Projection_default())({
  89858. extent: [0, 0, 256, 256],
  89859. code: 'TILE_PIXELS',
  89860. units: 'tile-pixels'
  89861. });
  89862. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1) {
  89863. tile.setExtent([0, 0, width, height]);
  89864. tile.setProjection(dataProjection);
  89865. features = tile.getFormat().readFeatures(core_Util_Util.toGeoJSON(features));
  89866. } else {
  89867. features = tile.getFormat().readFeatures(core_Util_Util.toGeoJSON(features), {
  89868. extent,
  89869. dataProjection,
  89870. featureProjection: projection
  89871. });
  89872. }
  89873. tile.setFeatures(features);
  89874. }
  89875. });
  89876. });
  89877. }
  89878. /**
  89879. * @private
  89880. * @function VectorTileSuperMapRest.prototype.tileLoadFunction
  89881. * @description 加载瓦片。
  89882. * @param {Object} tile -瓦片类。
  89883. * @param {string} tileUrl - 瓦片地址。
  89884. */
  89885. function mvtTileLoadFunction(tile, tileUrl) {
  89886. const format = tile.getFormat();
  89887. const success = tile.onLoad.bind(tile);
  89888. const failure = tile.onError.bind(tile);
  89889. tile.setLoader(function (extent, resolution, projection) {
  89890. const xhr = new XMLHttpRequest();
  89891. xhr.open(
  89892. 'GET',
  89893. typeof tileUrl === 'function' ? tileUrl(extent, resolution, projection) : tileUrl,
  89894. true
  89895. );
  89896. if (format.getType() == 'arraybuffer') {
  89897. xhr.responseType = 'arraybuffer';
  89898. }
  89899. xhr.withCredentials = me.withCredentials;
  89900. xhr.onload = function () {
  89901. if (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) {
  89902. const type = format.getType();
  89903. let source = void 0;
  89904. if (type === 'json' || type === 'text') {
  89905. source = xhr.responseText;
  89906. } else if (type === 'xml') {
  89907. source = xhr.responseXML;
  89908. if (!source) {
  89909. source = new DOMParser().parseFromString(xhr.responseText, 'application/xml');
  89910. }
  89911. } else if (type === 'arraybuffer') {
  89912. source = xhr.response;
  89913. }
  89914. if (source) {
  89915. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1) {
  89916. success.call(
  89917. this,
  89918. format.readFeatures(source, { featureProjection: projection }),
  89919. format.readProjection(source),
  89920. format.getLastExtent()
  89921. );
  89922. } else {
  89923. success.call(
  89924. this,
  89925. format.readFeatures(source, {
  89926. extent: extent,
  89927. featureProjection: projection
  89928. }),
  89929. format.readProjection(source)
  89930. );
  89931. }
  89932. } else {
  89933. failure.call(this);
  89934. }
  89935. } else {
  89936. failure.call(this);
  89937. }
  89938. }.bind(this);
  89939. xhr.onerror = function () {
  89940. failure.call(this);
  89941. }.bind(this);
  89942. xhr.send();
  89943. });
  89944. }
  89945. }
  89946. _fillByStyleJSON(style, source) {
  89947. if (!source) {
  89948. source = Object.keys(style.sources)[0];
  89949. }
  89950. if (style.sources && style.sources[source]) {
  89951. //ToDo 支持多个tiles地址
  89952. this._tileUrl = SecurityManager.appendCredential(style.sources[source].tiles[0]);
  89953. }
  89954. if (style.metadata && style.metadata.indexbounds) {
  89955. const indexbounds = style.metadata.indexbounds;
  89956. var max = Math.max(indexbounds[2] - indexbounds[0], indexbounds[3] - indexbounds[1]);
  89957. const defaultResolutions = [];
  89958. for (let index = 0; index < 30; index++) {
  89959. defaultResolutions.push(max / 512 / Math.pow(2, index));
  89960. }
  89961. this.tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  89962. extent: style.metadata.indexbounds,
  89963. resolutions: defaultResolutions,
  89964. tileSize: [512, 512]
  89965. });
  89966. }
  89967. }
  89968. _fillByRestMapOptions(url, options) {
  89969. this._tileUrl = Util_Util.urlPathAppend(options.url, 'tileFeature.json');
  89970. if (options.format instanceof (external_ol_format_MVT_default())) {
  89971. this._tileUrl = Util_Util.urlPathAppend(options.url, 'tileFeature.mvt');
  89972. }
  89973. //为url添加安全认证信息片段
  89974. this._tileUrl = SecurityManager.appendCredential(this._tileUrl);
  89975. var returnAttributes = true;
  89976. if (options.returnAttributes !== undefined) {
  89977. returnAttributes = options.returnAttributes;
  89978. }
  89979. var params = {};
  89980. params['returnAttributes'] = returnAttributes;
  89981. if (options._cache !== undefined) {
  89982. params['_cache'] = options._cache;
  89983. }
  89984. if (options.layersID !== undefined) {
  89985. params['layersID'] = options.layersID;
  89986. }
  89987. if (options.layerNames !== undefined) {
  89988. params['layerNames'] = options.layerNames;
  89989. }
  89990. if (options.expands !== undefined) {
  89991. params['expands'] = options.expands;
  89992. }
  89993. if (options.compressTolerance !== undefined) {
  89994. params['compressTolerance'] = options.compressTolerance;
  89995. }
  89996. if (options.coordinateType !== undefined) {
  89997. params['coordinateType'] = options.coordinateType;
  89998. }
  89999. if (options.returnCutEdges !== undefined) {
  90000. params['returnCutEdges'] = options.returnCutEdges;
  90001. }
  90002. this._tileUrl = Util_Util.urlAppend(this._tileUrl, Util_Util.getParameterString(params));
  90003. }
  90004. /**
  90005. * @function VectorTileSuperMapRest.optionsFromMapJSON
  90006. * @param {string} url - 地址。
  90007. * @param {Object} mapJSONObj - 地图 JSON。
  90008. * @description 获取地图 JSON 信息。
  90009. */
  90010. static optionsFromMapJSON(url, mapJSONObj) {
  90011. var options = {};
  90012. options.url = url;
  90013. options.crossOrigin = 'anonymous';
  90014. var extent = [mapJSONObj.bounds.left, mapJSONObj.bounds.bottom, mapJSONObj.bounds.right, mapJSONObj.bounds.top];
  90015. var resolutions = getResolutions();
  90016. function getResolutions() {
  90017. var level = 17;
  90018. var dpi = 96;
  90019. var width = extent[2] - extent[0];
  90020. var height = extent[3] - extent[1];
  90021. var tileSize = width >= height ? width : height;
  90022. var maxReolution;
  90023. if (tileSize === width) {
  90024. maxReolution = tileSize / mapJSONObj.viewer.width;
  90025. } else {
  90026. maxReolution = tileSize / mapJSONObj.viewer.height;
  90027. }
  90028. var resolutions = [];
  90029. var unit = Unit.METER;
  90030. if (mapJSONObj.coordUnit === Unit.DEGREE) {
  90031. unit = Unit.DEGREE;
  90032. }
  90033. if (mapJSONObj.visibleScales.length > 0) {
  90034. var scales = initScales(mapJSONObj);
  90035. for (let i = 0; i < scales.length; i++) {
  90036. resolutions.push(core_Util_Util.scaleToResolution(scales[i], dpi, unit));
  90037. }
  90038. } else {
  90039. for (let i = 0; i < level; i++) {
  90040. resolutions.push(maxReolution / Math.pow(2, i));
  90041. }
  90042. }
  90043. return resolutions;
  90044. }
  90045. function initScales(mapJSONObj) {
  90046. var scales = mapJSONObj.visibleScales;
  90047. if (!scales) {
  90048. return null;
  90049. }
  90050. var viewBounds = mapJSONObj.viewBounds,
  90051. coordUnit = mapJSONObj.coordUnit,
  90052. viewer = mapJSONObj.viewer,
  90053. scale = mapJSONObj.scale,
  90054. datumAxis = mapJSONObj.datumAxis;
  90055. //将jsonObject转化为SuperMap.Bounds,用于计算dpi。
  90056. viewBounds = new Bounds(viewBounds.left, viewBounds.bottom, viewBounds.right, viewBounds.top);
  90057. viewer = new Size(viewer.rightBottom.x, viewer.rightBottom.y);
  90058. coordUnit = coordUnit.toLowerCase();
  90059. datumAxis = datumAxis || 6378137;
  90060. var units = coordUnit;
  90061. var dpi = Util_Util.calculateDpi(viewBounds, viewer, scale, units, datumAxis);
  90062. var resolutions = _resolutionsFromScales(scales);
  90063. var len = resolutions.length;
  90064. scales = [len];
  90065. for (var i = 0; i < len; i++) {
  90066. scales[i] = Util_Util.getScaleFromResolutionDpi(resolutions[i], dpi, units, datumAxis);
  90067. }
  90068. function _resolutionsFromScales(scales) {
  90069. if (scales === null) {
  90070. return;
  90071. }
  90072. var resolutions, len;
  90073. len = scales.length;
  90074. resolutions = [len];
  90075. for (var i = 0; i < len; i++) {
  90076. resolutions[i] = Util_Util.getResolutionFromScaleDpi(scales[i], dpi, units, datumAxis);
  90077. }
  90078. return resolutions;
  90079. }
  90080. return scales;
  90081. }
  90082. options.tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  90083. extent: extent,
  90084. resolutions: resolutions
  90085. });
  90086. //options.projection = 'EPSG:' + mapJSONObj.prjCoordSys.epsgCode;
  90087. return options;
  90088. }
  90089. }
  90090. ;// CONCATENATED MODULE: ./src/openlayers/overlay/HeatMap.js
  90091. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  90092. * This program are made available under the terms of the Apache License, Version 2.0
  90093. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  90094. /**
  90095. * @class HeatMap
  90096. * @browsernamespace ol.source
  90097. * @classdesc 热力图层类。
  90098. * @modulecategory Overlay
  90099. * @category Visualization HeatMap
  90100. * @param {string} name - 图层名称。
  90101. * @param {Object} options - 参数。
  90102. * @param {ol.Map} options.map - openlayers 的 map 对象。
  90103. * @param {string} [options.id] - 专题图层 ID,默认使用 CommonUtil.createUniqueID("HeatMapSource_") 创建专题图层 ID。
  90104. * @param {string} [options.featureWeight] - 对应 feature 属性中的热点权重字段名称,权重值类型为 number。
  90105. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit 参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  90106. * @param {number} [options.opacity=1] - 图层透明度。
  90107. * @param {Array.<string>} [options.colors=['blue','cyan','lime','yellow','red']] - 颜色线性渐变数组,颜色值必须为 canvas 所支持的。
  90108. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,false 表示默认热点半径默认使用像素单位。当设置为 true 时,热点半径和图层地理坐标保持一致。
  90109. * @extends {ol.source.ImageCanvas}
  90110. * @usage
  90111. */
  90112. class HeatMap extends (external_ol_source_ImageCanvas_default()) {
  90113. constructor(name, opt_options) {
  90114. var options = opt_options ? opt_options : {};
  90115. super({
  90116. attributions: options.attributions || "Map Data <span>© SuperMap iServer</span> with <span>© SuperMap iClient</span>",
  90117. canvasFunction: canvasFunctionInternal_,
  90118. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  90119. projection: options.projection,
  90120. ratio: options.ratio,
  90121. resolutions: options.resolutions,
  90122. state: options.state
  90123. });
  90124. function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  90125. var mapWidth = size[0] * pixelRatio;
  90126. var mapHeight = size[1] * pixelRatio;
  90127. this.rootCanvas.width = this.maxWidth = mapWidth;
  90128. this.rootCanvas.height = this.maxHeight = mapHeight;
  90129. if (!this.features) {
  90130. return this.rootCanvas;
  90131. }
  90132. this.pixelRatio = pixelRatio;
  90133. //记录偏移量
  90134. var width = this.map.getSize()[0] * pixelRatio;
  90135. var height = this.map.getSize()[1] * pixelRatio;
  90136. this.offset = [(mapWidth - width) / 2 / pixelRatio, (mapHeight - height) / 2 / pixelRatio];
  90137. this.updateHeatPoints(resolution);
  90138. return this.rootCanvas;
  90139. }
  90140. //初始化成员变量
  90141. this.canvasFunctionInternal_ = canvasFunctionInternal_;
  90142. this.features = [];
  90143. this.name = name;
  90144. if (!options.map) {
  90145. throw new Error('options.map is not found.');
  90146. }
  90147. this.map = options.map;
  90148. // this.TFEvents = options.TFEvents || [];
  90149. this.id = options.id ? options.id : Util_Util.createUniqueID("HeatMapSource_");
  90150. this.opacity = options.opacity ? options.opacity : 1;
  90151. this.colors = options.colors ? options.colors : ['blue', 'cyan', 'lime', 'yellow', 'red'];
  90152. this.useGeoUnit = options.useGeoUnit ? options.useGeoUnit : false;
  90153. this.radius = options.radius ? options.radius : 50;
  90154. this.featureWeight = options.featureWeight ? options.featureWeight : null;
  90155. this.maxWeight = null;
  90156. this.minWeight = null;
  90157. this.maxWidth = null;
  90158. this.maxHeight = null;
  90159. //创建热力图绘制面板
  90160. this.rootCanvas = document.createElement("canvas");
  90161. var mapSize = this.map.getSize();
  90162. this.rootCanvas.width = this.maxWidth = parseInt(mapSize[0]);
  90163. this.rootCanvas.height = this.maxHeight = parseInt(mapSize[1]);
  90164. Util_Util.modifyDOMElement(this.rootCanvas, null, null, null,
  90165. null, null, null, this.opacity);
  90166. this.canvasContext = this.rootCanvas.getContext('2d');
  90167. }
  90168. /**
  90169. * @function HeatMap.prototype.addFeatures
  90170. * @description 添加热点信息。
  90171. * @param {(GeoJSONObject|Array.<ol.Feature>)} features - 待添加的要素数组。
  90172. * @example
  90173. * var geojson = {
  90174. * "type": "FeatureCollection",
  90175. * "features": [
  90176. * {
  90177. * "type": "feature",
  90178. * "geometry": {
  90179. * "type": "Point", //只支持point类型
  90180. * "coordinates": [0, 0]
  90181. * },
  90182. * "properties": {
  90183. * "height": Math.random()*9,
  90184. * }
  90185. * }
  90186. * ]
  90187. * };
  90188. * var heatMapSource = new HeatMap("heatMap",{"map": map});
  90189. * heatMapSource.addFeatures(geojson);
  90190. * map.addLayer(new ol.layer.Image({
  90191. * source: heatMapSource
  90192. * }));
  90193. */
  90194. addFeatures(features) {
  90195. this.features = this.toiClientFeature(features);
  90196. //支持更新features,刷新底图
  90197. this.changed();
  90198. }
  90199. /**
  90200. * @function HeatMap.prototype.setOpacity
  90201. * @description 设置图层的不透明度,取值 [0-1] 之间。
  90202. * @param {number} opacity - 不透明度。
  90203. */
  90204. setOpacity(opacity) {
  90205. if (opacity !== this.opacity) {
  90206. this.opacity = opacity;
  90207. var element = this.rootCanvas;
  90208. Util_Util.modifyDOMElement(element, null, null, null,
  90209. null, null, null, opacity);
  90210. if (this.map !== null) {
  90211. // this.dispatchEvent({type: 'changelayer', value: {layer: this, property: "opacity"}});
  90212. this.changed();
  90213. }
  90214. }
  90215. }
  90216. /**
  90217. * @function HeatMap.prototype.updateHeatPoints
  90218. * @description 刷新热点图显示。
  90219. * @param {ol.LngLatBounds} resolution - 当前显示范围。
  90220. * @private
  90221. */
  90222. updateHeatPoints(resolution) {
  90223. if (this.features && this.features.length > 0) {
  90224. this.convertFastToPixelPoints(resolution);
  90225. } else {
  90226. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxWidth);
  90227. }
  90228. }
  90229. /**
  90230. * @function HeatMap.prototype.convertFastToPixelPoints
  90231. * @description 过滤位于当前显示范围内的热点,并转换其为当前分辨率下的像素坐标。
  90232. * @param {number} resolution - 当前分辨率。
  90233. * @private
  90234. */
  90235. convertFastToPixelPoints(resolution) {
  90236. var data = [], x, y, k, maxTemp, minTemp, maxWeightTemp;
  90237. //热点半径
  90238. this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;
  90239. for (var i = 0; i < this.features.length; i++) {
  90240. var feature = this.features[i];
  90241. var point = feature.geometry;
  90242. //过滤,只显示当前范围
  90243. // if (mapBounds.contains(point.x, point.y)) {
  90244. var pixelPoint = this.getLocalXY(new LonLat(point.x, point.y));
  90245. if (this.featureWeight) {
  90246. pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
  90247. if (!this.maxWeight) {
  90248. //找出最大最小权重值
  90249. maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
  90250. minTemp = minTemp ? minTemp : pixelPoint.weight;
  90251. maxTemp = Math.max(maxTemp, pixelPoint.weight);
  90252. minTemp = Math.min(minTemp, pixelPoint.weight);
  90253. }
  90254. } else {
  90255. pixelPoint.weight = 1;
  90256. }
  90257. x = Math.floor(pixelPoint[0]);
  90258. y = Math.floor(pixelPoint[1]);
  90259. k = pixelPoint.weight;
  90260. data.push([x, y, k]);
  90261. // }
  90262. }
  90263. //无最大权重设置
  90264. if (!this.maxWeight) {
  90265. if (maxTemp && minTemp) {
  90266. maxWeightTemp = (maxTemp + minTemp) / 2;
  90267. } else {
  90268. maxWeightTemp = 1;
  90269. }
  90270. this.draw(data, maxWeightTemp);
  90271. } else {
  90272. this.draw(data, this.maxWeight);
  90273. }
  90274. }
  90275. /**
  90276. * @function HeatMap.prototype.draw
  90277. * @description 绘制热点图。
  90278. * @param {Array} data - convertToPixelPoints 方法计算出的点。
  90279. * @param {number} maxWeight -最大权重。
  90280. * @private
  90281. */
  90282. draw(data, maxWeight) {
  90283. if (this.maxHeight > 0 && this.maxWidth > 0) {
  90284. //清空
  90285. var ctx = this.canvasContext;
  90286. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxHeight);
  90287. this.drawCircle(this.useRadius);
  90288. this.createGradient();
  90289. for (var i = 0; i < data.length; i++) {
  90290. var p = data[i];
  90291. this.canvasContext.globalAlpha = Math.max(p[2] / maxWeight, 0.05);
  90292. this.canvasContext.drawImage(this.circle, p[0] - this.useRadius, p[1] - this.useRadius);
  90293. }
  90294. var colored = ctx.getImageData(0, 0, this.maxWidth, this.maxHeight);
  90295. this.colorize(colored.data, this.grad);
  90296. ctx.putImageData(colored, 0, 0);
  90297. } else {
  90298. return false;
  90299. }
  90300. }
  90301. /**
  90302. * @function HeatMap.prototype.colorize
  90303. * @description 根据渐变色重置热点图 rgb 值。
  90304. * @param {Object} pixels - 像素 rgba 值。
  90305. * @param {Array} gradient - 渐变 canvas.getImageData.data。
  90306. * @private
  90307. */
  90308. colorize(pixels, gradient) {
  90309. for (var i = 0, j; i < pixels.length; i += 4) {
  90310. j = pixels[i + 3] * 4;
  90311. if (j) {
  90312. pixels[i] = gradient[j];
  90313. pixels[i + 1] = gradient[j + 1];
  90314. pixels[i + 2] = gradient[j + 2];
  90315. }
  90316. }
  90317. }
  90318. /**
  90319. * @function HeatMap.drawCircle
  90320. * @description 绘制热点半径圆。
  90321. * @param {number} r - 热点半径。
  90322. * @private
  90323. */
  90324. drawCircle(r) {
  90325. var blur = r / 2;
  90326. var circle = this.circle = document.createElement('canvas'),
  90327. ctx = circle.getContext("2d");
  90328. circle.height = 2 * r;
  90329. circle.width = 2 * r;
  90330. ctx.shadowOffsetX = ctx.shadowOffsetY = 2 * r;
  90331. ctx.shadowBlur = blur;
  90332. ctx.shadowColor = "#000000";
  90333. ctx.beginPath();
  90334. ctx.arc(-r, -r, r / 2, 0, Math.PI * 2, true);
  90335. ctx.closePath();
  90336. ctx.fill();
  90337. }
  90338. /**
  90339. * @function HeatMap.createGradient
  90340. * @description 根据 this.canvasColors 设置渐变并 getImageData。
  90341. * @private
  90342. */
  90343. createGradient() {
  90344. var colors = this.colors;
  90345. var canvas = document.createElement('canvas'),
  90346. ctx = canvas.getContext("2d"),
  90347. gradient = ctx.createLinearGradient(0, 0, 0, 256);
  90348. canvas.height = 256;
  90349. canvas.width = 1;
  90350. var index = 1;
  90351. for (var i = 0, len = colors.length; i < len; i++) {
  90352. gradient.addColorStop(index / len, colors[i]);
  90353. index++;
  90354. }
  90355. ctx.fillStyle = gradient;
  90356. ctx.fillRect(0, 0, 1, 256);
  90357. this.grad = ctx.getImageData(0, 0, 1, 256).data;
  90358. }
  90359. /**
  90360. * @function HeatMap.prototype.getLocalXY
  90361. * @description 获取坐标系统。
  90362. * @param {Object} coordinate - 坐标位置。
  90363. */
  90364. getLocalXY(coordinate) {
  90365. var pixelP, map = this.map;
  90366. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  90367. pixelP = map.getPixelFromCoordinate([coordinate.x, coordinate.y]);
  90368. }
  90369. if (coordinate instanceof LonLat) {
  90370. pixelP = map.getPixelFromCoordinate([coordinate.lon, coordinate.lat]);
  90371. }
  90372. var rotation = -map.getView().getRotation();
  90373. var center = map.getPixelFromCoordinate(map.getView().getCenter());
  90374. var rotatedP = pixelP;
  90375. if (this.pixelRatio) {
  90376. rotatedP = this.scale(pixelP, center, this.pixelRatio);
  90377. }
  90378. if (pixelP && center) {
  90379. rotatedP = this.rotate(rotatedP, rotation, center);
  90380. }
  90381. if (this.offset && rotatedP) {
  90382. return [rotatedP[0] + this.offset[0], rotatedP[1] + this.offset[1]];
  90383. }
  90384. return rotatedP;
  90385. }
  90386. /**
  90387. * @function HeatMap.prototype.rotate
  90388. * @description 获取某像素坐标点 pixelP 绕中心 center 逆时针旋转 rotation 弧度后的像素点坐标。
  90389. * @param {number} pixelP - 像素坐标点位置。
  90390. * @param {number} rotation - 旋转角度。
  90391. * @param {number} center - 中心位置。
  90392. */
  90393. rotate(pixelP, rotation, center) {
  90394. var x = Math.cos(rotation) * (pixelP[0] - center[0]) - Math.sin(rotation) * (pixelP[1] - center[1]) + center[0];
  90395. var y = Math.sin(rotation) * (pixelP[0] - center[0]) + Math.cos(rotation) * (pixelP[1] - center[1]) + center[1];
  90396. return [x, y];
  90397. }
  90398. /**
  90399. * @function HeatMap.prototype.scale
  90400. * @description 获取某像素坐标点 pixelP 相对于中心 center 进行缩放 scaleRatio 倍后的像素点坐标。
  90401. * @param {Object} pixelP - 像素点。
  90402. * @param {Object} center - 中心点。
  90403. * @param {number} scaleRatio - 缩放倍数。
  90404. * @returns {Array.<number>} 返回数组型比例。
  90405. */
  90406. scale(pixelP, center, scaleRatio) {
  90407. var x = (pixelP[0] - center[0]) * scaleRatio + center[0];
  90408. var y = (pixelP[1] - center[1]) * scaleRatio + center[1];
  90409. return [x, y];
  90410. }
  90411. /**
  90412. * @function HeatMap.prototype.removeFeatures
  90413. * @description 移除指定的热点信息。
  90414. * @param {Array.<FeatureVector>|FeatureVector} features - 热点信息数组。
  90415. */
  90416. removeFeatures(features) {
  90417. if (!features || features.length === 0 || !this.features || this.features.length === 0) {
  90418. return;
  90419. }
  90420. if (features === this.features) {
  90421. return this.removeAllFeatures();
  90422. }
  90423. if (!(Util_Util.isArray(features))) {
  90424. features = [features];
  90425. }
  90426. var heatPoint, index, heatPointsFailedRemoved = [];
  90427. for (var i = 0, len = features.length; i < len; i++) {
  90428. heatPoint = features[i];
  90429. index = Util_Util.indexOf(this.features, heatPoint);
  90430. //找不到视为删除失败
  90431. if (index === -1) {
  90432. heatPointsFailedRemoved.push(heatPoint);
  90433. continue;
  90434. }
  90435. //删除热点
  90436. this.features.splice(index, 1);
  90437. }
  90438. var succeed = heatPointsFailedRemoved.length == 0 ? true : false;
  90439. //派发删除features成功的事件
  90440. this.dispatchEvent({type: 'featuresremoved', value: {features: heatPointsFailedRemoved, succeed: succeed}});
  90441. this.changed();
  90442. }
  90443. /**
  90444. * @function HeatMap.prototype.removeAllFeatures
  90445. * @description 移除全部的热点信息。
  90446. */
  90447. removeAllFeatures() {
  90448. this.features = [];
  90449. this.changed();
  90450. }
  90451. /**
  90452. * @function HeatMap.prototype.toiClientFeature
  90453. * @description 转为 iClient 要素。
  90454. * @param {GeoJSONObject|Array.<ol.Feature>} features - 待添加的要素数组。
  90455. * @returns {FeatureVector} 转换后的 iClient 要素。
  90456. */
  90457. toiClientFeature(features) {
  90458. if (!core_Util_Util.isArray(features)) {
  90459. features = [features];
  90460. }
  90461. let featuresTemp = [], geometry, attributes;
  90462. for (let i = 0, len = features.length; i < len; i++) {
  90463. if (features[i] instanceof (external_ol_Feature_default())) {
  90464. //热点图支支持传入点对象要素
  90465. if (features[i].getGeometry() instanceof (external_ol_geom_Point_default())) {
  90466. geometry = new Point(features[i].getGeometry().getCoordinates()[0], features[i].getGeometry().getCoordinates()[1]);
  90467. //固定属性字段为 "Properties"
  90468. attributes = features[i].getProperties()["Properties"] ? features[i].getProperties()["Properties"] : {};
  90469. featuresTemp.push(new Vector(geometry, attributes));
  90470. }
  90471. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  90472. let format = new GeoJSON();
  90473. featuresTemp = featuresTemp.concat(format.read(features[i]));
  90474. } else if (features[i].geometry && features[i].geometry.parts) {
  90475. //iServer服务器返回数据格式
  90476. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  90477. } else {
  90478. throw new Error(`Features[${i}]'s type does not match, please check.`);
  90479. }
  90480. }
  90481. return featuresTemp;
  90482. }
  90483. }
  90484. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/geometry-type.js
  90485. var geometry_type_GeometryType;
  90486. (function (GeometryType) {
  90487. GeometryType[GeometryType["Unknown"] = 0] = "Unknown";
  90488. GeometryType[GeometryType["Point"] = 1] = "Point";
  90489. GeometryType[GeometryType["LineString"] = 2] = "LineString";
  90490. GeometryType[GeometryType["Polygon"] = 3] = "Polygon";
  90491. GeometryType[GeometryType["MultiPoint"] = 4] = "MultiPoint";
  90492. GeometryType[GeometryType["MultiLineString"] = 5] = "MultiLineString";
  90493. GeometryType[GeometryType["MultiPolygon"] = 6] = "MultiPolygon";
  90494. GeometryType[GeometryType["GeometryCollection"] = 7] = "GeometryCollection";
  90495. GeometryType[GeometryType["CircularString"] = 8] = "CircularString";
  90496. GeometryType[GeometryType["CompoundCurve"] = 9] = "CompoundCurve";
  90497. GeometryType[GeometryType["CurvePolygon"] = 10] = "CurvePolygon";
  90498. GeometryType[GeometryType["MultiCurve"] = 11] = "MultiCurve";
  90499. GeometryType[GeometryType["MultiSurface"] = 12] = "MultiSurface";
  90500. GeometryType[GeometryType["Curve"] = 13] = "Curve";
  90501. GeometryType[GeometryType["Surface"] = 14] = "Surface";
  90502. GeometryType[GeometryType["PolyhedralSurface"] = 15] = "PolyhedralSurface";
  90503. GeometryType[GeometryType["TIN"] = 16] = "TIN";
  90504. GeometryType[GeometryType["Triangle"] = 17] = "Triangle";
  90505. })(geometry_type_GeometryType || (geometry_type_GeometryType = {}));
  90506. // EXTERNAL MODULE: ./node_modules/flatbuffers/js/flatbuffers.js
  90507. var js_flatbuffers = __webpack_require__(903);
  90508. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/geometry.js
  90509. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  90510. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  90511. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  90512. var geometry_Geometry = /*#__PURE__*/function () {
  90513. function Geometry() {
  90514. _classCallCheck(this, Geometry);
  90515. this.bb = null;
  90516. this.bb_pos = 0;
  90517. }
  90518. _createClass(Geometry, [{
  90519. key: "__init",
  90520. value: function __init(i, bb) {
  90521. this.bb_pos = i;
  90522. this.bb = bb;
  90523. return this;
  90524. }
  90525. }, {
  90526. key: "ends",
  90527. value: function ends(index) {
  90528. var offset = this.bb.__offset(this.bb_pos, 4);
  90529. return offset ? this.bb.readUint32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
  90530. }
  90531. }, {
  90532. key: "endsLength",
  90533. value: function endsLength() {
  90534. var offset = this.bb.__offset(this.bb_pos, 4);
  90535. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  90536. }
  90537. }, {
  90538. key: "endsArray",
  90539. value: function endsArray() {
  90540. var offset = this.bb.__offset(this.bb_pos, 4);
  90541. return offset ? new Uint32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  90542. }
  90543. }, {
  90544. key: "xy",
  90545. value: function xy(index) {
  90546. var offset = this.bb.__offset(this.bb_pos, 6);
  90547. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  90548. }
  90549. }, {
  90550. key: "xyLength",
  90551. value: function xyLength() {
  90552. var offset = this.bb.__offset(this.bb_pos, 6);
  90553. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  90554. }
  90555. }, {
  90556. key: "xyArray",
  90557. value: function xyArray() {
  90558. var offset = this.bb.__offset(this.bb_pos, 6);
  90559. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  90560. }
  90561. }, {
  90562. key: "z",
  90563. value: function z(index) {
  90564. var offset = this.bb.__offset(this.bb_pos, 8);
  90565. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  90566. }
  90567. }, {
  90568. key: "zLength",
  90569. value: function zLength() {
  90570. var offset = this.bb.__offset(this.bb_pos, 8);
  90571. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  90572. }
  90573. }, {
  90574. key: "zArray",
  90575. value: function zArray() {
  90576. var offset = this.bb.__offset(this.bb_pos, 8);
  90577. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  90578. }
  90579. }, {
  90580. key: "m",
  90581. value: function m(index) {
  90582. var offset = this.bb.__offset(this.bb_pos, 10);
  90583. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  90584. }
  90585. }, {
  90586. key: "mLength",
  90587. value: function mLength() {
  90588. var offset = this.bb.__offset(this.bb_pos, 10);
  90589. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  90590. }
  90591. }, {
  90592. key: "mArray",
  90593. value: function mArray() {
  90594. var offset = this.bb.__offset(this.bb_pos, 10);
  90595. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  90596. }
  90597. }, {
  90598. key: "t",
  90599. value: function t(index) {
  90600. var offset = this.bb.__offset(this.bb_pos, 12);
  90601. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  90602. }
  90603. }, {
  90604. key: "tLength",
  90605. value: function tLength() {
  90606. var offset = this.bb.__offset(this.bb_pos, 12);
  90607. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  90608. }
  90609. }, {
  90610. key: "tArray",
  90611. value: function tArray() {
  90612. var offset = this.bb.__offset(this.bb_pos, 12);
  90613. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  90614. }
  90615. }, {
  90616. key: "tm",
  90617. value: function tm(index) {
  90618. var offset = this.bb.__offset(this.bb_pos, 14);
  90619. return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
  90620. }
  90621. }, {
  90622. key: "tmLength",
  90623. value: function tmLength() {
  90624. var offset = this.bb.__offset(this.bb_pos, 14);
  90625. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  90626. }
  90627. }, {
  90628. key: "type",
  90629. value: function type() {
  90630. var offset = this.bb.__offset(this.bb_pos, 16);
  90631. return offset ? this.bb.readUint8(this.bb_pos + offset) : geometry_type_GeometryType.Unknown;
  90632. }
  90633. }, {
  90634. key: "parts",
  90635. value: function parts(index, obj) {
  90636. var offset = this.bb.__offset(this.bb_pos, 18);
  90637. return offset ? (obj || new Geometry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  90638. }
  90639. }, {
  90640. key: "partsLength",
  90641. value: function partsLength() {
  90642. var offset = this.bb.__offset(this.bb_pos, 18);
  90643. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  90644. }
  90645. }], [{
  90646. key: "getRootAsGeometry",
  90647. value: function getRootAsGeometry(bb, obj) {
  90648. return (obj || new Geometry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  90649. }
  90650. }, {
  90651. key: "getSizePrefixedRootAsGeometry",
  90652. value: function getSizePrefixedRootAsGeometry(bb, obj) {
  90653. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  90654. return (obj || new Geometry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  90655. }
  90656. }, {
  90657. key: "startGeometry",
  90658. value: function startGeometry(builder) {
  90659. builder.startObject(8);
  90660. }
  90661. }, {
  90662. key: "addEnds",
  90663. value: function addEnds(builder, endsOffset) {
  90664. builder.addFieldOffset(0, endsOffset, 0);
  90665. }
  90666. }, {
  90667. key: "createEndsVector",
  90668. value: function createEndsVector(builder, data) {
  90669. builder.startVector(4, data.length, 4);
  90670. for (var i = data.length - 1; i >= 0; i--) {
  90671. builder.addInt32(data[i]);
  90672. }
  90673. return builder.endVector();
  90674. }
  90675. }, {
  90676. key: "startEndsVector",
  90677. value: function startEndsVector(builder, numElems) {
  90678. builder.startVector(4, numElems, 4);
  90679. }
  90680. }, {
  90681. key: "addXy",
  90682. value: function addXy(builder, xyOffset) {
  90683. builder.addFieldOffset(1, xyOffset, 0);
  90684. }
  90685. }, {
  90686. key: "createXyVector",
  90687. value: function createXyVector(builder, data) {
  90688. builder.startVector(8, data.length, 8);
  90689. for (var i = data.length - 1; i >= 0; i--) {
  90690. builder.addFloat64(data[i]);
  90691. }
  90692. return builder.endVector();
  90693. }
  90694. }, {
  90695. key: "startXyVector",
  90696. value: function startXyVector(builder, numElems) {
  90697. builder.startVector(8, numElems, 8);
  90698. }
  90699. }, {
  90700. key: "addZ",
  90701. value: function addZ(builder, zOffset) {
  90702. builder.addFieldOffset(2, zOffset, 0);
  90703. }
  90704. }, {
  90705. key: "createZVector",
  90706. value: function createZVector(builder, data) {
  90707. builder.startVector(8, data.length, 8);
  90708. for (var i = data.length - 1; i >= 0; i--) {
  90709. builder.addFloat64(data[i]);
  90710. }
  90711. return builder.endVector();
  90712. }
  90713. }, {
  90714. key: "startZVector",
  90715. value: function startZVector(builder, numElems) {
  90716. builder.startVector(8, numElems, 8);
  90717. }
  90718. }, {
  90719. key: "addM",
  90720. value: function addM(builder, mOffset) {
  90721. builder.addFieldOffset(3, mOffset, 0);
  90722. }
  90723. }, {
  90724. key: "createMVector",
  90725. value: function createMVector(builder, data) {
  90726. builder.startVector(8, data.length, 8);
  90727. for (var i = data.length - 1; i >= 0; i--) {
  90728. builder.addFloat64(data[i]);
  90729. }
  90730. return builder.endVector();
  90731. }
  90732. }, {
  90733. key: "startMVector",
  90734. value: function startMVector(builder, numElems) {
  90735. builder.startVector(8, numElems, 8);
  90736. }
  90737. }, {
  90738. key: "addT",
  90739. value: function addT(builder, tOffset) {
  90740. builder.addFieldOffset(4, tOffset, 0);
  90741. }
  90742. }, {
  90743. key: "createTVector",
  90744. value: function createTVector(builder, data) {
  90745. builder.startVector(8, data.length, 8);
  90746. for (var i = data.length - 1; i >= 0; i--) {
  90747. builder.addFloat64(data[i]);
  90748. }
  90749. return builder.endVector();
  90750. }
  90751. }, {
  90752. key: "startTVector",
  90753. value: function startTVector(builder, numElems) {
  90754. builder.startVector(8, numElems, 8);
  90755. }
  90756. }, {
  90757. key: "addTm",
  90758. value: function addTm(builder, tmOffset) {
  90759. builder.addFieldOffset(5, tmOffset, 0);
  90760. }
  90761. }, {
  90762. key: "createTmVector",
  90763. value: function createTmVector(builder, data) {
  90764. builder.startVector(8, data.length, 8);
  90765. for (var i = data.length - 1; i >= 0; i--) {
  90766. builder.addInt64(data[i]);
  90767. }
  90768. return builder.endVector();
  90769. }
  90770. }, {
  90771. key: "startTmVector",
  90772. value: function startTmVector(builder, numElems) {
  90773. builder.startVector(8, numElems, 8);
  90774. }
  90775. }, {
  90776. key: "addType",
  90777. value: function addType(builder, type) {
  90778. builder.addFieldInt8(6, type, geometry_type_GeometryType.Unknown);
  90779. }
  90780. }, {
  90781. key: "addParts",
  90782. value: function addParts(builder, partsOffset) {
  90783. builder.addFieldOffset(7, partsOffset, 0);
  90784. }
  90785. }, {
  90786. key: "createPartsVector",
  90787. value: function createPartsVector(builder, data) {
  90788. builder.startVector(4, data.length, 4);
  90789. for (var i = data.length - 1; i >= 0; i--) {
  90790. builder.addOffset(data[i]);
  90791. }
  90792. return builder.endVector();
  90793. }
  90794. }, {
  90795. key: "startPartsVector",
  90796. value: function startPartsVector(builder, numElems) {
  90797. builder.startVector(4, numElems, 4);
  90798. }
  90799. }, {
  90800. key: "endGeometry",
  90801. value: function endGeometry(builder) {
  90802. var offset = builder.endObject();
  90803. return offset;
  90804. }
  90805. }, {
  90806. key: "createGeometry",
  90807. value: function createGeometry(builder, endsOffset, xyOffset, zOffset, mOffset, tOffset, tmOffset, type, partsOffset) {
  90808. Geometry.startGeometry(builder);
  90809. Geometry.addEnds(builder, endsOffset);
  90810. Geometry.addXy(builder, xyOffset);
  90811. Geometry.addZ(builder, zOffset);
  90812. Geometry.addM(builder, mOffset);
  90813. Geometry.addT(builder, tOffset);
  90814. Geometry.addTm(builder, tmOffset);
  90815. Geometry.addType(builder, type);
  90816. Geometry.addParts(builder, partsOffset);
  90817. return Geometry.endGeometry(builder);
  90818. }
  90819. }]);
  90820. return Geometry;
  90821. }();
  90822. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/geometry.js
  90823. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  90824. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  90825. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  90826. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  90827. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  90828. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  90829. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  90830. function geometry_buildGeometry(builder, parsedGeometry) {
  90831. var xy = parsedGeometry.xy,
  90832. z = parsedGeometry.z,
  90833. ends = parsedGeometry.ends,
  90834. parts = parsedGeometry.parts,
  90835. type = parsedGeometry.type;
  90836. if (parts) {
  90837. var partOffsets = parts.map(function (part) {
  90838. return geometry_buildGeometry(builder, part);
  90839. });
  90840. var partsOffset = Geometry.createPartsVector(builder, partOffsets);
  90841. Geometry.startGeometry(builder);
  90842. Geometry.addParts(builder, partsOffset);
  90843. Geometry.addType(builder, type);
  90844. return Geometry.endGeometry(builder);
  90845. }
  90846. var xyOffset = Geometry.createXyVector(builder, xy);
  90847. var zOffset;
  90848. if (z) zOffset = Geometry.createZVector(builder, z);
  90849. var endsOffset;
  90850. if (ends) endsOffset = Geometry.createEndsVector(builder, ends);
  90851. Geometry.startGeometry(builder);
  90852. if (endsOffset) Geometry.addEnds(builder, endsOffset);
  90853. Geometry.addXy(builder, xyOffset);
  90854. if (zOffset) Geometry.addZ(builder, zOffset);
  90855. Geometry.addType(builder, type);
  90856. return Geometry.endGeometry(builder);
  90857. }
  90858. function geometry_flat(a, xy, z) {
  90859. if (a.length === 0) return;
  90860. if (Array.isArray(a[0])) {
  90861. var _iterator = _createForOfIteratorHelper(a),
  90862. _step;
  90863. try {
  90864. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  90865. var sa = _step.value;
  90866. geometry_flat(sa, xy, z);
  90867. }
  90868. } catch (err) {
  90869. _iterator.e(err);
  90870. } finally {
  90871. _iterator.f();
  90872. }
  90873. } else {
  90874. if (a.length === 2) xy.push.apply(xy, _toConsumableArray(a));else {
  90875. xy.push(a[0], a[1]);
  90876. z.push(a[2]);
  90877. }
  90878. }
  90879. }
  90880. function geometry_parseGeometry(geometry, headerGeomType) {
  90881. var xy;
  90882. var ends;
  90883. var parts;
  90884. var type = headerGeomType;
  90885. if (type === GeometryType.Unknown) {
  90886. type = geometry_toGeometryType(geometry.getType());
  90887. }
  90888. if (type === GeometryType.MultiLineString) {
  90889. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  90890. var mlsEnds = geometry.getEnds();
  90891. if (mlsEnds.length > 1) ends = mlsEnds.map(function (e) {
  90892. return e >> 1;
  90893. });
  90894. } else if (type === GeometryType.Polygon) {
  90895. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  90896. var pEnds = geometry.getEnds();
  90897. if (pEnds.length > 1) ends = pEnds.map(function (e) {
  90898. return e >> 1;
  90899. });
  90900. } else if (type === GeometryType.MultiPolygon) {
  90901. var mp = geometry;
  90902. parts = mp.getPolygons().map(function (p) {
  90903. return geometry_parseGeometry(p, GeometryType.Polygon);
  90904. });
  90905. } else {
  90906. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  90907. }
  90908. return {
  90909. xy: xy,
  90910. ends: ends,
  90911. type: type,
  90912. parts: parts
  90913. };
  90914. }
  90915. function pairFlatCoordinates(xy, z) {
  90916. var newArray = [];
  90917. for (var i = 0; i < xy.length; i += 2) {
  90918. var a = [xy[i], xy[i + 1]];
  90919. if (z) a.push(z[i >> 1]);
  90920. newArray.push(a);
  90921. }
  90922. return newArray;
  90923. }
  90924. function geometry_toGeometryType(name) {
  90925. if (!name) return GeometryType.Unknown;
  90926. var type = GeometryType[name];
  90927. return type;
  90928. }
  90929. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/geometry.js
  90930. function geojson_geometry_parseGeometry(geometry) {
  90931. var cs = geometry.coordinates;
  90932. var xy = [];
  90933. var z = [];
  90934. var ends;
  90935. var parts;
  90936. var type = toGeometryType(geometry.type);
  90937. var end = 0;
  90938. switch (geometry.type) {
  90939. case 'Point':
  90940. flat(cs, xy, z);
  90941. break;
  90942. case 'MultiPoint':
  90943. case 'LineString':
  90944. flat(cs, xy, z);
  90945. break;
  90946. case 'MultiLineString':
  90947. case 'Polygon':
  90948. {
  90949. var css = cs;
  90950. flat(css, xy, z);
  90951. if (css.length > 1) ends = css.map(function (c) {
  90952. return end += c.length;
  90953. });
  90954. break;
  90955. }
  90956. case 'MultiPolygon':
  90957. {
  90958. var csss = cs;
  90959. var geometries = csss.map(function (coordinates) {
  90960. return {
  90961. type: 'Polygon',
  90962. coordinates: coordinates
  90963. };
  90964. });
  90965. parts = geometries.map(geojson_geometry_parseGeometry);
  90966. break;
  90967. }
  90968. }
  90969. return {
  90970. xy: xy,
  90971. z: z.length > 0 ? z : undefined,
  90972. ends: ends,
  90973. type: type,
  90974. parts: parts
  90975. };
  90976. }
  90977. function geometry_parseGC(geometry) {
  90978. var type = toGeometryType(geometry.type);
  90979. var parts = [];
  90980. for (var i = 0; i < geometry.geometries.length; i++) {
  90981. var g = geometry.geometries[i];
  90982. if (g.type === 'GeometryCollection') parts.push(geometry_parseGC(g));else parts.push(geojson_geometry_parseGeometry(g));
  90983. }
  90984. return {
  90985. type: type,
  90986. parts: parts
  90987. };
  90988. }
  90989. function extractParts(xy, z, ends) {
  90990. if (!ends || ends.length === 0) return [pairFlatCoordinates(xy, z)];
  90991. var s = 0;
  90992. var xySlices = Array.from(ends).map(function (e) {
  90993. return xy.slice(s, s = e << 1);
  90994. });
  90995. var zSlices;
  90996. if (z) {
  90997. s = 0;
  90998. zSlices = Array.from(ends).map(function (e) {
  90999. return z.slice(s, s = e);
  91000. });
  91001. }
  91002. return xySlices.map(function (xy, i) {
  91003. return pairFlatCoordinates(xy, zSlices ? zSlices[i] : undefined);
  91004. });
  91005. }
  91006. function toGeoJsonCoordinates(geometry, type) {
  91007. var xy = geometry.xyArray();
  91008. var z = geometry.zArray();
  91009. switch (type) {
  91010. case geometry_type_GeometryType.Point:
  91011. {
  91012. var a = Array.from(xy);
  91013. if (z) a.push(z[0]);
  91014. return a;
  91015. }
  91016. case geometry_type_GeometryType.MultiPoint:
  91017. case geometry_type_GeometryType.LineString:
  91018. return pairFlatCoordinates(xy, z);
  91019. case geometry_type_GeometryType.MultiLineString:
  91020. return extractParts(xy, z, geometry.endsArray());
  91021. case geometry_type_GeometryType.Polygon:
  91022. return extractParts(xy, z, geometry.endsArray());
  91023. }
  91024. }
  91025. function fromGeometry(geometry, headerType) {
  91026. var type = headerType;
  91027. if (type === geometry_type_GeometryType.Unknown) {
  91028. type = geometry.type();
  91029. }
  91030. if (type === geometry_type_GeometryType.GeometryCollection) {
  91031. var geometries = [];
  91032. for (var i = 0; i < geometry.partsLength(); i++) {
  91033. var part = geometry.parts(i);
  91034. var partType = part.type();
  91035. geometries.push(fromGeometry(part, partType));
  91036. }
  91037. return {
  91038. type: geometry_type_GeometryType[type],
  91039. geometries: geometries
  91040. };
  91041. } else if (type === geometry_type_GeometryType.MultiPolygon) {
  91042. var _geometries = [];
  91043. for (var _i2 = 0; _i2 < geometry.partsLength(); _i2++) _geometries.push(fromGeometry(geometry.parts(_i2), geometry_type_GeometryType.Polygon));
  91044. return {
  91045. type: geometry_type_GeometryType[type],
  91046. coordinates: _geometries.map(function (g) {
  91047. return g.coordinates;
  91048. })
  91049. };
  91050. }
  91051. var coordinates = toGeoJsonCoordinates(geometry, type);
  91052. return {
  91053. type: geometry_type_GeometryType[type],
  91054. coordinates: coordinates
  91055. };
  91056. }
  91057. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/column-type.js
  91058. var column_type_ColumnType;
  91059. (function (ColumnType) {
  91060. ColumnType[ColumnType["Byte"] = 0] = "Byte";
  91061. ColumnType[ColumnType["UByte"] = 1] = "UByte";
  91062. ColumnType[ColumnType["Bool"] = 2] = "Bool";
  91063. ColumnType[ColumnType["Short"] = 3] = "Short";
  91064. ColumnType[ColumnType["UShort"] = 4] = "UShort";
  91065. ColumnType[ColumnType["Int"] = 5] = "Int";
  91066. ColumnType[ColumnType["UInt"] = 6] = "UInt";
  91067. ColumnType[ColumnType["Long"] = 7] = "Long";
  91068. ColumnType[ColumnType["ULong"] = 8] = "ULong";
  91069. ColumnType[ColumnType["Float"] = 9] = "Float";
  91070. ColumnType[ColumnType["Double"] = 10] = "Double";
  91071. ColumnType[ColumnType["String"] = 11] = "String";
  91072. ColumnType[ColumnType["Json"] = 12] = "Json";
  91073. ColumnType[ColumnType["DateTime"] = 13] = "DateTime";
  91074. ColumnType[ColumnType["Binary"] = 14] = "Binary";
  91075. })(column_type_ColumnType || (column_type_ColumnType = {}));
  91076. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/column.js
  91077. function column_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  91078. function column_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  91079. function column_createClass(Constructor, protoProps, staticProps) { if (protoProps) column_defineProperties(Constructor.prototype, protoProps); if (staticProps) column_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  91080. var column_Column = /*#__PURE__*/function () {
  91081. function Column() {
  91082. column_classCallCheck(this, Column);
  91083. this.bb = null;
  91084. this.bb_pos = 0;
  91085. }
  91086. column_createClass(Column, [{
  91087. key: "__init",
  91088. value: function __init(i, bb) {
  91089. this.bb_pos = i;
  91090. this.bb = bb;
  91091. return this;
  91092. }
  91093. }, {
  91094. key: "name",
  91095. value: function name(optionalEncoding) {
  91096. var offset = this.bb.__offset(this.bb_pos, 4);
  91097. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91098. }
  91099. }, {
  91100. key: "type",
  91101. value: function type() {
  91102. var offset = this.bb.__offset(this.bb_pos, 6);
  91103. return offset ? this.bb.readUint8(this.bb_pos + offset) : column_type_ColumnType.Byte;
  91104. }
  91105. }, {
  91106. key: "title",
  91107. value: function title(optionalEncoding) {
  91108. var offset = this.bb.__offset(this.bb_pos, 8);
  91109. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91110. }
  91111. }, {
  91112. key: "description",
  91113. value: function description(optionalEncoding) {
  91114. var offset = this.bb.__offset(this.bb_pos, 10);
  91115. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91116. }
  91117. }, {
  91118. key: "width",
  91119. value: function width() {
  91120. var offset = this.bb.__offset(this.bb_pos, 12);
  91121. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  91122. }
  91123. }, {
  91124. key: "precision",
  91125. value: function precision() {
  91126. var offset = this.bb.__offset(this.bb_pos, 14);
  91127. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  91128. }
  91129. }, {
  91130. key: "scale",
  91131. value: function scale() {
  91132. var offset = this.bb.__offset(this.bb_pos, 16);
  91133. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  91134. }
  91135. }, {
  91136. key: "nullable",
  91137. value: function nullable() {
  91138. var offset = this.bb.__offset(this.bb_pos, 18);
  91139. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : true;
  91140. }
  91141. }, {
  91142. key: "unique",
  91143. value: function unique() {
  91144. var offset = this.bb.__offset(this.bb_pos, 20);
  91145. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  91146. }
  91147. }, {
  91148. key: "primaryKey",
  91149. value: function primaryKey() {
  91150. var offset = this.bb.__offset(this.bb_pos, 22);
  91151. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  91152. }
  91153. }, {
  91154. key: "metadata",
  91155. value: function metadata(optionalEncoding) {
  91156. var offset = this.bb.__offset(this.bb_pos, 24);
  91157. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91158. }
  91159. }], [{
  91160. key: "getRootAsColumn",
  91161. value: function getRootAsColumn(bb, obj) {
  91162. return (obj || new Column()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91163. }
  91164. }, {
  91165. key: "getSizePrefixedRootAsColumn",
  91166. value: function getSizePrefixedRootAsColumn(bb, obj) {
  91167. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  91168. return (obj || new Column()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91169. }
  91170. }, {
  91171. key: "startColumn",
  91172. value: function startColumn(builder) {
  91173. builder.startObject(11);
  91174. }
  91175. }, {
  91176. key: "addName",
  91177. value: function addName(builder, nameOffset) {
  91178. builder.addFieldOffset(0, nameOffset, 0);
  91179. }
  91180. }, {
  91181. key: "addType",
  91182. value: function addType(builder, type) {
  91183. builder.addFieldInt8(1, type, column_type_ColumnType.Byte);
  91184. }
  91185. }, {
  91186. key: "addTitle",
  91187. value: function addTitle(builder, titleOffset) {
  91188. builder.addFieldOffset(2, titleOffset, 0);
  91189. }
  91190. }, {
  91191. key: "addDescription",
  91192. value: function addDescription(builder, descriptionOffset) {
  91193. builder.addFieldOffset(3, descriptionOffset, 0);
  91194. }
  91195. }, {
  91196. key: "addWidth",
  91197. value: function addWidth(builder, width) {
  91198. builder.addFieldInt32(4, width, -1);
  91199. }
  91200. }, {
  91201. key: "addPrecision",
  91202. value: function addPrecision(builder, precision) {
  91203. builder.addFieldInt32(5, precision, -1);
  91204. }
  91205. }, {
  91206. key: "addScale",
  91207. value: function addScale(builder, scale) {
  91208. builder.addFieldInt32(6, scale, -1);
  91209. }
  91210. }, {
  91211. key: "addNullable",
  91212. value: function addNullable(builder, nullable) {
  91213. builder.addFieldInt8(7, +nullable, +true);
  91214. }
  91215. }, {
  91216. key: "addUnique",
  91217. value: function addUnique(builder, unique) {
  91218. builder.addFieldInt8(8, +unique, +false);
  91219. }
  91220. }, {
  91221. key: "addPrimaryKey",
  91222. value: function addPrimaryKey(builder, primaryKey) {
  91223. builder.addFieldInt8(9, +primaryKey, +false);
  91224. }
  91225. }, {
  91226. key: "addMetadata",
  91227. value: function addMetadata(builder, metadataOffset) {
  91228. builder.addFieldOffset(10, metadataOffset, 0);
  91229. }
  91230. }, {
  91231. key: "endColumn",
  91232. value: function endColumn(builder) {
  91233. var offset = builder.endObject();
  91234. builder.requiredField(offset, 4);
  91235. return offset;
  91236. }
  91237. }, {
  91238. key: "createColumn",
  91239. value: function createColumn(builder, nameOffset, type, titleOffset, descriptionOffset, width, precision, scale, nullable, unique, primaryKey, metadataOffset) {
  91240. Column.startColumn(builder);
  91241. Column.addName(builder, nameOffset);
  91242. Column.addType(builder, type);
  91243. Column.addTitle(builder, titleOffset);
  91244. Column.addDescription(builder, descriptionOffset);
  91245. Column.addWidth(builder, width);
  91246. Column.addPrecision(builder, precision);
  91247. Column.addScale(builder, scale);
  91248. Column.addNullable(builder, nullable);
  91249. Column.addUnique(builder, unique);
  91250. Column.addPrimaryKey(builder, primaryKey);
  91251. Column.addMetadata(builder, metadataOffset);
  91252. return Column.endColumn(builder);
  91253. }
  91254. }]);
  91255. return Column;
  91256. }();
  91257. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/feature.js
  91258. function feature_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  91259. function feature_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  91260. function feature_createClass(Constructor, protoProps, staticProps) { if (protoProps) feature_defineProperties(Constructor.prototype, protoProps); if (staticProps) feature_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  91261. var feature_Feature = /*#__PURE__*/function () {
  91262. function Feature() {
  91263. feature_classCallCheck(this, Feature);
  91264. this.bb = null;
  91265. this.bb_pos = 0;
  91266. }
  91267. feature_createClass(Feature, [{
  91268. key: "__init",
  91269. value: function __init(i, bb) {
  91270. this.bb_pos = i;
  91271. this.bb = bb;
  91272. return this;
  91273. }
  91274. }, {
  91275. key: "geometry",
  91276. value: function geometry(obj) {
  91277. var offset = this.bb.__offset(this.bb_pos, 4);
  91278. return offset ? (obj || new geometry_Geometry()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
  91279. }
  91280. }, {
  91281. key: "properties",
  91282. value: function properties(index) {
  91283. var offset = this.bb.__offset(this.bb_pos, 6);
  91284. return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
  91285. }
  91286. }, {
  91287. key: "propertiesLength",
  91288. value: function propertiesLength() {
  91289. var offset = this.bb.__offset(this.bb_pos, 6);
  91290. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91291. }
  91292. }, {
  91293. key: "propertiesArray",
  91294. value: function propertiesArray() {
  91295. var offset = this.bb.__offset(this.bb_pos, 6);
  91296. return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  91297. }
  91298. }, {
  91299. key: "columns",
  91300. value: function columns(index, obj) {
  91301. var offset = this.bb.__offset(this.bb_pos, 8);
  91302. return offset ? (obj || new column_Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  91303. }
  91304. }, {
  91305. key: "columnsLength",
  91306. value: function columnsLength() {
  91307. var offset = this.bb.__offset(this.bb_pos, 8);
  91308. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91309. }
  91310. }], [{
  91311. key: "getRootAsFeature",
  91312. value: function getRootAsFeature(bb, obj) {
  91313. return (obj || new Feature()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91314. }
  91315. }, {
  91316. key: "getSizePrefixedRootAsFeature",
  91317. value: function getSizePrefixedRootAsFeature(bb, obj) {
  91318. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  91319. return (obj || new Feature()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91320. }
  91321. }, {
  91322. key: "startFeature",
  91323. value: function startFeature(builder) {
  91324. builder.startObject(3);
  91325. }
  91326. }, {
  91327. key: "addGeometry",
  91328. value: function addGeometry(builder, geometryOffset) {
  91329. builder.addFieldOffset(0, geometryOffset, 0);
  91330. }
  91331. }, {
  91332. key: "addProperties",
  91333. value: function addProperties(builder, propertiesOffset) {
  91334. builder.addFieldOffset(1, propertiesOffset, 0);
  91335. }
  91336. }, {
  91337. key: "createPropertiesVector",
  91338. value: function createPropertiesVector(builder, data) {
  91339. builder.startVector(1, data.length, 1);
  91340. for (var i = data.length - 1; i >= 0; i--) {
  91341. builder.addInt8(data[i]);
  91342. }
  91343. return builder.endVector();
  91344. }
  91345. }, {
  91346. key: "startPropertiesVector",
  91347. value: function startPropertiesVector(builder, numElems) {
  91348. builder.startVector(1, numElems, 1);
  91349. }
  91350. }, {
  91351. key: "addColumns",
  91352. value: function addColumns(builder, columnsOffset) {
  91353. builder.addFieldOffset(2, columnsOffset, 0);
  91354. }
  91355. }, {
  91356. key: "createColumnsVector",
  91357. value: function createColumnsVector(builder, data) {
  91358. builder.startVector(4, data.length, 4);
  91359. for (var i = data.length - 1; i >= 0; i--) {
  91360. builder.addOffset(data[i]);
  91361. }
  91362. return builder.endVector();
  91363. }
  91364. }, {
  91365. key: "startColumnsVector",
  91366. value: function startColumnsVector(builder, numElems) {
  91367. builder.startVector(4, numElems, 4);
  91368. }
  91369. }, {
  91370. key: "endFeature",
  91371. value: function endFeature(builder) {
  91372. var offset = builder.endObject();
  91373. return offset;
  91374. }
  91375. }, {
  91376. key: "finishFeatureBuffer",
  91377. value: function finishFeatureBuffer(builder, offset) {
  91378. builder.finish(offset);
  91379. }
  91380. }, {
  91381. key: "finishSizePrefixedFeatureBuffer",
  91382. value: function finishSizePrefixedFeatureBuffer(builder, offset) {
  91383. builder.finish(offset, undefined, true);
  91384. }
  91385. }, {
  91386. key: "createFeature",
  91387. value: function createFeature(builder, geometryOffset, propertiesOffset, columnsOffset) {
  91388. Feature.startFeature(builder);
  91389. Feature.addGeometry(builder, geometryOffset);
  91390. Feature.addProperties(builder, propertiesOffset);
  91391. Feature.addColumns(builder, columnsOffset);
  91392. return Feature.endFeature(builder);
  91393. }
  91394. }]);
  91395. return Feature;
  91396. }();
  91397. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/feature.js
  91398. var textEncoder = new TextEncoder();
  91399. var textDecoder = new TextDecoder();
  91400. function fromFeature(feature, header, createGeometry, createFeature) {
  91401. var columns = header.columns;
  91402. var geometry = feature.geometry();
  91403. var simpleGeometry = createGeometry(geometry, header.geometryType);
  91404. var properties = parseProperties(feature, columns);
  91405. return createFeature(simpleGeometry, properties);
  91406. }
  91407. function feature_buildFeature(geometry, properties, header) {
  91408. var columns = header.columns;
  91409. var builder = new flatbuffers.Builder();
  91410. var offset = 0;
  91411. var capacity = 1024;
  91412. var bytes = new Uint8Array(capacity);
  91413. var view = new DataView(bytes.buffer);
  91414. var prep = function prep(size) {
  91415. if (offset + size < capacity) return;
  91416. capacity = Math.max(capacity + size, capacity * 2);
  91417. var newBytes = new Uint8Array(capacity);
  91418. newBytes.set(bytes);
  91419. bytes = newBytes;
  91420. view = new DataView(bytes.buffer);
  91421. };
  91422. if (columns) {
  91423. for (var i = 0; i < columns.length; i++) {
  91424. var column = columns[i];
  91425. var value = properties[column.name];
  91426. if (value === null) continue;
  91427. prep(2);
  91428. view.setUint16(offset, i, true);
  91429. offset += 2;
  91430. switch (column.type) {
  91431. case ColumnType.Bool:
  91432. prep(1);
  91433. view.setUint8(offset, value);
  91434. offset += 1;
  91435. break;
  91436. case ColumnType.Short:
  91437. prep(2);
  91438. view.setInt16(offset, value, true);
  91439. offset += 2;
  91440. break;
  91441. case ColumnType.UShort:
  91442. prep(2);
  91443. view.setUint16(offset, value, true);
  91444. offset += 2;
  91445. break;
  91446. case ColumnType.Int:
  91447. prep(4);
  91448. view.setInt32(offset, value, true);
  91449. offset += 4;
  91450. break;
  91451. case ColumnType.UInt:
  91452. prep(4);
  91453. view.setUint32(offset, value, true);
  91454. offset += 4;
  91455. break;
  91456. case ColumnType.Long:
  91457. prep(8);
  91458. view.setBigInt64(offset, BigInt(value), true);
  91459. offset += 8;
  91460. break;
  91461. case ColumnType.Float:
  91462. prep(4);
  91463. view.setFloat32(offset, value, true);
  91464. offset += 4;
  91465. break;
  91466. case ColumnType.Double:
  91467. prep(8);
  91468. view.setFloat64(offset, value, true);
  91469. offset += 8;
  91470. break;
  91471. case ColumnType.DateTime:
  91472. case ColumnType.String:
  91473. {
  91474. var str = textEncoder.encode(value);
  91475. prep(4);
  91476. view.setUint32(offset, str.length, true);
  91477. offset += 4;
  91478. prep(str.length);
  91479. bytes.set(str, offset);
  91480. offset += str.length;
  91481. break;
  91482. }
  91483. case ColumnType.Json:
  91484. {
  91485. var _str = textEncoder.encode(JSON.stringify(value));
  91486. prep(4);
  91487. view.setUint32(offset, _str.length, true);
  91488. offset += 4;
  91489. prep(_str.length);
  91490. bytes.set(_str, offset);
  91491. offset += _str.length;
  91492. break;
  91493. }
  91494. default:
  91495. throw new Error('Unknown type ' + column.type);
  91496. }
  91497. }
  91498. }
  91499. var propertiesOffset = null;
  91500. if (offset > 0) propertiesOffset = Feature.createPropertiesVector(builder, bytes.slice(0, offset));
  91501. var geometryOffset = buildGeometry(builder, geometry);
  91502. Feature.startFeature(builder);
  91503. Feature.addGeometry(builder, geometryOffset);
  91504. if (propertiesOffset) Feature.addProperties(builder, propertiesOffset);
  91505. var featureOffset = Feature.endFeature(builder);
  91506. builder.finishSizePrefixed(featureOffset);
  91507. return builder.asUint8Array();
  91508. }
  91509. function parseProperties(feature, columns) {
  91510. var properties = {};
  91511. if (!columns || columns.length === 0) return properties;
  91512. var array = feature.propertiesArray();
  91513. if (!array) return properties;
  91514. var view = new DataView(array.buffer, array.byteOffset);
  91515. var length = feature.propertiesLength();
  91516. var offset = 0;
  91517. while (offset < length) {
  91518. var i = view.getUint16(offset, true);
  91519. offset += 2;
  91520. var column = columns[i];
  91521. var name = column.name;
  91522. switch (column.type) {
  91523. case column_type_ColumnType.Bool:
  91524. {
  91525. properties[name] = !!view.getUint8(offset);
  91526. offset += 1;
  91527. break;
  91528. }
  91529. case column_type_ColumnType.Byte:
  91530. {
  91531. properties[name] = view.getInt8(offset);
  91532. offset += 1;
  91533. break;
  91534. }
  91535. case column_type_ColumnType.UByte:
  91536. {
  91537. properties[name] = view.getUint8(offset);
  91538. offset += 1;
  91539. break;
  91540. }
  91541. case column_type_ColumnType.Short:
  91542. {
  91543. properties[name] = view.getInt16(offset, true);
  91544. offset += 2;
  91545. break;
  91546. }
  91547. case column_type_ColumnType.UShort:
  91548. {
  91549. properties[name] = view.getUint16(offset, true);
  91550. offset += 2;
  91551. break;
  91552. }
  91553. case column_type_ColumnType.Int:
  91554. {
  91555. properties[name] = view.getInt32(offset, true);
  91556. offset += 4;
  91557. break;
  91558. }
  91559. case column_type_ColumnType.UInt:
  91560. {
  91561. properties[name] = view.getUint32(offset, true);
  91562. offset += 4;
  91563. break;
  91564. }
  91565. case column_type_ColumnType.Long:
  91566. {
  91567. properties[name] = Number(view.getBigInt64(offset, true));
  91568. offset += 8;
  91569. break;
  91570. }
  91571. case column_type_ColumnType.ULong:
  91572. {
  91573. properties[name] = Number(view.getBigUint64(offset, true));
  91574. offset += 8;
  91575. break;
  91576. }
  91577. case column_type_ColumnType.Float:
  91578. {
  91579. properties[name] = view.getFloat32(offset, true);
  91580. offset += 4;
  91581. break;
  91582. }
  91583. case column_type_ColumnType.Double:
  91584. {
  91585. properties[name] = view.getFloat64(offset, true);
  91586. offset += 8;
  91587. break;
  91588. }
  91589. case column_type_ColumnType.DateTime:
  91590. case column_type_ColumnType.String:
  91591. {
  91592. var _length = view.getUint32(offset, true);
  91593. offset += 4;
  91594. properties[name] = textDecoder.decode(array.subarray(offset, offset + _length));
  91595. offset += _length;
  91596. break;
  91597. }
  91598. case column_type_ColumnType.Json:
  91599. {
  91600. var _length2 = view.getUint32(offset, true);
  91601. offset += 4;
  91602. var str = textDecoder.decode(array.subarray(offset, offset + _length2));
  91603. properties[name] = JSON.parse(str);
  91604. offset += _length2;
  91605. break;
  91606. }
  91607. default:
  91608. throw new Error('Unknown type ' + column.type);
  91609. }
  91610. }
  91611. return properties;
  91612. }
  91613. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/feature.js
  91614. function feature_fromFeature(feature, header) {
  91615. var columns = header.columns;
  91616. var geometry = fromGeometry(feature.geometry(), header.geometryType);
  91617. var geoJsonfeature = {
  91618. type: 'Feature',
  91619. geometry: geometry,
  91620. properties: parseProperties(feature, columns)
  91621. };
  91622. return geoJsonfeature;
  91623. }
  91624. // EXTERNAL MODULE: ./node_modules/slice-source/dist/slice-source.js
  91625. var slice_source = __webpack_require__(901);
  91626. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/crs.js
  91627. function crs_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  91628. function crs_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  91629. function crs_createClass(Constructor, protoProps, staticProps) { if (protoProps) crs_defineProperties(Constructor.prototype, protoProps); if (staticProps) crs_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  91630. var Crs = /*#__PURE__*/function () {
  91631. function Crs() {
  91632. crs_classCallCheck(this, Crs);
  91633. this.bb = null;
  91634. this.bb_pos = 0;
  91635. }
  91636. crs_createClass(Crs, [{
  91637. key: "__init",
  91638. value: function __init(i, bb) {
  91639. this.bb_pos = i;
  91640. this.bb = bb;
  91641. return this;
  91642. }
  91643. }, {
  91644. key: "org",
  91645. value: function org(optionalEncoding) {
  91646. var offset = this.bb.__offset(this.bb_pos, 4);
  91647. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91648. }
  91649. }, {
  91650. key: "code",
  91651. value: function code() {
  91652. var offset = this.bb.__offset(this.bb_pos, 6);
  91653. return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
  91654. }
  91655. }, {
  91656. key: "name",
  91657. value: function name(optionalEncoding) {
  91658. var offset = this.bb.__offset(this.bb_pos, 8);
  91659. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91660. }
  91661. }, {
  91662. key: "description",
  91663. value: function description(optionalEncoding) {
  91664. var offset = this.bb.__offset(this.bb_pos, 10);
  91665. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91666. }
  91667. }, {
  91668. key: "wkt",
  91669. value: function wkt(optionalEncoding) {
  91670. var offset = this.bb.__offset(this.bb_pos, 12);
  91671. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91672. }
  91673. }, {
  91674. key: "codeString",
  91675. value: function codeString(optionalEncoding) {
  91676. var offset = this.bb.__offset(this.bb_pos, 14);
  91677. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91678. }
  91679. }], [{
  91680. key: "getRootAsCrs",
  91681. value: function getRootAsCrs(bb, obj) {
  91682. return (obj || new Crs()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91683. }
  91684. }, {
  91685. key: "getSizePrefixedRootAsCrs",
  91686. value: function getSizePrefixedRootAsCrs(bb, obj) {
  91687. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  91688. return (obj || new Crs()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91689. }
  91690. }, {
  91691. key: "startCrs",
  91692. value: function startCrs(builder) {
  91693. builder.startObject(6);
  91694. }
  91695. }, {
  91696. key: "addOrg",
  91697. value: function addOrg(builder, orgOffset) {
  91698. builder.addFieldOffset(0, orgOffset, 0);
  91699. }
  91700. }, {
  91701. key: "addCode",
  91702. value: function addCode(builder, code) {
  91703. builder.addFieldInt32(1, code, 0);
  91704. }
  91705. }, {
  91706. key: "addName",
  91707. value: function addName(builder, nameOffset) {
  91708. builder.addFieldOffset(2, nameOffset, 0);
  91709. }
  91710. }, {
  91711. key: "addDescription",
  91712. value: function addDescription(builder, descriptionOffset) {
  91713. builder.addFieldOffset(3, descriptionOffset, 0);
  91714. }
  91715. }, {
  91716. key: "addWkt",
  91717. value: function addWkt(builder, wktOffset) {
  91718. builder.addFieldOffset(4, wktOffset, 0);
  91719. }
  91720. }, {
  91721. key: "addCodeString",
  91722. value: function addCodeString(builder, codeStringOffset) {
  91723. builder.addFieldOffset(5, codeStringOffset, 0);
  91724. }
  91725. }, {
  91726. key: "endCrs",
  91727. value: function endCrs(builder) {
  91728. var offset = builder.endObject();
  91729. return offset;
  91730. }
  91731. }, {
  91732. key: "createCrs",
  91733. value: function createCrs(builder, orgOffset, code, nameOffset, descriptionOffset, wktOffset, codeStringOffset) {
  91734. Crs.startCrs(builder);
  91735. Crs.addOrg(builder, orgOffset);
  91736. Crs.addCode(builder, code);
  91737. Crs.addName(builder, nameOffset);
  91738. Crs.addDescription(builder, descriptionOffset);
  91739. Crs.addWkt(builder, wktOffset);
  91740. Crs.addCodeString(builder, codeStringOffset);
  91741. return Crs.endCrs(builder);
  91742. }
  91743. }]);
  91744. return Crs;
  91745. }();
  91746. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/header.js
  91747. function header_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  91748. function header_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  91749. function header_createClass(Constructor, protoProps, staticProps) { if (protoProps) header_defineProperties(Constructor.prototype, protoProps); if (staticProps) header_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  91750. var header_Header = /*#__PURE__*/function () {
  91751. function Header() {
  91752. header_classCallCheck(this, Header);
  91753. this.bb = null;
  91754. this.bb_pos = 0;
  91755. }
  91756. header_createClass(Header, [{
  91757. key: "__init",
  91758. value: function __init(i, bb) {
  91759. this.bb_pos = i;
  91760. this.bb = bb;
  91761. return this;
  91762. }
  91763. }, {
  91764. key: "name",
  91765. value: function name(optionalEncoding) {
  91766. var offset = this.bb.__offset(this.bb_pos, 4);
  91767. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91768. }
  91769. }, {
  91770. key: "envelope",
  91771. value: function envelope(index) {
  91772. var offset = this.bb.__offset(this.bb_pos, 6);
  91773. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  91774. }
  91775. }, {
  91776. key: "envelopeLength",
  91777. value: function envelopeLength() {
  91778. var offset = this.bb.__offset(this.bb_pos, 6);
  91779. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91780. }
  91781. }, {
  91782. key: "envelopeArray",
  91783. value: function envelopeArray() {
  91784. var offset = this.bb.__offset(this.bb_pos, 6);
  91785. return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
  91786. }
  91787. }, {
  91788. key: "geometryType",
  91789. value: function geometryType() {
  91790. var offset = this.bb.__offset(this.bb_pos, 8);
  91791. return offset ? this.bb.readUint8(this.bb_pos + offset) : geometry_type_GeometryType.Unknown;
  91792. }
  91793. }, {
  91794. key: "hasZ",
  91795. value: function hasZ() {
  91796. var offset = this.bb.__offset(this.bb_pos, 10);
  91797. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  91798. }
  91799. }, {
  91800. key: "hasM",
  91801. value: function hasM() {
  91802. var offset = this.bb.__offset(this.bb_pos, 12);
  91803. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  91804. }
  91805. }, {
  91806. key: "hasT",
  91807. value: function hasT() {
  91808. var offset = this.bb.__offset(this.bb_pos, 14);
  91809. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  91810. }
  91811. }, {
  91812. key: "hasTm",
  91813. value: function hasTm() {
  91814. var offset = this.bb.__offset(this.bb_pos, 16);
  91815. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  91816. }
  91817. }, {
  91818. key: "columns",
  91819. value: function columns(index, obj) {
  91820. var offset = this.bb.__offset(this.bb_pos, 18);
  91821. return offset ? (obj || new column_Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  91822. }
  91823. }, {
  91824. key: "columnsLength",
  91825. value: function columnsLength() {
  91826. var offset = this.bb.__offset(this.bb_pos, 18);
  91827. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  91828. }
  91829. }, {
  91830. key: "featuresCount",
  91831. value: function featuresCount() {
  91832. var offset = this.bb.__offset(this.bb_pos, 20);
  91833. return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
  91834. }
  91835. }, {
  91836. key: "indexNodeSize",
  91837. value: function indexNodeSize() {
  91838. var offset = this.bb.__offset(this.bb_pos, 22);
  91839. return offset ? this.bb.readUint16(this.bb_pos + offset) : 16;
  91840. }
  91841. }, {
  91842. key: "crs",
  91843. value: function crs(obj) {
  91844. var offset = this.bb.__offset(this.bb_pos, 24);
  91845. return offset ? (obj || new Crs()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
  91846. }
  91847. }, {
  91848. key: "title",
  91849. value: function title(optionalEncoding) {
  91850. var offset = this.bb.__offset(this.bb_pos, 26);
  91851. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91852. }
  91853. }, {
  91854. key: "description",
  91855. value: function description(optionalEncoding) {
  91856. var offset = this.bb.__offset(this.bb_pos, 28);
  91857. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91858. }
  91859. }, {
  91860. key: "metadata",
  91861. value: function metadata(optionalEncoding) {
  91862. var offset = this.bb.__offset(this.bb_pos, 30);
  91863. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  91864. }
  91865. }], [{
  91866. key: "getRootAsHeader",
  91867. value: function getRootAsHeader(bb, obj) {
  91868. return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91869. }
  91870. }, {
  91871. key: "getSizePrefixedRootAsHeader",
  91872. value: function getSizePrefixedRootAsHeader(bb, obj) {
  91873. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  91874. return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  91875. }
  91876. }, {
  91877. key: "startHeader",
  91878. value: function startHeader(builder) {
  91879. builder.startObject(14);
  91880. }
  91881. }, {
  91882. key: "addName",
  91883. value: function addName(builder, nameOffset) {
  91884. builder.addFieldOffset(0, nameOffset, 0);
  91885. }
  91886. }, {
  91887. key: "addEnvelope",
  91888. value: function addEnvelope(builder, envelopeOffset) {
  91889. builder.addFieldOffset(1, envelopeOffset, 0);
  91890. }
  91891. }, {
  91892. key: "createEnvelopeVector",
  91893. value: function createEnvelopeVector(builder, data) {
  91894. builder.startVector(8, data.length, 8);
  91895. for (var i = data.length - 1; i >= 0; i--) {
  91896. builder.addFloat64(data[i]);
  91897. }
  91898. return builder.endVector();
  91899. }
  91900. }, {
  91901. key: "startEnvelopeVector",
  91902. value: function startEnvelopeVector(builder, numElems) {
  91903. builder.startVector(8, numElems, 8);
  91904. }
  91905. }, {
  91906. key: "addGeometryType",
  91907. value: function addGeometryType(builder, geometryType) {
  91908. builder.addFieldInt8(2, geometryType, geometry_type_GeometryType.Unknown);
  91909. }
  91910. }, {
  91911. key: "addHasZ",
  91912. value: function addHasZ(builder, hasZ) {
  91913. builder.addFieldInt8(3, +hasZ, +false);
  91914. }
  91915. }, {
  91916. key: "addHasM",
  91917. value: function addHasM(builder, hasM) {
  91918. builder.addFieldInt8(4, +hasM, +false);
  91919. }
  91920. }, {
  91921. key: "addHasT",
  91922. value: function addHasT(builder, hasT) {
  91923. builder.addFieldInt8(5, +hasT, +false);
  91924. }
  91925. }, {
  91926. key: "addHasTm",
  91927. value: function addHasTm(builder, hasTm) {
  91928. builder.addFieldInt8(6, +hasTm, +false);
  91929. }
  91930. }, {
  91931. key: "addColumns",
  91932. value: function addColumns(builder, columnsOffset) {
  91933. builder.addFieldOffset(7, columnsOffset, 0);
  91934. }
  91935. }, {
  91936. key: "createColumnsVector",
  91937. value: function createColumnsVector(builder, data) {
  91938. builder.startVector(4, data.length, 4);
  91939. for (var i = data.length - 1; i >= 0; i--) {
  91940. builder.addOffset(data[i]);
  91941. }
  91942. return builder.endVector();
  91943. }
  91944. }, {
  91945. key: "startColumnsVector",
  91946. value: function startColumnsVector(builder, numElems) {
  91947. builder.startVector(4, numElems, 4);
  91948. }
  91949. }, {
  91950. key: "addFeaturesCount",
  91951. value: function addFeaturesCount(builder, featuresCount) {
  91952. builder.addFieldInt64(8, featuresCount, BigInt('0'));
  91953. }
  91954. }, {
  91955. key: "addIndexNodeSize",
  91956. value: function addIndexNodeSize(builder, indexNodeSize) {
  91957. builder.addFieldInt16(9, indexNodeSize, 16);
  91958. }
  91959. }, {
  91960. key: "addCrs",
  91961. value: function addCrs(builder, crsOffset) {
  91962. builder.addFieldOffset(10, crsOffset, 0);
  91963. }
  91964. }, {
  91965. key: "addTitle",
  91966. value: function addTitle(builder, titleOffset) {
  91967. builder.addFieldOffset(11, titleOffset, 0);
  91968. }
  91969. }, {
  91970. key: "addDescription",
  91971. value: function addDescription(builder, descriptionOffset) {
  91972. builder.addFieldOffset(12, descriptionOffset, 0);
  91973. }
  91974. }, {
  91975. key: "addMetadata",
  91976. value: function addMetadata(builder, metadataOffset) {
  91977. builder.addFieldOffset(13, metadataOffset, 0);
  91978. }
  91979. }, {
  91980. key: "endHeader",
  91981. value: function endHeader(builder) {
  91982. var offset = builder.endObject();
  91983. return offset;
  91984. }
  91985. }, {
  91986. key: "finishHeaderBuffer",
  91987. value: function finishHeaderBuffer(builder, offset) {
  91988. builder.finish(offset);
  91989. }
  91990. }, {
  91991. key: "finishSizePrefixedHeaderBuffer",
  91992. value: function finishSizePrefixedHeaderBuffer(builder, offset) {
  91993. builder.finish(offset, undefined, true);
  91994. }
  91995. }]);
  91996. return Header;
  91997. }();
  91998. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/header-meta.js
  91999. function fromByteBuffer(bb) {
  92000. var header = header_Header.getRootAsHeader(bb);
  92001. var featuresCount = header.featuresCount();
  92002. var indexNodeSize = header.indexNodeSize();
  92003. var columns = [];
  92004. for (var j = 0; j < header.columnsLength(); j++) {
  92005. var column = header.columns(j);
  92006. if (!column) throw new Error('Column unexpectedly missing');
  92007. if (!column.name()) throw new Error('Column name unexpectedly missing');
  92008. columns.push({
  92009. name: column.name(),
  92010. type: column.type(),
  92011. title: column.title(),
  92012. description: column.description(),
  92013. width: column.width(),
  92014. precision: column.precision(),
  92015. scale: column.scale(),
  92016. nullable: column.nullable(),
  92017. unique: column.unique(),
  92018. primary_key: column.primaryKey()
  92019. });
  92020. }
  92021. var crs = header.crs();
  92022. var crsMeta = crs ? {
  92023. org: crs.org(),
  92024. code: crs.code(),
  92025. name: crs.name(),
  92026. description: crs.description(),
  92027. wkt: crs.wkt(),
  92028. code_string: crs.codeString()
  92029. } : null;
  92030. var headerMeta = {
  92031. geometryType: header.geometryType(),
  92032. columns: columns,
  92033. envelope: null,
  92034. featuresCount: Number(featuresCount),
  92035. indexNodeSize: indexNodeSize,
  92036. crs: crsMeta,
  92037. title: header.title(),
  92038. description: header.description(),
  92039. metadata: header.metadata()
  92040. };
  92041. return headerMeta;
  92042. }
  92043. // EXTERNAL MODULE: ./node_modules/@repeaterjs/repeater/cjs/repeater.js
  92044. var repeater = __webpack_require__(982);
  92045. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/config.js
  92046. function config_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  92047. function config_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  92048. function config_createClass(Constructor, protoProps, staticProps) { if (protoProps) config_defineProperties(Constructor.prototype, protoProps); if (staticProps) config_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  92049. var config_Config = /*#__PURE__*/function () {
  92050. function Config() {
  92051. config_classCallCheck(this, Config);
  92052. this._extraRequestThreshold = 256 * 1024;
  92053. }
  92054. config_createClass(Config, [{
  92055. key: "extraRequestThreshold",
  92056. value: function extraRequestThreshold() {
  92057. return this._extraRequestThreshold;
  92058. }
  92059. }, {
  92060. key: "setExtraRequestThreshold",
  92061. value: function setExtraRequestThreshold(bytes) {
  92062. if (bytes < 0) {
  92063. throw new Error('extraRequestThreshold cannot be negative');
  92064. }
  92065. this._extraRequestThreshold = bytes;
  92066. }
  92067. }]);
  92068. return Config;
  92069. }();
  92070. config_Config.global = new config_Config();
  92071. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/logger.js
  92072. function logger_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  92073. function logger_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  92074. function logger_createClass(Constructor, protoProps, staticProps) { if (protoProps) logger_defineProperties(Constructor.prototype, protoProps); if (staticProps) logger_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  92075. var LogLevel;
  92076. (function (LogLevel) {
  92077. LogLevel[LogLevel["Debug"] = 0] = "Debug";
  92078. LogLevel[LogLevel["Info"] = 1] = "Info";
  92079. LogLevel[LogLevel["Warn"] = 2] = "Warn";
  92080. LogLevel[LogLevel["Error"] = 3] = "Error";
  92081. })(LogLevel || (LogLevel = {}));
  92082. var Logger = /*#__PURE__*/function () {
  92083. function Logger() {
  92084. logger_classCallCheck(this, Logger);
  92085. }
  92086. logger_createClass(Logger, null, [{
  92087. key: "debug",
  92088. value: function debug() {
  92089. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  92090. args[_key] = arguments[_key];
  92091. }
  92092. this.log.apply(this, [LogLevel.Debug].concat(args));
  92093. }
  92094. }, {
  92095. key: "info",
  92096. value: function info() {
  92097. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  92098. args[_key2] = arguments[_key2];
  92099. }
  92100. this.log.apply(this, [LogLevel.Info].concat(args));
  92101. }
  92102. }, {
  92103. key: "warn",
  92104. value: function warn() {
  92105. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  92106. args[_key3] = arguments[_key3];
  92107. }
  92108. this.log.apply(this, [LogLevel.Warn].concat(args));
  92109. }
  92110. }, {
  92111. key: "error",
  92112. value: function error() {
  92113. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  92114. args[_key4] = arguments[_key4];
  92115. }
  92116. this.log.apply(this, [LogLevel.Error].concat(args));
  92117. }
  92118. }, {
  92119. key: "log",
  92120. value: function log(level) {
  92121. if (this.logLevel > level) {
  92122. return;
  92123. }
  92124. for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
  92125. args[_key5 - 1] = arguments[_key5];
  92126. }
  92127. switch (level) {
  92128. case LogLevel.Debug:
  92129. {
  92130. var _console;
  92131. (_console = console).debug.apply(_console, args);
  92132. break;
  92133. }
  92134. case LogLevel.Info:
  92135. {
  92136. var _console2;
  92137. (_console2 = console).info.apply(_console2, args);
  92138. break;
  92139. }
  92140. case LogLevel.Warn:
  92141. {
  92142. var _console3;
  92143. (_console3 = console).warn.apply(_console3, args);
  92144. break;
  92145. }
  92146. case LogLevel.Error:
  92147. {
  92148. var _console4;
  92149. (_console4 = console).error.apply(_console4, args);
  92150. break;
  92151. }
  92152. }
  92153. }
  92154. }]);
  92155. return Logger;
  92156. }();
  92157. Logger.logLevel = LogLevel.Info;
  92158. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/packedrtree.js
  92159. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  92160. function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  92161. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || packedrtree_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  92162. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  92163. function packedrtree_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return packedrtree_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return packedrtree_arrayLikeToArray(o, minLen); }
  92164. function packedrtree_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  92165. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  92166. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  92167. function packedrtree_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  92168. function packedrtree_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  92169. function packedrtree_createClass(Constructor, protoProps, staticProps) { if (protoProps) packedrtree_defineProperties(Constructor.prototype, protoProps); if (staticProps) packedrtree_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  92170. function _awaitAsyncGenerator(value) { return new _OverloadYield(value, 0); }
  92171. function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; }
  92172. function _AsyncGenerator(gen) { var front, back; function resume(key, arg) { try { var result = gen[key](arg), value = result.value, overloaded = value instanceof _OverloadYield; Promise.resolve(overloaded ? value.v : value).then(function (arg) { if (overloaded) { var nextKey = "return" === key ? "return" : "next"; if (!value.k || arg.done) return resume(nextKey, arg); arg = gen[nextKey](arg).value; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: !0 }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: !1 }); } (front = front.next) ? resume(front.key, front.arg) : back = null; } this._invoke = function (key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; back ? back = back.next = request : (front = back = request, resume(key, arg)); }); }, "function" != typeof gen["return"] && (this["return"] = void 0); }
  92173. _AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }, _AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }, _AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }, _AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); };
  92174. function _OverloadYield(value, kind) { this.v = value, this.k = kind; }
  92175. var NODE_ITEM_LEN = 8 * 4 + 8;
  92176. var DEFAULT_NODE_SIZE = 16;
  92177. function calcTreeSize(numItems, nodeSize) {
  92178. nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);
  92179. var n = numItems;
  92180. var numNodes = n;
  92181. do {
  92182. n = Math.ceil(n / nodeSize);
  92183. numNodes += n;
  92184. } while (n !== 1);
  92185. return numNodes * NODE_ITEM_LEN;
  92186. }
  92187. function generateLevelBounds(numItems, nodeSize) {
  92188. if (nodeSize < 2) throw new Error('Node size must be at least 2');
  92189. if (numItems === 0) throw new Error('Number of items must be greater than 0');
  92190. var n = numItems;
  92191. var numNodes = n;
  92192. var levelNumNodes = [n];
  92193. do {
  92194. n = Math.ceil(n / nodeSize);
  92195. numNodes += n;
  92196. levelNumNodes.push(n);
  92197. } while (n !== 1);
  92198. var levelOffsets = [];
  92199. n = numNodes;
  92200. for (var _i = 0, _levelNumNodes = levelNumNodes; _i < _levelNumNodes.length; _i++) {
  92201. var size = _levelNumNodes[_i];
  92202. levelOffsets.push(n - size);
  92203. n -= size;
  92204. }
  92205. levelOffsets.reverse();
  92206. levelNumNodes.reverse();
  92207. var levelBounds = [];
  92208. for (var i = 0; i < levelNumNodes.length; i++) levelBounds.push([levelOffsets[i], levelOffsets[i] + levelNumNodes[i]]);
  92209. levelBounds.reverse();
  92210. return levelBounds;
  92211. }
  92212. function streamSearch(_x, _x2, _x3, _x4) {
  92213. return _streamSearch.apply(this, arguments);
  92214. }
  92215. function _streamSearch() {
  92216. _streamSearch = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(numItems, nodeSize, rect, readNode) {
  92217. var NodeRange, minX, minY, maxX, maxY, levelBounds, leafNodesOffset, rootNodeRange, queue, _loop;
  92218. return _regeneratorRuntime().wrap(function _callee$(_context3) {
  92219. while (1) switch (_context3.prev = _context3.next) {
  92220. case 0:
  92221. NodeRange = /*#__PURE__*/function () {
  92222. function NodeRange(nodes, level) {
  92223. packedrtree_classCallCheck(this, NodeRange);
  92224. this._level = level;
  92225. this.nodes = nodes;
  92226. }
  92227. packedrtree_createClass(NodeRange, [{
  92228. key: "level",
  92229. value: function level() {
  92230. return this._level;
  92231. }
  92232. }, {
  92233. key: "startNode",
  92234. value: function startNode() {
  92235. return this.nodes[0];
  92236. }
  92237. }, {
  92238. key: "endNode",
  92239. value: function endNode() {
  92240. return this.nodes[1];
  92241. }
  92242. }, {
  92243. key: "extendEndNodeToNewOffset",
  92244. value: function extendEndNodeToNewOffset(newOffset) {
  92245. console.assert(newOffset > this.nodes[1]);
  92246. this.nodes[1] = newOffset;
  92247. }
  92248. }, {
  92249. key: "toString",
  92250. value: function toString() {
  92251. return "[NodeRange level: ".concat(this._level, ", nodes: ").concat(this.nodes[0], "-").concat(this.nodes[1], "]");
  92252. }
  92253. }]);
  92254. return NodeRange;
  92255. }();
  92256. minX = rect.minX, minY = rect.minY, maxX = rect.maxX, maxY = rect.maxY;
  92257. Logger.info("tree items: ".concat(numItems, ", nodeSize: ").concat(nodeSize));
  92258. levelBounds = generateLevelBounds(numItems, nodeSize);
  92259. leafNodesOffset = levelBounds[0][0];
  92260. rootNodeRange = function () {
  92261. var range = [0, 1];
  92262. var level = levelBounds.length - 1;
  92263. return new NodeRange(range, level);
  92264. }();
  92265. queue = [rootNodeRange];
  92266. Logger.debug("starting stream search with queue: ".concat(queue, ", numItems: ").concat(numItems, ", nodeSize: ").concat(nodeSize, ", levelBounds: ").concat(levelBounds));
  92267. _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
  92268. var nodeRange, nodeIndex, isLeafNode, _levelBounds$nodeRang, levelBound, end, length, buffer, float64Array, uint32Array, _loop2, _ret, pos;
  92269. return _regeneratorRuntime().wrap(function _loop$(_context2) {
  92270. while (1) switch (_context2.prev = _context2.next) {
  92271. case 0:
  92272. nodeRange = queue.shift();
  92273. Logger.debug("popped node: ".concat(nodeRange, ", queueLength: ").concat(queue.length));
  92274. nodeIndex = nodeRange.startNode();
  92275. isLeafNode = nodeIndex >= leafNodesOffset;
  92276. _levelBounds$nodeRang = _slicedToArray(levelBounds[nodeRange.level()], 2), levelBound = _levelBounds$nodeRang[1];
  92277. end = Math.min(nodeRange.endNode() + nodeSize, levelBound);
  92278. length = end - nodeIndex;
  92279. _context2.next = 9;
  92280. return _awaitAsyncGenerator(readNode(nodeIndex * NODE_ITEM_LEN, length * NODE_ITEM_LEN));
  92281. case 9:
  92282. buffer = _context2.sent;
  92283. float64Array = new Float64Array(buffer);
  92284. uint32Array = new Uint32Array(buffer);
  92285. _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2(pos) {
  92286. var nodePos, low32Offset, high32Offset, offset, featureLength, extraRequestThresholdNodes, nearestNodeRange, newNodeRange;
  92287. return _regeneratorRuntime().wrap(function _loop2$(_context) {
  92288. while (1) switch (_context.prev = _context.next) {
  92289. case 0:
  92290. nodePos = (pos - nodeIndex) * 5;
  92291. if (!(maxX < float64Array[nodePos + 0])) {
  92292. _context.next = 3;
  92293. break;
  92294. }
  92295. return _context.abrupt("return", 0);
  92296. case 3:
  92297. if (!(maxY < float64Array[nodePos + 1])) {
  92298. _context.next = 5;
  92299. break;
  92300. }
  92301. return _context.abrupt("return", 0);
  92302. case 5:
  92303. if (!(minX > float64Array[nodePos + 2])) {
  92304. _context.next = 7;
  92305. break;
  92306. }
  92307. return _context.abrupt("return", 0);
  92308. case 7:
  92309. if (!(minY > float64Array[nodePos + 3])) {
  92310. _context.next = 9;
  92311. break;
  92312. }
  92313. return _context.abrupt("return", 0);
  92314. case 9:
  92315. low32Offset = uint32Array[(nodePos << 1) + 8];
  92316. high32Offset = uint32Array[(nodePos << 1) + 9];
  92317. offset = readUint52(high32Offset, low32Offset);
  92318. if (!isLeafNode) {
  92319. _context.next = 17;
  92320. break;
  92321. }
  92322. featureLength = function () {
  92323. if (pos < numItems - 1) {
  92324. var nextPos = (pos - nodeIndex + 1) * 5;
  92325. var _low32Offset = uint32Array[(nextPos << 1) + 8];
  92326. var _high32Offset = uint32Array[(nextPos << 1) + 9];
  92327. var nextOffset = readUint52(_high32Offset, _low32Offset);
  92328. return nextOffset - offset;
  92329. } else {
  92330. return null;
  92331. }
  92332. }();
  92333. _context.next = 16;
  92334. return [offset, pos - leafNodesOffset, featureLength];
  92335. case 16:
  92336. return _context.abrupt("return", 0);
  92337. case 17:
  92338. extraRequestThresholdNodes = config_Config.global.extraRequestThreshold() / NODE_ITEM_LEN;
  92339. nearestNodeRange = queue[queue.length - 1];
  92340. if (!(nearestNodeRange !== undefined && nearestNodeRange.level() == nodeRange.level() - 1 && offset < nearestNodeRange.endNode() + extraRequestThresholdNodes)) {
  92341. _context.next = 23;
  92342. break;
  92343. }
  92344. Logger.debug("Merging \"nodeRange\" request into existing range: ".concat(nearestNodeRange, ", newOffset: ").concat(nearestNodeRange.endNode(), " -> ").concat(offset));
  92345. nearestNodeRange.extendEndNodeToNewOffset(offset);
  92346. return _context.abrupt("return", 0);
  92347. case 23:
  92348. newNodeRange = function () {
  92349. var level = nodeRange.level() - 1;
  92350. var range = [offset, offset + 1];
  92351. return new NodeRange(range, level);
  92352. }();
  92353. if (nearestNodeRange !== undefined && nearestNodeRange.level() == newNodeRange.level()) {
  92354. Logger.info("Same level, but too far away. Pushing new request at offset: ".concat(offset, " rather than merging with distant ").concat(nearestNodeRange));
  92355. } else {
  92356. Logger.info("Pushing new level for ".concat(newNodeRange, " onto queue with nearestNodeRange: ").concat(nearestNodeRange, " since there's not already a range for this level."));
  92357. }
  92358. queue.push(newNodeRange);
  92359. case 26:
  92360. case "end":
  92361. return _context.stop();
  92362. }
  92363. }, _loop2);
  92364. });
  92365. pos = nodeIndex;
  92366. case 14:
  92367. if (!(pos < end)) {
  92368. _context2.next = 22;
  92369. break;
  92370. }
  92371. return _context2.delegateYield(_loop2(pos), "t0", 16);
  92372. case 16:
  92373. _ret = _context2.t0;
  92374. if (!(_ret === 0)) {
  92375. _context2.next = 19;
  92376. break;
  92377. }
  92378. return _context2.abrupt("continue", 19);
  92379. case 19:
  92380. pos++;
  92381. _context2.next = 14;
  92382. break;
  92383. case 22:
  92384. case "end":
  92385. return _context2.stop();
  92386. }
  92387. }, _loop);
  92388. });
  92389. case 9:
  92390. if (!(queue.length != 0)) {
  92391. _context3.next = 13;
  92392. break;
  92393. }
  92394. return _context3.delegateYield(_loop(), "t0", 11);
  92395. case 11:
  92396. _context3.next = 9;
  92397. break;
  92398. case 13:
  92399. case "end":
  92400. return _context3.stop();
  92401. }
  92402. }, _callee);
  92403. }));
  92404. return _streamSearch.apply(this, arguments);
  92405. }
  92406. function readUint52(high32Bits, low32Bits) {
  92407. if ((high32Bits & 0xfff00000) != 0) {
  92408. throw Error('integer is too large to be safely represented');
  92409. }
  92410. var result = low32Bits + high32Bits * Math.pow(2, 32);
  92411. return result;
  92412. }
  92413. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/constants.js
  92414. var constants_magicbytes = new Uint8Array([0x66, 0x67, 0x62, 0x03, 0x66, 0x67, 0x62, 0x00]);
  92415. var SIZE_PREFIX_LEN = 4;
  92416. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/http-reader.js
  92417. function http_reader_typeof(obj) { "@babel/helpers - typeof"; return http_reader_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, http_reader_typeof(obj); }
  92418. function http_reader_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = http_reader_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  92419. function http_reader_slicedToArray(arr, i) { return http_reader_arrayWithHoles(arr) || http_reader_iterableToArrayLimit(arr, i) || http_reader_unsupportedIterableToArray(arr, i) || http_reader_nonIterableRest(); }
  92420. function http_reader_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  92421. function http_reader_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return http_reader_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return http_reader_arrayLikeToArray(o, minLen); }
  92422. function http_reader_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  92423. function http_reader_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  92424. function http_reader_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  92425. function http_reader_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ http_reader_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == http_reader_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  92426. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  92427. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  92428. function http_reader_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  92429. function http_reader_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  92430. function http_reader_createClass(Constructor, protoProps, staticProps) { if (protoProps) http_reader_defineProperties(Constructor.prototype, protoProps); if (staticProps) http_reader_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  92431. function http_reader_wrapAsyncGenerator(fn) { return function () { return new http_reader_AsyncGenerator(fn.apply(this, arguments)); }; }
  92432. function http_reader_AsyncGenerator(gen) { var front, back; function resume(key, arg) { try { var result = gen[key](arg), value = result.value, overloaded = value instanceof http_reader_OverloadYield; Promise.resolve(overloaded ? value.v : value).then(function (arg) { if (overloaded) { var nextKey = "return" === key ? "return" : "next"; if (!value.k || arg.done) return resume(nextKey, arg); arg = gen[nextKey](arg).value; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: !0 }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: !1 }); } (front = front.next) ? resume(front.key, front.arg) : back = null; } this._invoke = function (key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; back ? back = back.next = request : (front = back = request, resume(key, arg)); }); }, "function" != typeof gen["return"] && (this["return"] = void 0); }
  92433. http_reader_AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }, http_reader_AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }, http_reader_AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }, http_reader_AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); };
  92434. function http_reader_awaitAsyncGenerator(value) { return new http_reader_OverloadYield(value, 0); }
  92435. function _asyncGeneratorDelegate(inner) { var iter = {}, waiting = !1; function pump(key, value) { return waiting = !0, value = new Promise(function (resolve) { resolve(inner[key](value)); }), { done: !1, value: new http_reader_OverloadYield(value, 1) }; } return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { return this; }, iter.next = function (value) { return waiting ? (waiting = !1, value) : pump("next", value); }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) { if (waiting) throw waiting = !1, value; return pump("throw", value); }), "function" == typeof inner["return"] && (iter["return"] = function (value) { return waiting ? (waiting = !1, value) : pump("return", value); }), iter; }
  92436. function http_reader_OverloadYield(value, kind) { this.v = value, this.k = kind; }
  92437. function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  92438. function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
  92439. var HttpReader = /*#__PURE__*/function () {
  92440. function HttpReader(headerClient, header, headerLength, indexLength) {
  92441. http_reader_classCallCheck(this, HttpReader);
  92442. this.headerClient = headerClient;
  92443. this.header = header;
  92444. this.headerLength = headerLength;
  92445. this.indexLength = indexLength;
  92446. }
  92447. http_reader_createClass(HttpReader, [{
  92448. key: "selectBbox",
  92449. value: function selectBbox(rect) {
  92450. var _this = this;
  92451. return http_reader_wrapAsyncGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee2() {
  92452. var lengthBeforeTree, bufferedClient, readNode, batches, currentBatch, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, searchResult, _searchResult2, featureOffset, _searchResult4, featureLength, guessLength, prevFeature, gap, promises;
  92453. return http_reader_regeneratorRuntime().wrap(function _callee2$(_context2) {
  92454. while (1) switch (_context2.prev = _context2.next) {
  92455. case 0:
  92456. lengthBeforeTree = _this.lengthBeforeTree();
  92457. bufferedClient = _this.headerClient;
  92458. readNode = /*#__PURE__*/function () {
  92459. var _ref = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee(offsetIntoTree, size) {
  92460. var minReqLength;
  92461. return http_reader_regeneratorRuntime().wrap(function _callee$(_context) {
  92462. while (1) switch (_context.prev = _context.next) {
  92463. case 0:
  92464. minReqLength = 0;
  92465. return _context.abrupt("return", bufferedClient.getRange(lengthBeforeTree + offsetIntoTree, size, minReqLength, 'index'));
  92466. case 2:
  92467. case "end":
  92468. return _context.stop();
  92469. }
  92470. }, _callee);
  92471. }));
  92472. return function readNode(_x, _x2) {
  92473. return _ref.apply(this, arguments);
  92474. };
  92475. }();
  92476. batches = [];
  92477. currentBatch = [];
  92478. _iteratorAbruptCompletion = false;
  92479. _didIteratorError = false;
  92480. _context2.prev = 7;
  92481. _iterator = _asyncIterator(streamSearch(_this.header.featuresCount, _this.header.indexNodeSize, rect, readNode));
  92482. case 9:
  92483. _context2.next = 11;
  92484. return http_reader_awaitAsyncGenerator(_iterator.next());
  92485. case 11:
  92486. if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
  92487. _context2.next = 26;
  92488. break;
  92489. }
  92490. searchResult = _step.value;
  92491. _searchResult2 = http_reader_slicedToArray(searchResult, 2), featureOffset = _searchResult2[0];
  92492. _searchResult4 = http_reader_slicedToArray(searchResult, 3), featureLength = _searchResult4[2];
  92493. if (!featureLength) {
  92494. Logger.info('final feature');
  92495. guessLength = config_Config.global.extraRequestThreshold();
  92496. featureLength = guessLength;
  92497. }
  92498. if (!(currentBatch.length == 0)) {
  92499. _context2.next = 19;
  92500. break;
  92501. }
  92502. currentBatch.push([featureOffset, featureLength]);
  92503. return _context2.abrupt("continue", 23);
  92504. case 19:
  92505. prevFeature = currentBatch[currentBatch.length - 1];
  92506. gap = featureOffset - (prevFeature[0] + prevFeature[1]);
  92507. if (gap > config_Config.global.extraRequestThreshold()) {
  92508. Logger.info("Pushing new feature batch, since gap ".concat(gap, " was too large"));
  92509. batches.push(currentBatch);
  92510. currentBatch = [];
  92511. }
  92512. currentBatch.push([featureOffset, featureLength]);
  92513. case 23:
  92514. _iteratorAbruptCompletion = false;
  92515. _context2.next = 9;
  92516. break;
  92517. case 26:
  92518. _context2.next = 32;
  92519. break;
  92520. case 28:
  92521. _context2.prev = 28;
  92522. _context2.t0 = _context2["catch"](7);
  92523. _didIteratorError = true;
  92524. _iteratorError = _context2.t0;
  92525. case 32:
  92526. _context2.prev = 32;
  92527. _context2.prev = 33;
  92528. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  92529. _context2.next = 37;
  92530. break;
  92531. }
  92532. _context2.next = 37;
  92533. return http_reader_awaitAsyncGenerator(_iterator["return"]());
  92534. case 37:
  92535. _context2.prev = 37;
  92536. if (!_didIteratorError) {
  92537. _context2.next = 40;
  92538. break;
  92539. }
  92540. throw _iteratorError;
  92541. case 40:
  92542. return _context2.finish(37);
  92543. case 41:
  92544. return _context2.finish(32);
  92545. case 42:
  92546. _this.headerClient.logUsage('header+index');
  92547. if (currentBatch.length > 0) {
  92548. batches.push(currentBatch);
  92549. }
  92550. promises = batches.flatMap(function (batch) {
  92551. return _this.readFeatureBatch(batch);
  92552. });
  92553. return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(repeater/* Repeater */.ZN.merge(promises)), http_reader_awaitAsyncGenerator), "t1", 46);
  92554. case 46:
  92555. case "end":
  92556. return _context2.stop();
  92557. }
  92558. }, _callee2, null, [[7, 28, 32, 42], [33,, 37, 41]]);
  92559. }))();
  92560. }
  92561. }, {
  92562. key: "lengthBeforeTree",
  92563. value: function lengthBeforeTree() {
  92564. return constants_magicbytes.length + SIZE_PREFIX_LEN + this.headerLength;
  92565. }
  92566. }, {
  92567. key: "lengthBeforeFeatures",
  92568. value: function lengthBeforeFeatures() {
  92569. return this.lengthBeforeTree() + this.indexLength;
  92570. }
  92571. }, {
  92572. key: "buildFeatureClient",
  92573. value: function buildFeatureClient() {
  92574. return new BufferedHttpRangeClient(this.headerClient.httpClient);
  92575. }
  92576. }, {
  92577. key: "readFeatureBatch",
  92578. value: function readFeatureBatch(batch) {
  92579. var _this2 = this;
  92580. return http_reader_wrapAsyncGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee3() {
  92581. var _batch$, firstFeatureOffset, _batch, lastFeatureOffset, lastFeatureLength, batchStart, batchEnd, batchSize, featureClient, _iterator2, _step2, _step2$value2, featureOffset;
  92582. return http_reader_regeneratorRuntime().wrap(function _callee3$(_context3) {
  92583. while (1) switch (_context3.prev = _context3.next) {
  92584. case 0:
  92585. _batch$ = http_reader_slicedToArray(batch[0], 1), firstFeatureOffset = _batch$[0];
  92586. _batch = http_reader_slicedToArray(batch[batch.length - 1], 2), lastFeatureOffset = _batch[0], lastFeatureLength = _batch[1];
  92587. batchStart = firstFeatureOffset;
  92588. batchEnd = lastFeatureOffset + lastFeatureLength;
  92589. batchSize = batchEnd - batchStart;
  92590. featureClient = _this2.buildFeatureClient();
  92591. _iterator2 = http_reader_createForOfIteratorHelper(batch);
  92592. _context3.prev = 7;
  92593. _iterator2.s();
  92594. case 9:
  92595. if ((_step2 = _iterator2.n()).done) {
  92596. _context3.next = 17;
  92597. break;
  92598. }
  92599. _step2$value2 = http_reader_slicedToArray(_step2.value, 1), featureOffset = _step2$value2[0];
  92600. _context3.next = 13;
  92601. return http_reader_awaitAsyncGenerator(_this2.readFeature(featureClient, featureOffset, batchSize));
  92602. case 13:
  92603. _context3.next = 15;
  92604. return _context3.sent;
  92605. case 15:
  92606. _context3.next = 9;
  92607. break;
  92608. case 17:
  92609. _context3.next = 22;
  92610. break;
  92611. case 19:
  92612. _context3.prev = 19;
  92613. _context3.t0 = _context3["catch"](7);
  92614. _iterator2.e(_context3.t0);
  92615. case 22:
  92616. _context3.prev = 22;
  92617. _iterator2.f();
  92618. return _context3.finish(22);
  92619. case 25:
  92620. featureClient.logUsage('feature');
  92621. case 26:
  92622. case "end":
  92623. return _context3.stop();
  92624. }
  92625. }, _callee3, null, [[7, 19, 22, 25]]);
  92626. }))();
  92627. }
  92628. }, {
  92629. key: "readFeature",
  92630. value: function () {
  92631. var _readFeature = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee4(featureClient, featureOffset, minFeatureReqLength) {
  92632. var offset, featureLength, _bytes, byteBuffer, bytes, bytesAligned, bb;
  92633. return http_reader_regeneratorRuntime().wrap(function _callee4$(_context4) {
  92634. while (1) switch (_context4.prev = _context4.next) {
  92635. case 0:
  92636. offset = featureOffset + this.lengthBeforeFeatures();
  92637. _context4.next = 3;
  92638. return featureClient.getRange(offset, 4, minFeatureReqLength, 'feature length');
  92639. case 3:
  92640. _bytes = _context4.sent;
  92641. featureLength = new DataView(_bytes).getUint32(0, true);
  92642. _context4.next = 7;
  92643. return featureClient.getRange(offset + 4, featureLength, minFeatureReqLength, 'feature data');
  92644. case 7:
  92645. byteBuffer = _context4.sent;
  92646. bytes = new Uint8Array(byteBuffer);
  92647. bytesAligned = new Uint8Array(featureLength + SIZE_PREFIX_LEN);
  92648. bytesAligned.set(bytes, SIZE_PREFIX_LEN);
  92649. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytesAligned);
  92650. bb.setPosition(SIZE_PREFIX_LEN);
  92651. return _context4.abrupt("return", feature_Feature.getRootAsFeature(bb));
  92652. case 14:
  92653. case "end":
  92654. return _context4.stop();
  92655. }
  92656. }, _callee4, this);
  92657. }));
  92658. function readFeature(_x3, _x4, _x5) {
  92659. return _readFeature.apply(this, arguments);
  92660. }
  92661. return readFeature;
  92662. }()
  92663. }], [{
  92664. key: "open",
  92665. value: function () {
  92666. var _open = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee5(url) {
  92667. var assumedHeaderLength, headerClient, assumedIndexLength, minReqLength, _bytes2, headerLength, _bytes3, HEADER_MAX_BUFFER_SIZE, bytes, bb, header, indexLength;
  92668. return http_reader_regeneratorRuntime().wrap(function _callee5$(_context5) {
  92669. while (1) switch (_context5.prev = _context5.next) {
  92670. case 0:
  92671. assumedHeaderLength = 2024;
  92672. headerClient = new BufferedHttpRangeClient(url);
  92673. assumedIndexLength = function () {
  92674. var assumedBranchingFactor = DEFAULT_NODE_SIZE;
  92675. var prefetchedLayers = 3;
  92676. var result = 0;
  92677. var i;
  92678. for (i = 0; i < prefetchedLayers; i++) {
  92679. var layer_width = Math.pow(assumedBranchingFactor, i) * NODE_ITEM_LEN;
  92680. result += layer_width;
  92681. }
  92682. return result;
  92683. }();
  92684. minReqLength = assumedHeaderLength + assumedIndexLength;
  92685. Logger.debug("fetching header. minReqLength: ".concat(minReqLength, " (assumedHeaderLength: ").concat(assumedHeaderLength, ", assumedIndexLength: ").concat(assumedIndexLength, ")"));
  92686. _context5.t0 = Uint8Array;
  92687. _context5.next = 8;
  92688. return headerClient.getRange(0, 8, minReqLength, 'header');
  92689. case 8:
  92690. _context5.t1 = _context5.sent;
  92691. _bytes2 = new _context5.t0(_context5.t1);
  92692. if (_bytes2.subarray(0, 3).every(function (v, i) {
  92693. return constants_magicbytes[i] === v;
  92694. })) {
  92695. _context5.next = 13;
  92696. break;
  92697. }
  92698. Logger.error("bytes: ".concat(_bytes2, " != ").concat(constants_magicbytes));
  92699. throw new Error('Not a FlatGeobuf file');
  92700. case 13:
  92701. Logger.debug('magic bytes look good');
  92702. _context5.next = 16;
  92703. return headerClient.getRange(8, 4, minReqLength, 'header');
  92704. case 16:
  92705. _bytes3 = _context5.sent;
  92706. headerLength = new DataView(_bytes3).getUint32(0, true);
  92707. HEADER_MAX_BUFFER_SIZE = 1048576 * 10;
  92708. if (!(headerLength > HEADER_MAX_BUFFER_SIZE || headerLength < 8)) {
  92709. _context5.next = 21;
  92710. break;
  92711. }
  92712. throw new Error('Invalid header size');
  92713. case 21:
  92714. Logger.debug("headerLength: ".concat(headerLength));
  92715. _context5.next = 24;
  92716. return headerClient.getRange(12, headerLength, minReqLength, 'header');
  92717. case 24:
  92718. bytes = _context5.sent;
  92719. bb = new js_flatbuffers/* ByteBuffer */.cZ(new Uint8Array(bytes));
  92720. header = fromByteBuffer(bb);
  92721. indexLength = calcTreeSize(header.featuresCount, header.indexNodeSize);
  92722. Logger.debug('completed: opening http reader');
  92723. return _context5.abrupt("return", new HttpReader(headerClient, header, headerLength, indexLength));
  92724. case 30:
  92725. case "end":
  92726. return _context5.stop();
  92727. }
  92728. }, _callee5);
  92729. }));
  92730. function open(_x6) {
  92731. return _open.apply(this, arguments);
  92732. }
  92733. return open;
  92734. }()
  92735. }]);
  92736. return HttpReader;
  92737. }();
  92738. var BufferedHttpRangeClient = /*#__PURE__*/function () {
  92739. function BufferedHttpRangeClient(source) {
  92740. http_reader_classCallCheck(this, BufferedHttpRangeClient);
  92741. this.bytesEverUsed = 0;
  92742. this.bytesEverFetched = 0;
  92743. this.buffer = new ArrayBuffer(0);
  92744. this.head = 0;
  92745. if (typeof source === 'string') {
  92746. this.httpClient = new HttpRangeClient(source);
  92747. } else {
  92748. this.httpClient = source;
  92749. }
  92750. }
  92751. http_reader_createClass(BufferedHttpRangeClient, [{
  92752. key: "getRange",
  92753. value: function () {
  92754. var _getRange = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee6(start, length, minReqLength, purpose) {
  92755. var start_i, end_i, lengthToFetch;
  92756. return http_reader_regeneratorRuntime().wrap(function _callee6$(_context6) {
  92757. while (1) switch (_context6.prev = _context6.next) {
  92758. case 0:
  92759. this.bytesEverUsed += length;
  92760. start_i = start - this.head;
  92761. end_i = start_i + length;
  92762. if (!(start_i >= 0 && end_i <= this.buffer.byteLength)) {
  92763. _context6.next = 5;
  92764. break;
  92765. }
  92766. return _context6.abrupt("return", this.buffer.slice(start_i, end_i));
  92767. case 5:
  92768. lengthToFetch = Math.max(length, minReqLength);
  92769. this.bytesEverFetched += lengthToFetch;
  92770. Logger.debug("requesting for new Range: ".concat(start, "-").concat(start + length - 1));
  92771. _context6.next = 10;
  92772. return this.httpClient.getRange(start, lengthToFetch, purpose);
  92773. case 10:
  92774. this.buffer = _context6.sent;
  92775. this.head = start;
  92776. return _context6.abrupt("return", this.buffer.slice(0, length));
  92777. case 13:
  92778. case "end":
  92779. return _context6.stop();
  92780. }
  92781. }, _callee6, this);
  92782. }));
  92783. function getRange(_x7, _x8, _x9, _x10) {
  92784. return _getRange.apply(this, arguments);
  92785. }
  92786. return getRange;
  92787. }()
  92788. }, {
  92789. key: "logUsage",
  92790. value: function logUsage(purpose) {
  92791. var category = purpose.split(' ')[0];
  92792. var used = this.bytesEverUsed;
  92793. var requested = this.bytesEverFetched;
  92794. var efficiency = (100.0 * used / requested).toFixed(2);
  92795. Logger.info("".concat(category, " bytes used/requested: ").concat(used, " / ").concat(requested, " = ").concat(efficiency, "%"));
  92796. }
  92797. }]);
  92798. return BufferedHttpRangeClient;
  92799. }();
  92800. var HttpRangeClient = /*#__PURE__*/function () {
  92801. function HttpRangeClient(url) {
  92802. http_reader_classCallCheck(this, HttpRangeClient);
  92803. this.requestsEverMade = 0;
  92804. this.bytesEverRequested = 0;
  92805. this.url = url;
  92806. }
  92807. http_reader_createClass(HttpRangeClient, [{
  92808. key: "getRange",
  92809. value: function () {
  92810. var _getRange2 = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee7(begin, length, purpose) {
  92811. var range, response;
  92812. return http_reader_regeneratorRuntime().wrap(function _callee7$(_context7) {
  92813. while (1) switch (_context7.prev = _context7.next) {
  92814. case 0:
  92815. this.requestsEverMade += 1;
  92816. this.bytesEverRequested += length;
  92817. range = "bytes=".concat(begin, "-").concat(begin + length - 1);
  92818. Logger.info("request: #".concat(this.requestsEverMade, ", purpose: ").concat(purpose, "), bytes: (this_request: ").concat(length, ", ever: ").concat(this.bytesEverRequested, "), Range: ").concat(range));
  92819. _context7.next = 6;
  92820. return fetch(this.url, {
  92821. headers: {
  92822. Range: range
  92823. }
  92824. });
  92825. case 6:
  92826. response = _context7.sent;
  92827. return _context7.abrupt("return", response.arrayBuffer());
  92828. case 8:
  92829. case "end":
  92830. return _context7.stop();
  92831. }
  92832. }, _callee7, this);
  92833. }));
  92834. function getRange(_x11, _x12, _x13) {
  92835. return _getRange2.apply(this, arguments);
  92836. }
  92837. return getRange;
  92838. }()
  92839. }]);
  92840. return HttpRangeClient;
  92841. }();
  92842. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/header.js
  92843. function header_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = header_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  92844. function header_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return header_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return header_arrayLikeToArray(o, minLen); }
  92845. function header_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  92846. function featureGeomType(feature) {
  92847. if (feature.getGeometry) {
  92848. return toGeometryType(feature.getGeometry().getType());
  92849. } else {
  92850. return toGeometryType(feature.geometry.type);
  92851. }
  92852. }
  92853. function header_inferGeometryType(features) {
  92854. var geometryType = undefined;
  92855. var _iterator = header_createForOfIteratorHelper(features),
  92856. _step;
  92857. try {
  92858. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  92859. var f = _step.value;
  92860. if (geometryType === GeometryType.Unknown) {
  92861. break;
  92862. }
  92863. var gtype = featureGeomType(f);
  92864. if (geometryType === undefined) {
  92865. geometryType = gtype;
  92866. } else if (geometryType !== gtype) {
  92867. geometryType = GeometryType.Unknown;
  92868. }
  92869. }
  92870. } catch (err) {
  92871. _iterator.e(err);
  92872. } finally {
  92873. _iterator.f();
  92874. }
  92875. if (geometryType === undefined) {
  92876. throw new Error('Could not infer geometry type for collection of features.');
  92877. }
  92878. return geometryType;
  92879. }
  92880. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/featurecollection.js
  92881. function featurecollection_typeof(obj) { "@babel/helpers - typeof"; return featurecollection_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, featurecollection_typeof(obj); }
  92882. function featurecollection_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ featurecollection_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == featurecollection_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  92883. function featurecollection_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  92884. function featurecollection_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { featurecollection_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { featurecollection_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  92885. function featurecollection_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = featurecollection_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  92886. function featurecollection_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return featurecollection_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return featurecollection_arrayLikeToArray(o, minLen); }
  92887. function featurecollection_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  92888. function featurecollection_asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new featurecollection_AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  92889. function featurecollection_AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return featurecollection_AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, featurecollection_AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new featurecollection_AsyncFromSyncIterator(s); }
  92890. function featurecollection_awaitAsyncGenerator(value) { return new featurecollection_OverloadYield(value, 0); }
  92891. function featurecollection_wrapAsyncGenerator(fn) { return function () { return new featurecollection_AsyncGenerator(fn.apply(this, arguments)); }; }
  92892. function featurecollection_AsyncGenerator(gen) { var front, back; function resume(key, arg) { try { var result = gen[key](arg), value = result.value, overloaded = value instanceof featurecollection_OverloadYield; Promise.resolve(overloaded ? value.v : value).then(function (arg) { if (overloaded) { var nextKey = "return" === key ? "return" : "next"; if (!value.k || arg.done) return resume(nextKey, arg); arg = gen[nextKey](arg).value; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: !0 }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: !1 }); } (front = front.next) ? resume(front.key, front.arg) : back = null; } this._invoke = function (key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; back ? back = back.next = request : (front = back = request, resume(key, arg)); }); }, "function" != typeof gen["return"] && (this["return"] = void 0); }
  92893. featurecollection_AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }, featurecollection_AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }, featurecollection_AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }, featurecollection_AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); };
  92894. function featurecollection_OverloadYield(value, kind) { this.v = value, this.k = kind; }
  92895. function serialize(features) {
  92896. var headerMeta = introspectHeaderMeta(features);
  92897. var header = featurecollection_buildHeader(headerMeta);
  92898. var featureBuffers = features.map(function (f) {
  92899. if (!f.getGeometry) throw new Error('Missing getGeometry implementation');
  92900. if (!f.getProperties) throw new Error('Missing getProperties implementation');
  92901. return buildFeature(parseGeometry(f.getGeometry(), headerMeta.geometryType), f.getProperties(), headerMeta);
  92902. });
  92903. var featuresLength = featureBuffers.map(function (f) {
  92904. return f.length;
  92905. }).reduce(function (a, b) {
  92906. return a + b;
  92907. });
  92908. var uint8 = new Uint8Array(magicbytes.length + header.length + featuresLength);
  92909. uint8.set(header, magicbytes.length);
  92910. var offset = magicbytes.length + header.length;
  92911. var _iterator2 = featurecollection_createForOfIteratorHelper(featureBuffers),
  92912. _step2;
  92913. try {
  92914. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  92915. var feature = _step2.value;
  92916. uint8.set(feature, offset);
  92917. offset += feature.length;
  92918. }
  92919. } catch (err) {
  92920. _iterator2.e(err);
  92921. } finally {
  92922. _iterator2.f();
  92923. }
  92924. uint8.set(magicbytes);
  92925. return uint8;
  92926. }
  92927. function deserialize(bytes, fromFeature, headerMetaFn) {
  92928. if (!bytes.subarray(0, 3).every(function (v, i) {
  92929. return constants_magicbytes[i] === v;
  92930. })) throw new Error('Not a FlatGeobuf file');
  92931. var bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  92932. var headerLength = bb.readUint32(constants_magicbytes.length);
  92933. bb.setPosition(constants_magicbytes.length + SIZE_PREFIX_LEN);
  92934. var headerMeta = fromByteBuffer(bb);
  92935. if (headerMetaFn) headerMetaFn(headerMeta);
  92936. var offset = constants_magicbytes.length + SIZE_PREFIX_LEN + headerLength;
  92937. var indexNodeSize = headerMeta.indexNodeSize,
  92938. featuresCount = headerMeta.featuresCount;
  92939. if (indexNodeSize > 0) offset += calcTreeSize(featuresCount, indexNodeSize);
  92940. var features = [];
  92941. while (offset < bb.capacity()) {
  92942. var featureLength = bb.readUint32(offset);
  92943. bb.setPosition(offset + SIZE_PREFIX_LEN);
  92944. var feature = feature_Feature.getRootAsFeature(bb);
  92945. features.push(fromFeature(feature, headerMeta));
  92946. offset += SIZE_PREFIX_LEN + featureLength;
  92947. }
  92948. return features;
  92949. }
  92950. function deserializeStream(_x, _x2, _x3) {
  92951. return _deserializeStream.apply(this, arguments);
  92952. }
  92953. function _deserializeStream() {
  92954. _deserializeStream = featurecollection_wrapAsyncGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee2(stream, fromFeature, headerMetaFn) {
  92955. var reader, read, bytes, bb, headerLength, headerMeta, indexNodeSize, featuresCount, treeSize, feature;
  92956. return featurecollection_regeneratorRuntime().wrap(function _callee2$(_context2) {
  92957. while (1) switch (_context2.prev = _context2.next) {
  92958. case 0:
  92959. reader = slice_source(stream);
  92960. read = /*#__PURE__*/function () {
  92961. var _ref = featurecollection_asyncToGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee(size) {
  92962. return featurecollection_regeneratorRuntime().wrap(function _callee$(_context) {
  92963. while (1) switch (_context.prev = _context.next) {
  92964. case 0:
  92965. _context.next = 2;
  92966. return reader.slice(size);
  92967. case 2:
  92968. return _context.abrupt("return", _context.sent);
  92969. case 3:
  92970. case "end":
  92971. return _context.stop();
  92972. }
  92973. }, _callee);
  92974. }));
  92975. return function read(_x8) {
  92976. return _ref.apply(this, arguments);
  92977. };
  92978. }();
  92979. _context2.t0 = Uint8Array;
  92980. _context2.next = 5;
  92981. return featurecollection_awaitAsyncGenerator(read(8, 'magic bytes'));
  92982. case 5:
  92983. _context2.t1 = _context2.sent;
  92984. bytes = new _context2.t0(_context2.t1);
  92985. if (bytes.subarray(0, 3).every(function (v, i) {
  92986. return constants_magicbytes[i] === v;
  92987. })) {
  92988. _context2.next = 9;
  92989. break;
  92990. }
  92991. throw new Error('Not a FlatGeobuf file');
  92992. case 9:
  92993. _context2.t2 = Uint8Array;
  92994. _context2.next = 12;
  92995. return featurecollection_awaitAsyncGenerator(read(4, 'header length'));
  92996. case 12:
  92997. _context2.t3 = _context2.sent;
  92998. bytes = new _context2.t2(_context2.t3);
  92999. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  93000. headerLength = bb.readUint32(0);
  93001. _context2.t4 = Uint8Array;
  93002. _context2.next = 19;
  93003. return featurecollection_awaitAsyncGenerator(read(headerLength, 'header data'));
  93004. case 19:
  93005. _context2.t5 = _context2.sent;
  93006. bytes = new _context2.t4(_context2.t5);
  93007. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  93008. headerMeta = fromByteBuffer(bb);
  93009. if (headerMetaFn) headerMetaFn(headerMeta);
  93010. indexNodeSize = headerMeta.indexNodeSize, featuresCount = headerMeta.featuresCount;
  93011. if (!(indexNodeSize > 0)) {
  93012. _context2.next = 29;
  93013. break;
  93014. }
  93015. treeSize = calcTreeSize(featuresCount, indexNodeSize);
  93016. _context2.next = 29;
  93017. return featurecollection_awaitAsyncGenerator(read(treeSize, 'entire index, w/o rect'));
  93018. case 29:
  93019. _context2.next = 31;
  93020. return featurecollection_awaitAsyncGenerator(readFeature(read, headerMeta, fromFeature));
  93021. case 31:
  93022. if (!(feature = _context2.sent)) {
  93023. _context2.next = 36;
  93024. break;
  93025. }
  93026. _context2.next = 34;
  93027. return feature;
  93028. case 34:
  93029. _context2.next = 29;
  93030. break;
  93031. case 36:
  93032. case "end":
  93033. return _context2.stop();
  93034. }
  93035. }, _callee2);
  93036. }));
  93037. return _deserializeStream.apply(this, arguments);
  93038. }
  93039. function deserializeFiltered(_x4, _x5, _x6, _x7) {
  93040. return _deserializeFiltered.apply(this, arguments);
  93041. }
  93042. function _deserializeFiltered() {
  93043. _deserializeFiltered = featurecollection_wrapAsyncGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee3(url, rect, fromFeature, headerMetaFn) {
  93044. var reader, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, feature;
  93045. return featurecollection_regeneratorRuntime().wrap(function _callee3$(_context3) {
  93046. while (1) switch (_context3.prev = _context3.next) {
  93047. case 0:
  93048. _context3.next = 2;
  93049. return featurecollection_awaitAsyncGenerator(HttpReader.open(url));
  93050. case 2:
  93051. reader = _context3.sent;
  93052. Logger.debug('opened reader');
  93053. if (headerMetaFn) headerMetaFn(reader.header);
  93054. _iteratorAbruptCompletion = false;
  93055. _didIteratorError = false;
  93056. _context3.prev = 7;
  93057. _iterator = featurecollection_asyncIterator(reader.selectBbox(rect));
  93058. case 9:
  93059. _context3.next = 11;
  93060. return featurecollection_awaitAsyncGenerator(_iterator.next());
  93061. case 11:
  93062. if (!(_iteratorAbruptCompletion = !(_step = _context3.sent).done)) {
  93063. _context3.next = 18;
  93064. break;
  93065. }
  93066. feature = _step.value;
  93067. _context3.next = 15;
  93068. return fromFeature(feature, reader.header);
  93069. case 15:
  93070. _iteratorAbruptCompletion = false;
  93071. _context3.next = 9;
  93072. break;
  93073. case 18:
  93074. _context3.next = 24;
  93075. break;
  93076. case 20:
  93077. _context3.prev = 20;
  93078. _context3.t0 = _context3["catch"](7);
  93079. _didIteratorError = true;
  93080. _iteratorError = _context3.t0;
  93081. case 24:
  93082. _context3.prev = 24;
  93083. _context3.prev = 25;
  93084. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  93085. _context3.next = 29;
  93086. break;
  93087. }
  93088. _context3.next = 29;
  93089. return featurecollection_awaitAsyncGenerator(_iterator["return"]());
  93090. case 29:
  93091. _context3.prev = 29;
  93092. if (!_didIteratorError) {
  93093. _context3.next = 32;
  93094. break;
  93095. }
  93096. throw _iteratorError;
  93097. case 32:
  93098. return _context3.finish(29);
  93099. case 33:
  93100. return _context3.finish(24);
  93101. case 34:
  93102. case "end":
  93103. return _context3.stop();
  93104. }
  93105. }, _callee3, null, [[7, 20, 24, 34], [25,, 29, 33]]);
  93106. }));
  93107. return _deserializeFiltered.apply(this, arguments);
  93108. }
  93109. function readFeature(_x9, _x10, _x11) {
  93110. return _readFeature.apply(this, arguments);
  93111. }
  93112. function _readFeature() {
  93113. _readFeature = featurecollection_asyncToGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee4(read, headerMeta, fromFeature) {
  93114. var bytes, bb, featureLength, bytesAligned, feature;
  93115. return featurecollection_regeneratorRuntime().wrap(function _callee4$(_context4) {
  93116. while (1) switch (_context4.prev = _context4.next) {
  93117. case 0:
  93118. _context4.t0 = Uint8Array;
  93119. _context4.next = 3;
  93120. return read(4, 'feature length');
  93121. case 3:
  93122. _context4.t1 = _context4.sent;
  93123. bytes = new _context4.t0(_context4.t1);
  93124. if (!(bytes.byteLength === 0)) {
  93125. _context4.next = 7;
  93126. break;
  93127. }
  93128. return _context4.abrupt("return");
  93129. case 7:
  93130. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  93131. featureLength = bb.readUint32(0);
  93132. _context4.t2 = Uint8Array;
  93133. _context4.next = 12;
  93134. return read(featureLength, 'feature data');
  93135. case 12:
  93136. _context4.t3 = _context4.sent;
  93137. bytes = new _context4.t2(_context4.t3);
  93138. bytesAligned = new Uint8Array(featureLength + 4);
  93139. bytesAligned.set(bytes, 4);
  93140. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytesAligned);
  93141. bb.setPosition(SIZE_PREFIX_LEN);
  93142. feature = feature_Feature.getRootAsFeature(bb);
  93143. return _context4.abrupt("return", fromFeature(feature, headerMeta));
  93144. case 20:
  93145. case "end":
  93146. return _context4.stop();
  93147. }
  93148. }, _callee4);
  93149. }));
  93150. return _readFeature.apply(this, arguments);
  93151. }
  93152. function buildColumn(builder, column) {
  93153. var nameOffset = builder.createString(column.name);
  93154. Column.startColumn(builder);
  93155. Column.addName(builder, nameOffset);
  93156. Column.addType(builder, column.type);
  93157. return Column.endColumn(builder);
  93158. }
  93159. function featurecollection_buildHeader(header) {
  93160. var builder = new flatbuffers.Builder();
  93161. var columnOffsets = null;
  93162. if (header.columns) columnOffsets = Header.createColumnsVector(builder, header.columns.map(function (c) {
  93163. return buildColumn(builder, c);
  93164. }));
  93165. var nameOffset = builder.createString('L1');
  93166. Header.startHeader(builder);
  93167. Header.addFeaturesCount(builder, BigInt(header.featuresCount));
  93168. Header.addGeometryType(builder, header.geometryType);
  93169. Header.addIndexNodeSize(builder, 0);
  93170. if (columnOffsets) Header.addColumns(builder, columnOffsets);
  93171. Header.addName(builder, nameOffset);
  93172. var offset = Header.endHeader(builder);
  93173. builder.finishSizePrefixed(offset);
  93174. return builder.asUint8Array();
  93175. }
  93176. function valueToType(value) {
  93177. if (typeof value === 'boolean') return ColumnType.Bool;else if (typeof value === 'number') {
  93178. if (value % 1 === 0) return ColumnType.Int;else return ColumnType.Double;
  93179. } else if (typeof value === 'string') return ColumnType.String;else if (value === null) return ColumnType.String;else if (featurecollection_typeof(value) === 'object') return ColumnType.Json;else throw new Error("Unknown type (value '".concat(value, "')"));
  93180. }
  93181. function featurecollection_mapColumn(properties, k) {
  93182. return {
  93183. name: k,
  93184. type: valueToType(properties[k]),
  93185. title: null,
  93186. description: null,
  93187. width: -1,
  93188. precision: -1,
  93189. scale: -1,
  93190. nullable: true,
  93191. unique: false,
  93192. primary_key: false
  93193. };
  93194. }
  93195. function introspectHeaderMeta(features) {
  93196. var sampleFeature = features[0];
  93197. var properties = sampleFeature.getProperties ? sampleFeature.getProperties() : {};
  93198. var columns = null;
  93199. if (properties) columns = Object.keys(properties).filter(function (key) {
  93200. return key !== 'geometry';
  93201. }).map(function (k) {
  93202. return featurecollection_mapColumn(properties, k);
  93203. });
  93204. var geometryType = inferGeometryType(features);
  93205. var headerMeta = {
  93206. geometryType: geometryType,
  93207. columns: columns,
  93208. envelope: null,
  93209. featuresCount: features.length,
  93210. indexNodeSize: 0,
  93211. crs: null,
  93212. title: null,
  93213. description: null,
  93214. metadata: null
  93215. };
  93216. return headerMeta;
  93217. }
  93218. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/featurecollection.js
  93219. function geojson_featurecollection_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = geojson_featurecollection_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  93220. function geojson_featurecollection_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return geojson_featurecollection_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return geojson_featurecollection_arrayLikeToArray(o, minLen); }
  93221. function geojson_featurecollection_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  93222. function featurecollection_serialize(featurecollection) {
  93223. var headerMeta = featurecollection_introspectHeaderMeta(featurecollection);
  93224. var header = buildHeader(headerMeta);
  93225. var features = featurecollection.features.map(function (f) {
  93226. return buildFeature(f.geometry.type === 'GeometryCollection' ? parseGC(f.geometry) : parseGeometry(f.geometry), f.properties, headerMeta);
  93227. });
  93228. var featuresLength = features.map(function (f) {
  93229. return f.length;
  93230. }).reduce(function (a, b) {
  93231. return a + b;
  93232. });
  93233. var uint8 = new Uint8Array(magicbytes.length + header.length + featuresLength);
  93234. uint8.set(header, magicbytes.length);
  93235. var offset = magicbytes.length + header.length;
  93236. var _iterator = geojson_featurecollection_createForOfIteratorHelper(features),
  93237. _step;
  93238. try {
  93239. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  93240. var feature = _step.value;
  93241. uint8.set(feature, offset);
  93242. offset += feature.length;
  93243. }
  93244. } catch (err) {
  93245. _iterator.e(err);
  93246. } finally {
  93247. _iterator.f();
  93248. }
  93249. uint8.set(magicbytes);
  93250. return uint8;
  93251. }
  93252. function featurecollection_deserialize(bytes, headerMetaFn) {
  93253. var features = deserialize(bytes, feature_fromFeature, headerMetaFn);
  93254. return {
  93255. type: 'FeatureCollection',
  93256. features: features
  93257. };
  93258. }
  93259. function featurecollection_deserializeStream(stream, headerMetaFn) {
  93260. return deserializeStream(stream, feature_fromFeature, headerMetaFn);
  93261. }
  93262. function featurecollection_deserializeFiltered(url, rect, headerMetaFn) {
  93263. return deserializeFiltered(url, rect, feature_fromFeature, headerMetaFn);
  93264. }
  93265. function featurecollection_introspectHeaderMeta(featurecollection) {
  93266. var feature = featurecollection.features[0];
  93267. var properties = feature.properties;
  93268. var columns = null;
  93269. if (properties) columns = Object.keys(properties).map(function (k) {
  93270. return mapColumn(properties, k);
  93271. });
  93272. var geometryType = inferGeometryType(featurecollection.features);
  93273. var headerMeta = {
  93274. geometryType: geometryType,
  93275. columns: columns,
  93276. envelope: null,
  93277. featuresCount: featurecollection.features.length,
  93278. indexNodeSize: 0,
  93279. crs: null,
  93280. title: null,
  93281. description: null,
  93282. metadata: null
  93283. };
  93284. return headerMeta;
  93285. }
  93286. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson.js
  93287. function geojson_serialize(geojson) {
  93288. var bytes = fcSerialize(geojson);
  93289. return bytes;
  93290. }
  93291. function geojson_deserialize(input, rect, headerMetaFn) {
  93292. if (input instanceof Uint8Array) return featurecollection_deserialize(input, headerMetaFn);else if (input instanceof ReadableStream) return featurecollection_deserializeStream(input, headerMetaFn);else return featurecollection_deserializeFiltered(input, rect, headerMetaFn);
  93293. }
  93294. ;// CONCATENATED MODULE: external "ol.loadingstrategy"
  93295. const external_ol_loadingstrategy_namespaceObject = ol.loadingstrategy;
  93296. ;// CONCATENATED MODULE: ./src/openlayers/overlay/FGB.js
  93297. function FGB_typeof(obj) { "@babel/helpers - typeof"; return FGB_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, FGB_typeof(obj); }
  93298. function FGB_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ FGB_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == FGB_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  93299. function FGB_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  93300. function FGB_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { FGB_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { FGB_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  93301. function FGB_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  93302. function FGB_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  93303. function FGB_createClass(Constructor, protoProps, staticProps) { if (protoProps) FGB_defineProperties(Constructor.prototype, protoProps); if (staticProps) FGB_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  93304. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  93305. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  93306. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  93307. function _possibleConstructorReturn(self, call) { if (call && (FGB_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  93308. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  93309. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  93310. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  93311. function FGB_asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new FGB_AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  93312. function FGB_AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return FGB_AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, FGB_AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new FGB_AsyncFromSyncIterator(s); }
  93313. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  93314. * This program are made available under the terms of the Apache License, Version 2.0
  93315. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  93316. /**
  93317. * @class FGB
  93318. * @browsernamespace ol.source
  93319. * @category Visualization FGB
  93320. * @classdesc FGB 图层源,该图层源把 {@link FlatGeobuf} 格式解析为点线面要素。
  93321. * @modulecategory Overlay
  93322. * @version 11.1.0
  93323. * @param {Object} opt_options - 参数。
  93324. * @param {string} opt_options.url - FGB 地址,例如:http://localhost:8090/iserver/services/xxx/rest/data/featureResults/newResourceId.fgb。
  93325. * @param {ol.loadingstrategy} [opt_options.strategy= ol.loadingstrategy.bbox] - ol.loadingstrategy.all为全量加载,要素会以流的方式渲染到地图。 ol.loadingstrategy.bbox为当前可见范围加载,当地图范围改变时会重新加载要素,此时可以通过idField 参数来标识已被加载过的要素,被标识的要素无需再次加载。idField 参数无效时会清空要素,重新加载。
  93326. * @param {Array} [opt_options.extent] - 加载范围, 参数规范为: [minX, minY, maxX, maxY], 传递此参数后, 图层将使用局部加载。
  93327. * @param {function} [opt_options.featureLoader] - 要素加载回调函数
  93328. * @param {boolean} [opt_options.overlaps] - 是否优化重叠要素的填充与描边操作
  93329. * @param {boolean} [opt_options.useSpatialIndex] - 是否启用要素空间索引
  93330. * @param {boolean} [opt_options.wrapX] - 是否平铺地图
  93331. * @param {boolean} [opt_options.idField='SmID'] - 要素属性中表示唯一标识的字段,当 strategy 为 ol.loadingstrategy.bbox时生效。
  93332. * @extends {ol.source.Vector}
  93333. * @usage
  93334. */
  93335. var FGB = /*#__PURE__*/function (_VectorSource) {
  93336. _inherits(FGB, _VectorSource);
  93337. var _super = _createSuper(FGB);
  93338. function FGB(options) {
  93339. var _this;
  93340. FGB_classCallCheck(this, FGB);
  93341. var baseOptions = Object.assign({
  93342. strategy: external_ol_loadingstrategy_namespaceObject.bbox
  93343. }, options);
  93344. delete baseOptions.url;
  93345. delete baseOptions.extent;
  93346. delete baseOptions.idField;
  93347. _this = _super.call(this, baseOptions);
  93348. _this.options = options || {};
  93349. _this.strategy = baseOptions.strategy;
  93350. _this.url = _this.options.url;
  93351. _this.extent = _this.options.extent;
  93352. _this._idField = _this.options.idField || 'SmID';
  93353. _this._validatedId = false;
  93354. _this._checked = false;
  93355. _this.setLoader( /*#__PURE__*/function () {
  93356. var _ref = FGB_asyncToGenerator( /*#__PURE__*/FGB_regeneratorRuntime().mark(function _callee(extent) {
  93357. var intersectExtent, fgbStream;
  93358. return FGB_regeneratorRuntime().wrap(function _callee$(_context) {
  93359. while (1) switch (_context.prev = _context.next) {
  93360. case 0:
  93361. if (this.strategy === external_ol_loadingstrategy_namespaceObject.bbox) {
  93362. if (!this._validatedId) {
  93363. this.clear();
  93364. }
  93365. if (this.extent) {
  93366. intersectExtent = getIntersection(this.extent, extent);
  93367. extent = intersectExtent && intersectExtent.length ? intersectExtent : this.extent;
  93368. }
  93369. }
  93370. if (!this.extent && (this.strategy === external_ol_loadingstrategy_namespaceObject.all || !isFinite(extent[0]))) {
  93371. extent = [];
  93372. }
  93373. if (Object.keys(extent).length) {
  93374. _context.next = 6;
  93375. break;
  93376. }
  93377. _context.next = 5;
  93378. return this._getStream(this.url);
  93379. case 5:
  93380. fgbStream = _context.sent;
  93381. case 6:
  93382. this._handleFeatures(fgbStream && fgbStream.body || this.url, extent);
  93383. case 7:
  93384. case "end":
  93385. return _context.stop();
  93386. }
  93387. }, _callee, this);
  93388. }));
  93389. return function (_x) {
  93390. return _ref.apply(this, arguments);
  93391. };
  93392. }());
  93393. return _this;
  93394. }
  93395. FGB_createClass(FGB, [{
  93396. key: "_handleFeatures",
  93397. value: function () {
  93398. var _handleFeatures2 = FGB_asyncToGenerator( /*#__PURE__*/FGB_regeneratorRuntime().mark(function _callee2(url, extent) {
  93399. var rect, fgb, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, feature, id;
  93400. return FGB_regeneratorRuntime().wrap(function _callee2$(_context2) {
  93401. while (1) switch (_context2.prev = _context2.next) {
  93402. case 0:
  93403. rect = {};
  93404. if (extent && extent.length) {
  93405. rect = {
  93406. minX: extent[0],
  93407. minY: extent[1],
  93408. maxX: extent[2],
  93409. maxY: extent[3]
  93410. };
  93411. }
  93412. fgb = geojson_deserialize(url, rect);
  93413. _iteratorAbruptCompletion = false;
  93414. _didIteratorError = false;
  93415. _context2.prev = 5;
  93416. _iterator = FGB_asyncIterator(fgb);
  93417. case 7:
  93418. _context2.next = 9;
  93419. return _iterator.next();
  93420. case 9:
  93421. if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
  93422. _context2.next = 20;
  93423. break;
  93424. }
  93425. feature = _step.value;
  93426. id = feature.properties[this._idField];
  93427. if (id && !this._validatedId) {
  93428. this._validatedId = true;
  93429. this._checked = true;
  93430. }
  93431. feature = new (external_ol_format_GeoJSON_default())().readFeature(feature);
  93432. if (id && this._checked) {
  93433. feature.setId(id);
  93434. }
  93435. if (this.options.featureLoader && typeof this.options.featureLoader === 'function') {
  93436. feature = this.options.featureLoader(feature);
  93437. }
  93438. this.addFeature(feature);
  93439. case 17:
  93440. _iteratorAbruptCompletion = false;
  93441. _context2.next = 7;
  93442. break;
  93443. case 20:
  93444. _context2.next = 26;
  93445. break;
  93446. case 22:
  93447. _context2.prev = 22;
  93448. _context2.t0 = _context2["catch"](5);
  93449. _didIteratorError = true;
  93450. _iteratorError = _context2.t0;
  93451. case 26:
  93452. _context2.prev = 26;
  93453. _context2.prev = 27;
  93454. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  93455. _context2.next = 31;
  93456. break;
  93457. }
  93458. _context2.next = 31;
  93459. return _iterator["return"]();
  93460. case 31:
  93461. _context2.prev = 31;
  93462. if (!_didIteratorError) {
  93463. _context2.next = 34;
  93464. break;
  93465. }
  93466. throw _iteratorError;
  93467. case 34:
  93468. return _context2.finish(31);
  93469. case 35:
  93470. return _context2.finish(26);
  93471. case 36:
  93472. case "end":
  93473. return _context2.stop();
  93474. }
  93475. }, _callee2, this, [[5, 22, 26, 36], [27,, 31, 35]]);
  93476. }));
  93477. function _handleFeatures(_x2, _x3) {
  93478. return _handleFeatures2.apply(this, arguments);
  93479. }
  93480. return _handleFeatures;
  93481. }()
  93482. }, {
  93483. key: "_getStream",
  93484. value: function () {
  93485. var _getStream2 = FGB_asyncToGenerator( /*#__PURE__*/FGB_regeneratorRuntime().mark(function _callee3(url) {
  93486. return FGB_regeneratorRuntime().wrap(function _callee3$(_context3) {
  93487. while (1) switch (_context3.prev = _context3.next) {
  93488. case 0:
  93489. _context3.next = 2;
  93490. return FetchRequest.get(url, {}, {
  93491. withoutFormatSuffix: true
  93492. }).then(function (response) {
  93493. return response;
  93494. });
  93495. case 2:
  93496. return _context3.abrupt("return", _context3.sent);
  93497. case 3:
  93498. case "end":
  93499. return _context3.stop();
  93500. }
  93501. }, _callee3);
  93502. }));
  93503. function _getStream(_x4) {
  93504. return _getStream2.apply(this, arguments);
  93505. }
  93506. return _getStream;
  93507. }()
  93508. }]);
  93509. return FGB;
  93510. }((external_ol_source_Vector_default()));
  93511. ;// CONCATENATED MODULE: ./src/openlayers/services/KnowledgeGraphService.js
  93512. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  93513. * This program are made available under the terms of the Apache License, Version 2.0
  93514. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  93515. /**
  93516. * @class KnowledgeGraphService
  93517. * @category iServer KnowledgeGraph
  93518. * @classdesc 知识图谱服务类。
  93519. * @version 11.1.0
  93520. * @example
  93521. * new KnowledgeGraphService(url)
  93522. * .query(param,function(result){
  93523. * //doSomething
  93524. * })
  93525. * @extends {ServiceBase}
  93526. * @param {string} url - 服务地址。
  93527. * @param {Object} options -参数。
  93528. * @param {string} [options.proxy] - 服务代理地址。
  93529. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  93530. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  93531. * @param {Object} [options.headers] - 请求头。
  93532. * @usage
  93533. */
  93534. class KnowledgeGraphService extends ServiceBase {
  93535. constructor(url, options) {
  93536. super(url, options);
  93537. this._knowledgeGraphService = new KnowledgeGraphService_KnowledgeGraphService(url, options);
  93538. }
  93539. /**
  93540. * @function KnowledgeGraphService.prototype.query
  93541. * @description 通过查询语句查询知识图谱数据。
  93542. * @param {string} cypherQuery - 查询条件。
  93543. * @param {RequestCallback} callback - 回调函数。
  93544. */
  93545. query(cypherQuery, callback) {
  93546. this._knowledgeGraphService.query(cypherQuery, callback);
  93547. }
  93548. // /**
  93549. // * @function KnowledgeGraphService.prototype.getMetaData
  93550. // * @description 获取元信息(展示所有实体类型和关系类型)。
  93551. // * @param {RequestCallback} callback 回调函数。
  93552. // */
  93553. // getMetaData(callback) {
  93554. // this._knowledgeGraphService.getMetaData(callback);
  93555. // }
  93556. /**
  93557. * @function KnowledgeGraphService.prototype.getGraphMaps
  93558. * @description 获取图谱列表。
  93559. * @param {RequestCallback} callback 回调函数。
  93560. */
  93561. getGraphMaps(callback) {
  93562. this._knowledgeGraphService.getGraphMaps(callback);
  93563. }
  93564. /**
  93565. * @function KnowledgeGraphService.prototype.getGraphMap
  93566. * @description 获取图谱图序列化数据。
  93567. * @param {string} params 图谱名称。
  93568. * @param {RequestCallback} callback 回调函数。
  93569. */
  93570. getGraphMap(params, callback) {
  93571. this._knowledgeGraphService.getGraphMap(params, callback);
  93572. }
  93573. /**
  93574. * @function KnowledgeGraphService.prototype.getGraphMapData
  93575. * @description 将iServer GraphMap服务的数据格式转换为KnowledgeGraph的数据格式。
  93576. * @param {string} graphMapName - 图谱名称。
  93577. * @returns {Promise} Promise 对象。
  93578. */
  93579. async getGraphMapData(graphMapName) {
  93580. const res = await this._knowledgeGraphService.getGraphMapData(graphMapName);
  93581. return res;
  93582. }
  93583. }
  93584. ;// CONCATENATED MODULE: ./src/openlayers/overlay/GraphMap.js
  93585. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  93586. * This program are made available under the terms of the Apache License, Version 2.0
  93587. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  93588. /**
  93589. * @class GraphMap
  93590. * @classdesc 对接 iServer GraphMap。
  93591. * @category iServer KnowledgeGraph
  93592. * @version 11.1.0
  93593. * @param {string} serviceUrl - GraphMap服务地址, 例如:http://{iserver}/services/{knowledgeGraph-provider}/restjsr/graph/graphmaps/{graphmap}。
  93594. * @param {Object} [options] - 参数。
  93595. * @param {KnowledgeGraph.Config} [options.config] - KnowledgeGraph的配置项。
  93596. * @param {string} [options.proxy] - 服务代理地址。
  93597. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  93598. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  93599. * @param {Object} [options.headers] - 请求头。
  93600. * @fires GraphMap#loaded
  93601. * @extends {ol.Observable}
  93602. * @usage
  93603. */
  93604. class GraphMap extends (external_ol_Observable_default()) {
  93605. constructor(serviceUrl, options) {
  93606. super();
  93607. /**
  93608. * @member GraphMap.prototype.graph
  93609. * @description KnowledgeGraph的实例.
  93610. *
  93611. */
  93612. this.graph = null;
  93613. /**
  93614. * @member GraphMap.prototype.EVENT_TYPES
  93615. * @description 监听一个自定义事件可用如下方式:
  93616. *
  93617. * 支持的事件如下:
  93618. * loaded - 渲染完成时触发。
  93619. */
  93620. this.EVENT_TYPES = ['loaded'];
  93621. this.url = serviceUrl;
  93622. this.options = options;
  93623. const graphMapName = serviceUrl.split('/').pop();
  93624. this.url = serviceUrl.replace(`/graphmaps/${graphMapName}`, '');
  93625. this.createGraphMap(graphMapName, options);
  93626. }
  93627. /**
  93628. * @private
  93629. * @function GraphMap.prototype.createGraphMap
  93630. * @description 创建图谱。
  93631. * @param {string} graphMapName - 图谱名称。
  93632. * @param {Object} options - 参数。
  93633. * @param {string} [options.proxy] - 服务代理地址。
  93634. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  93635. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  93636. * @param {Object} [options.headers] - 请求头。
  93637. * @param {KnowledgeGraph.Config} [options.config] - knowledgegrah配置项。
  93638. */
  93639. async createGraphMap(graphMapName, options) {
  93640. this.knowledgeGraphService = this.createKnowledgeGraphService(this.url, options);
  93641. const res = await this.knowledgeGraphService.getGraphMapData(graphMapName);
  93642. const result = KnowledgeGraph.dataFromGraphMap(res.data, res.graphMap);
  93643. this.graph = new KnowledgeGraph(options && options.config);
  93644. this.graph.on('beforelayout', () => {
  93645. /**
  93646. * @event GraphMap#loaded
  93647. * @description 渲染完成时触发。
  93648. */
  93649. this.dispatchEvent(this.EVENT_TYPES[0]);
  93650. });
  93651. this.graph.setData(result);
  93652. this.graph.handleNodeStatus(transformExpandCollapseHiddenData(res.graphMap));
  93653. }
  93654. /**
  93655. * @private
  93656. * @function GraphMap.prototype.createKnowledgeGraphService
  93657. * @description 创建KnowledgeGraphService实例。
  93658. * @param {string} serviceUrl - GraphMap服务地址, 例如:http://{iserver}/services/knowledgeGraph-test/restjsr/graph
  93659. * @param {Object} options - 参数。
  93660. * @param {string} [options.proxy] - 服务代理地址。
  93661. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  93662. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  93663. * @param {Object} [options.headers] - 请求头。
  93664. */
  93665. createKnowledgeGraphService(serviceUrl, options) {
  93666. return new KnowledgeGraphService(serviceUrl, options);
  93667. }
  93668. }
  93669. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/index.js
  93670. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  93671. * This program are made available under the terms of the Apache License, Version 2.0
  93672. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  93673. ;// CONCATENATED MODULE: ./src/openlayers/overlay/mapv/index.js
  93674. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  93675. * This program are made available under the terms of the Apache License, Version 2.0
  93676. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  93677. ;// CONCATENATED MODULE: ./src/openlayers/overlay/theme/index.js
  93678. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  93679. * This program are made available under the terms of the Apache License, Version 2.0
  93680. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  93681. ;// CONCATENATED MODULE: external "ol.geom.LineString"
  93682. const external_ol_geom_LineString_namespaceObject = ol.geom.LineString;
  93683. var external_ol_geom_LineString_default = /*#__PURE__*/__webpack_require__.n(external_ol_geom_LineString_namespaceObject);
  93684. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/olExtends.js
  93685. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  93686. * This program are made available under the terms of the Apache License, Version 2.0
  93687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  93688. var olExtends = function(targetMap) {
  93689. //解决olms.js插件,在使用ol.js时沿线标注不显示的问题,因为ol.geom.LineString.getFlatMidpoint未非公开方法
  93690. if (!(external_ol_geom_LineString_default()).prototype.getFlatMidpoint) {
  93691. (external_ol_geom_LineString_default()).prototype.getFlatMidpoint = function() {
  93692. return this.getCoordinateAt(0.5);
  93693. };
  93694. }
  93695. if (core_Util_Util.getOlVersion() === '4' && window && window.ol && window.ol.geom.flat) {
  93696. // for ol4-debug
  93697. window.targetMapCache = targetMap;
  93698. let ol = window.ol;
  93699. //解决 new ol.format.MVT({featureClass: ol.Feature})时,非3857显示异常的问题。ol即将发布的5.0版本已解决。
  93700. // eslint-disable-next-line no-unused-vars
  93701. ol.format.MVT.prototype.readProjection = function(source) {
  93702. return new ol.proj.Projection({
  93703. code: '',
  93704. units: ol.proj.Units.TILE_PIXELS
  93705. });
  93706. };
  93707. //解决 new ol.format.MVT({featureClass: ol.Feature})时,非3857显示异常的问题。ol即将发布的5.0版本已解决。
  93708. // eslint-disable-next-line no-unused-vars
  93709. ol.format.MVT.prototype.readProjection = function(source) {
  93710. return new ol.proj.Projection({
  93711. code: '',
  93712. units: ol.proj.Units.TILE_PIXELS
  93713. });
  93714. };
  93715. //解决面填充时不能整版填充的问题。ol即将发布的5.0版本已解决。
  93716. // eslint-disable-next-line no-unused-vars
  93717. ol.render.canvas.Replay.prototype.applyFill = function(state, geometry) {
  93718. var fillStyle = state.fillStyle;
  93719. var fillInstruction = [ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle];
  93720. if (typeof fillStyle !== 'string') {
  93721. var viewExtent = window.targetMapCache
  93722. .getView()
  93723. .getProjection()
  93724. .getExtent();
  93725. fillInstruction.push([viewExtent[0], viewExtent[3]]);
  93726. }
  93727. this.instructions.push(fillInstruction);
  93728. };
  93729. //解决面填充时不能整版填充的问题。ol即将发布的5.0版本已解决。
  93730. // eslint-disable-next-line no-unused-vars
  93731. ol.render.canvas.Replay.prototype.applyFill = function(state, geometry) {
  93732. var fillStyle = state.fillStyle;
  93733. var fillInstruction = [ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle];
  93734. if (typeof fillStyle !== 'string') {
  93735. var viewExtent = window.targetMapCache
  93736. .getView()
  93737. .getProjection()
  93738. .getExtent();
  93739. fillInstruction.push([viewExtent[0], viewExtent[3]]);
  93740. }
  93741. this.instructions.push(fillInstruction);
  93742. };
  93743. //解决在多面时,第一个面是逆时针时无法显示的问题。该问题由组件修复。
  93744. ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
  93745. var type = rawFeature.type;
  93746. if (type === 0) {
  93747. return null;
  93748. }
  93749. var feature;
  93750. var id = rawFeature.id;
  93751. var values = rawFeature.properties;
  93752. values[this.layerName_] = rawFeature.layer.name;
  93753. var flatCoordinates = [];
  93754. var ends = [];
  93755. ol.format.MVT.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
  93756. var geometryType = ol.format.MVT.getGeometryType_(type, ends.length);
  93757. if (this.featureClass_ === ol.render.Feature) {
  93758. feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
  93759. } else {
  93760. var geom;
  93761. if (geometryType == ol.geom.GeometryType.POLYGON) {
  93762. var endss = [];
  93763. var offset = 0;
  93764. var prevEndIndex = 0;
  93765. for (var i = 0, ii = ends.length; i < ii; ++i) {
  93766. var end = ends[i];
  93767. if (!ol.geom.flat.orient.linearRingIsClockwise(flatCoordinates, offset, end, 2)) {
  93768. endss.push(ends.slice(prevEndIndex, i + 1));
  93769. prevEndIndex = i + 1;
  93770. }
  93771. offset = end;
  93772. }
  93773. if (endss.length > 1) {
  93774. ends = endss;
  93775. geom = new ol.geom.MultiPolygon(null);
  93776. } else {
  93777. geom = new ol.geom.Polygon(null);
  93778. }
  93779. } else {
  93780. geom =
  93781. geometryType === ol.geom.GeometryType.POINT
  93782. ? new ol.geom.Point(null)
  93783. : geometryType === ol.geom.GeometryType.LINE_STRING
  93784. ? new ol.geom.LineString(null)
  93785. : geometryType === ol.geom.GeometryType.POLYGON
  93786. ? new ol.geom.Polygon(null)
  93787. : geometryType === ol.geom.GeometryType.MULTI_POINT
  93788. ? new ol.geom.MultiPoint(null)
  93789. : geometryType === ol.geom.GeometryType.MULTI_LINE_STRING
  93790. ? new ol.geom.MultiLineString(null)
  93791. : null;
  93792. }
  93793. if (geom) {
  93794. geom.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates, ends);
  93795. feature = new this.featureClass_();
  93796. if (this.geometryName_) {
  93797. feature.setGeometryName(this.geometryName_);
  93798. }
  93799. var geometry = ol.format.Feature.transformWithOptions(geom, false, this.adaptOptions(opt_options));
  93800. feature.setGeometry(geometry);
  93801. feature.setId(id);
  93802. feature.setProperties(values);
  93803. }
  93804. }
  93805. return feature;
  93806. };
  93807. //解决中文沿线表述显示不符合中文阅读习惯的问题
  93808. ol.geom.flat.textpath.lineString = function(
  93809. flatCoordinates,
  93810. offset,
  93811. end,
  93812. stride,
  93813. text,
  93814. measure,
  93815. startM,
  93816. maxAngle
  93817. ) {
  93818. var result = [];
  93819. // Keep text upright
  93820. var anglereverse = Math.atan2(
  93821. flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1],
  93822. flatCoordinates[end - stride] - flatCoordinates[offset]
  93823. );
  93824. var reverse = anglereverse < -0.785 || anglereverse > 2.356; //0.785//2.356
  93825. var isRotateUp =
  93826. (anglereverse < -0.785 && anglereverse > -2.356) || (anglereverse > 0.785 && anglereverse < 2.356);
  93827. var numChars = text.length;
  93828. var x1 = flatCoordinates[offset];
  93829. var y1 = flatCoordinates[offset + 1];
  93830. offset += stride;
  93831. var x2 = flatCoordinates[offset];
  93832. var y2 = flatCoordinates[offset + 1];
  93833. var segmentM = 0;
  93834. var segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  93835. while (offset < end - stride && segmentM + segmentLength < startM) {
  93836. x1 = x2;
  93837. y1 = y2;
  93838. offset += stride;
  93839. x2 = flatCoordinates[offset];
  93840. y2 = flatCoordinates[offset + 1];
  93841. segmentM += segmentLength;
  93842. segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  93843. }
  93844. var interpolate = (startM - segmentM) / segmentLength;
  93845. var x0 = ol.math.lerp(x1, x2, interpolate); //起始点
  93846. var y0 = ol.math.lerp(y1, y2, interpolate); //起始点
  93847. var chunk = '';
  93848. var chunkLength = 0;
  93849. var data, index, previousAngle, previousLang;
  93850. for (var i = 0; i < numChars; ++i) {
  93851. index = reverse ? numChars - i - 1 : i;
  93852. var char = text.charAt(index);
  93853. var charcode = char.charCodeAt(0);
  93854. var ischinese = charcode >= 19968 && charcode <= 40907;
  93855. chunk = reverse ? char + chunk : chunk + char;
  93856. var charLength = measure(chunk) - chunkLength;
  93857. chunkLength += charLength;
  93858. //var charM = startM + charLength / 2;
  93859. while (
  93860. offset < end - stride &&
  93861. Math.sqrt(Math.pow(x2 - x0, 2) + Math.pow(y2 - y0, 2)) < charLength / 2
  93862. ) {
  93863. x1 = x2;
  93864. y1 = y2;
  93865. offset += stride;
  93866. x2 = flatCoordinates[offset];
  93867. y2 = flatCoordinates[offset + 1];
  93868. }
  93869. var a = Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2);
  93870. var b = 2 * (x2 - x1) * (x1 - x0) + 2 * (y2 - y1) * (y1 - y0);
  93871. var c = Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2) - Math.pow(charLength / 2, 2);
  93872. var scale1 = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);
  93873. var scale2 = (-b - Math.sqrt(b * b - 4 * a * c)) / (2 * a);
  93874. interpolate =
  93875. scale1 < 0 || scale1 > 1
  93876. ? scale2
  93877. : scale2 < 0 || scale2 > 1
  93878. ? scale1
  93879. : scale1 < scale2
  93880. ? scale2
  93881. : scale1;
  93882. var x = ol.math.lerp(x1, x2, interpolate);
  93883. var y = ol.math.lerp(y1, y2, interpolate);
  93884. while (offset < end - stride && Math.sqrt(Math.pow(x2 - x, 2) + Math.pow(y2 - y, 2)) < charLength / 2) {
  93885. x1 = x2;
  93886. y1 = y2;
  93887. offset += stride;
  93888. x2 = flatCoordinates[offset];
  93889. y2 = flatCoordinates[offset + 1];
  93890. }
  93891. a = Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2);
  93892. b = 2 * (x2 - x1) * (x1 - x) + 2 * (y2 - y1) * (y1 - y);
  93893. c = Math.pow(x1 - x, 2) + Math.pow(y1 - y, 2) - Math.pow(charLength / 2, 2);
  93894. scale1 = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);
  93895. scale2 = (-b - Math.sqrt(b * b - 4 * a * c)) / (2 * a);
  93896. interpolate =
  93897. scale1 < 0 || scale1 > 1
  93898. ? scale2
  93899. : scale2 < 0 || scale2 > 1
  93900. ? scale1
  93901. : scale1 < scale2
  93902. ? scale2
  93903. : scale1;
  93904. var x3 = ol.math.lerp(x1, x2, interpolate);
  93905. var y3 = ol.math.lerp(y1, y2, interpolate);
  93906. var angle = Math.atan2(y3 - y0, x3 - x0);
  93907. if (reverse) {
  93908. angle += angle > 0 ? -Math.PI : Math.PI;
  93909. }
  93910. if (ischinese && isRotateUp) {
  93911. angle += angle > 0 ? -Math.PI / 2 : Math.PI / 2;
  93912. }
  93913. if (previousAngle !== undefined) {
  93914. var delta = angle - previousAngle;
  93915. delta += delta > Math.PI ? -2 * Math.PI : delta < -Math.PI ? 2 * Math.PI : 0;
  93916. if (
  93917. ischinese === previousLang
  93918. ? Math.abs(delta) > maxAngle
  93919. : Math.abs(delta) > maxAngle + Math.PI / 2
  93920. ) {
  93921. return null;
  93922. }
  93923. }
  93924. if (previousAngle == angle && !isRotateUp) {
  93925. if (reverse) {
  93926. data[0] = x;
  93927. data[1] = y;
  93928. data[2] = charLength / 2;
  93929. }
  93930. data[4] = chunk;
  93931. } else {
  93932. chunk = char;
  93933. chunkLength = charLength;
  93934. data = [x, y, charLength / 2, angle, chunk];
  93935. if (reverse) {
  93936. result.unshift(data);
  93937. } else {
  93938. result.push(data);
  93939. }
  93940. previousAngle = angle;
  93941. previousLang = ischinese;
  93942. }
  93943. x0 = x3;
  93944. y0 = y3;
  93945. startM += charLength;
  93946. }
  93947. return result;
  93948. };
  93949. //以下两个方法解决在大数据量图斑时,内存疯长的问题。该改法引发新问题:无法点选要素
  93950. ol.layer.VectorTile.prototype.setFastRender = function(fastRender) {
  93951. return (this.fastRender = fastRender);
  93952. };
  93953. ol.renderer.canvas.VectorTileLayer.prototype.postCompose = function(context, frameState, layerState) {
  93954. var layer = this.getLayer();
  93955. var declutterReplays = layer.getDeclutter() ? {} : null;
  93956. var source = /** @type {ol.source.VectorTile} */ (layer.getSource());
  93957. var renderMode = layer.getRenderMode();
  93958. var replayTypes = ol.renderer.canvas.VectorTileLayer.VECTOR_REPLAYS[renderMode];
  93959. var pixelRatio = frameState.pixelRatio;
  93960. var rotation = frameState.viewState.rotation;
  93961. var size = frameState.size;
  93962. var offsetX, offsetY;
  93963. if (rotation) {
  93964. offsetX = Math.round((pixelRatio * size[0]) / 2);
  93965. offsetY = Math.round((pixelRatio * size[1]) / 2);
  93966. ol.render.canvas.rotateAtOffset(context, -rotation, offsetX, offsetY);
  93967. }
  93968. if (declutterReplays) {
  93969. this.declutterTree_.clear();
  93970. }
  93971. var tiles = this.renderedTiles;
  93972. var tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
  93973. var clips = [];
  93974. var zs = [];
  93975. for (var i = tiles.length - 1; i >= 0; --i) {
  93976. var tile = /** @type {ol.VectorImageTile} */ (tiles[i]);
  93977. if (tile.getState() == ol.TileState.ABORT) {
  93978. continue;
  93979. }
  93980. var tileCoord = tile.tileCoord;
  93981. var worldOffset =
  93982. tileGrid.getTileCoordExtent(tileCoord)[0] - tileGrid.getTileCoordExtent(tile.wrappedTileCoord)[0];
  93983. var transform = undefined;
  93984. for (var t = 0, tt = tile.tileKeys.length; t < tt; ++t) {
  93985. var sourceTile = tile.getTile(tile.tileKeys[t]);
  93986. if (sourceTile.getState() == ol.TileState.ERROR) {
  93987. continue;
  93988. }
  93989. var replayGroup = sourceTile.getReplayGroup(layer, tileCoord.toString());
  93990. if (
  93991. renderMode != ol.layer.VectorTileRenderType.VECTOR &&
  93992. (!replayGroup || !replayGroup.hasReplays(replayTypes))
  93993. ) {
  93994. if (layer.fastRender === true) {
  93995. sourceTile.replayGroups_ = {};
  93996. sourceTile.features_ = [];
  93997. }
  93998. continue;
  93999. }
  94000. if (!transform) {
  94001. transform = this.getTransform(frameState, worldOffset);
  94002. }
  94003. var currentZ = sourceTile.tileCoord[0];
  94004. var currentClip = replayGroup.getClipCoords(transform);
  94005. context.save();
  94006. context.globalAlpha = layerState.opacity;
  94007. // Create a clip mask for regions in this low resolution tile that are
  94008. // already filled by a higher resolution tile
  94009. for (var j = 0, jj = clips.length; j < jj; ++j) {
  94010. var clip = clips[j];
  94011. if (currentZ < zs[j]) {
  94012. context.beginPath();
  94013. // counter-clockwise (outer ring) for current tile
  94014. context.moveTo(currentClip[0], currentClip[1]);
  94015. context.lineTo(currentClip[2], currentClip[3]);
  94016. context.lineTo(currentClip[4], currentClip[5]);
  94017. context.lineTo(currentClip[6], currentClip[7]);
  94018. // clockwise (inner ring) for higher resolution tile
  94019. context.moveTo(clip[6], clip[7]);
  94020. context.lineTo(clip[4], clip[5]);
  94021. context.lineTo(clip[2], clip[3]);
  94022. context.lineTo(clip[0], clip[1]);
  94023. context.clip();
  94024. }
  94025. }
  94026. replayGroup.replay(context, transform, rotation, {}, replayTypes, declutterReplays);
  94027. context.restore();
  94028. clips.push(currentClip);
  94029. zs.push(currentZ);
  94030. }
  94031. }
  94032. if (declutterReplays) {
  94033. ol.render.canvas.ReplayGroup.replayDeclutter(declutterReplays, context, rotation);
  94034. }
  94035. if (rotation) {
  94036. ol.render.canvas.rotateAtOffset(
  94037. context,
  94038. rotation,
  94039. /** @type {number} */
  94040. (offsetX),
  94041. /** @type {number} */ (offsetY)
  94042. );
  94043. }
  94044. ol.renderer.canvas.TileLayer.prototype.postCompose.apply(this, arguments);
  94045. };
  94046. }
  94047. };
  94048. window.olExtends = olExtends;
  94049. // EXTERNAL MODULE: ./node_modules/lodash.remove/index.js
  94050. var lodash_remove = __webpack_require__(794);
  94051. var lodash_remove_default = /*#__PURE__*/__webpack_require__.n(lodash_remove);
  94052. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/MapboxStyles.js
  94053. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94054. * This program are made available under the terms of the Apache License, Version 2.0
  94055. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94056. /**
  94057. * @class MapboxStyles
  94058. * @classdesc Mapbox 矢量瓦片风格。
  94059. * <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
  94060. * <p style="color: #ce4844">Notice</p>
  94061. * <p style="font-size: 13px">该功能依赖 <a href='https://github.com/boundlessgeo/ol-mapbox-style'>ol-mapbox-style</a> 插件,请确认引入该插件。</p>
  94062. * `<script type="text/javascript" src="https://rawgit.com/boundlessgeo/ol-mapbox-style/v2.11.2-1/dist/olms.js"></script>`
  94063. * </div>
  94064. * @modulecategory Overlay
  94065. * @category Visualization VectorTile
  94066. * @param {Object} options - 参数。
  94067. * @param {(string|undefined)} [options.url] - SuperMap iServer 地图服务地址,例如'http://localhost:8090/iserver/services/map-mvt-test/rest/maps/test',与options.style互斥,优先级低于options.style。
  94068. * @param {(Object|string|undefined)} [options.style] - Mapbox Style JSON 对象或获取 Mapbox Style JSON 对象的 URL。与 options.url 互斥,优先级高于 options.url。
  94069. * @param {Array.<number>} [options.resolutions] - 地图分辨率数组,用于映射 zoom 值。通常情況与地图的 {@link ol.View} 的分辨率一致。</br>
  94070. * 默认值为:[78271.51696402048,39135.75848201024, 19567.87924100512,9783.93962050256,4891.96981025128,2445.98490512564, 1222.99245256282,611.49622628141,305.748113140705,152.8740565703525, 76.43702828517625,38.21851414258813,19.109257071294063,9.554628535647032, 4.777314267823516,2.388657133911758,1.194328566955879,0.5971642834779395, 0.29858214173896974,0.14929107086948487,0.07464553543474244]。
  94071. * @param {(string|Array.<string>|undefined)} [options.source] - Mapbox Style 'source'的 key 值或者 'layer' 的 ID 数组。
  94072. * 当配置 'source' 的 key 值时,source 为该值的 layer 会被加载;
  94073. * 当配置为 'layer' 的 ID 数组时,指定的 layer 会被加载,注意被指定的 layer 需要有相同的 source。
  94074. * 当不配置时,默认为 Mapbox Style JSON 的 `sources` 对象中的第一个。
  94075. * @param {ol.Map} [options.map] - Openlayers 地图对象,仅用于面填充样式,若没有面填充样式可不填。
  94076. * @param {ol.StyleFunction} [options.selectedStyle] -选中样式Function。
  94077. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  94078. * @example
  94079. * var mbStyle = new MapboxStyles({
  94080. url: url,
  94081. source: 'California',
  94082. resolutions: [78271.51696402048,39135.75848201024, 19567.87924100512,9783.93962050256,4891.96981025128,2445.98490512564]
  94083. })
  94084. mbStyle.on('styleLoaded', function () {
  94085. var vectorLayer = new ol.layer.VectorTile({
  94086. //设置避让参数
  94087. declutter: true,
  94088. source: new ol.source.VectorTileSuperMapRest({
  94089. url: url,
  94090. format: new ol.format.MVT({
  94091. featureClass: ol.Feature
  94092. }),
  94093. tileType: 'ScaleXY'
  94094. }),
  94095. style: mbStyle.featureStyleFuntion
  94096. });
  94097. map.addLayer(vectorLayer);
  94098. })
  94099. * @usage
  94100. */
  94101. class MapboxStyles extends (external_ol_Observable_default()) {
  94102. constructor(options) {
  94103. super();
  94104. options = options || {};
  94105. this.spriteRegEx = /^(.*)(\?.*)$/;
  94106. this.defaultFont = ['DIN Offc Pro Medium', 'Arial Unicode MS Regular'];
  94107. this.map = options.map;
  94108. this.source = options.source;
  94109. this.styleTarget =
  94110. options.style ||
  94111. Util_Util.urlAppend(
  94112. Util_Util.urlPathAppend(options.url, 'tileFeature/vectorstyles'),
  94113. 'type=MapBox_GL&styleonly=true'
  94114. );
  94115. this.resolutions = options.resolutions;
  94116. this.withCredentials = options.withCredentials;
  94117. this.selectedObjects = [];
  94118. this.selectedStyle =
  94119. options.selectedStyle ||
  94120. function() {
  94121. return new (external_ol_style_Style_default())({
  94122. fill: new (external_ol_style_Fill_default())({
  94123. color: 'rgba(255, 0, 0, 1)'
  94124. }),
  94125. stroke: new (external_ol_style_Stroke_default())({
  94126. color: 'rgba(255, 0, 0, 1)',
  94127. width: 10
  94128. }),
  94129. text: new (external_ol_style_Text_default())({
  94130. font: 'normal 400 11.19px "Microsoft YaHei"',
  94131. placement: 'point',
  94132. fill: new (external_ol_style_Fill_default())({
  94133. color: 'blue'
  94134. })
  94135. }),
  94136. image: new (external_ol_style_Circle_default())({
  94137. radius: 5,
  94138. fill: new (external_ol_style_Fill_default())({
  94139. color: 'blue'
  94140. })
  94141. })
  94142. });
  94143. };
  94144. this.layersBySourceLayer = {};
  94145. olExtends(this.map);
  94146. this._loadStyle(this.styleTarget);
  94147. }
  94148. /**
  94149. * @function MapboxStyles.prototype.getStyleFunction
  94150. * @description 获取 ol.StyleFunction。
  94151. * @returns {ol.StyleFunction} 返回 ol.StyleFunction
  94152. */
  94153. getStyleFunction() {
  94154. return this.featureStyleFuntion;
  94155. }
  94156. /**
  94157. * @function MapboxStyles.prototype.getStylesBySourceLayer
  94158. * @description 根据图层名称获取样式。
  94159. * @param {string} sourceLayer - 数据图层名称。
  94160. */
  94161. getStylesBySourceLayer(sourceLayer) {
  94162. if (this.layersBySourceLayer[sourceLayer]) {
  94163. return this.layersBySourceLayer[sourceLayer];
  94164. }
  94165. const layers = [];
  94166. for (let index = 0; index < this._mbStyle.layers.length; index++) {
  94167. const layer = this._mbStyle.layers[index];
  94168. if (layer['source-layer'] !== sourceLayer) {
  94169. continue;
  94170. }
  94171. layers.push(layer);
  94172. }
  94173. this.layersBySourceLayer[sourceLayer] = layers;
  94174. return layers;
  94175. }
  94176. /**
  94177. * @function MapboxStyles.prototype.setSelectedId
  94178. * @description 设置选中要素,该要素将会用 `selectedStyle` 样式绘制。调用该方法后需要调用 {@link ol.layer.VectorTile} 的 `changed`,才能生效。
  94179. * @param {number} selectedId - 要素ID。
  94180. * @param {string} sourceLayer - 要素所在图层名称。
  94181. */
  94182. setSelectedId(selectedId, sourceLayer) {
  94183. this.selectedObjects = [];
  94184. this.selectedObjects.push({
  94185. id: selectedId,
  94186. sourceLayer: sourceLayer
  94187. });
  94188. }
  94189. /**
  94190. * @typedef {Object} MapboxStyles.selectedObject
  94191. * @description 要选择的要素对象。
  94192. * @property {number} selectedId - 要素ID。
  94193. * @property {string} sourceLayer - 要素所在图层名称。
  94194. */
  94195. /**
  94196. * @function MapboxStyles.prototype.setSelectedObjects
  94197. * @version 10.0.0
  94198. * @description 设置选中要素或要素数组,该要素将会用 `selectedStyle` 样式绘制。调用该方法后需要调用 {@link ol.layer.VectorTile} 的 `changed`,才能生效。
  94199. * @param {MapboxStyles.selectedObject|Array.<MapboxStyles.selectedObject>} addSelectedObjects - 选择的要素或要素数组。
  94200. */
  94201. setSelectedObjects(selectedObjects) {
  94202. if (!Array.isArray(selectedObjects)) {
  94203. selectedObjects = [selectedObjects];
  94204. }
  94205. this.selectedObjects = [];
  94206. this.selectedObjects = selectedObjects;
  94207. }
  94208. /**
  94209. * @function MapboxStyles.prototype.addSelectedObjects
  94210. * @version 10.0.0
  94211. * @description 增加选中的要素或要素数组,该要素将会用 `selectedStyle` 样式绘制。调用该方法后需要调用 {@link ol.layer.VectorTile} 的 `changed` 才能生效。
  94212. * @param {MapboxStyles.selectedObject|Array.<MapboxStyles.selectedObject>} addSelectedObjects - 选择的要素或要素数组。
  94213. */
  94214. addSelectedObjects(selectedObjects) {
  94215. if (!Array.isArray(selectedObjects)) {
  94216. selectedObjects = [selectedObjects];
  94217. }
  94218. this.selectedObjects.push(...selectedObjects);
  94219. }
  94220. /**
  94221. * @function MapboxStyles.prototype.removeSelectedObjects
  94222. * @version 10.0.0
  94223. * @description 清空选中状态。调用该方法后需要调用 {@link ol.layer.VectorTile} 的 `changed` 才能生效。
  94224. */
  94225. removeSelectedObjects(selectedObjects) {
  94226. if (!Array.isArray(selectedObjects)) {
  94227. selectedObjects = [selectedObjects];
  94228. }
  94229. selectedObjects.forEach(element => {
  94230. lodash_remove_default()(this.selectedObjects, obj => {
  94231. return element.id === obj.id && element.sourceLayer === obj.sourceLayer;
  94232. });
  94233. });
  94234. }
  94235. /**
  94236. * @function MapboxStyles.prototype.clearSelectedObjects
  94237. * @version 10.0.0
  94238. * @description 清空选中状态。调用该方法后需要调用 {@link ol.layer.VectorTile} 的 `changed`,才能生效。
  94239. */
  94240. clearSelectedObjects() {
  94241. this.selectedObjects = [];
  94242. }
  94243. /**
  94244. * @function MapboxStyles.prototype.updateStyles
  94245. * @description 更新图层样式。
  94246. * @param {Object} layerStyles - 图层样式或图层样式数组。
  94247. */
  94248. updateStyles(layerStyles) {
  94249. if (Object.prototype.toString.call(layerStyles) !== '[object Array]') {
  94250. layerStyles = [layerStyles];
  94251. }
  94252. const layerObj = {};
  94253. layerStyles.forEach(layerStyle => {
  94254. layerObj[layerStyle.id] = layerStyle;
  94255. });
  94256. let count = 0;
  94257. for (const key in this._mbStyle.layers) {
  94258. const oldLayerStyle = this._mbStyle.layers[key];
  94259. if (count >= layerStyles.length) {
  94260. break;
  94261. }
  94262. if (!layerObj[oldLayerStyle.id]) {
  94263. continue;
  94264. }
  94265. const newLayerStyle = JSON.parse(JSON.stringify(layerObj[oldLayerStyle.id]));
  94266. if (newLayerStyle.paint) {
  94267. newLayerStyle.paint = Object.assign({}, oldLayerStyle.paint, newLayerStyle.paint);
  94268. }
  94269. if (newLayerStyle.layout) {
  94270. newLayerStyle.layout = Object.assign({}, oldLayerStyle.layout, newLayerStyle.layout);
  94271. }
  94272. Object.assign(oldLayerStyle, newLayerStyle);
  94273. count++;
  94274. }
  94275. this._createStyleFunction();
  94276. }
  94277. /**
  94278. * @function MapboxStyles.prototype.setStyle
  94279. * @version 9.1.1
  94280. * @description 设置 Mapbox style 对象。
  94281. * @param {Object} style - Mapbox style 对象。
  94282. */
  94283. setStyle(style) {
  94284. this.layersBySourceLayer = {};
  94285. this._loadStyle(style);
  94286. }
  94287. _loadStyle(style) {
  94288. if (Object.prototype.toString.call(style) == '[object Object]') {
  94289. this._mbStyle = style;
  94290. this._resolve();
  94291. } else {
  94292. var url = SecurityManager.appendCredential(style);
  94293. FetchRequest.get(url, null, { withCredentials: this.withCredentials })
  94294. .then(response => response.json())
  94295. .then(mbStyle => {
  94296. this._mbStyle = mbStyle;
  94297. this._resolve();
  94298. });
  94299. }
  94300. }
  94301. _resolve() {
  94302. if (!this.source) {
  94303. this.source = Object.keys(this._mbStyle.sources)[0];
  94304. }
  94305. if (this._mbStyle.sprite) {
  94306. const spriteScale = window.devicePixelRatio >= 1.5 ? 0.5 : 1;
  94307. const sizeFactor = spriteScale == 0.5 ? '@2x' : '';
  94308. //兼容一下iServer 等iServer修改
  94309. this._mbStyle.sprite = this._mbStyle.sprite.replace('@2x', '');
  94310. const spriteUrl = this._toSpriteUrl(this._mbStyle.sprite, this.path, sizeFactor + '.json');
  94311. FetchRequest.get(SecurityManager.appendCredential(spriteUrl), null, {
  94312. withCredentials: this.withCredentials
  94313. })
  94314. .then(response => response.json())
  94315. .then(spritesJson => {
  94316. this._spriteData = spritesJson;
  94317. this._spriteImageUrl = SecurityManager.appendCredential(
  94318. this._toSpriteUrl(this._mbStyle.sprite, this.path, sizeFactor + '.png')
  94319. );
  94320. this._spriteImage = null;
  94321. const img = new Image();
  94322. img.crossOrigin = this.withCredentials ? 'use-credentials' : 'anonymous';
  94323. img.onload = () => {
  94324. this._spriteImage = img;
  94325. this._initStyleFunction();
  94326. };
  94327. img.onerror = () => {
  94328. this._spriteImage = null;
  94329. this._initStyleFunction();
  94330. };
  94331. img.src = this._spriteImageUrl;
  94332. })
  94333. .catch( err => {
  94334. console.log(err);
  94335. this._spriteImage = null;
  94336. this._initStyleFunction();
  94337. });
  94338. } else {
  94339. this._initStyleFunction();
  94340. }
  94341. }
  94342. _initStyleFunction() {
  94343. if (!this.resolutions && this._mbStyle.metadata && this._mbStyle.metadata.indexbounds) {
  94344. const indexbounds = this._mbStyle.metadata.indexbounds;
  94345. var max = Math.max(indexbounds[2] - indexbounds[0], indexbounds[3] - indexbounds[1]);
  94346. const defaultResolutions = [];
  94347. for (let index = 0; index < 30; index++) {
  94348. defaultResolutions.push(max / 512 / Math.pow(2, index));
  94349. }
  94350. this.resolutions = defaultResolutions;
  94351. }
  94352. this._createStyleFunction();
  94353. /**
  94354. * @event MapboxStyles#styleloaded
  94355. * @description 样式加载成功后触发。
  94356. */
  94357. this.dispatchEvent('styleloaded');
  94358. }
  94359. _createStyleFunction() {
  94360. if (this.map) {
  94361. window.olms.applyBackground(this.map, this._mbStyle);
  94362. }
  94363. this.featureStyleFuntion = this._getStyleFunction();
  94364. }
  94365. _getStyleFunction() {
  94366. this.fun = window.olms.stylefunction(
  94367. { setStyle: function() {}, set: function() {}, changed: function() {} },
  94368. this._mbStyle,
  94369. this.source,
  94370. this.resolutions,
  94371. this._spriteData,
  94372. '',
  94373. this._spriteImage
  94374. );
  94375. return (feature, resolution) => {
  94376. const style = this.fun(feature, resolution);
  94377. if (
  94378. this.selectedObjects.length > 0 &&
  94379. this.selectedObjects.find(element => {
  94380. return element.id === feature.getId() && element.sourceLayer === feature.get('layer');
  94381. })
  94382. ) {
  94383. const styleIndex = style && style[0] ? style[0].getZIndex() : 99999;
  94384. let selectStyles = this.selectedStyle(feature, resolution);
  94385. if (!Array.isArray(selectStyles)) {
  94386. selectStyles = [selectStyles];
  94387. }
  94388. for (let index = 0; index < selectStyles.length; index++) {
  94389. const selectStyle = selectStyles[index];
  94390. if (feature.getGeometry().getType() === 'Point' && style[0].getText() && selectStyle.getText()) {
  94391. selectStyle.setFill(null);
  94392. selectStyle.setStroke(null);
  94393. selectStyle.setImage();
  94394. selectStyle.getText().setText(style[0].getText().getText());
  94395. }
  94396. selectStyle.setZIndex(styleIndex);
  94397. }
  94398. return selectStyles;
  94399. }
  94400. return style;
  94401. };
  94402. }
  94403. _withPath(url, path) {
  94404. if (path && url.indexOf('http') != 0) {
  94405. url = path + url;
  94406. }
  94407. return url;
  94408. }
  94409. _toSpriteUrl(url, path, extension) {
  94410. url = this._withPath(url, path);
  94411. const parts = url.match(this.spriteRegEx);
  94412. return parts ? parts[1] + extension + (parts.length > 2 ? parts[2] : '') : url + extension;
  94413. }
  94414. }
  94415. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/index.js
  94416. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94417. * This program are made available under the terms of the Apache License, Version 2.0
  94418. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94419. ;// CONCATENATED MODULE: ./src/openlayers/overlay/index.js
  94420. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94421. * This program are made available under the terms of the Apache License, Version 2.0
  94422. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94423. ;// CONCATENATED MODULE: ./src/openlayers/services/AddressMatchService.js
  94424. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94425. * This program are made available under the terms of the Apache License, Version 2.0
  94426. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94427. /**
  94428. * @class AddressMatchService
  94429. * @category iServer AddressMatch
  94430. * @classdesc 地址匹配服务。
  94431. * @modulecategory Services
  94432. * @example
  94433. * new AddressMatchService(url,options)
  94434. * .code(function(result){
  94435. * //doSomething
  94436. * })
  94437. * @param {string} url - 服务地址。
  94438. * @param {Object} options - 参数。
  94439. * @param {string} [options.proxy] - 服务代理地址。
  94440. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94441. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94442. * @param {Object} [options.headers] - 请求头。
  94443. * @extends {ServiceBase}
  94444. * @usage
  94445. */
  94446. class AddressMatchService extends ServiceBase {
  94447. constructor(url, options) {
  94448. super(url, options);
  94449. this._addressMatchService = new AddressMatchService_AddressMatchService(this.url, {
  94450. proxy: this.options.proxy,
  94451. withCredentials: this.options.withCredentials,
  94452. crossOrigin: this.options.crossOrigin,
  94453. headers: this.options.headers
  94454. });
  94455. }
  94456. /**
  94457. * @function AddressMatchService.prototype.code
  94458. * @description 获取正向地址匹配结果。
  94459. * @param {GeoCodingParameter} params - 正向匹配参数。
  94460. * @param {RequestCallback} callback 回调函数。
  94461. */
  94462. code(params, callback) {
  94463. this._addressMatchService.code(Util_Util.urlPathAppend(this.url, 'geocoding'), params, callback);
  94464. }
  94465. /**
  94466. * @function AddressMatchService.prototype.decode
  94467. * @description 获取反向地址匹配结果。
  94468. * @param {GeoDecodingParameter} params - 反向匹配参数。
  94469. * @param {RequestCallback} callback 回调函数。
  94470. */
  94471. decode(params, callback) {
  94472. this._addressMatchService.decode(Util_Util.urlPathAppend(this.url, 'geodecoding'), params, callback);
  94473. }
  94474. }
  94475. ;// CONCATENATED MODULE: ./src/common/iServer/ChartService.js
  94476. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94477. * This program are made available under the terms of the Apache License, Version 2.0
  94478. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94479. /**
  94480. * @class ChartService
  94481. * @category iServer Map Chart
  94482. * @classdesc 海图服务。
  94483. * @extends {ServiceBase}
  94484. * @example
  94485. * new ChartService(url).queryChart(param,function(result){
  94486. * //doSomething
  94487. * })
  94488. * @param {string} url - 服务地址。
  94489. * @param {Object} options - 参数。
  94490. * @param {string} [options.proxy] - 服务代理地址。
  94491. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94492. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94493. * @param {Object} [options.headers] - 请求头。
  94494. * @usage
  94495. */
  94496. class ChartService_ChartService {
  94497. constructor(url, options) {
  94498. this.url = url;
  94499. this.options = options || {};
  94500. }
  94501. /**
  94502. * @function ChartService.prototype.queryChart
  94503. * @description 查询海图服务。
  94504. * @param {ChartQueryParameters} params - 海图查询所需参数类。
  94505. * @param {RequestCallback} callback - 回调函数。
  94506. * @param {DataFormat} resultFormat - 返回结果类型。
  94507. */
  94508. queryChart(params, callback, resultFormat) {
  94509. var me = this,
  94510. param = params,
  94511. format = me._processFormat(resultFormat);
  94512. var chartQueryService = new ChartQueryService(me.url, {
  94513. proxy: me.options.proxy,
  94514. withCredentials: me.options.withCredentials,
  94515. crossOrigin: me.options.crossOrigin,
  94516. headers: me.options.headers,
  94517. eventListeners: {
  94518. scope: me,
  94519. processCompleted: callback,
  94520. processFailed: callback
  94521. },
  94522. format: format
  94523. });
  94524. chartQueryService.processAsync(param);
  94525. }
  94526. /**
  94527. * @function ChartService.prototype.getChartFeatureInfo
  94528. * @description 获取海图物标信息服务。
  94529. * @param {RequestCallback} callback 回调函数。
  94530. */
  94531. getChartFeatureInfo(callback) {
  94532. var me = this;
  94533. var url = Util_Util.urlPathAppend(me.url, 'chartFeatureInfoSpecs');
  94534. var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService(url, {
  94535. proxy: me.options.proxy,
  94536. withCredentials: me.options.withCredentials,
  94537. crossOrigin: me.options.crossOrigin,
  94538. headers: me.options.headers,
  94539. eventListeners: {
  94540. scope: me,
  94541. processCompleted: callback,
  94542. processFailed: callback
  94543. }
  94544. });
  94545. chartFeatureInfoSpecsService.processAsync();
  94546. }
  94547. _processFormat(resultFormat) {
  94548. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  94549. }
  94550. }
  94551. ;// CONCATENATED MODULE: ./src/openlayers/services/ChartService.js
  94552. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94553. * This program are made available under the terms of the Apache License, Version 2.0
  94554. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94555. /**
  94556. * @class ChartService
  94557. * @category iServer Map Chart
  94558. * @classdesc 海图服务。
  94559. * @modulecategory Services
  94560. * @extends {ServiceBase}
  94561. * @example
  94562. * new ChartService(url).queryChart(param,function(result){
  94563. * //doSomething
  94564. * })
  94565. * @param {string} url - 服务地址。
  94566. * @param {Object} options - 参数。
  94567. * @param {string} [options.proxy] - 服务代理地址。
  94568. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94569. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94570. * @param {Object} [options.headers] - 请求头。
  94571. * @usage
  94572. */
  94573. class ChartService extends ServiceBase {
  94574. constructor(url, options) {
  94575. super(url, options);
  94576. this._chartService = new ChartService_ChartService(url, options);
  94577. }
  94578. /**
  94579. * @function ChartService.prototype.queryChart
  94580. * @description 查询海图服务。
  94581. * @param {ChartQueryParameters} params - 海图查询所需参数类。
  94582. * @param {RequestCallback} callback - 回调函数。
  94583. * @param {DataFormat} resultFormat - 返回结果类型。
  94584. */
  94585. queryChart(params, callback, resultFormat) {
  94586. params = this._processParams(params);
  94587. this._chartService.queryChart(params, callback, resultFormat);
  94588. }
  94589. /**
  94590. * @function ChartService.prototype.getChartFeatureInfo
  94591. * @description 获取海图物标信息服务。
  94592. * @param {RequestCallback} callback 回调函数。
  94593. */
  94594. getChartFeatureInfo(callback) {
  94595. this._chartService.getChartFeatureInfo(callback);
  94596. }
  94597. _processParams(params) {
  94598. if (!params) {
  94599. return {};
  94600. }
  94601. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  94602. if (params.filter) {
  94603. params.chartQueryFilterParameters = core_Util_Util.isArray(params.filter) ? params.filter : [params.filter];
  94604. }
  94605. if (params.bounds) {
  94606. params.bounds = new Bounds(
  94607. params.bounds[0],
  94608. params.bounds[1],
  94609. params.bounds[2],
  94610. params.bounds[3]
  94611. );
  94612. }
  94613. }
  94614. }
  94615. ;// CONCATENATED MODULE: ./src/common/iServer/FieldService.js
  94616. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94617. * This program are made available under the terms of the Apache License, Version 2.0
  94618. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94619. /**
  94620. * @class FieldService
  94621. * @category iServer Data Field
  94622. * @classdesc 字段服务类。
  94623. * @example
  94624. * new FieldService(url).getFields(function(result){
  94625. * //doSomething
  94626. * });
  94627. * @param {string} url - 服务地址。
  94628. * @param {Object} options - 参数。
  94629. * @param {string} [options.proxy] - 服务代理地址。
  94630. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94631. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94632. * @param {Object} [options.headers] - 请求头。
  94633. * @extends {ServiceBase}
  94634. * @usage
  94635. */
  94636. class FieldService_FieldService {
  94637. constructor(url, options) {
  94638. this.url = url;
  94639. this.options = options || {};
  94640. }
  94641. /**
  94642. * @function FieldService.prototype.getFields
  94643. * @description 字段查询服务。
  94644. * @param {FieldParameters} params - 字段信息查询参数类。
  94645. * @param {RequestCallback} callback 回调函数。
  94646. */
  94647. getFields(params, callback) {
  94648. var me = this;
  94649. var getFieldsService = new GetFieldsService(me.url, {
  94650. proxy: me.options.proxy,
  94651. withCredentials: me.options.withCredentials,
  94652. crossOrigin: me.options.crossOrigin,
  94653. headers: me.options.headers,
  94654. eventListeners: {
  94655. scope: me,
  94656. processCompleted: callback,
  94657. processFailed: callback
  94658. },
  94659. datasource: params.datasource,
  94660. dataset: params.dataset
  94661. });
  94662. getFieldsService.processAsync();
  94663. }
  94664. /**
  94665. * @function FieldService.prototype.getFieldStatisticsInfo
  94666. * @description 字段统计服务。
  94667. * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
  94668. * @param {RequestCallback} callback 回调函数。
  94669. */
  94670. getFieldStatisticsInfo(params, callback) {
  94671. if (!(params instanceof FieldStatisticsParameters)) {
  94672. return;
  94673. }
  94674. var me = this,
  94675. fieldName = params.fieldName,
  94676. modes = params.statisticMode;
  94677. if (modes && !Array.isArray(modes)) {
  94678. modes = [modes];
  94679. }
  94680. me.currentStatisticResult = {fieldName: fieldName};
  94681. me._statisticsCallback = callback;
  94682. //针对每种统计方式分别进行请求
  94683. modes.forEach(mode => {
  94684. me.currentStatisticResult[mode] = null;
  94685. me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode);
  94686. })
  94687. }
  94688. _fieldStatisticRequest(datasource, dataset, fieldName, statisticMode) {
  94689. var me = this;
  94690. var statisticService = new FieldStatisticService(me.url, {
  94691. eventListeners: {
  94692. scope: me,
  94693. processCompleted: me._processCompleted.bind(me),
  94694. processFailed: me._statisticsCallback
  94695. },
  94696. datasource: datasource,
  94697. dataset: dataset,
  94698. field: fieldName,
  94699. statisticMode: statisticMode,
  94700. crossOrigin: me.options.crossOrigin,
  94701. headers: me.options.headers
  94702. });
  94703. statisticService.processAsync();
  94704. }
  94705. _processCompleted(fieldStatisticResult, options) {
  94706. var me = this;
  94707. var getAll = true,
  94708. result = fieldStatisticResult.result;
  94709. if (this.currentStatisticResult) {
  94710. if (null == me.currentStatisticResult[result.mode]) {
  94711. this.currentStatisticResult[result.mode] = result.result;
  94712. }
  94713. }
  94714. for (var mode in me.currentStatisticResult) {
  94715. if (null == me.currentStatisticResult[mode]) {
  94716. getAll = false;
  94717. break;
  94718. }
  94719. }
  94720. if (getAll) {
  94721. me._statisticsCallback({result: me.currentStatisticResult, options});
  94722. }
  94723. }
  94724. }
  94725. ;// CONCATENATED MODULE: ./src/openlayers/services/FieldService.js
  94726. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94727. * This program are made available under the terms of the Apache License, Version 2.0
  94728. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94729. /**
  94730. * @class FieldService
  94731. * @category iServer Data Field
  94732. * @classdesc 字段服务类。
  94733. * @example
  94734. * new FieldService(url).getFields(function(result){
  94735. * //doSomething
  94736. * });
  94737. * @modulecategory Services
  94738. * @param {string} url - 服务地址。
  94739. * @param {Object} options - 参数。
  94740. * @param {string} [options.proxy] - 服务代理地址。
  94741. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94742. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94743. * @param {Object} [options.headers] - 请求头。
  94744. * @extends {ServiceBase}
  94745. * @usage
  94746. */
  94747. class FieldService extends ServiceBase {
  94748. constructor(url, options) {
  94749. super(url, options);
  94750. this._fieldService = new FieldService_FieldService(url, options);
  94751. }
  94752. /**
  94753. * @function FieldService.prototype.getFields
  94754. * @description 字段查询服务。
  94755. * @param {FieldParameters} params - 字段信息查询参数类。
  94756. * @param {RequestCallback} callback - 回调函数。
  94757. */
  94758. getFields(params, callback) {
  94759. this._fieldService.getFields(params, callback);
  94760. }
  94761. /**
  94762. * @function FieldService.prototype.getFieldStatisticsInfo
  94763. * @description 字段统计服务。
  94764. * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
  94765. * @param {RequestCallback} callback - 回调函数。
  94766. */
  94767. getFieldStatisticsInfo(params, callback) {
  94768. this._fieldService.getFieldStatisticsInfo(params, callback);
  94769. }
  94770. }
  94771. ;// CONCATENATED MODULE: ./src/openlayers/services/DatasetService.js
  94772. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94773. * This program are made available under the terms of the Apache License, Version 2.0
  94774. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94775. /**
  94776. * @class DatasetService
  94777. * @category iServer Data Dataset
  94778. * @classdesc 数据集服务类。
  94779. * @modulecategory Services
  94780. * @param {string} url - 服务地址。
  94781. * @param {Object} options - 参数。
  94782. * @param {string} [options.proxy] - 服务代理地址。
  94783. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94784. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94785. * @param {Object} [options.headers] - 请求头。
  94786. * @extends {ServiceBase}
  94787. * @usage
  94788. */
  94789. class DatasetService extends ServiceBase {
  94790. constructor(url, options) {
  94791. super(url, options);
  94792. this._datasetService = new DatasetService_DatasetService(this.url, {
  94793. proxy: this.options.proxy,
  94794. withCredentials: this.options.withCredentials,
  94795. crossOrigin: this.options.crossOrigin,
  94796. headers: this.options.headers
  94797. });
  94798. }
  94799. /**
  94800. * @function DatasetService.prototype.getDatasets
  94801. * @description 数据集查询服务。
  94802. * @param {string} datasourceName - 数据源名称。
  94803. * @param {RequestCallback} callback - 回调函数。
  94804. */
  94805. getDatasets(datasourceName, callback) {
  94806. if (!datasourceName) {
  94807. return;
  94808. }
  94809. this._datasetService.getDatasetsService(datasourceName, callback);
  94810. }
  94811. /**
  94812. * @function DatasetService.prototype.getDataset
  94813. * @description 数据集查询服务。
  94814. * @param {string} datasourceName - 数据源名称。
  94815. * @param {string} datasetName - 数据集名称。
  94816. * @param {RequestCallback} callback - 回调函数。
  94817. */
  94818. getDataset(datasourceName, datasetName, callback) {
  94819. if (!datasourceName || !datasetName) {
  94820. return;
  94821. }
  94822. this._datasetService.getDatasetService(datasourceName, datasetName, callback);
  94823. }
  94824. /**
  94825. * @function DatasetService.prototype.setDataset
  94826. * @description 数据集信息设置服务。可实现修改已存在数据集,新增不存在数据集。
  94827. * @param {CreateDatasetParameters | UpdateDatasetParameters } params - 数据集创建参数类或数据集信息更改参数类。
  94828. * @param {RequestCallback} callback - 回调函数。
  94829. */
  94830. setDataset(params, callback) {
  94831. if(!(params instanceof CreateDatasetParameters) && !(params instanceof UpdateDatasetParameters)){
  94832. return;
  94833. }else if (params instanceof CreateDatasetParameters) {
  94834. var datasetParams = {
  94835. "datasetType": params.datasetType,
  94836. "datasetName": params.datasetName,
  94837. "datasourceName": params.datasourceName
  94838. }
  94839. }else if(params instanceof UpdateDatasetParameters){
  94840. datasetParams = {
  94841. "datasetName": params.datasetName,
  94842. "datasourceName": params.datasourceName,
  94843. "isFileCache": params.isFileCache,
  94844. "description": params.description,
  94845. "prjCoordSys": params.prjCoordSys,
  94846. "charset": params.charset
  94847. }
  94848. }
  94849. this._datasetService.setDatasetService(datasetParams, callback);
  94850. }
  94851. /**
  94852. * @function DatasetService.prototype.deleteDataset
  94853. * @description 指定数据源下的数据集删除服务。
  94854. * @param {string} datasourceName - 数据源名称。
  94855. * @param {string} datasetName - 数据集名称。
  94856. * @param {RequestCallback} callback - 回调函数。
  94857. */
  94858. deleteDataset(datasourceName, datasetName, callback) {
  94859. this._datasetService.deleteDatasetService(datasourceName, datasetName, callback);
  94860. }
  94861. }
  94862. ;// CONCATENATED MODULE: ./src/openlayers/services/DatasourceService.js
  94863. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94864. * This program are made available under the terms of the Apache License, Version 2.0
  94865. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94866. /**
  94867. * @class DatasourceService
  94868. * @category iServer Data Datasource
  94869. * @classdesc 数据源服务类。
  94870. * @modulecategory Services
  94871. * @param {string} url - 服务地址。
  94872. * @param {Object} options - 参数。
  94873. * @param {string} [options.proxy] - 服务代理地址。
  94874. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94875. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94876. * @param {Object} [options.headers] - 请求头。
  94877. * @extends {ServiceBase}
  94878. * @usage
  94879. */
  94880. class DatasourceService extends ServiceBase {
  94881. constructor(url, options) {
  94882. super(url, options);
  94883. this._datasourceService = new DatasourceService_DatasourceService(this.url, {
  94884. proxy: this.proxy,
  94885. withCredentials: this.withCredentials,
  94886. crossOrigin: this.crossOrigin,
  94887. headers: this.headers
  94888. });
  94889. }
  94890. /**
  94891. * @function DatasourceService.prototype.getDatasources
  94892. * @description 数据源集查询服务。
  94893. * @param {RequestCallback} callback - 回调函数。
  94894. */
  94895. getDatasources(callback) {
  94896. this._datasourceService.getDatasourcesService(callback);
  94897. }
  94898. /**
  94899. * @function DatasourceService.prototype.getDatasource
  94900. * @description 数据源信息查询服务。
  94901. * @param {string} datasourceName - 数据源名称。
  94902. * @param {RequestCallback} callback 回调函数。
  94903. */
  94904. getDatasource(datasourceName, callback) {
  94905. if (!datasourceName) {
  94906. return;
  94907. }
  94908. this._datasourceService.getDatasourceService(datasourceName, callback);
  94909. }
  94910. /**
  94911. * @function DatasourceService.prototype.setDatasource
  94912. * @description 数据源信息设置服务。可实现更改当前数据源信息。
  94913. * @param {SetDatasourceParameters} params - 数据源信息设置参数类。
  94914. * @param {RequestCallback} callback - 回调函数。
  94915. */
  94916. setDatasource(params, callback) {
  94917. if (!(params instanceof SetDatasourceParameters)) {
  94918. return;
  94919. }
  94920. const datasourceParams = {
  94921. description: params.description,
  94922. coordUnit: params.coordUnit,
  94923. distanceUnit: params.distanceUnit,
  94924. datasourceName: params.datasourceName
  94925. };
  94926. this._datasourceService.setDatasourceService(datasourceParams, callback);
  94927. }
  94928. }
  94929. ;// CONCATENATED MODULE: ./src/openlayers/services/GridCellInfosService.js
  94930. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  94931. * This program are made available under the terms of the Apache License, Version 2.0
  94932. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  94933. /**
  94934. /**
  94935. * @class GridCellInfosService
  94936. * @category iServer Data Grid
  94937. * @classdesc 数据栅格查询服务。
  94938. * @modulecategory Services
  94939. * @extends {ServiceBase}
  94940. * @example
  94941. * new GridCellInfosService(url)
  94942. * .getGridCellInfos(param,function(result){
  94943. * //doSomething
  94944. * })
  94945. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  94946. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World。
  94947. * @param {Object} options - 参数。
  94948. * @param {string} [options.proxy] - 服务代理地址。
  94949. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  94950. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  94951. * @param {Object} [options.headers] - 请求头。
  94952. * @usage
  94953. */
  94954. class GridCellInfosService extends ServiceBase {
  94955. constructor(url, options) {
  94956. super(url, options);
  94957. this._gridCellQueryService = new GetGridCellInfosService(this.url, {
  94958. proxy: this.options.proxy,
  94959. withCredentials: this.options.withCredentials,
  94960. crossOrigin: this.options.crossOrigin,
  94961. headers: this.options.headers
  94962. });
  94963. }
  94964. /**
  94965. * @function GridCellInfosService.prototype.getGridCellInfos
  94966. * @param {GetGridCellInfosParameters} params - 数据服务栅格查询参数类。
  94967. * @param {RequestCallback} callback - 回调函数。
  94968. */
  94969. getGridCellInfos(params, callback) {
  94970. if (!params) {
  94971. return null;
  94972. }
  94973. this._gridCellQueryService.processAsync(params, callback);
  94974. }
  94975. }
  94976. ;// CONCATENATED MODULE: ./src/openlayers/services/GeoprocessingService.js
  94977. /**
  94978. * @class GeoprocessingService
  94979. * @classdesc 处理自动化服务接口类。
  94980. * @modulecategory Services
  94981. * @version 10.1.0
  94982. * @category iServer ProcessingAutomationService
  94983. * @extends {ServiceBase}
  94984. * @example
  94985. * //为了安全访问受保护的处理自动化服务,必须通过传递iserver令牌(token),才能正确访问相关资源。
  94986. * SecurityManager.registerToken(serviceUrl, token);
  94987. * var geoprocessingService = new geoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
  94988. geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
  94989. console.log(serverResult.result);
  94990. var jobID = serverResult.result.jobID;
  94991. var options = {
  94992. interval: 5000,
  94993. statusCallback: function(state) {
  94994. console.log("Job Status: ", state);
  94995. }
  94996. };
  94997. geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
  94998. console.log(serverResult);
  94999. });
  95000. })
  95001. * @param {string} url - 服务地址。
  95002. * @param {Object} options - 参数。
  95003. * @usage
  95004. */
  95005. class GeoprocessingService extends ServiceBase {
  95006. constructor(url, options) {
  95007. super(url, options);
  95008. this.headers = true;
  95009. this.crossOrigin = true;
  95010. this.withCredentials = true;
  95011. this.proxy = true;
  95012. this._geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  95013. proxy: this.options.proxy,
  95014. withCredentials: this.options.withCredentials,
  95015. crossOrigin: this.options.crossOrigin,
  95016. headers: this.options.headers
  95017. });
  95018. }
  95019. /**
  95020. * @function GeoprocessingService.prototype.getTools
  95021. * @description 获取处理自动化工具列表。
  95022. * @param {RequestCallback} callback 回调函数。
  95023. */
  95024. getTools(callback) {
  95025. this._geoprocessingJobsService.getTools(callback);
  95026. }
  95027. /**
  95028. * @function GeoprocessingService.prototype.getTool
  95029. * @description 获取处理自动化工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  95030. * @param {string} identifier - 处理自动化工具ID。
  95031. * @param {RequestCallback} callback 回调函数。
  95032. */
  95033. getTool(identifier, callback) {
  95034. this._geoprocessingJobsService.getTool(identifier, callback);
  95035. }
  95036. /**
  95037. * @function GeoprocessingService.prototype.execute
  95038. * @description 同步执行处理自动化工具。
  95039. * @param {string} identifier - 处理自动化工具ID。
  95040. * @param {Object} parameter - 处理自动化工具的输入参数。
  95041. * @param {Object} environment - 处理自动化工具的环境参数。
  95042. * @param {RequestCallback} callback 回调函数。
  95043. */
  95044. execute(identifier, parameter, environment, callback) {
  95045. this._geoprocessingJobsService.execute(identifier, parameter, environment, callback);
  95046. }
  95047. /**
  95048. * @function GeoprocessingService.prototype.submitJob
  95049. * @description 异步执行处理自动化工具。
  95050. * @param {string} identifier - 处理自动化工具ID。
  95051. * @param {Object} parameter - 处理自动化工具的输入参数。
  95052. * @param {Object} environment - 处理自动化工具的环境参数。
  95053. * @param {RequestCallback} callback 回调函数。
  95054. */
  95055. submitJob(identifier, parameter, environment, callback) {
  95056. this._geoprocessingJobsService.submitJob(identifier, parameter, environment, callback);
  95057. }
  95058. /**
  95059. * @function GeoprocessingService.prototype.waitForJobCompletion
  95060. * @description 获取处理自动化异步执行状态信息。
  95061. * @param {string} jobId - 处理自动化任务ID。
  95062. * @param {string} identifier - 处理自动化工具ID。
  95063. * @param {Object} options - 状态信息参数。
  95064. * @param {number} options.interval - 定时器时间间隔。
  95065. * @param {function} options.statusCallback - 回调函数。
  95066. * @param {RequestCallback} callback 回调函数。
  95067. */
  95068. waitForJobCompletion(jobId, identifier, options, callback) {
  95069. this._geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options, callback);
  95070. }
  95071. /**
  95072. * @function GeoprocessingService.prototype.getJobInfo
  95073. * @description 获取处理自动化任务的执行信息。
  95074. * @param {string} identifier - 处理自动化工具ID。
  95075. * @param {string} jobId - 处理自动化任务ID。
  95076. * @param {RequestCallback} callback 回调函数。
  95077. */
  95078. getJobInfo(identifier, jobId, callback) {
  95079. this._geoprocessingJobsService.getJobInfo(identifier, jobId, callback);
  95080. }
  95081. /**
  95082. * @function GeoprocessingService.prototype.cancelJob
  95083. * @description 取消处理自动化任务的异步执行。
  95084. * @param {string} identifier - 处理自动化工具ID。
  95085. * @param {string} jobId - 处理自动化任务ID。
  95086. * @param {RequestCallback} callback 回调函数。
  95087. */
  95088. cancelJob(identifier, jobId, callback) {
  95089. this._geoprocessingJobsService.cancelJob(identifier, jobId, callback);
  95090. }
  95091. /**
  95092. * @function GeoprocessingService.prototype.getJobs
  95093. * @description 获取处理自动化服务任务列表。
  95094. * @param {string} identifier - 处理自动化工具ID。(可选,传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  95095. * @param {RequestCallback} callback 回调函数。
  95096. */
  95097. getJobs(identifier, callback) {
  95098. this._geoprocessingJobsService.getJobs(identifier, callback);
  95099. }
  95100. /**
  95101. * @function GeoprocessingService.prototype.getResults
  95102. * @description 处理自动化工具异步执行的结果,支持结果过滤。
  95103. * @param {string} identifier - 处理自动化工具ID。
  95104. * @param {string} jobId - 处理自动化任务ID。
  95105. * @param {string} filter - 输出异步结果的ID。(可选,传入filter参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  95106. * @param {RequestCallback} callback 回调函数。
  95107. */
  95108. getResults(identifier, jobId, filter, callback) {
  95109. this._geoprocessingJobsService.getResults(identifier, jobId, filter, callback);
  95110. }
  95111. }
  95112. ;// CONCATENATED MODULE: ./src/common/iServer/LayerInfoService.js
  95113. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95114. * This program are made available under the terms of the Apache License, Version 2.0
  95115. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95116. /**
  95117. * @class LayerInfoService
  95118. * @category iServer Map Layer
  95119. * @classdesc 图层信息服务类。
  95120. * @extends {ServiceBase}
  95121. * @example
  95122. * new LayerInfoService(url).getLayersInfo(function(result){
  95123. * //doSomething
  95124. * })
  95125. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  95126. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  95127. * @param {Object} options - 参数。
  95128. * @param {string} [options.proxy] - 服务代理地址。
  95129. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  95130. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95131. * @param {Object} [options.headers] - 请求头。
  95132. * @usage
  95133. */
  95134. class LayerInfoService_LayerInfoService {
  95135. constructor(url, options) {
  95136. this.url = url;
  95137. this.options = options || {};
  95138. }
  95139. /**
  95140. * @function LayerInfoService.prototype.getLayersInfo
  95141. * @description 获取图层信息服务。
  95142. * @param {RequestCallback} callback - 回调函数。
  95143. */
  95144. getLayersInfo(callback) {
  95145. var me = this;
  95146. var getLayersInfoService = new GetLayersInfoService(me.url, {
  95147. proxy: me.options.proxy,
  95148. withCredentials: me.options.withCredentials,
  95149. crossOrigin: me.options.crossOrigin,
  95150. headers: me.options.headers,
  95151. eventListeners: {
  95152. processCompleted: callback,
  95153. processFailed: callback
  95154. }
  95155. });
  95156. getLayersInfoService.processAsync();
  95157. }
  95158. /**
  95159. * @function LayerInfoService.prototype.setLayerInfo
  95160. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  95161. * @param {SetLayerInfoParameters} params - 设置图层信息参数类。
  95162. * @param {RequestCallback} callback - 回调函数。
  95163. */
  95164. setLayerInfo(params, callback) {
  95165. if (!params) {
  95166. return;
  95167. }
  95168. var me = this,
  95169. resourceID = params.resourceID,
  95170. tempLayerName = params.tempLayerName,
  95171. layerInfoParams = params.layerInfo;
  95172. if (!resourceID || !tempLayerName) {
  95173. return;
  95174. }
  95175. var url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + resourceID + "/" + tempLayerName);
  95176. var setLayerInfoService = new SetLayerInfoService(url, {
  95177. proxy: me.options.proxy,
  95178. withCredentials: me.options.withCredentials,
  95179. crossOrigin: me.options.crossOrigin,
  95180. headers: me.options.headers,
  95181. eventListeners: {
  95182. processCompleted: callback,
  95183. processFailed: callback
  95184. }
  95185. });
  95186. setLayerInfoService.processAsync(layerInfoParams);
  95187. }
  95188. /**
  95189. * @function LayerInfoService.prototype.setLayersInfo
  95190. * @description 设置图层信息服务。可以创建新的临时图层和修改现有的临时图层。
  95191. * @param {SetLayersInfoParameters} params - 设置图层信息参数类。
  95192. * @param {RequestCallback} callback - 回调函数。
  95193. */
  95194. setLayersInfo(params, callback) {
  95195. if (!params) {
  95196. return;
  95197. }
  95198. var me = this,
  95199. resourceID = params.resourceID,
  95200. isTempLayers = params.isTempLayers ? params.isTempLayers : false,
  95201. layersInfo = params.layersInfo;
  95202. if ((isTempLayers && !resourceID) || !layersInfo) {
  95203. return;
  95204. }
  95205. var setLayersInfoService = new SetLayersInfoService(me.url, {
  95206. proxy: me.options.proxy,
  95207. withCredentials: me.options.withCredentials,
  95208. crossOrigin: me.options.crossOrigin,
  95209. headers: me.options.headers,
  95210. eventListeners: {
  95211. processCompleted: callback,
  95212. processFailed: callback
  95213. },
  95214. resourceID: resourceID,
  95215. isTempLayers: isTempLayers
  95216. });
  95217. setLayersInfoService.processAsync(layersInfo);
  95218. }
  95219. /**
  95220. * @function LayerInfoService.prototype.setLayerStatus
  95221. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  95222. * @param {SetLayerStatusParameters} params - 子图层显示控制参数类。
  95223. * @param {RequestCallback} callback - 回调函数。
  95224. */
  95225. setLayerStatus(params, callback) {
  95226. if (!params) {
  95227. return;
  95228. }
  95229. var me = this;
  95230. var setLayerStatusService = new SetLayerStatusService(me.url, {
  95231. proxy: me.options.proxy,
  95232. withCredentials: me.options.withCredentials,
  95233. crossOrigin: me.options.crossOrigin,
  95234. headers: me.options.headers,
  95235. eventListeners: {
  95236. processCompleted: callback,
  95237. processFailed: callback
  95238. }
  95239. });
  95240. setLayerStatusService.processAsync(params);
  95241. }
  95242. }
  95243. ;// CONCATENATED MODULE: ./src/openlayers/services/LayerInfoService.js
  95244. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95245. * This program are made available under the terms of the Apache License, Version 2.0
  95246. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95247. /**
  95248. * @class LayerInfoService
  95249. * @category iServer Map Layer
  95250. * @classdesc 图层信息服务类。
  95251. * @modulecategory Services
  95252. * @extends {ServiceBase}
  95253. * @example
  95254. * new LayerInfoService(url).getLayersInfo(function(result){
  95255. * //doSomething
  95256. * })
  95257. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  95258. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  95259. * @param {Object} options - 参数。
  95260. * @param {string} [options.proxy] - 服务代理地址。
  95261. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  95262. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95263. * @param {Object} [options.headers] - 请求头。
  95264. * @usage
  95265. */
  95266. class LayerInfoService extends ServiceBase {
  95267. constructor(url, options) {
  95268. super(url, options);
  95269. this._layerInfoService = new LayerInfoService_LayerInfoService(url, options);
  95270. }
  95271. /**
  95272. * @function LayerInfoService.prototype.getLayersInfo
  95273. * @description 获取图层信息服务。
  95274. * @param {RequestCallback} callback - 回调函数。
  95275. */
  95276. getLayersInfo(callback) {
  95277. this._layerInfoService.getLayersInfo(callback);
  95278. }
  95279. /**
  95280. * @function LayerInfoService.prototype.setLayerInfo
  95281. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  95282. * @param {SetLayerInfoParameters} params - 设置图层信息参数类。
  95283. * @param {RequestCallback} callback - 回调函数。
  95284. */
  95285. setLayerInfo(params, callback) {
  95286. this._layerInfoService.setLayerInfo(params, callback);
  95287. }
  95288. /**
  95289. * @function LayerInfoService.prototype.setLayersInfo
  95290. * @description 设置图层信息服务。可以创建新的临时图层和修改现有的临时图层。
  95291. * @param {SetLayersInfoParameters} params - 设置图层信息参数类。
  95292. * @param {RequestCallback} callback - 回调函数。
  95293. */
  95294. setLayersInfo(params, callback) {
  95295. this._layerInfoService.setLayersInfo(params, callback);
  95296. }
  95297. /**
  95298. * @function LayerInfoService.prototype.setLayerStatus
  95299. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  95300. * @param {SetLayerStatusParameters} params - 子图层显示控制参数类。
  95301. * @param {RequestCallback} callback - 回调函数。
  95302. */
  95303. setLayerStatus(params, callback) {
  95304. this._layerInfoService.setLayerStatus(params, callback);
  95305. }
  95306. }
  95307. ;// CONCATENATED MODULE: ./src/openlayers/services/MeasureService.js
  95308. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95309. * This program are made available under the terms of the Apache License, Version 2.0
  95310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95311. /**
  95312. * @class MeasureService
  95313. * @category iServer Map Measure
  95314. * @classdesc 量算服务。
  95315. * @modulecategory Services
  95316. * @extends {ServiceBase}
  95317. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  95318. * @param {Object} options - 参数。
  95319. * @param {string} [options.proxy] - 服务代理地址。
  95320. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95321. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95322. * @param {Object} [options.headers] - 请求头。
  95323. * @usage
  95324. */
  95325. class MeasureService extends ServiceBase {
  95326. constructor(url, options) {
  95327. super(url, options);
  95328. }
  95329. /**
  95330. * @function MeasureService.prototype.measureDistance
  95331. * @description 测距。
  95332. * @param {MeasureParameters} params - 量算参数类。
  95333. * @param {RequestCallback} callback - 回调函数。
  95334. */
  95335. measureDistance(params, callback) {
  95336. this.measure(params, 'DISTANCE', callback);
  95337. }
  95338. /**
  95339. * @function MeasureService.prototype.measureArea
  95340. * @description 测面积。
  95341. * @param {MeasureParameters} params - 量算参数类。
  95342. * @param {RequestCallback} callback - 回调函数。
  95343. */
  95344. measureArea(params, callback) {
  95345. this.measure(params, 'AREA', callback);
  95346. }
  95347. /**
  95348. * @function MeasureService.prototype.measure
  95349. * @description 测量。
  95350. * @param {MeasureParameters} params - 量算参数类。
  95351. * @param {string} type - 类型。
  95352. * @param {RequestCallback} callback - 回调函数。
  95353. * @returns {MeasureService} 量算服务。
  95354. */
  95355. measure(params, type, callback) {
  95356. var me = this;
  95357. var measureService = new MeasureService_MeasureService(me.url, {
  95358. proxy: me.options.proxy,
  95359. withCredentials: me.options.withCredentials,
  95360. crossOrigin: me.options.crossOrigin,
  95361. headers: me.options.headers,
  95362. measureMode: type
  95363. });
  95364. measureService.processAsync(me._processParam(params), callback);
  95365. }
  95366. _processParam(params) {
  95367. if (params && params.geometry) {
  95368. params.geometry = core_Util_Util.toSuperMapGeometry(JSON.parse((new (external_ol_format_GeoJSON_default())()).writeGeometry(params.geometry)));
  95369. }
  95370. return params;
  95371. }
  95372. }
  95373. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalyst3DService.js
  95374. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95375. * This program are made available under the terms of the Apache License, Version 2.0
  95376. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95377. /**
  95378. * @class NetworkAnalyst3DService
  95379. * @category iServer FacilityAnalyst3D
  95380. * @classdesc 3D 网络分析服务类。
  95381. * @extends {ServiceBase}
  95382. * @example
  95383. * new NetworkAnalyst3DService(url).sinksFacilityAnalyst(params,function(result){
  95384. * //doSomething
  95385. * })
  95386. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为:
  95387. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  95388. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  95389. * @param {Object} options - 参数。
  95390. * @param {string} [options.proxy] - 服务代理地址。
  95391. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95392. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95393. * @param {Object} [options.headers] - 请求头。
  95394. * @usage
  95395. */
  95396. class NetworkAnalyst3DService_NetworkAnalyst3DService {
  95397. constructor(url, options) {
  95398. this.url = url;
  95399. this.options = options || {};
  95400. }
  95401. /**
  95402. * @function NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  95403. * @description 汇查找服务
  95404. * @param {FacilityAnalystSinks3DParameters} params- 最近设施分析参数类(汇查找资源)。
  95405. * @param {RequestCallback} callback - 回调函数。
  95406. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95407. */
  95408. sinksFacilityAnalyst(params, callback) {
  95409. var me = this;
  95410. var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService(me.url, {
  95411. proxy: me.options.proxy,
  95412. withCredentials: me.options.withCredentials,
  95413. crossOrigin: me.options.crossOrigin,
  95414. headers: me.options.headers,
  95415. eventListeners: {
  95416. scope: me,
  95417. processCompleted: callback,
  95418. processFailed: callback
  95419. }
  95420. });
  95421. facilityAnalystSinks3DService.processAsync(params);
  95422. }
  95423. /**
  95424. * @function NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  95425. * @description 源查找服务。
  95426. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  95427. * @param {RequestCallback} callback - 回调函数。
  95428. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95429. */
  95430. sourcesFacilityAnalyst(params, callback) {
  95431. var me = this;
  95432. var facilityAnalystSources3DService = new FacilityAnalystSources3DService(me.url, {
  95433. proxy: me.options.proxy,
  95434. withCredentials: me.options.withCredentials,
  95435. crossOrigin: me.options.crossOrigin,
  95436. headers: me.options.headers,
  95437. eventListeners: {
  95438. scope: me,
  95439. processCompleted: callback,
  95440. processFailed: callback
  95441. }
  95442. });
  95443. facilityAnalystSources3DService.processAsync(params);
  95444. }
  95445. /**
  95446. * @function NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  95447. * @description 上游追踪资源服务。
  95448. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  95449. * @param {RequestCallback} callback - 回调函数。
  95450. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95451. */
  95452. traceUpFacilityAnalyst(params, callback) {
  95453. var me = this;
  95454. var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService(me.url, {
  95455. proxy: me.options.proxy,
  95456. withCredentials: me.options.withCredentials,
  95457. crossOrigin: me.options.crossOrigin,
  95458. headers: me.options.headers,
  95459. eventListeners: {
  95460. scope: me,
  95461. processCompleted: callback,
  95462. processFailed: callback
  95463. }
  95464. });
  95465. facilityAnalystTraceup3DService.processAsync(params);
  95466. }
  95467. /**
  95468. * @function NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  95469. * @description 下游追踪资源服务。
  95470. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  95471. * @param {RequestCallback} callback - 回调函数。
  95472. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95473. */
  95474. traceDownFacilityAnalyst(params, callback) {
  95475. var me = this;
  95476. var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService(me.url, {
  95477. proxy: me.options.proxy,
  95478. withCredentials: me.options.withCredentials,
  95479. crossOrigin: me.options.crossOrigin,
  95480. headers: me.options.headers,
  95481. eventListeners: {
  95482. scope: me,
  95483. processCompleted: callback,
  95484. processFailed: callback
  95485. }
  95486. });
  95487. facilityAnalystTracedown3DService.processAsync(params);
  95488. }
  95489. /**
  95490. * @function NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  95491. * @description 上游关键设施查找服务。
  95492. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  95493. * @param {RequestCallback} callback - 回调函数。
  95494. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95495. */
  95496. upstreamFacilityAnalyst(params, callback) {
  95497. var me = this;
  95498. var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService(me.url, {
  95499. proxy: me.options.proxy,
  95500. withCredentials: me.options.withCredentials,
  95501. crossOrigin: me.options.crossOrigin,
  95502. headers: me.options.headers,
  95503. eventListeners: {
  95504. scope: me,
  95505. processCompleted: callback,
  95506. processFailed: callback
  95507. }
  95508. });
  95509. facilityAnalystUpstream3DService.processAsync(params);
  95510. }
  95511. }
  95512. ;// CONCATENATED MODULE: ./src/openlayers/services/NetworkAnalyst3DService.js
  95513. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95514. * This program are made available under the terms of the Apache License, Version 2.0
  95515. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95516. /**
  95517. * @class NetworkAnalyst3DService
  95518. * @category iServer FacilityAnalyst3D
  95519. * @classdesc 3D 网络分析服务类。
  95520. * @modulecategory Services
  95521. * @extends {ServiceBase}
  95522. * @example
  95523. * new NetworkAnalyst3DService(url).sinksFacilityAnalyst(params,function(result){
  95524. * //doSomething
  95525. * })
  95526. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为:
  95527. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  95528. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  95529. * @param {Object} options - 参数。
  95530. * @param {string} [options.proxy] - 服务代理地址。
  95531. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95532. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95533. * @param {Object} [options.headers] - 请求头。
  95534. * @usage
  95535. */
  95536. class NetworkAnalyst3DService extends ServiceBase {
  95537. constructor(url, options) {
  95538. super(url, options);
  95539. this._networkAnalyst3DService = new NetworkAnalyst3DService_NetworkAnalyst3DService(url, options);
  95540. }
  95541. /**
  95542. * @function NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  95543. * @description 汇查找服务
  95544. * @param {FacilityAnalystSinks3DParameters} params- 最近设施分析参数类(汇查找资源)。
  95545. * @param {RequestCallback} callback - 回调函数。
  95546. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95547. */
  95548. sinksFacilityAnalyst(params, callback) {
  95549. this._networkAnalyst3DService.sinksFacilityAnalyst(params, callback);
  95550. }
  95551. /**
  95552. * @function NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  95553. * @description 源查找服务。
  95554. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  95555. * @param {RequestCallback} callback - 回调函数。
  95556. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95557. */
  95558. sourcesFacilityAnalyst(params, callback) {
  95559. this._networkAnalyst3DService.sourcesFacilityAnalyst(params, callback);
  95560. }
  95561. /**
  95562. * @function NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  95563. * @description 上游追踪资源服务。
  95564. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  95565. * @param {RequestCallback} callback - 回调函数。
  95566. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95567. */
  95568. traceUpFacilityAnalyst(params, callback) {
  95569. this._networkAnalyst3DService.traceUpFacilityAnalyst(params, callback);
  95570. }
  95571. /**
  95572. * @function NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  95573. * @description 下游追踪资源服务。
  95574. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  95575. * @param {RequestCallback} callback - 回调函数。
  95576. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95577. */
  95578. traceDownFacilityAnalyst(params, callback) {
  95579. this._networkAnalyst3DService.traceDownFacilityAnalyst(params, callback);
  95580. }
  95581. /**
  95582. * @function NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  95583. * @description 上游关键设施查找服务。
  95584. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  95585. * @param {RequestCallback} callback - 回调函数。
  95586. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  95587. */
  95588. upstreamFacilityAnalyst(params, callback) {
  95589. this._networkAnalyst3DService.upstreamFacilityAnalyst(params, callback);
  95590. }
  95591. }
  95592. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystService.js
  95593. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95594. * This program are made available under the terms of the Apache License, Version 2.0
  95595. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95596. /**
  95597. * @class NetworkAnalystService
  95598. * @category iServer NetworkAnalyst
  95599. * @classdesc 网络分析服务类。
  95600. * @extends {ServiceBase}
  95601. * @example
  95602. * new NetworkAnalystService(url)
  95603. * .findPath(params,function(result){
  95604. * //doSomething
  95605. * })
  95606. * @param {string} url - 服务地址。请求网络分析服务,URL应为:</br>
  95607. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  95608. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  95609. * @param {Object} options - 参数。
  95610. * @param {string} [options.proxy] - 服务代理地址。
  95611. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95612. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95613. * @param {Object} [options.headers] - 请求头。
  95614. * @usage
  95615. */
  95616. class NetworkAnalystService_NetworkAnalystService {
  95617. constructor(url, options) {
  95618. this.url = url;
  95619. this.options = options || {};
  95620. }
  95621. /**
  95622. * @function NetworkAnalystService.prototype.burstPipelineAnalyst
  95623. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  95624. * @param {BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  95625. * @param {RequestCallback} callback 回调函数。
  95626. */
  95627. burstPipelineAnalyst(params, callback) {
  95628. var me = this;
  95629. var burstPipelineAnalystService = new BurstPipelineAnalystService(me.url, {
  95630. proxy: me.options.proxy,
  95631. withCredentials: me.options.withCredentials,
  95632. crossOrigin: me.options.crossOrigin,
  95633. headers: me.options.headers,
  95634. eventListeners: {
  95635. scope: me,
  95636. processCompleted: callback,
  95637. processFailed: callback
  95638. }
  95639. });
  95640. burstPipelineAnalystService.processAsync(params);
  95641. }
  95642. /**
  95643. * @function NetworkAnalystService.prototype.computeWeightMatrix
  95644. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  95645. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  95646. * @param {RequestCallback} callback - 回调函数。
  95647. */
  95648. computeWeightMatrix(params, callback) {
  95649. var me = this;
  95650. var computeWeightMatrixService = new ComputeWeightMatrixService(me.url, {
  95651. proxy: me.options.proxy,
  95652. withCredentials: me.options.withCredentials,
  95653. crossOrigin: me.options.crossOrigin,
  95654. headers: me.options.headers,
  95655. eventListeners: {
  95656. scope: me,
  95657. processCompleted: callback,
  95658. processFailed: callback
  95659. }
  95660. });
  95661. computeWeightMatrixService.processAsync(params);
  95662. }
  95663. /**
  95664. * @function NetworkAnalystService.prototype.findClosestFacilities
  95665. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  95666. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  95667. * @param {RequestCallback} callback 回调函数。
  95668. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  95669. */
  95670. findClosestFacilities(params, callback, resultFormat) {
  95671. var me = this;
  95672. var findClosestFacilitiesService = new FindClosestFacilitiesService(me.url, {
  95673. proxy: me.options.proxy,
  95674. withCredentials: me.options.withCredentials,
  95675. crossOrigin: me.options.crossOrigin,
  95676. headers: me.options.headers,
  95677. eventListeners: {
  95678. scope: me,
  95679. processCompleted: callback,
  95680. processFailed: callback
  95681. },
  95682. format: me._processFormat(resultFormat)
  95683. });
  95684. findClosestFacilitiesService.processAsync(params);
  95685. }
  95686. /**
  95687. * @function NetworkAnalystService.prototype.streamFacilityAnalyst
  95688. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  95689. * @param {FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  95690. * @param {RequestCallback} callback 回调函数。
  95691. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  95692. */
  95693. streamFacilityAnalyst(params, callback, resultFormat) {
  95694. var me = this;
  95695. var facilityAnalystStreamService = new FacilityAnalystStreamService(me.url, {
  95696. proxy: me.options.proxy,
  95697. withCredentials: me.options.withCredentials,
  95698. crossOrigin: me.options.crossOrigin,
  95699. headers: me.options.headers,
  95700. eventListeners: {
  95701. scope: me,
  95702. processCompleted: callback,
  95703. processFailed: callback
  95704. },
  95705. format: me._processFormat(resultFormat)
  95706. });
  95707. facilityAnalystStreamService.processAsync(params);
  95708. }
  95709. /**
  95710. * @function NetworkAnalystService.prototype.findLocation
  95711. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  95712. * @param {FindLocationParameters} params - 选址分区分析服务参数类。
  95713. * @param {RequestCallback} callback 回调函数。
  95714. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  95715. */
  95716. findLocation(params, callback, resultFormat) {
  95717. var me = this;
  95718. var findLocationService = new FindLocationService(me.url, {
  95719. proxy: me.options.proxy,
  95720. withCredentials: me.options.withCredentials,
  95721. crossOrigin: me.options.crossOrigin,
  95722. headers: me.options.headers,
  95723. eventListeners: {
  95724. scope: me,
  95725. processCompleted: callback,
  95726. processFailed: callback
  95727. },
  95728. format: me._processFormat(resultFormat)
  95729. });
  95730. findLocationService.processAsync(params);
  95731. }
  95732. /**
  95733. * @function NetworkAnalystService.prototype.findPath
  95734. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  95735. * @param {FindPathParameters} params - 最佳路径分析服务参数类。
  95736. * @param {RequestCallback} callback - 回调函数。
  95737. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  95738. */
  95739. findPath(params, callback, resultFormat) {
  95740. var me = this;
  95741. var findPathService = new FindPathService(me.url, {
  95742. proxy: me.options.proxy,
  95743. withCredentials: me.options.withCredentials,
  95744. crossOrigin: me.options.crossOrigin,
  95745. headers: me.options.headers,
  95746. eventListeners: {
  95747. scope: me,
  95748. processCompleted: callback,
  95749. processFailed: callback
  95750. },
  95751. format: me._processFormat(resultFormat)
  95752. });
  95753. findPathService.processAsync(params);
  95754. }
  95755. /**
  95756. * @function NetworkAnalystService.prototype.findTSPPaths
  95757. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  95758. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  95759. * @param {RequestCallback} callback - 回调函数。
  95760. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  95761. */
  95762. findTSPPaths(params, callback, resultFormat) {
  95763. var me = this;
  95764. var findTSPPathsService = new FindTSPPathsService(me.url, {
  95765. proxy: me.options.proxy,
  95766. withCredentials: me.options.withCredentials,
  95767. crossOrigin: me.options.crossOrigin,
  95768. headers: me.options.headers,
  95769. eventListeners: {
  95770. scope: me,
  95771. processCompleted: callback,
  95772. processFailed: callback
  95773. },
  95774. format: me._processFormat(resultFormat)
  95775. });
  95776. findTSPPathsService.processAsync(params);
  95777. }
  95778. /**
  95779. * @function NetworkAnalystService.prototype.findMTSPPaths
  95780. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  95781. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  95782. * @param {RequestCallback} callback - 回调函数。
  95783. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  95784. */
  95785. findMTSPPaths(params, callback, resultFormat) {
  95786. var me = this;
  95787. var findMTSPPathsService = new FindMTSPPathsService(me.url, {
  95788. proxy: me.options.proxy,
  95789. withCredentials: me.options.withCredentials,
  95790. crossOrigin: me.options.crossOrigin,
  95791. headers: me.options.headers,
  95792. eventListeners: {
  95793. scope: me,
  95794. processCompleted: callback,
  95795. processFailed: callback
  95796. },
  95797. format: me._processFormat(resultFormat)
  95798. });
  95799. findMTSPPathsService.processAsync(params);
  95800. }
  95801. /**
  95802. * @function NetworkAnalystService.prototype.findServiceAreas
  95803. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  95804. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类。
  95805. * @param {RequestCallback} callback 回调函数。
  95806. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  95807. */
  95808. findServiceAreas(params, callback, resultFormat) {
  95809. var me = this;
  95810. var findServiceAreasService = new FindServiceAreasService(me.url, {
  95811. proxy: me.options.proxy,
  95812. withCredentials: me.options.withCredentials,
  95813. crossOrigin: me.options.crossOrigin,
  95814. headers: me.options.headers,
  95815. eventListeners: {
  95816. scope: me,
  95817. processCompleted: callback,
  95818. processFailed: callback
  95819. },
  95820. format: me._processFormat(resultFormat)
  95821. });
  95822. findServiceAreasService.processAsync(params);
  95823. }
  95824. /**
  95825. * @function NetworkAnalystService.prototype.updateEdgeWeight
  95826. * @description 更新边的耗费权重服务。
  95827. * @param {UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  95828. * @param {RequestCallback} callback 回调函数。
  95829. */
  95830. updateEdgeWeight(params, callback) {
  95831. var me = this;
  95832. var updateEdgeWeightService = new UpdateEdgeWeightService(me.url, {
  95833. proxy: me.options.proxy,
  95834. withCredentials: me.options.withCredentials,
  95835. crossOrigin: me.options.crossOrigin,
  95836. headers: me.options.headers,
  95837. eventListeners: {
  95838. scope: me,
  95839. processCompleted: callback,
  95840. processFailed: callback
  95841. }
  95842. });
  95843. updateEdgeWeightService.processAsync(params);
  95844. }
  95845. /**
  95846. * @function NetworkAnalystService.prototype.updateTurnNodeWeight
  95847. * @description 转向耗费权重更新服务。
  95848. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  95849. * @param {RequestCallback} callback - 回调函数。
  95850. */
  95851. updateTurnNodeWeight(params, callback) {
  95852. var me = this;
  95853. var updateTurnNodeWeightService = new UpdateTurnNodeWeightService(me.url, {
  95854. proxy: me.options.proxy,
  95855. withCredentials: me.options.withCredentials,
  95856. crossOrigin: me.options.crossOrigin,
  95857. headers: me.options.headers,
  95858. eventListeners: {
  95859. scope: me,
  95860. processCompleted: callback,
  95861. processFailed: callback
  95862. }
  95863. });
  95864. updateTurnNodeWeightService.processAsync(params);
  95865. }
  95866. _processFormat(resultFormat) {
  95867. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  95868. }
  95869. }
  95870. ;// CONCATENATED MODULE: ./src/openlayers/services/NetworkAnalystService.js
  95871. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  95872. * This program are made available under the terms of the Apache License, Version 2.0
  95873. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  95874. /**
  95875. * @class NetworkAnalystService
  95876. * @category iServer NetworkAnalyst
  95877. * @classdesc 网络分析服务类。
  95878. * @modulecategory Services
  95879. * @extends {ServiceBase}
  95880. * @example
  95881. * new NetworkAnalystService(url).findPath(params,function(result){
  95882. * //doSomething
  95883. * })
  95884. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为:
  95885. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  95886. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  95887. * @param {Object} options - 参数。
  95888. * @param {string} [options.proxy] - 服务代理地址。
  95889. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  95890. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  95891. * @param {Object} [options.headers] - 请求头。
  95892. * @usage
  95893. */
  95894. class NetworkAnalystService extends ServiceBase {
  95895. constructor(url, options) {
  95896. super(url, options);
  95897. this._networkAnalystService = new NetworkAnalystService_NetworkAnalystService(url, options);
  95898. }
  95899. /**
  95900. * @function NetworkAnalystService.prototype.burstPipelineAnalyst
  95901. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  95902. * @param {BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  95903. * @param {RequestCallback} callback 回调函数。
  95904. */
  95905. burstPipelineAnalyst(params, callback) {
  95906. params = this._processParams(params);
  95907. this._networkAnalystService.burstPipelineAnalyst(params, callback);
  95908. }
  95909. /**
  95910. * @function NetworkAnalystService.prototype.computeWeightMatrix
  95911. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  95912. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  95913. * @param {RequestCallback} callback - 回调函数。
  95914. */
  95915. computeWeightMatrix(params, callback) {
  95916. params = this._processParams(params);
  95917. this._networkAnalystService.computeWeightMatrix(params, callback);
  95918. }
  95919. /**
  95920. * @function NetworkAnalystService.prototype.findClosestFacilities
  95921. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  95922. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  95923. * @param {RequestCallback} callback - 回调函数。
  95924. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  95925. */
  95926. findClosestFacilities(params, callback, resultFormat) {
  95927. params = this._processParams(params);
  95928. this._networkAnalystService.findClosestFacilities(params, callback, resultFormat);
  95929. }
  95930. /**
  95931. * @function NetworkAnalystService.prototype.streamFacilityAnalyst
  95932. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  95933. * @param {FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  95934. * @param {RequestCallback} callback - 回调函数。
  95935. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  95936. */
  95937. streamFacilityAnalyst(params, callback, resultFormat) {
  95938. params = this._processParams(params);
  95939. this._networkAnalystService.streamFacilityAnalyst(params, callback, resultFormat);
  95940. }
  95941. /**
  95942. * @function NetworkAnalystService.prototype.findLocation
  95943. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  95944. * @param {FindLocationParameters} params - 选址分区分析服务参数类。
  95945. * @param {RequestCallback} callback - 回调函数。
  95946. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  95947. */
  95948. findLocation(params, callback, resultFormat) {
  95949. params = this._processParams(params);
  95950. this._networkAnalystService.findLocation(params, callback, resultFormat);
  95951. }
  95952. /**
  95953. * @function NetworkAnalystService.prototype.findPath
  95954. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  95955. * @param {FindPathParameters} params - 最佳路径分析服务参数类。
  95956. * @param {RequestCallback} callback - 回调函数。
  95957. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  95958. */
  95959. findPath(params, callback, resultFormat) {
  95960. params = this._processParams(params);
  95961. this._networkAnalystService.findPath(params, callback, resultFormat);
  95962. }
  95963. /**
  95964. * @function NetworkAnalystService.prototype.findTSPPaths
  95965. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  95966. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  95967. * @param {RequestCallback} callback - 回调函数。
  95968. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  95969. */
  95970. findTSPPaths(params, callback, resultFormat) {
  95971. params = this._processParams(params);
  95972. this._networkAnalystService.findTSPPaths(params, callback, resultFormat);
  95973. }
  95974. /**
  95975. * @function NetworkAnalystService.prototype.findMTSPPaths
  95976. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  95977. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  95978. * @param {RequestCallback} callback - 回调函数。
  95979. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  95980. */
  95981. findMTSPPaths(params, callback, resultFormat) {
  95982. params = this._processParams(params);
  95983. this._networkAnalystService.findMTSPPaths(params, callback, resultFormat);
  95984. }
  95985. /**
  95986. * @function NetworkAnalystService.prototype.findServiceAreas
  95987. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  95988. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类。
  95989. * @param {RequestCallback} callback - 回调函数。
  95990. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  95991. */
  95992. findServiceAreas(params, callback, resultFormat) {
  95993. params = this._processParams(params);
  95994. this._networkAnalystService.findServiceAreas(params, callback, resultFormat);
  95995. }
  95996. /**
  95997. * @function NetworkAnalystService.prototype.updateEdgeWeight
  95998. * @description 更新边的耗费权重服务。
  95999. * @param {UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  96000. * @param {RequestCallback} callback 回调函数。
  96001. */
  96002. updateEdgeWeight(params, callback) {
  96003. this._networkAnalystService.updateEdgeWeight(params, callback);
  96004. }
  96005. /**
  96006. * @function NetworkAnalystService.prototype.updateTurnNodeWeight
  96007. * @description 转向耗费权重更新服务。
  96008. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  96009. * @param {RequestCallback} callback - 回调函数。
  96010. */
  96011. updateTurnNodeWeight(params, callback) {
  96012. this._networkAnalystService.updateTurnNodeWeight(params, callback);
  96013. }
  96014. _processParams(params) {
  96015. if (!params) {
  96016. return {};
  96017. }
  96018. if (params.centers && core_Util_Util.isArray(params.centers)) {
  96019. params.centers.map(function (point, key) {
  96020. params.centers[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  96021. x: point.getCoordinates()[0],
  96022. y: point.getCoordinates()[1]
  96023. } : point;
  96024. return params.centers[key];
  96025. });
  96026. }
  96027. if (params.nodes && core_Util_Util.isArray(params.nodes)) {
  96028. params.nodes.map(function (point, key) {
  96029. params.nodes[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  96030. x: point.getCoordinates()[0],
  96031. y: point.getCoordinates()[1]
  96032. } : point;
  96033. return params.nodes[key];
  96034. });
  96035. }
  96036. if (params.event && params.event instanceof (external_ol_geom_Point_default())) {
  96037. params.event = {x: params.event.getCoordinates()[0], y: params.event.getCoordinates()[1]};
  96038. }
  96039. if (params.facilities && core_Util_Util.isArray(params.facilities)) {
  96040. params.facilities.map(function (point, key) {
  96041. params.facilities[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  96042. x: point.getCoordinates()[0],
  96043. y: point.getCoordinates()[1]
  96044. } : point;
  96045. return params.facilities[key];
  96046. });
  96047. }
  96048. if (params.parameter && params.parameter.barrierPoints) {
  96049. var barrierPoints = params.parameter.barrierPoints;
  96050. if (core_Util_Util.isArray(barrierPoints)) {
  96051. barrierPoints.map(function (point, key) {
  96052. params.parameter.barrierPoints[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  96053. x: point.getCoordinates()[0],
  96054. y: point.getCoordinates()[1]
  96055. } : point;
  96056. return params.parameter.barrierPoints[key];
  96057. });
  96058. } else {
  96059. params.parameter.barrierPoints = [(barrierPoints instanceof (external_ol_geom_Point_default())) ? {
  96060. x: barrierPoints.getCoordinates()[0],
  96061. y: barrierPoints.getCoordinates()[1]
  96062. } : barrierPoints];
  96063. }
  96064. }
  96065. return params;
  96066. }
  96067. _processFormat(resultFormat) {
  96068. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  96069. }
  96070. }
  96071. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingService.js
  96072. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  96073. * This program are made available under the terms of the Apache License, Version 2.0
  96074. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  96075. /**
  96076. * @class ProcessingService
  96077. * @category iServer ProcessingService
  96078. * @classdesc 分布式分析相关服务类。
  96079. * @extends {ServiceBase}
  96080. * @example
  96081. * new ProcessingService(url,options)
  96082. * .getKernelDensityJobs(function(result){
  96083. * //doSomething
  96084. * })
  96085. * @param {string} url - 服务地址。
  96086. * @param {Object} options - 参数。
  96087. * @param {string} [options.proxy] - 服务代理地址。
  96088. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  96089. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  96090. * @param {Object} [options.headers] - 请求头。
  96091. * @usage
  96092. */
  96093. class ProcessingService_ProcessingService {
  96094. constructor(url, options) {
  96095. this.url = url;
  96096. this.options = options || {};
  96097. this.kernelDensityJobs = {};
  96098. this.summaryMeshJobs = {};
  96099. this.queryJobs = {};
  96100. this.summaryRegionJobs = {};
  96101. this.vectorClipJobs = {};
  96102. this.overlayGeoJobs = {};
  96103. this.buffersJobs = {};
  96104. this.topologyValidatorJobs = {};
  96105. this.summaryAttributesJobs = {};
  96106. }
  96107. /**
  96108. * @function ProcessingService.prototype.getKernelDensityJobs
  96109. * @description 获取密度分析的列表。
  96110. * @param {RequestCallback} callback - 回调函数。
  96111. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96112. */
  96113. getKernelDensityJobs(callback, resultFormat) {
  96114. var me = this,
  96115. format = me._processFormat(resultFormat);
  96116. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  96117. proxy: me.options.proxy,
  96118. withCredentials: me.options.withCredentials,
  96119. crossOrigin: me.options.crossOrigin,
  96120. headers: me.options.headers,
  96121. eventListeners: {
  96122. scope: me,
  96123. processCompleted: callback,
  96124. processFailed: callback
  96125. },
  96126. format: format
  96127. });
  96128. kernelDensityJobsService.getKernelDensityJobs();
  96129. }
  96130. /**
  96131. * @function ProcessingService.prototype.getKernelDensityJob
  96132. * @description 获取某个密度分析。
  96133. * @param {string} id - 空间分析的ID。
  96134. * @param {RequestCallback} callback - 回调函数。
  96135. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96136. */
  96137. getKernelDensityJob(id, callback, resultFormat) {
  96138. var me = this,
  96139. format = me._processFormat(resultFormat);
  96140. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  96141. proxy: me.options.proxy,
  96142. withCredentials: me.options.withCredentials,
  96143. crossOrigin: me.options.crossOrigin,
  96144. headers: me.options.headers,
  96145. eventListeners: {
  96146. scope: me,
  96147. processCompleted: callback,
  96148. processFailed: callback
  96149. },
  96150. format: format
  96151. });
  96152. kernelDensityJobsService.getKernelDensityJob(id);
  96153. }
  96154. /**
  96155. * @function ProcessingService.prototype.addKernelDensityJob
  96156. * @description 密度分析。
  96157. * @param {KernelDensityJobParameter} params -密度分析参数类。
  96158. * @param {RequestCallback} callback 回调函数。
  96159. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96160. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96161. */
  96162. addKernelDensityJob(params, callback, seconds, resultFormat) {
  96163. var me = this,
  96164. format = me._processFormat(resultFormat);
  96165. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  96166. proxy: me.options.proxy,
  96167. withCredentials: me.options.withCredentials,
  96168. crossOrigin: me.options.crossOrigin,
  96169. headers: me.options.headers,
  96170. eventListeners: {
  96171. scope: me,
  96172. processCompleted: callback,
  96173. processFailed: callback,
  96174. processRunning: function (job) {
  96175. me.kernelDensityJobs[job.id] = job.state;
  96176. }
  96177. },
  96178. format: format
  96179. });
  96180. kernelDensityJobsService.addKernelDensityJob(params, seconds);
  96181. }
  96182. /**
  96183. * @function ProcessingService.prototype.getKernelDensityJobState
  96184. * @description 获取密度分析的状态。
  96185. * @param {string} id - 密度分析的id。
  96186. * @returns {Object} 密度分析的状态。
  96187. */
  96188. getKernelDensityJobState(id) {
  96189. return this.kernelDensityJobs[id];
  96190. }
  96191. /**
  96192. * @function ProcessingService.prototype.getSummaryMeshJobs
  96193. * @description 获取点聚合分析的列表。
  96194. * @param {RequestCallback} callback - 回调函数。
  96195. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96196. */
  96197. getSummaryMeshJobs(callback, resultFormat) {
  96198. var me = this,
  96199. format = me._processFormat(resultFormat);
  96200. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  96201. proxy: me.options.proxy,
  96202. withCredentials: me.options.withCredentials,
  96203. crossOrigin: me.options.crossOrigin,
  96204. headers: me.options.headers,
  96205. eventListeners: {
  96206. scope: me,
  96207. processCompleted: callback,
  96208. processFailed: callback
  96209. },
  96210. format: format
  96211. });
  96212. summaryMeshJobsService.getSummaryMeshJobs();
  96213. }
  96214. /**
  96215. * @function ProcessingService.prototype.getSummaryMeshJob
  96216. * @description 获取某个点聚合分析。
  96217. * @param {string} id - 空间分析的 ID。
  96218. * @param {RequestCallback} callback - 回调函数。
  96219. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96220. */
  96221. getSummaryMeshJob(id, callback, resultFormat) {
  96222. var me = this,
  96223. format = me._processFormat(resultFormat);
  96224. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  96225. proxy: me.options.proxy,
  96226. withCredentials: me.options.withCredentials,
  96227. crossOrigin: me.options.crossOrigin,
  96228. headers: me.options.headers,
  96229. eventListeners: {
  96230. scope: me,
  96231. processCompleted: callback,
  96232. processFailed: callback
  96233. },
  96234. format: format
  96235. });
  96236. summaryMeshJobsService.getSummaryMeshJob(id);
  96237. }
  96238. /**
  96239. * @function ProcessingService.prototype.addSummaryMeshJob
  96240. * @description 点聚合分析。
  96241. * @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  96242. * @param {RequestCallback} callback 回调函数。
  96243. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96244. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96245. */
  96246. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  96247. var me = this,
  96248. format = me._processFormat(resultFormat);
  96249. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  96250. proxy: me.options.proxy,
  96251. withCredentials: me.options.withCredentials,
  96252. crossOrigin: me.options.crossOrigin,
  96253. headers: me.options.headers,
  96254. eventListeners: {
  96255. scope: me,
  96256. processCompleted: callback,
  96257. processFailed: callback,
  96258. processRunning: function (job) {
  96259. me.summaryMeshJobs[job.id] = job.state;
  96260. }
  96261. },
  96262. format: format
  96263. });
  96264. summaryMeshJobsService.addSummaryMeshJob(params, seconds);
  96265. }
  96266. /**
  96267. * @function ProcessingService.prototype.getSummaryMeshJobState
  96268. * @description 获取点聚合分析的状态。
  96269. * @param {string} id - 点聚合分析的 ID。
  96270. * @returns {Object} 点聚合分析的状态。
  96271. */
  96272. getSummaryMeshJobState(id) {
  96273. return this.summaryMeshJobs[id];
  96274. }
  96275. /**
  96276. * @function ProcessingService.prototype.getQueryJobs
  96277. * @description 获取单对象查询分析的列表。
  96278. * @param {RequestCallback} callback - 回调函数。
  96279. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96280. */
  96281. getQueryJobs(callback, resultFormat) {
  96282. var me = this,
  96283. format = me._processFormat(resultFormat);
  96284. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  96285. proxy: me.options.proxy,
  96286. withCredentials: me.options.withCredentials,
  96287. crossOrigin: me.options.crossOrigin,
  96288. headers: me.options.headers,
  96289. eventListeners: {
  96290. scope: me,
  96291. processCompleted: callback,
  96292. processFailed: callback
  96293. },
  96294. format: format
  96295. });
  96296. singleObjectQueryJobsService.getQueryJobs();
  96297. }
  96298. /**
  96299. * @function ProcessingService.prototype.getQueryJob
  96300. * @description 获取某个单对象查询分析。
  96301. * @param {string} id - 空间分析的 ID。
  96302. * @param {RequestCallback} callback - 回调函数。
  96303. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96304. */
  96305. getQueryJob(id, callback, resultFormat) {
  96306. var me = this,
  96307. format = me._processFormat(resultFormat);
  96308. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  96309. proxy: me.options.proxy,
  96310. withCredentials: me.options.withCredentials,
  96311. crossOrigin: me.options.crossOrigin,
  96312. headers: me.options.headers,
  96313. eventListeners: {
  96314. scope: me,
  96315. processCompleted: callback,
  96316. processFailed: callback
  96317. },
  96318. format: format
  96319. });
  96320. singleObjectQueryJobsService.getQueryJob(id);
  96321. }
  96322. /**
  96323. * @function ProcessingService.prototype.addQueryJob
  96324. * @description 单对象查询分析。
  96325. * @param {SingleObjectQueryJobsParameter} params - 单对象查询分析的请求参数。
  96326. * @param {RequestCallback} callback - 回调函数。
  96327. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96328. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96329. */
  96330. addQueryJob(params, callback, seconds, resultFormat) {
  96331. var me = this,
  96332. format = me._processFormat(resultFormat);
  96333. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  96334. proxy: me.options.proxy,
  96335. withCredentials: me.options.withCredentials,
  96336. crossOrigin: me.options.crossOrigin,
  96337. headers: me.options.headers,
  96338. eventListeners: {
  96339. scope: me,
  96340. processCompleted: callback,
  96341. processFailed: callback,
  96342. processRunning: function (job) {
  96343. me.queryJobs[job.id] = job.state;
  96344. }
  96345. },
  96346. format: format
  96347. });
  96348. singleObjectQueryJobsService.addQueryJob(params, seconds);
  96349. }
  96350. /**
  96351. * @function ProcessingService.prototype.getQueryJobState
  96352. * @description 获取单对象查询分析的状态。
  96353. * @param {string} id - 单对象查询分析的 ID。
  96354. * @returns {Object} 单对象查询分析的状态。
  96355. */
  96356. getQueryJobState(id) {
  96357. return this.queryJobs[id];
  96358. }
  96359. /**
  96360. * @function ProcessingService.prototype.getSummaryRegionJobs
  96361. * @description 获取区域汇总分析的列表。
  96362. * @param {RequestCallback} callback - 回调函数。
  96363. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96364. */
  96365. getSummaryRegionJobs(callback, resultFormat) {
  96366. var me = this,
  96367. format = me._processFormat(resultFormat);
  96368. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  96369. proxy: me.options.proxy,
  96370. withCredentials: me.options.withCredentials,
  96371. crossOrigin: me.options.crossOrigin,
  96372. headers: me.options.headers,
  96373. eventListeners: {
  96374. scope: me,
  96375. processCompleted: callback,
  96376. processFailed: callback
  96377. },
  96378. format: format
  96379. });
  96380. summaryRegionJobsService.getSummaryRegionJobs();
  96381. }
  96382. /**
  96383. * @function ProcessingService.prototype.getSummaryRegionJob
  96384. * @description 获取某个区域汇总分析。
  96385. * @param {string} id - 区域汇总分析的 ID。
  96386. * @param {RequestCallback} callback - 回调函数。
  96387. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96388. */
  96389. getSummaryRegionJob(id, callback, resultFormat) {
  96390. var me = this,
  96391. format = me._processFormat(resultFormat);
  96392. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  96393. proxy: me.options.proxy,
  96394. withCredentials: me.options.withCredentials,
  96395. crossOrigin: me.options.crossOrigin,
  96396. headers: me.options.headers,
  96397. eventListeners: {
  96398. scope: me,
  96399. processCompleted: callback,
  96400. processFailed: callback
  96401. },
  96402. format: format
  96403. });
  96404. summaryRegionJobsService.getSummaryRegionJob(id);
  96405. }
  96406. /**
  96407. * @function ProcessingService.prototype.addSummaryRegionJob
  96408. * @description 区域汇总分析。
  96409. * @param {SummaryRegionJobParameter} params - 区域汇总分析参数类。
  96410. * @param {RequestCallback} callback - 回调函数。
  96411. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96412. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96413. */
  96414. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  96415. var me = this,
  96416. format = me._processFormat(resultFormat);
  96417. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  96418. proxy: me.options.proxy,
  96419. withCredentials: me.options.withCredentials,
  96420. crossOrigin: me.options.crossOrigin,
  96421. headers: me.options.headers,
  96422. eventListeners: {
  96423. scope: me,
  96424. processCompleted: callback,
  96425. processFailed: callback,
  96426. processRunning: function (job) {
  96427. me.summaryRegionJobs[job.id] = job.state;
  96428. }
  96429. },
  96430. format: format
  96431. });
  96432. summaryRegionJobsService.addSummaryRegionJob(params, seconds);
  96433. }
  96434. /**
  96435. * @function ProcessingService.prototype.getSummaryRegionJobState
  96436. * @description 获取区域汇总分析的状态。
  96437. * @param {string} id - 生成区域汇总分析的 ID。
  96438. * @returns {Object} 区域汇总分析的状态。
  96439. */
  96440. getSummaryRegionJobState(id) {
  96441. return this.summaryRegionJobs[id];
  96442. }
  96443. /**
  96444. * @function ProcessingService.prototype.getVectorClipJobs
  96445. * @description 获取矢量裁剪分析的列表。
  96446. * @param {RequestCallback} callback - 回调函数。
  96447. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96448. */
  96449. getVectorClipJobs(callback, resultFormat) {
  96450. var me = this,
  96451. format = me._processFormat(resultFormat);
  96452. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  96453. proxy: me.options.proxy,
  96454. withCredentials: me.options.withCredentials,
  96455. crossOrigin: me.options.crossOrigin,
  96456. headers: me.options.headers,
  96457. eventListeners: {
  96458. scope: me,
  96459. processCompleted: callback,
  96460. processFailed: callback
  96461. },
  96462. format: format
  96463. });
  96464. vectorClipJobsService.getVectorClipJobs();
  96465. }
  96466. /**
  96467. * @function ProcessingService.prototype.getVectorClipJob
  96468. * @description 获取某个矢量裁剪分析。
  96469. * @param {string} id - 空间分析的 ID。
  96470. * @param {RequestCallback} callback - 回调函数。
  96471. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96472. */
  96473. getVectorClipJob(id, callback, resultFormat) {
  96474. var me = this,
  96475. format = me._processFormat(resultFormat);
  96476. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  96477. proxy: me.options.proxy,
  96478. withCredentials: me.options.withCredentials,
  96479. crossOrigin: me.options.crossOrigin,
  96480. headers: me.options.headers,
  96481. eventListeners: {
  96482. scope: me,
  96483. processCompleted: callback,
  96484. processFailed: callback
  96485. },
  96486. format: format
  96487. });
  96488. vectorClipJobsService.getVectorClipJob(id);
  96489. }
  96490. /**
  96491. * @function ProcessingService.prototype.addVectorClipJob
  96492. * @description 矢量裁剪分析。
  96493. * @param {VectorClipJobsParameter} params - 矢量裁剪分析请求参数类。
  96494. * @param {RequestCallback} callback - 回调函数。
  96495. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96496. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96497. */
  96498. addVectorClipJob(params, callback, seconds, resultFormat) {
  96499. var me = this,
  96500. format = me._processFormat(resultFormat);
  96501. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  96502. proxy: me.options.proxy,
  96503. withCredentials: me.options.withCredentials,
  96504. crossOrigin: me.options.crossOrigin,
  96505. headers: me.options.headers,
  96506. eventListeners: {
  96507. scope: me,
  96508. processCompleted: callback,
  96509. processFailed: callback,
  96510. processRunning: function (job) {
  96511. me.vectorClipJobs[job.id] = job.state;
  96512. }
  96513. },
  96514. format: format
  96515. });
  96516. vectorClipJobsService.addVectorClipJob(params, seconds);
  96517. }
  96518. /**
  96519. * @function ProcessingService.prototype.getVectorClipJobState
  96520. * @description 获取矢量裁剪分析的状态。
  96521. * @param {number} id - 矢量裁剪分析的ID。
  96522. * @returns {Object} 矢量裁剪分析的状态。
  96523. */
  96524. getVectorClipJobState(id) {
  96525. return this.vectorClipJobs[id];
  96526. }
  96527. /**
  96528. * @function ProcessingService.prototype.getOverlayGeoJobs
  96529. * @description 获取叠加分析的列表。
  96530. * @param {RequestCallback} callback - 回调函数。
  96531. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96532. */
  96533. getOverlayGeoJobs(callback, resultFormat) {
  96534. var me = this,
  96535. format = me._processFormat(resultFormat);
  96536. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  96537. proxy: me.options.proxy,
  96538. withCredentials: me.options.withCredentials,
  96539. crossOrigin: me.options.crossOrigin,
  96540. headers: me.options.headers,
  96541. eventListeners: {
  96542. scope: me,
  96543. processCompleted: callback,
  96544. processFailed: callback
  96545. },
  96546. format: format
  96547. });
  96548. overlayGeoJobsService.getOverlayGeoJobs();
  96549. }
  96550. /**
  96551. * @function ProcessingService.prototype.getOverlayGeoJob
  96552. * @description 获取某个叠加分析。
  96553. * @param {string} id - 空间分析的 ID。
  96554. * @param {RequestCallback} callback - 回调函数。
  96555. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96556. */
  96557. getOverlayGeoJob(id, callback, resultFormat) {
  96558. var me = this,
  96559. format = me._processFormat(resultFormat);
  96560. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  96561. proxy: me.options.proxy,
  96562. withCredentials: me.options.withCredentials,
  96563. crossOrigin: me.options.crossOrigin,
  96564. headers: me.options.headers,
  96565. eventListeners: {
  96566. scope: me,
  96567. processCompleted: callback,
  96568. processFailed: callback
  96569. },
  96570. format: format
  96571. });
  96572. overlayGeoJobsService.getOverlayGeoJob(id);
  96573. }
  96574. /**
  96575. * @function ProcessingService.prototype.addOverlayGeoJob
  96576. * @description 叠加分析。
  96577. * @param {OverlayGeoJobParameter} params - 叠加分析请求参数类。
  96578. * @param {RequestCallback} callback - 回调函数。
  96579. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96580. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96581. */
  96582. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  96583. var me = this,
  96584. format = me._processFormat(resultFormat);
  96585. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  96586. proxy: me.options.proxy,
  96587. withCredentials: me.options.withCredentials,
  96588. crossOrigin: me.options.crossOrigin,
  96589. headers: me.options.headers,
  96590. eventListeners: {
  96591. scope: me,
  96592. processCompleted: callback,
  96593. processFailed: callback,
  96594. processRunning: function (job) {
  96595. me.overlayGeoJobs[job.id] = job.state;
  96596. }
  96597. },
  96598. format: format
  96599. });
  96600. overlayGeoJobsService.addOverlayGeoJob(params, seconds);
  96601. }
  96602. /**
  96603. * @function ProcessingService.prototype.getoverlayGeoJobState
  96604. * @description 获取叠加分析的状态。
  96605. * @param {string} id - 叠加分析的 ID。
  96606. * @returns {Object} 叠加分析的状态。
  96607. */
  96608. getoverlayGeoJobState(id) {
  96609. return this.overlayGeoJobs[id];
  96610. }
  96611. /**
  96612. * @function ProcessingService.prototype.getBuffersJobs
  96613. * @description 获取缓冲区分析的列表。
  96614. * @param {RequestCallback} callback - 回调函数。
  96615. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96616. */
  96617. getBuffersJobs(callback, resultFormat) {
  96618. var me = this,
  96619. format = me._processFormat(resultFormat);
  96620. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  96621. proxy: me.options.proxy,
  96622. withCredentials: me.options.withCredentials,
  96623. crossOrigin: me.options.crossOrigin,
  96624. headers: me.options.headers,
  96625. eventListeners: {
  96626. scope: me,
  96627. processCompleted: callback,
  96628. processFailed: callback
  96629. },
  96630. format: format
  96631. });
  96632. buffersAnalystJobsService.getBuffersJobs();
  96633. }
  96634. /**
  96635. * @function ProcessingService.prototype.getBuffersJob
  96636. * @description 获取某个缓冲区分析。
  96637. * @param {string} id - 空间分析的 ID。
  96638. * @param {RequestCallback} callback - 回调函数。
  96639. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96640. */
  96641. getBuffersJob(id, callback, resultFormat) {
  96642. var me = this,
  96643. format = me._processFormat(resultFormat);
  96644. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  96645. proxy: me.options.proxy,
  96646. withCredentials: me.options.withCredentials,
  96647. crossOrigin: me.options.crossOrigin,
  96648. headers: me.options.headers,
  96649. eventListeners: {
  96650. scope: me,
  96651. processCompleted: callback,
  96652. processFailed: callback
  96653. },
  96654. format: format
  96655. });
  96656. buffersAnalystJobsService.getBuffersJob(id);
  96657. }
  96658. /**
  96659. * @function ProcessingService.prototype.addBuffersJob
  96660. * @description 缓冲区分析。
  96661. * @param {BuffersAnalystJobsParameter} params - 缓冲区分析请求参数类。
  96662. * @param {RequestCallback} callback - 回调函数。
  96663. * @param {number} seconds - 获取创建成功结果的时间间隔。
  96664. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96665. */
  96666. addBuffersJob(params, callback, seconds, resultFormat) {
  96667. var me = this,
  96668. format = me._processFormat(resultFormat);
  96669. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  96670. proxy: me.options.proxy,
  96671. withCredentials: me.options.withCredentials,
  96672. crossOrigin: me.options.crossOrigin,
  96673. headers: me.options.headers,
  96674. eventListeners: {
  96675. scope: me,
  96676. processCompleted: callback,
  96677. processFailed: callback,
  96678. processRunning: function (job) {
  96679. me.buffersJobs[job.id] = job.state;
  96680. }
  96681. },
  96682. format: format
  96683. });
  96684. buffersAnalystJobsService.addBuffersJob(params, seconds);
  96685. }
  96686. /**
  96687. * @function ProcessingService.prototype.getBuffersJobState
  96688. * @description 获取缓冲区分析的状态。
  96689. * @param {string} id - 缓冲区分析的 ID。
  96690. * @returns {Object} 缓冲区分析的状态。
  96691. */
  96692. getBuffersJobState(id) {
  96693. return this.buffersJobs[id];
  96694. }
  96695. /**
  96696. * @function ProcessingService.prototype.getTopologyValidatorJobs
  96697. * @description 获取拓扑检查分析的列表。
  96698. * @param {RequestCallback} callback - 回调函数。
  96699. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96700. */
  96701. getTopologyValidatorJobs(callback, resultFormat) {
  96702. var me = this,
  96703. format = me._processFormat(resultFormat);
  96704. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  96705. proxy: me.options.proxy,
  96706. withCredentials: me.options.withCredentials,
  96707. crossOrigin: me.options.crossOrigin,
  96708. headers: me.options.headers,
  96709. eventListeners: {
  96710. scope: me,
  96711. processCompleted: callback,
  96712. processFailed: callback
  96713. },
  96714. format: format
  96715. });
  96716. topologyValidatorJobsService.getTopologyValidatorJobs();
  96717. }
  96718. /**
  96719. * @function ProcessingService.prototype.getTopologyValidatorJob
  96720. * @description 获取某个拓扑检查分析。
  96721. * @param {string} id - 空间分析的 ID。
  96722. * @param {RequestCallback} callback - 回调函数。
  96723. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96724. */
  96725. getTopologyValidatorJob(id, callback, resultFormat) {
  96726. var me = this,
  96727. format = me._processFormat(resultFormat);
  96728. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  96729. proxy: me.options.proxy,
  96730. withCredentials: me.options.withCredentials,
  96731. crossOrigin: me.options.crossOrigin,
  96732. headers: me.options.headers,
  96733. eventListeners: {
  96734. scope: me,
  96735. processCompleted: callback,
  96736. processFailed: callback
  96737. },
  96738. format: format
  96739. });
  96740. topologyValidatorJobsService.getTopologyValidatorJob(id);
  96741. }
  96742. /**
  96743. * @function ProcessingService.prototype.addTopologyValidatorJob
  96744. * @description 拓扑检查分析。
  96745. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析请求参数类。
  96746. * @param {RequestCallback} callback - 回调函数。
  96747. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96748. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96749. */
  96750. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  96751. var me = this,
  96752. format = me._processFormat(resultFormat);
  96753. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  96754. proxy: me.options.proxy,
  96755. withCredentials: me.options.withCredentials,
  96756. crossOrigin: me.options.crossOrigin,
  96757. headers: me.options.headers,
  96758. eventListeners: {
  96759. scope: me,
  96760. processCompleted: callback,
  96761. processFailed: callback,
  96762. processRunning: function (job) {
  96763. me.topologyValidatorJobs[job.id] = job.state;
  96764. }
  96765. },
  96766. format: format
  96767. });
  96768. topologyValidatorJobsService.addTopologyValidatorJob(params, seconds);
  96769. }
  96770. /**
  96771. * @function ProcessingService.prototype.getTopologyValidatorJobState
  96772. * @description 获取拓扑检查分析的状态。
  96773. * @param {string} id - 拓扑检查分析的 ID。
  96774. * @returns {Object} 拓扑检查分析的状态。
  96775. */
  96776. getTopologyValidatorJobState(id) {
  96777. return this.topologyValidatorJobs[id];
  96778. }
  96779. /**
  96780. * @function ProcessingService.prototype.getSummaryAttributesJobs
  96781. * @description 获取属性汇总分析的列表。
  96782. * @param {RequestCallback} callback - 回调函数。
  96783. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96784. */
  96785. getSummaryAttributesJobs(callback, resultFormat) {
  96786. var me = this,
  96787. format = me._processFormat(resultFormat);
  96788. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  96789. proxy: me.options.proxy,
  96790. withCredentials: me.options.withCredentials,
  96791. crossOrigin: me.options.crossOrigin,
  96792. headers: me.options.headers,
  96793. eventListeners: {
  96794. scope: me,
  96795. processCompleted: callback,
  96796. processFailed: callback
  96797. },
  96798. format: format
  96799. });
  96800. summaryAttributesJobsService.getSummaryAttributesJobs();
  96801. }
  96802. /**
  96803. * @function ProcessingService.prototype.getSummaryAttributesJob
  96804. * @description 获取某个属性汇总分析。
  96805. * @param {string} id - 空间分析的 ID。
  96806. * @param {RequestCallback} callback - 回调函数。
  96807. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96808. */
  96809. getSummaryAttributesJob(id, callback, resultFormat) {
  96810. var me = this,
  96811. format = me._processFormat(resultFormat);
  96812. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  96813. proxy: me.options.proxy,
  96814. withCredentials: me.options.withCredentials,
  96815. crossOrigin: me.options.crossOrigin,
  96816. headers: me.options.headers,
  96817. eventListeners: {
  96818. scope: me,
  96819. processCompleted: callback,
  96820. processFailed: callback
  96821. },
  96822. format: format
  96823. });
  96824. summaryAttributesJobsService.getSummaryAttributesJob(id);
  96825. }
  96826. /**
  96827. * @function ProcessingService.prototype.addSummaryAttributesJob
  96828. * @description 属性汇总分析。
  96829. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析参数类。
  96830. * @param {RequestCallback} callback - 回调函数。
  96831. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96832. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96833. */
  96834. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  96835. var me = this,
  96836. format = me._processFormat(resultFormat);
  96837. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  96838. proxy: me.options.proxy,
  96839. withCredentials: me.options.withCredentials,
  96840. crossOrigin: me.options.crossOrigin,
  96841. headers: me.options.headers,
  96842. eventListeners: {
  96843. scope: me,
  96844. processCompleted: callback,
  96845. processFailed: callback,
  96846. processRunning: function (job) {
  96847. me.summaryAttributesJobs[job.id] = job.state;
  96848. }
  96849. },
  96850. format: format
  96851. });
  96852. summaryAttributesJobsService.addSummaryAttributesJob(params, seconds);
  96853. }
  96854. /**
  96855. * @function ProcessingService.prototype.getSummaryAttributesJobState
  96856. * @description 获取属性汇总分析的状态。
  96857. * @param {string} id - 属性汇总分析的 ID。
  96858. * @returns {Object} 属性汇总分析的状态
  96859. */
  96860. getSummaryAttributesJobState(id) {
  96861. return this.summaryAttributesJobs[id];
  96862. }
  96863. _processFormat(resultFormat) {
  96864. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  96865. }
  96866. }
  96867. ;// CONCATENATED MODULE: ./src/openlayers/services/ProcessingService.js
  96868. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  96869. * This program are made available under the terms of the Apache License, Version 2.0
  96870. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  96871. /**
  96872. * @class ProcessingService
  96873. * @category iServer ProcessingService
  96874. * @classdesc 分布式分析相关服务类。
  96875. * @extends {ServiceBase}
  96876. * @example
  96877. * new ProcessingService(url,options).getKernelDensityJobs(function(result){
  96878. * //doSomething
  96879. * })
  96880. * @param {string} url - 服务地址。
  96881. * @param {Object} options - 参数。
  96882. * @param {string} [options.proxy] - 服务代理地址。
  96883. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  96884. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  96885. * @param {Object} [options.headers] - 请求头。
  96886. * @usage
  96887. */
  96888. class ProcessingService extends ServiceBase {
  96889. constructor(url, options) {
  96890. super(url, options);
  96891. this._processingService = new ProcessingService_ProcessingService(url, options);
  96892. }
  96893. /**
  96894. * @function ProcessingService.prototype.getKernelDensityJobs
  96895. * @description 获取密度分析的列表。
  96896. * @param {RequestCallback} callback - 回调函数。
  96897. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96898. */
  96899. getKernelDensityJobs(callback, resultFormat) {
  96900. this._processingService.getKernelDensityJobs(callback, resultFormat);
  96901. }
  96902. /**
  96903. * @function ProcessingService.prototype.getKernelDensityJob
  96904. * @description 获取密度分析。
  96905. * @param {string} id - 空间分析的 ID。
  96906. * @param {RequestCallback} callback - 回调函数。
  96907. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96908. */
  96909. getKernelDensityJob(id, callback, resultFormat) {
  96910. this._processingService.getKernelDensityJob(id, callback, resultFormat);
  96911. }
  96912. /**
  96913. * @function ProcessingService.prototype.addKernelDensityJob
  96914. * @description 密度分析。
  96915. * @param {KernelDensityJobParameter} params - 核密度分析服务参数类。
  96916. * @param {RequestCallback} callback - 回调函数。
  96917. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96918. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96919. */
  96920. addKernelDensityJob(params, callback, seconds, resultFormat) {
  96921. params = this._processParams(params);
  96922. this._processingService.addKernelDensityJob(params, callback, seconds, resultFormat);
  96923. }
  96924. /**
  96925. * @function ProcessingService.prototype.getKernelDensityJobState
  96926. * @description 获取密度分析的状态。
  96927. * @param {string} id - 密度分析的 ID。
  96928. * @returns {Object} 密度分析的状态
  96929. */
  96930. getKernelDensityJobState(id) {
  96931. return this._processingService.getKernelDensityJobState(id)
  96932. }
  96933. /**
  96934. * @function ProcessingService.prototype.getSummaryMeshJobs
  96935. * @description 获取点聚合分析的列表。
  96936. * @param {RequestCallback} callback - 回调函数。
  96937. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96938. */
  96939. getSummaryMeshJobs(callback, resultFormat) {
  96940. this._processingService.getSummaryMeshJobs(callback, resultFormat);
  96941. }
  96942. /**
  96943. * @function ProcessingService.prototype.getSummaryMeshJob
  96944. * @description 获取点聚合分析。
  96945. * @param {string} id - 空间分析的 ID。
  96946. * @param {RequestCallback} callback - 回调函数。
  96947. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96948. */
  96949. getSummaryMeshJob(id, callback, resultFormat) {
  96950. this._processingService.getSummaryMeshJob(id, callback, resultFormat);
  96951. }
  96952. /**
  96953. * @function ProcessingService.prototype.addSummaryMeshJob
  96954. * @description 点聚合分析。
  96955. * @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  96956. * @param {RequestCallback} callback - 回调函数。
  96957. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96958. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96959. */
  96960. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  96961. params = this._processParams(params);
  96962. this._processingService.addSummaryMeshJob(params, callback, seconds, resultFormat);
  96963. }
  96964. /**
  96965. * @function ProcessingService.prototype.getSummaryMeshJobState
  96966. * @description 获取点聚合分析的状态。
  96967. * @param {string} id - 点聚合分析的 ID。
  96968. * @returns {Object} 点聚合分析的状态。
  96969. */
  96970. getSummaryMeshJobState(id) {
  96971. return this._processingService.getSummaryMeshJobState(id)
  96972. }
  96973. /**
  96974. * @function ProcessingService.prototype.getQueryJobs
  96975. * @description 获取单对象查询分析的列表。
  96976. * @param {RequestCallback} callback - 回调函数。
  96977. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96978. */
  96979. getQueryJobs(callback, resultFormat) {
  96980. this._processingService.getQueryJobs(callback, resultFormat);
  96981. }
  96982. /**
  96983. * @function ProcessingService.prototype.getQueryJob
  96984. * @description 获取单对象查询分析。
  96985. * @param {string} id - 空间分析的 ID。
  96986. * @param {RequestCallback} callback - 回调函数。
  96987. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96988. */
  96989. getQueryJob(id, callback, resultFormat) {
  96990. this._processingService.getQueryJob(id, callback, resultFormat);
  96991. }
  96992. /**
  96993. * @function ProcessingService.prototype.addQueryJob
  96994. * @description 单对象查询分析。
  96995. * @param {SingleObjectQueryJobsParameter} params - 单对象空间查询分析任务参数类。
  96996. * @param {RequestCallback} callback - 回调函数。
  96997. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  96998. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  96999. */
  97000. addQueryJob(params, callback, seconds, resultFormat) {
  97001. params = this._processParams(params);
  97002. this._processingService.addQueryJob(params, callback, seconds, resultFormat);
  97003. }
  97004. /**
  97005. * @function ProcessingService.prototype.getQueryJobState
  97006. * @description 获取单对象查询分析的状态。
  97007. * @param {string} id - 单对象查询分析的 ID。
  97008. * @returns {Object} 单对象查询分析的状态。
  97009. */
  97010. getQueryJobState(id) {
  97011. return this._processingService.getQueryJobState(id)
  97012. }
  97013. /**
  97014. * @function ProcessingService.prototype.getSummaryRegionJobs
  97015. * @description 获取区域汇总分析的列表。
  97016. * @param {RequestCallback} callback - 回调函数。
  97017. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97018. */
  97019. getSummaryRegionJobs(callback, resultFormat) {
  97020. this._processingService.getSummaryRegionJobs(callback, resultFormat);
  97021. }
  97022. /**
  97023. * @function ProcessingService.prototype.getSummaryRegionJob
  97024. * @description 获取区域汇总分析。
  97025. * @param {string} id - 区域汇总分析的 ID。
  97026. * @param {RequestCallback} callback - 回调函数。
  97027. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97028. */
  97029. getSummaryRegionJob(id, callback, resultFormat) {
  97030. this._processingService.getSummaryRegionJob(id, callback, resultFormat);
  97031. }
  97032. /**
  97033. * @function ProcessingService.prototype.addSummaryRegionJob
  97034. * @description 区域汇总分析。
  97035. * @param {SummaryRegionJobParameter} params - 区域汇总分析任务参数类。
  97036. * @param {RequestCallback} callback - 回调函数。
  97037. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97038. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97039. */
  97040. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  97041. params = this._processParams(params);
  97042. this._processingService.addSummaryRegionJob(params, callback, seconds, resultFormat);
  97043. }
  97044. /**
  97045. * @function ProcessingService.prototype.getSummaryRegionJobState
  97046. * @description 获取区域汇总分析的状态。
  97047. * @param {string} id - 生成区域汇总分析的 ID。
  97048. * @returns {Object} 区域汇总分析的状态。
  97049. */
  97050. getSummaryRegionJobState(id) {
  97051. return this._processingService.getSummaryRegionJobState(id)
  97052. }
  97053. /**
  97054. * @function ProcessingService.prototype.getVectorClipJobs
  97055. * @description 获取矢量裁剪分析的列表。
  97056. * @param {RequestCallback} callback 回调函数。
  97057. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97058. */
  97059. getVectorClipJobs(callback, resultFormat) {
  97060. this._processingService.getVectorClipJobs(callback, resultFormat);
  97061. }
  97062. /**
  97063. * @function ProcessingService.prototype.getVectorClipJob
  97064. * @description 获取矢量裁剪分析。
  97065. * @param {string} id - 空间分析的 ID。
  97066. * @param {RequestCallback} callback 回调函数。
  97067. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97068. */
  97069. getVectorClipJob(id, callback, resultFormat) {
  97070. return this._processingService.getVectorClipJob(id, callback, resultFormat);
  97071. }
  97072. /**
  97073. * @function ProcessingService.prototype.addVectorClipJob
  97074. * @description 矢量裁剪分析。
  97075. * @param {VectorClipJobsParameter} params - 矢量裁剪分析任务参数类。
  97076. * @param {RequestCallback} callback 回调函数。
  97077. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97078. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97079. */
  97080. addVectorClipJob(params, callback, seconds, resultFormat) {
  97081. params = this._processParams(params);
  97082. this._processingService.addVectorClipJob(params, callback, seconds, resultFormat);
  97083. }
  97084. /**
  97085. * @function ProcessingService.prototype.getVectorClipJobState
  97086. * @description 获取矢量裁剪分析的状态。
  97087. * @param {number} id - 矢量裁剪分析的 ID。
  97088. * @returns {Object} 矢量裁剪分析的状态。
  97089. */
  97090. getVectorClipJobState(id) {
  97091. return this._processingService.getVectorClipJobState(id)
  97092. }
  97093. /**
  97094. * @function ProcessingService.prototype.getOverlayGeoJobs
  97095. * @description 获取叠加分析的列表。
  97096. * @param {RequestCallback} callback 回调函数。
  97097. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97098. */
  97099. getOverlayGeoJobs(callback, resultFormat) {
  97100. this._processingService.getOverlayGeoJobs(callback, resultFormat);
  97101. }
  97102. /**
  97103. * @function ProcessingService.prototype.getOverlayGeoJob
  97104. * @description 获取叠加分析。
  97105. * @param {string} id - 空间分析的 ID。
  97106. * @param {RequestCallback} callback 回调函数。
  97107. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97108. */
  97109. getOverlayGeoJob(id, callback, resultFormat) {
  97110. this._processingService.getOverlayGeoJob(id, callback, resultFormat);
  97111. }
  97112. /**
  97113. * @function ProcessingService.prototype.addOverlayGeoJob
  97114. * @description 叠加分析。
  97115. * @param {OverlayGeoJobParameter} params - 叠加分析任务参数类。
  97116. * @param {RequestCallback} callback 回调函数。
  97117. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97118. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97119. */
  97120. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  97121. params = this._processParams(params);
  97122. this._processingService.addOverlayGeoJob(params, callback, seconds, resultFormat);
  97123. }
  97124. /**
  97125. * @function ProcessingService.prototype.getoverlayGeoJobState
  97126. * @description 获取叠加分析的状态。
  97127. * @param {string} id - 叠加分析的 ID。
  97128. * @returns {Object} 叠加分析的状态。
  97129. */
  97130. getoverlayGeoJobState(id) {
  97131. return this._processingService.getoverlayGeoJobState(id);
  97132. }
  97133. /**
  97134. * @function ProcessingService.prototype.getBuffersJobs
  97135. * @description 获取缓冲区分析的列表。
  97136. * @param {RequestCallback} callback 回调函数。
  97137. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97138. */
  97139. getBuffersJobs(callback, resultFormat) {
  97140. this._processingService.getBuffersJobs(callback, resultFormat);
  97141. }
  97142. /**
  97143. * @function ProcessingService.prototype.getBuffersJob
  97144. * @description 获取缓冲区分析。
  97145. * @param {string} id - 空间分析的 ID。
  97146. * @param {RequestCallback} callback 回调函数。
  97147. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97148. */
  97149. getBuffersJob(id, callback, resultFormat) {
  97150. this._processingService.getBuffersJob(id, callback, resultFormat);
  97151. }
  97152. /**
  97153. * @function ProcessingService.prototype.addBuffersJob
  97154. * @description 缓冲区分析。
  97155. * @param {BuffersAnalystJobsParameter} params - 缓冲区分析任务参数类。
  97156. * @param {RequestCallback} callback 回调函数。
  97157. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97158. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97159. */
  97160. addBuffersJob(params, callback, seconds, resultFormat) {
  97161. params = this._processParams(params);
  97162. this._processingService.addBuffersJob(params, callback, seconds, resultFormat);
  97163. }
  97164. /**
  97165. * @function ProcessingService.prototype.getBuffersJobState
  97166. * @description 获取缓冲区分析的状态。
  97167. * @param {string} id - 缓冲区分析的 ID。
  97168. * @returns {Object} 缓冲区分析的状态。
  97169. */
  97170. getBuffersJobState(id) {
  97171. return this._processingService.getBuffersJobState(id)
  97172. }
  97173. /**
  97174. * @function ProcessingService.prototype.getTopologyValidatorJobs
  97175. * @description 获取拓扑检查分析的列表。
  97176. * @param {RequestCallback} callback 回调函数。
  97177. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97178. */
  97179. getTopologyValidatorJobs(callback, resultFormat) {
  97180. this._processingService.getTopologyValidatorJobs(callback, resultFormat);
  97181. }
  97182. /**
  97183. * @function ProcessingService.prototype.getTopologyValidatorJob
  97184. * @description 获取拓扑检查分析。
  97185. * @param {string} id - 空间分析的 ID。
  97186. * @param {RequestCallback} callback - 回调函数。
  97187. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97188. */
  97189. getTopologyValidatorJob(id, callback, resultFormat) {
  97190. this._processingService.getTopologyValidatorJob(id, callback, resultFormat);
  97191. }
  97192. /**
  97193. * @function ProcessingService.prototype.addTopologyValidatorJob
  97194. * @description 拓扑检查分析。
  97195. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析任务参数类。
  97196. * @param {RequestCallback} callback - 回调函数。
  97197. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97198. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97199. */
  97200. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  97201. params = this._processParams(params);
  97202. this._processingService.addTopologyValidatorJob(params, callback, seconds, resultFormat);
  97203. }
  97204. /**
  97205. * @function ProcessingService.prototype.getTopologyValidatorJobState
  97206. * @description 获取拓扑检查分析的状态。
  97207. * @param {string} id - 拓扑检查分析的 ID。
  97208. * @returns {Object} 拓扑检查分析的状态。
  97209. */
  97210. getTopologyValidatorJobState(id) {
  97211. return this._processingService.getTopologyValidatorJobState(id)
  97212. }
  97213. /**
  97214. * @function ProcessingService.prototype.getSummaryAttributesJobs
  97215. * @description 获取拓扑检查属性汇总分析的列表。
  97216. * @param {RequestCallback} callback - 回调函数。
  97217. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97218. */
  97219. getSummaryAttributesJobs(callback, resultFormat) {
  97220. this._processingService.getSummaryAttributesJobs(callback, resultFormat);
  97221. }
  97222. /**
  97223. * @function ProcessingService.prototype.getSummaryAttributesJob
  97224. * @description 获取属性汇总分析。
  97225. * @param {string} id - 空间分析的 ID。
  97226. * @param {RequestCallback} callback - 回调函数。
  97227. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97228. */
  97229. getSummaryAttributesJob(id, callback, resultFormat) {
  97230. this._processingService.getSummaryAttributesJob(id, callback, resultFormat);
  97231. }
  97232. /**
  97233. * @function ProcessingService.prototype.addSummaryAttributesJob
  97234. * @description 属性汇总分析。
  97235. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析任务参数类。
  97236. * @param {RequestCallback} callback - 回调函数。
  97237. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  97238. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  97239. */
  97240. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  97241. params = this._processParams(params);
  97242. this._processingService.addSummaryAttributesJob(params, callback, seconds, resultFormat);
  97243. }
  97244. /**
  97245. * @function ProcessingService.prototype.getSummaryAttributesJobState
  97246. * @description 获取属性汇总分析的状态。
  97247. * @param {string} id - 属性汇总分析的 ID。
  97248. * @returns {Object} 属性汇总分析的状态。
  97249. */
  97250. getSummaryAttributesJobState(id) {
  97251. return this._processingService.getSummaryAttributesJobState(id)
  97252. }
  97253. _processFormat(resultFormat) {
  97254. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  97255. }
  97256. _processParams(params) {
  97257. if (!params) {
  97258. return {};
  97259. }
  97260. if (params.bounds) {
  97261. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  97262. }
  97263. if (params.query) {
  97264. params.query = core_Util_Util.toSuperMapBounds(params.query);
  97265. }
  97266. if (params.geometryQuery) {
  97267. params.geometryQuery = core_Util_Util.toProcessingParam(params.geometryQuery);
  97268. }
  97269. if (params.geometryClip) {
  97270. params.geometryClip = core_Util_Util.toProcessingParam(params.geometryClip);
  97271. }
  97272. return params;
  97273. }
  97274. }
  97275. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystService.js
  97276. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  97277. * This program are made available under the terms of the Apache License, Version 2.0
  97278. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  97279. /**
  97280. * @class SpatialAnalystService
  97281. * @extends {ServiceBase}
  97282. * @category iServer SpatialAnalyst
  97283. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  97284. * @example
  97285. * new SpatialAnalystService(url).bufferAnalysis(params,function(result){
  97286. * //doSomething
  97287. * })
  97288. * @param {string} url - 服务地址。
  97289. * @param {Object} options - 参数。
  97290. * @param {string} [options.proxy] - 服务代理地址。
  97291. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  97292. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  97293. * @param {Object} [options.headers] - 请求头。
  97294. * @usage
  97295. */
  97296. class SpatialAnalystService_SpatialAnalystService {
  97297. constructor(url, options) {
  97298. this.url = url;
  97299. this.options = options || {};
  97300. }
  97301. /**
  97302. * @function SpatialAnalystService.prototype.getAreaSolarRadiationResult
  97303. * @description 地区太阳辐射。
  97304. * @param {AreaSolarRadiationParameters} params - 地区太阳辐射参数类。
  97305. * @param {RequestCallback} callback 回调函数。
  97306. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97307. */
  97308. getAreaSolarRadiationResult(params, callback, resultFormat) {
  97309. var me = this;
  97310. var areaSolarRadiationService = new AreaSolarRadiationService(me.url, {
  97311. proxy: me.options.proxy,
  97312. withCredentials: me.options.withCredentials,
  97313. crossOrigin: me.options.crossOrigin,
  97314. headers: me.options.headers,
  97315. eventListeners: {
  97316. scope: me,
  97317. processCompleted: callback,
  97318. processFailed: callback
  97319. },
  97320. format: me._processFormat(resultFormat)
  97321. });
  97322. areaSolarRadiationService.processAsync(params);
  97323. }
  97324. /**
  97325. * @function SpatialAnalystService.prototype.bufferAnalysis
  97326. * @description 缓冲区分析。
  97327. * @param {DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
  97328. * @param {RequestCallback} callback 回调函数。
  97329. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97330. */
  97331. bufferAnalysis(params, callback, resultFormat) {
  97332. var me = this;
  97333. var bufferAnalystService = new BufferAnalystService(me.url, {
  97334. proxy: me.options.proxy,
  97335. withCredentials: me.options.withCredentials,
  97336. crossOrigin: me.options.crossOrigin,
  97337. headers: me.options.headers,
  97338. eventListeners: {
  97339. scope: me,
  97340. processCompleted: callback,
  97341. processFailed: callback
  97342. },
  97343. format: me._processFormat(resultFormat)
  97344. });
  97345. bufferAnalystService.processAsync(params);
  97346. }
  97347. /**
  97348. * @function SpatialAnalystService.prototype.densityAnalysis
  97349. * @description 点密度分析。
  97350. * @param {DensityKernelAnalystParameters} params - 核密度分析参数类。
  97351. * @param {RequestCallback} callback 回调函数。
  97352. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97353. */
  97354. densityAnalysis(params, callback, resultFormat) {
  97355. var me = this;
  97356. var densityAnalystService = new DensityAnalystService(me.url, {
  97357. proxy: me.options.proxy,
  97358. withCredentials: me.options.withCredentials,
  97359. crossOrigin: me.options.crossOrigin,
  97360. headers: me.options.headers,
  97361. eventListeners: {
  97362. scope: me,
  97363. processCompleted: callback,
  97364. processFailed: callback
  97365. },
  97366. format: me._processFormat(resultFormat)
  97367. });
  97368. densityAnalystService.processAsync(params);
  97369. }
  97370. /**
  97371. * @function SpatialAnalystService.prototype.generateSpatialData
  97372. * @description 动态分段分析。
  97373. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  97374. * @param {RequestCallback} callback 回调函数。
  97375. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97376. */
  97377. generateSpatialData(params, callback, resultFormat) {
  97378. var me = this;
  97379. var generateSpatialDataService = new GenerateSpatialDataService(me.url, {
  97380. proxy: me.options.proxy,
  97381. withCredentials: me.options.withCredentials,
  97382. crossOrigin: me.options.crossOrigin,
  97383. headers: me.options.headers,
  97384. eventListeners: {
  97385. scope: me,
  97386. processCompleted: callback,
  97387. processFailed: callback
  97388. },
  97389. format: me._processFormat(resultFormat)
  97390. });
  97391. generateSpatialDataService.processAsync(params);
  97392. }
  97393. /**
  97394. * @function SpatialAnalystService.prototype.geoRelationAnalysis
  97395. * @description 空间关系分析。
  97396. * @param {GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
  97397. * @param {RequestCallback} callback 回调函数。
  97398. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97399. */
  97400. geoRelationAnalysis(params, callback, resultFormat) {
  97401. var me = this;
  97402. var geoRelationAnalystService = new GeoRelationAnalystService(me.url, {
  97403. proxy: me.options.proxy,
  97404. withCredentials: me.options.withCredentials,
  97405. crossOrigin: me.options.crossOrigin,
  97406. headers: me.options.headers,
  97407. eventListeners: {
  97408. scope: me,
  97409. processCompleted: callback,
  97410. processFailed: callback
  97411. },
  97412. format: me._processFormat(resultFormat)
  97413. });
  97414. geoRelationAnalystService.processAsync(params);
  97415. }
  97416. /**
  97417. * @function SpatialAnalystService.prototype.interpolationAnalysis
  97418. * @description 插值分析。
  97419. * @param {InterpolationRBFAnalystParameters|InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationKrigingAnalystParameters} params - 样条插值分析参数类。
  97420. * @param {RequestCallback} callback 回调函数。
  97421. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97422. */
  97423. interpolationAnalysis(params, callback, resultFormat) {
  97424. var me = this;
  97425. var interpolationAnalystService = new InterpolationAnalystService(me.url, {
  97426. proxy: me.options.proxy,
  97427. withCredentials: me.options.withCredentials,
  97428. crossOrigin: me.options.crossOrigin,
  97429. headers: me.options.headers,
  97430. eventListeners: {
  97431. scope: me,
  97432. processCompleted: callback,
  97433. processFailed: callback
  97434. },
  97435. format: me._processFormat(resultFormat)
  97436. });
  97437. interpolationAnalystService.processAsync(params);
  97438. }
  97439. /**
  97440. * @function SpatialAnalystService.prototype.mathExpressionAnalysis
  97441. * @description 栅格代数运算。
  97442. * @param {MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
  97443. * @param {RequestCallback} callback 回调函数。
  97444. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97445. */
  97446. mathExpressionAnalysis(params, callback, resultFormat) {
  97447. var me = this;
  97448. var mathExpressionAnalysisService = new MathExpressionAnalysisService(me.url, {
  97449. proxy: me.options.proxy,
  97450. withCredentials: me.options.withCredentials,
  97451. crossOrigin: me.options.crossOrigin,
  97452. headers: me.options.headers,
  97453. eventListeners: {
  97454. scope: me,
  97455. processCompleted: callback,
  97456. processFailed: callback
  97457. },
  97458. format: me._processFormat(resultFormat)
  97459. });
  97460. mathExpressionAnalysisService.processAsync(params);
  97461. }
  97462. /**
  97463. * @function SpatialAnalystService.prototype.overlayAnalysis
  97464. * @description 叠加分析。
  97465. * @param {DatasetOverlayAnalystParameters|GeometryOverlayAnalystParameters} params - 数据集叠加分析参数类或几何对象叠加分析参数类。
  97466. * @param {RequestCallback} callback 回调函数。
  97467. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97468. */
  97469. overlayAnalysis(params, callback, resultFormat) {
  97470. var me = this;
  97471. var overlayAnalystService = new OverlayAnalystService(me.url, {
  97472. proxy: me.options.proxy,
  97473. withCredentials: me.options.withCredentials,
  97474. crossOrigin: me.options.crossOrigin,
  97475. headers: me.options.headers,
  97476. eventListeners: {
  97477. scope: me,
  97478. processCompleted: callback,
  97479. processFailed: callback
  97480. },
  97481. format: me._processFormat(resultFormat)
  97482. });
  97483. overlayAnalystService.processAsync(params);
  97484. }
  97485. /**
  97486. * @function SpatialAnalystService.prototype.routeCalculateMeasure
  97487. * @description 路由测量计算。
  97488. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  97489. * @param {RequestCallback} callback 回调函数。
  97490. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97491. */
  97492. routeCalculateMeasure(params, callback, resultFormat) {
  97493. var me = this;
  97494. var routeCalculateMeasureService = new RouteCalculateMeasureService(me.url, {
  97495. proxy: me.options.proxy,
  97496. withCredentials: me.options.withCredentials,
  97497. crossOrigin: me.options.crossOrigin,
  97498. headers: me.options.headers,
  97499. eventListeners: {
  97500. scope: me,
  97501. processCompleted: callback,
  97502. processFailed: callback
  97503. },
  97504. format: me._processFormat(resultFormat)
  97505. });
  97506. routeCalculateMeasureService.processAsync(params);
  97507. }
  97508. /**
  97509. * @function SpatialAnalystService.prototype.routeLocate
  97510. * @description 路由定位。
  97511. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  97512. * @param {RequestCallback} callback 回调函数。
  97513. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97514. */
  97515. routeLocate(params, callback, resultFormat) {
  97516. var me = this;
  97517. var routeLocatorService = new RouteLocatorService(me.url, {
  97518. proxy: me.options.proxy,
  97519. withCredentials: me.options.withCredentials,
  97520. crossOrigin: me.options.crossOrigin,
  97521. headers: me.options.headers,
  97522. eventListeners: {
  97523. scope: me,
  97524. processCompleted: callback,
  97525. processFailed: callback
  97526. },
  97527. format: me._processFormat(resultFormat)
  97528. });
  97529. routeLocatorService.processAsync(params);
  97530. }
  97531. /**
  97532. * @function SpatialAnalystService.prototype.surfaceAnalysis
  97533. * @description 表面分析。
  97534. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  97535. * @param {RequestCallback} callback 回调函数。
  97536. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97537. */
  97538. surfaceAnalysis(params, callback, resultFormat) {
  97539. var me = this;
  97540. var surfaceAnalystService = new SurfaceAnalystService(me.url, {
  97541. proxy: me.options.proxy,
  97542. withCredentials: me.options.withCredentials,
  97543. crossOrigin: me.options.crossOrigin,
  97544. headers: me.options.headers,
  97545. eventListeners: {
  97546. scope: me,
  97547. processCompleted: callback,
  97548. processFailed: callback
  97549. },
  97550. format: me._processFormat(resultFormat)
  97551. });
  97552. surfaceAnalystService.processAsync(params);
  97553. }
  97554. /**
  97555. * @function SpatialAnalystService.prototype.terrainCurvatureCalculate
  97556. * @description 地形曲率计算。
  97557. * @param {TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
  97558. * @param {RequestCallback} callback 回调函数。
  97559. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97560. */
  97561. terrainCurvatureCalculate(params, callback, resultFormat) {
  97562. var me = this;
  97563. var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService(me.url, {
  97564. proxy: me.options.proxy,
  97565. withCredentials: me.options.withCredentials,
  97566. crossOrigin: me.options.crossOrigin,
  97567. headers: me.options.headers,
  97568. eventListeners: {
  97569. scope: me,
  97570. processCompleted: callback,
  97571. processFailed: callback
  97572. },
  97573. format: me._processFormat(resultFormat)
  97574. });
  97575. terrainCurvatureCalculationService.processAsync(params);
  97576. }
  97577. /**
  97578. * @function SpatialAnalystService.prototype.thiessenAnalysis
  97579. * @description 泰森多边形分析。
  97580. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
  97581. * @param {RequestCallback} callback 回调函数。
  97582. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97583. */
  97584. thiessenAnalysis(params, callback, resultFormat) {
  97585. var me = this;
  97586. var thiessenAnalystService = new ThiessenAnalystService(me.url, {
  97587. proxy: me.options.proxy,
  97588. withCredentials: me.options.withCredentials,
  97589. crossOrigin: me.options.crossOrigin,
  97590. headers: me.options.headers,
  97591. eventListeners: {
  97592. scope: me,
  97593. processCompleted: callback,
  97594. processFailed: callback
  97595. },
  97596. format: me._processFormat(resultFormat)
  97597. });
  97598. thiessenAnalystService.processAsync(params);
  97599. }
  97600. /**
  97601. * @function SpatialAnalystService.prototype.geometrybatchAnalysis
  97602. * @description 批量空间分析。
  97603. * @param {Array.<Object>} params - 批量分析参数对象数组。
  97604. * @param {Array.<Object>} params.analystName - 空间分析方法的名称。包括:</br>
  97605. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  97606. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  97607. * {@link GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  97608. * {@link GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  97609. * {@link InterpolationAnalystParameters} 插值分析参数类。</br>
  97610. * {@link SurfaceAnalystParameters} 表面分析参数类。</br>
  97611. * @param {RequestCallback} callback - 回调函数。
  97612. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97613. */
  97614. geometrybatchAnalysis(params, callback, resultFormat) {
  97615. var me = this;
  97616. var geometryBatchAnalystService = new GeometryBatchAnalystService(me.url, {
  97617. eventListeners: {
  97618. scope: me,
  97619. processCompleted: callback,
  97620. processFailed: callback
  97621. },
  97622. format: me._processFormat(resultFormat)
  97623. });
  97624. //处理批量分析中各个分类类型的参数:
  97625. var analystParameters = [];
  97626. for (var i = 0; i < params.length; i++) {
  97627. var tempParameter = params[i];
  97628. analystParameters.push({
  97629. analystName: tempParameter.analystName,
  97630. param: tempParameter.param
  97631. })
  97632. }
  97633. geometryBatchAnalystService.processAsync(analystParameters);
  97634. }
  97635. _processFormat(resultFormat) {
  97636. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  97637. }
  97638. }
  97639. ;// CONCATENATED MODULE: ./src/openlayers/services/SpatialAnalystService.js
  97640. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  97641. * This program are made available under the terms of the Apache License, Version 2.0
  97642. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  97643. /**
  97644. * @class SpatialAnalystService
  97645. * @extends {ServiceBase}
  97646. * @category iServer SpatialAnalyst
  97647. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  97648. * @modulecategory Services
  97649. * @example
  97650. * new SpatialAnalystService(url).bufferAnalysis(params,function(result){
  97651. * //doSomething
  97652. * })
  97653. * @param {string} url - 服务地址。
  97654. * @param {Object} options - 参数。
  97655. * @param {string} [options.proxy] - 服务代理地址。
  97656. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  97657. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  97658. * @param {Object} [options.headers] - 请求头。
  97659. * @usage
  97660. */
  97661. class SpatialAnalystService extends ServiceBase {
  97662. constructor(url, options) {
  97663. super(url, options);
  97664. this._spatialAnalystService = new SpatialAnalystService_SpatialAnalystService(url, options);
  97665. }
  97666. /**
  97667. * @function SpatialAnalystService.prototype.getAreaSolarRadiationResult
  97668. * @description 地区太阳辐射。
  97669. * @param {AreaSolarRadiationParameters} params - 地区太阳辐射参数类。
  97670. * @param {RequestCallback} callback 回调函数。
  97671. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97672. */
  97673. getAreaSolarRadiationResult(params, callback, resultFormat) {
  97674. this._spatialAnalystService.getAreaSolarRadiationResult(params, callback, resultFormat);
  97675. }
  97676. /**
  97677. * @function SpatialAnalystService.prototype.bufferAnalysis
  97678. * @description 缓冲区分析。
  97679. * @param {DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
  97680. * @param {RequestCallback} callback 回调函数。
  97681. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97682. */
  97683. bufferAnalysis(params, callback, resultFormat) {
  97684. params = this._processParams(params);
  97685. this._spatialAnalystService.bufferAnalysis(params, callback, resultFormat);
  97686. }
  97687. /**
  97688. * @function SpatialAnalystService.prototype.densityAnalysis
  97689. * @description 点密度分析。
  97690. * @param {DensityKernelAnalystParameters} params - 核密度分析参数类。
  97691. * @param {RequestCallback} callback 回调函数。
  97692. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97693. */
  97694. densityAnalysis(params, callback, resultFormat) {
  97695. params = this._processParams(params);
  97696. this._spatialAnalystService.densityAnalysis(params, callback, resultFormat);
  97697. }
  97698. /**
  97699. * @function SpatialAnalystService.prototype.generateSpatialData
  97700. * @description 动态分段分析。
  97701. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  97702. * @param {RequestCallback} callback 回调函数。
  97703. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97704. */
  97705. generateSpatialData(params, callback, resultFormat) {
  97706. this._spatialAnalystService.generateSpatialData(params, callback, resultFormat);
  97707. }
  97708. /**
  97709. * @function SpatialAnalystService.prototype.geoRelationAnalysis
  97710. * @description 空间关系分析。
  97711. * @param {GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
  97712. * @param {RequestCallback} callback 回调函数。
  97713. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97714. */
  97715. geoRelationAnalysis(params, callback, resultFormat) {
  97716. params = this._processParams(params);
  97717. this._spatialAnalystService.geoRelationAnalysis(params, callback, resultFormat);
  97718. }
  97719. /**
  97720. * @function SpatialAnalystService.prototype.interpolationAnalysis
  97721. * @description 插值分析。
  97722. * @param {InterpolationRBFAnalystParameters|InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationKrigingAnalystParameters} params - 样条插值分析参数类。
  97723. * @param {RequestCallback} callback 回调函数。
  97724. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97725. */
  97726. interpolationAnalysis(params, callback, resultFormat) {
  97727. params = this._processParams(params);
  97728. this._spatialAnalystService.interpolationAnalysis(params, callback, resultFormat);
  97729. }
  97730. /**
  97731. * @function SpatialAnalystService.prototype.mathExpressionAnalysis
  97732. * @description 栅格代数运算。
  97733. * @param {MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
  97734. * @param {RequestCallback} callback 回调函数。
  97735. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97736. */
  97737. mathExpressionAnalysis(params, callback, resultFormat) {
  97738. params = this._processParams(params);
  97739. this._spatialAnalystService.mathExpressionAnalysis(params, callback, resultFormat);
  97740. }
  97741. /**
  97742. * @function SpatialAnalystService.prototype.overlayAnalysis
  97743. * @description 叠加分析。
  97744. * @param {DatasetOverlayAnalystParameters|GeometryOverlayAnalystParameters} params - 数据集叠加分析参数类或几何对象叠加分析参数类。
  97745. * @param {RequestCallback} callback 回调函数。
  97746. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97747. */
  97748. overlayAnalysis(params, callback, resultFormat) {
  97749. params = this._processParams(params);
  97750. this._spatialAnalystService.overlayAnalysis(params, callback, resultFormat);
  97751. }
  97752. /**
  97753. * @function SpatialAnalystService.prototype.routeCalculateMeasure
  97754. * @description 路由测量计算。
  97755. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  97756. * @param {RequestCallback} callback 回调函数。
  97757. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97758. */
  97759. routeCalculateMeasure(params, callback, resultFormat) {
  97760. params = this._processParams(params);
  97761. this._spatialAnalystService.routeCalculateMeasure(params, callback, resultFormat);
  97762. }
  97763. /**
  97764. * @function SpatialAnalystService.prototype.routeLocate
  97765. * @description 路由定位。
  97766. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  97767. * @param {RequestCallback} callback 回调函数。
  97768. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97769. */
  97770. routeLocate(params, callback, resultFormat) {
  97771. params = this._processParams(params);
  97772. this._spatialAnalystService.routeLocate(params, callback, resultFormat);
  97773. }
  97774. /**
  97775. * @function SpatialAnalystService.prototype.surfaceAnalysis
  97776. * @description 表面分析。
  97777. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  97778. * @param {RequestCallback} callback 回调函数。
  97779. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97780. */
  97781. surfaceAnalysis(params, callback, resultFormat) {
  97782. params = this._processParams(params);
  97783. this._spatialAnalystService.surfaceAnalysis(params, callback, resultFormat);
  97784. }
  97785. /**
  97786. * @function SpatialAnalystService.prototype.terrainCurvatureCalculate
  97787. * @description 地形曲率计算。
  97788. * @param {TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
  97789. * @param {RequestCallback} callback 回调函数。
  97790. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97791. */
  97792. terrainCurvatureCalculate(params, callback, resultFormat) {
  97793. this._spatialAnalystService.terrainCurvatureCalculate(params, callback, resultFormat);
  97794. }
  97795. /**
  97796. * @function SpatialAnalystService.prototype.thiessenAnalysis
  97797. * @description 泰森多边形分析。
  97798. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
  97799. * @param {RequestCallback} callback 回调函数。
  97800. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97801. */
  97802. thiessenAnalysis(params, callback, resultFormat) {
  97803. params = this._processParams(params);
  97804. this._spatialAnalystService.thiessenAnalysis(params, callback, resultFormat);
  97805. }
  97806. /**
  97807. * @function SpatialAnalystService.prototype.geometrybatchAnalysis
  97808. * @description 批量空间分析。
  97809. * @param {Array.<Object>} params - 批量分析参数对象数组。
  97810. * @param {Array.<Object>} params.analystName - 空间分析方法的名称。包括:</br>
  97811. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  97812. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  97813. * {@link GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  97814. * {@link GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  97815. * {@link InterpolationAnalystParameters} 插值分析参数类。</br>
  97816. * {@link SurfaceAnalystParameters} 表面分析参数类。</br>
  97817. * @param {RequestCallback} callback - 回调函数。
  97818. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  97819. */
  97820. geometrybatchAnalysis(params, callback, resultFormat) {
  97821. for (var i = 0; i < params.length; i++) {
  97822. params[i].param = this._processParams(params[i].param)
  97823. }
  97824. this._spatialAnalystService.geometrybatchAnalysis(params, callback, resultFormat);
  97825. }
  97826. _processParams(params) {
  97827. if (!params) {
  97828. return {};
  97829. }
  97830. if (params.bounds) {
  97831. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  97832. }
  97833. if (params.inputPoints) {
  97834. for (let i = 0; i < params.inputPoints.length; i++) {
  97835. var inputPoint = params.inputPoints[i];
  97836. if (core_Util_Util.isArray(inputPoint)) {
  97837. params.inputPoints[i] = {x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2]};
  97838. } else {
  97839. params.inputPoints[i] = {
  97840. x: inputPoint.getCoordinates()[0],
  97841. y: inputPoint.getCoordinates()[1],
  97842. tag: inputPoint.tag
  97843. };
  97844. }
  97845. }
  97846. }
  97847. if (params.points) {
  97848. for (let i = 0; i < params.points.length; i++) {
  97849. let point = params.points[i];
  97850. if (core_Util_Util.isArray(point)) {
  97851. point.setCoordinates(point);
  97852. }
  97853. params.points[i] = new Point(point.getCoordinates()[0], point.getCoordinates()[1]);
  97854. }
  97855. }
  97856. if (params.point) {
  97857. let point = params.point;
  97858. if (core_Util_Util.isArray(point)) {
  97859. point.setCoordinates(point);
  97860. }
  97861. params.point = new Point(point.getCoordinates()[0], point.getCoordinates()[1]);
  97862. }
  97863. if (params.extractRegion) {
  97864. params.extractRegion = this.convertGeometry(params.extractRegion);
  97865. }
  97866. if (params.extractParameter && params.extractParameter.clipRegion) {
  97867. params.extractParameter.clipRegion = this.convertGeometry(params.extractParameter.clipRegion);
  97868. }
  97869. if (params.clipParam && params.clipParam.clipRegion) {
  97870. params.clipParam.clipRegion = this.convertGeometry(params.clipParam.clipRegion);
  97871. }
  97872. //支持格式:Vector Layers; GeoJson
  97873. if (params.sourceGeometry) {
  97874. var SRID = null;
  97875. if (params.sourceGeometrySRID) {
  97876. SRID = params.sourceGeometrySRID;
  97877. }
  97878. params.sourceGeometry = this.convertGeometry(params.sourceGeometry);
  97879. if (SRID) {
  97880. params.sourceGeometry.SRID = SRID;
  97881. }
  97882. delete params.sourceGeometry.sourceGeometrySRID;
  97883. }
  97884. if (params.operateGeometry) {
  97885. params.operateGeometry = this.convertGeometry(params.operateGeometry);
  97886. }
  97887. //支持传入多个几何要素进行叠加分析:
  97888. if (params.sourceGeometries) {
  97889. var sourceGeometries = [];
  97890. for (var k = 0; k < params.sourceGeometries.length; k++) {
  97891. sourceGeometries.push(this.convertGeometry(params.sourceGeometries[k]));
  97892. }
  97893. params.sourceGeometries = sourceGeometries;
  97894. }
  97895. //支持传入多个几何要素进行叠加分析:
  97896. if (params.operateGeometries) {
  97897. var operateGeometries = [];
  97898. for (var j = 0; j < params.operateGeometries.length; j++) {
  97899. operateGeometries.push(this.convertGeometry(params.operateGeometries[j]));
  97900. }
  97901. params.operateGeometries = operateGeometries;
  97902. }
  97903. if (params.sourceRoute) {
  97904. if (params.sourceRoute instanceof (external_ol_geom_LineString_default()) && params.sourceRoute.getCoordinates()) {
  97905. var target = {};
  97906. target.type = "LINEM";
  97907. target.parts = [params.sourceRoute.getCoordinates()[0].length];
  97908. target.points = [];
  97909. for (let i = 0; i < params.sourceRoute.getCoordinates()[0].length; i++) {
  97910. let point = params.sourceRoute.getCoordinates()[0][i];
  97911. target.points = target.points.concat({x: point[0], y: point[1], measure: point[2]})
  97912. }
  97913. params.sourceRoute = target;
  97914. }
  97915. }
  97916. var me = this;
  97917. if (params.operateRegions && core_Util_Util.isArray(params.operateRegions)) {
  97918. params.operateRegions.map(function (geometry, key) {
  97919. params.operateRegions[key] = me.convertGeometry(geometry);
  97920. return params.operateRegions[key];
  97921. });
  97922. }
  97923. if (params.sourceRoute && params.sourceRoute.components && core_Util_Util.isArray(params.sourceRoute.components)) {
  97924. params.sourceRoute.components.map(function (geometry, key) {
  97925. params.sourceRoute.components[key] = me.convertGeometry(geometry);
  97926. return params.sourceRoute.components[key];
  97927. });
  97928. }
  97929. return params;
  97930. }
  97931. _processFormat(resultFormat) {
  97932. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  97933. }
  97934. /**
  97935. * @private
  97936. * @function SpatialAnalystService.prototype.convertGeometry
  97937. * @description 转换几何对象。
  97938. * @param {Object} ol3Geometry - 待转换的几何对象。
  97939. */
  97940. convertGeometry(ol3Geometry) {
  97941. //判断是否传入的是geojson 并作相应处理
  97942. if(["FeatureCollection", "Feature", "Geometry"].indexOf(ol3Geometry.type) != -1){
  97943. return core_Util_Util.toSuperMapGeometry(ol3Geometry);
  97944. }
  97945. return core_Util_Util.toSuperMapGeometry(JSON.parse((new (external_ol_format_GeoJSON_default())()).writeGeometry(ol3Geometry)));
  97946. }
  97947. }
  97948. ;// CONCATENATED MODULE: ./src/openlayers/services/ThemeService.js
  97949. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  97950. * This program are made available under the terms of the Apache License, Version 2.0
  97951. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  97952. /**
  97953. * @class ThemeService
  97954. * @category iServer Map Theme
  97955. * @classdesc 专题图服务类。
  97956. * @modulecategory Services
  97957. * @extends {ServiceBase}
  97958. * @example
  97959. * new ThemeService(url,{
  97960. * projection:projection
  97961. * }).getThemeInfo(params,function(result){
  97962. * //doSomething
  97963. * });
  97964. * @param {string} url - 服务地址。
  97965. * @param {Object} options - 参数。
  97966. * @param {string} [options.proxy] - 服务代理地址。
  97967. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  97968. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  97969. * @param {Object} [options.headers] - 请求头。
  97970. * @usage
  97971. */
  97972. class ThemeService extends ServiceBase {
  97973. constructor(url, options) {
  97974. super(url, options);
  97975. var me = this;
  97976. this._themeService = new ThemeService_ThemeService(me.url, {
  97977. proxy: me.options.proxy,
  97978. withCredentials: me.options.withCredentials,
  97979. crossOrigin: me.options.crossOrigin,
  97980. headers: me.options.headers
  97981. });
  97982. }
  97983. /**
  97984. * @function ThemeService.prototype.getThemeInfo
  97985. * @description 获取专题图信息。
  97986. * @param {ThemeParameters} params - 专题图参数类。
  97987. * @param {RequestCallback} callback 回调函数。
  97988. */
  97989. getThemeInfo(params, callback) {
  97990. this._themeService.processAsync(params, callback);
  97991. }
  97992. }
  97993. ;// CONCATENATED MODULE: ./src/common/iServer/TrafficTransferAnalystService.js
  97994. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  97995. * This program are made available under the terms of the Apache License, Version 2.0
  97996. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  97997. /**
  97998. * @class TrafficTransferAnalystService
  97999. * @extends {ServiceBase}
  98000. * @category iServer TrafficTransferAnalyst
  98001. * @classdesc 交通换乘分析服务类。
  98002. * @example
  98003. * new TrafficTransferAnalystService(url).queryStop(params,function(result){
  98004. * //doSomething
  98005. * })
  98006. * @param {string} url - 服务地址。
  98007. * @param {Object} options - 参数。
  98008. * @param {string} [options.proxy] - 服务代理地址。
  98009. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98010. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98011. * @param {Object} [options.headers] - 请求头。
  98012. * @usage
  98013. */
  98014. class TrafficTransferAnalystService_TrafficTransferAnalystService {
  98015. constructor(url, options) {
  98016. this.url = url;
  98017. this.options = options || {};
  98018. }
  98019. /**
  98020. * @function TrafficTransferAnalystService.prototype.queryStop
  98021. * @description 站点查询服务。
  98022. * @param {StopQueryParameters} params - 查询相关参数类。
  98023. * @param {RequestCallback} callback - 回调函数。
  98024. */
  98025. queryStop(params, callback) {
  98026. var me = this;
  98027. var stopQueryService = new StopQueryService(me.url, {
  98028. proxy: me.options.proxy,
  98029. withCredentials: me.options.withCredentials,
  98030. crossOrigin: me.options.crossOrigin,
  98031. headers: me.options.headers,
  98032. eventListeners: {
  98033. scope: me,
  98034. processCompleted: callback,
  98035. processFailed: callback
  98036. }
  98037. });
  98038. stopQueryService.processAsync(params);
  98039. }
  98040. /**
  98041. * @function TrafficTransferAnalystService.prototype.analysisTransferPath
  98042. * @description 交通换乘线路查询服务。
  98043. * @param {TransferPathParameters} params - 查询相关参数类。
  98044. * @param {RequestCallback} callback - 回调函数。
  98045. */
  98046. analysisTransferPath(params, callback) {
  98047. var me = this;
  98048. var transferPathService = new TransferPathService(me.url, {
  98049. proxy: me.options.proxy,
  98050. withCredentials: me.options.withCredentials,
  98051. crossOrigin: me.options.crossOrigin,
  98052. headers: me.options.headers,
  98053. eventListeners: {
  98054. scope: me,
  98055. processCompleted: callback,
  98056. processFailed: callback
  98057. }
  98058. });
  98059. transferPathService.processAsync(params);
  98060. }
  98061. /**
  98062. * @function TrafficTransferAnalystService.prototype.analysisTransferSolution
  98063. * @description 交通换乘方案查询服务。
  98064. * @param {TransferSolutionParameters} params - 查询相关参数类。
  98065. * @param {RequestCallback} callback - 回调函数。
  98066. */
  98067. analysisTransferSolution(params, callback) {
  98068. var me = this;
  98069. var transferSolutionService = new TransferSolutionService(me.url, {
  98070. proxy: me.options.proxy,
  98071. withCredentials: me.options.withCredentials,
  98072. crossOrigin: me.options.crossOrigin,
  98073. headers: me.options.headers,
  98074. eventListeners: {
  98075. scope: me,
  98076. processCompleted: callback,
  98077. processFailed: callback
  98078. }
  98079. });
  98080. transferSolutionService.processAsync(params);
  98081. }
  98082. }
  98083. ;// CONCATENATED MODULE: ./src/openlayers/services/TrafficTransferAnalystService.js
  98084. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98085. * This program are made available under the terms of the Apache License, Version 2.0
  98086. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98087. /**
  98088. * @class TrafficTransferAnalystService
  98089. * @extends {ServiceBase}
  98090. * @category iServer TrafficTransferAnalyst
  98091. * @classdesc 交通换乘分析服务类。
  98092. * @modulecategory Services
  98093. * @example
  98094. * new TrafficTransferAnalystService(url).queryStop(params,function(result){
  98095. * //doSomething
  98096. * })
  98097. * @param {string} url - 服务地址。
  98098. * @param {Object} options - 参数。
  98099. * @param {string} [options.proxy] - 服务代理地址。
  98100. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98101. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98102. * @param {Object} [options.headers] - 请求头。
  98103. * @usage
  98104. */
  98105. class TrafficTransferAnalystService extends ServiceBase {
  98106. constructor(url, options) {
  98107. super(url, options);
  98108. this._commonTrafficTransferAnalystService = new TrafficTransferAnalystService_TrafficTransferAnalystService(url, options);
  98109. }
  98110. /**
  98111. * @function TrafficTransferAnalystService.prototype.queryStop
  98112. * @description 站点查询服务。
  98113. * @param {StopQueryParameters} params - 查询相关参数类。
  98114. * @param {RequestCallback} callback - 回调函数。
  98115. */
  98116. queryStop(params, callback) {
  98117. this._commonTrafficTransferAnalystService.queryStop(params, callback);
  98118. }
  98119. /**
  98120. * @function TrafficTransferAnalystService.prototype.analysisTransferPath
  98121. * @description 交通换乘线路查询服务。
  98122. * @param {TransferPathParameters} params - 查询相关参数类。
  98123. * @param {RequestCallback} callback - 回调函数。
  98124. */
  98125. analysisTransferPath(params, callback) {
  98126. params = this._processParams(params);
  98127. this._commonTrafficTransferAnalystService.analysisTransferPath(params, callback);
  98128. }
  98129. /**
  98130. * @function TrafficTransferAnalystService.prototype.analysisTransferSolution
  98131. * @description 交通换乘方案查询服务。
  98132. * @param {TransferSolutionParameters} params - 查询相关参数类。
  98133. * @param {RequestCallback} callback - 回调函数。
  98134. */
  98135. analysisTransferSolution(params, callback) {
  98136. params = this._processParams(params);
  98137. this._commonTrafficTransferAnalystService.analysisTransferSolution(params, callback);
  98138. }
  98139. _processParams(params) {
  98140. if (!params) {
  98141. return {};
  98142. }
  98143. if (params.transferLines && !core_Util_Util.isArray(params.transferLines)) {
  98144. params.transferLines = [params.transferLines];
  98145. }
  98146. if (params.points && core_Util_Util.isArray(params.points)) {
  98147. params.points.map(function (point, key) {
  98148. params.points[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  98149. x: point.getCoordinates()[0],
  98150. y: point.getCoordinates()[1]
  98151. } : point;
  98152. return params.points[key];
  98153. });
  98154. }
  98155. return params;
  98156. }
  98157. }
  98158. ;// CONCATENATED MODULE: ./src/openlayers/services/WebPrintingJobService.js
  98159. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98160. * This program are made available under the terms of the Apache License, Version 2.0
  98161. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98162. /**
  98163. * @class WebPrintingJobService
  98164. * @category iServer WebPrintingJob
  98165. * @version 10.1.0
  98166. * @classdesc Web 打印服务类。
  98167. * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。
  98168. * @modulecategory Services
  98169. * @extends {ServiceBase}
  98170. * @param {string} url - 服务地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  98171. * @param {Object} options - 服务交互时所需的可选参数。
  98172. * @param {string} [options.proxy] - 服务代理地址。
  98173. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98174. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98175. * @param {Object} [options.headers] - 请求头。
  98176. * @example
  98177. * new WebPrintingJobService(url).createWebPrintingJob(param,function(result){
  98178. * //doSomething
  98179. * })
  98180. * @usage
  98181. */
  98182. class WebPrintingJobService extends ServiceBase {
  98183. constructor(url, options) {
  98184. super(url, options);
  98185. this._webPrintingService = new WebPrintingService(this.url, {
  98186. proxy: this.options.proxy,
  98187. withCredentials:this.options.withCredentials,
  98188. crossOrigin: this.options.crossOrigin,
  98189. headers: this.options.headers
  98190. });
  98191. }
  98192. /**
  98193. * @function WebPrintingJobService.prototype.createWebPrintingJob
  98194. * @description 创建 Web 打印任务。
  98195. * @param {WebPrintingJobParameters} params - Web 打印参数类。
  98196. * @param {RequestCallback} callback - 回调函数。
  98197. */
  98198. createWebPrintingJob(params, callback) {
  98199. if (!params) {
  98200. return;
  98201. }
  98202. this._webPrintingService.createWebPrintingJob(this._processParams(params), callback);
  98203. }
  98204. /**
  98205. * @function WebPrintingJobService.prototype.getPrintingJob
  98206. * @description 获取 Web 打印输出文档任务。
  98207. * @param {string} jobId - Web 打印输入文档任务 ID。
  98208. * @param {RequestCallback} callback - 回调函数。
  98209. */
  98210. getPrintingJob(jobId, callback) {
  98211. this._webPrintingService.getPrintingJob(jobId, callback);
  98212. }
  98213. /**
  98214. * @function WebPrintingJobService.prototype.getPrintingJobResult
  98215. * @description 获取 Web 打印任务的输出文档。
  98216. * @param {string} jobId - Web 打印输入文档任务 ID。
  98217. * @param {RequestCallback} callback - 回调函数。
  98218. */
  98219. getPrintingJobResult(jobId, callback) {
  98220. this._webPrintingService.getPrintingJobResult(jobId, callback);
  98221. }
  98222. /**
  98223. * @function WebPrintingJobService.prototype.getLayoutTemplates
  98224. * @description 查询 Web 打印服务所有可用的模板信息。
  98225. * @param {RequestCallback} callback - 回调函数。
  98226. */
  98227. getLayoutTemplates(callback) {
  98228. this._webPrintingService.getLayoutTemplates(callback);
  98229. }
  98230. _processParams(params) {
  98231. if (params.layoutOptions && params.layoutOptions.littleMapOptions) {
  98232. params.layoutOptions.littleMapOptions.center = this._toPointObject(
  98233. params.layoutOptions.littleMapOptions.center
  98234. );
  98235. }
  98236. if (params.exportOptions) {
  98237. params.exportOptions.center = this._toPointObject(params.exportOptions.center);
  98238. }
  98239. return params;
  98240. }
  98241. _toPointObject(point) {
  98242. if (Array.isArray(point)) {
  98243. return {
  98244. x: point[0],
  98245. y: point[1]
  98246. };
  98247. } else if (point instanceof Point || point instanceof (external_ol_geom_Point_default())) {
  98248. return {
  98249. x: point.x,
  98250. y: point.y
  98251. };
  98252. }
  98253. return point;
  98254. }
  98255. }
  98256. ;// CONCATENATED MODULE: ./src/openlayers/services/ImageService.js
  98257. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98258. * This program are made available under the terms of the Apache License, Version 2.0
  98259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98260. /**
  98261. * @class ImageService
  98262. * @version 10.2.0
  98263. * @constructs ImageService
  98264. * @classdesc 影像服务类。
  98265. * @modulecategory Services
  98266. * @category iServer Image
  98267. * @extends {ServiceBase}
  98268. * @example
  98269. * ImageService(url,options).getCollections(function(result){
  98270. * //doSomething
  98271. * })
  98272. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  98273. * @param {Object} options - 参数。
  98274. * @param {string} [options.proxy] - 服务代理地址。
  98275. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98276. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98277. * @param {Object} [options.headers] - 请求头。
  98278. * @usage
  98279. */
  98280. class ImageService extends ServiceBase {
  98281. constructor(url, options) {
  98282. super(url, options);
  98283. this._imageService = new ImageService_ImageService(this.url, {
  98284. proxy: this.options.proxy,
  98285. withCredentials: this.options.withCredentials,
  98286. crossOrigin: this.options.crossOrigin,
  98287. headers: this.options.headers
  98288. });
  98289. }
  98290. /**
  98291. * @function ImageService.prototype.getCollections
  98292. * @description 返回当前影像服务中的影像集合列表(Collections)。
  98293. * @param {RequestCallback} callback - 回调函数。
  98294. */
  98295. getCollections(callback) {
  98296. this._imageService.getCollections(callback);
  98297. }
  98298. /**
  98299. * @function ImageService.prototype.getCollectionByID
  98300. * @description ID值等于`collectionId`参数值的影像集合(Collection)。ID值用于在服务中唯一标识该影像集合。
  98301. * @param {string} collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  98302. * @param {RequestCallback} callback - 回调函数。
  98303. */
  98304. getCollectionByID(collectionId, callback) {
  98305. this._imageService.getCollectionByID(collectionId, callback);
  98306. }
  98307. /**
  98308. * @function ImageService.prototype.search
  98309. * @description 查询与过滤条件匹配的影像数据。
  98310. * @param {ImageSearchParameter} [itemSearch] 查询参数。
  98311. * @param {RequestCallback} callback - 回调函数。
  98312. */
  98313. search(itemSearch, callback) {
  98314. this._imageService.search(itemSearch, callback);
  98315. }
  98316. }
  98317. ;// CONCATENATED MODULE: ./src/openlayers/services/ImageCollectionService.js
  98318. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98319. * This program are made available under the terms of the Apache License, Version 2.0
  98320. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98321. /**
  98322. * @class ImageCollectionService
  98323. * @version 10.2.0
  98324. * @constructs ImageCollectionService
  98325. * @classdesc 影像集合服务类。
  98326. * @modulecategory Services
  98327. * @category iServer Image
  98328. * @extends {ServiceBase}
  98329. * @example
  98330. * new ImageCollectionService(url,options).getLegend(queryParams,function(result){
  98331. * //doSomething
  98332. * })
  98333. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  98334. * @param {Object} options - 参数。
  98335. * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  98336. * @param {string} [options.proxy] - 服务代理地址。
  98337. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  98338. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  98339. * @param {Object} [options.headers] - 请求头。
  98340. * @usage
  98341. */
  98342. class ImageCollectionService extends ServiceBase {
  98343. constructor(url, options) {
  98344. super(url, options);
  98345. this._imageCollectionService = new ImageCollectionService_ImageCollectionService(this.url, {
  98346. collectionId: this.options.collectionId,
  98347. proxy: this.options.proxy,
  98348. withCredentials: this.options.withCredentials,
  98349. crossOrigin: this.options.crossOrigin,
  98350. headers: this.options.headers
  98351. });
  98352. }
  98353. /**
  98354. * @function ImageCollectionService.prototype.getLegend
  98355. * @param {Object} queryParams query参数。
  98356. * @param {ImageRenderingRule} [queryParams.renderingRule] 指定影像显示的风格,包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。不指定时,使用发布服务时所配置的风格。
  98357. * @param {RequestCallback} callback - 回调函数。
  98358. */
  98359. getLegend(queryParams, callback) {
  98360. this._imageCollectionService.getLegend(queryParams, callback);
  98361. }
  98362. /**
  98363. * @function ImageCollectionService.prototype.getStatistics
  98364. * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
  98365. * @param {RequestCallback} callback - 回调函数。
  98366. */
  98367. getStatistics(callback) {
  98368. this._imageCollectionService.getStatistics(callback);
  98369. }
  98370. /**
  98371. * @function ImageCollectionService.prototype.getTileInfo
  98372. * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
  98373. * @param {RequestCallback} callback - 回调函数。
  98374. */
  98375. getTileInfo(callback) {
  98376. this._imageCollectionService.getTileInfo(callback);
  98377. }
  98378. /**
  98379. * @function ImageCollectionService.prototype.deleteItemByID
  98380. * @description 删除影像集合中的指定ID(`featureId`)的Item对象,即从影像集合中删除指定的影像。
  98381. * @param {string} featureId Feature 的本地标识符。
  98382. * @param {RequestCallback} callback - 回调函数。
  98383. */
  98384. deleteItemByID(featureId, callback) {
  98385. this._imageCollectionService.deleteItemByID(featureId, callback);
  98386. }
  98387. /**
  98388. * @function ImageCollectionService.prototype.getItemByID
  98389. * @description 返回影像集合中的指定ID(`featureId`)的Item对象,即返回影像集合中指定的影像。
  98390. * @param {string} featureId Feature 的本地标识符。
  98391. * @param {RequestCallback} callback - 回调函数。
  98392. */
  98393. getItemByID(featureId, callback) {
  98394. this._imageCollectionService.getItemByID(featureId, callback);
  98395. }
  98396. }
  98397. ;// CONCATENATED MODULE: ./src/openlayers/services/index.js
  98398. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98399. * This program are made available under the terms of the Apache License, Version 2.0
  98400. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98401. ;// CONCATENATED MODULE: ./src/openlayers/mapping/webmap/config/ProvinceCenter.json
  98402. const ProvinceCenter_namespaceObject = JSON.parse('[{"name":"黑龙江省","coord":[127.64559817675396,48.48668098449708]},{"name":"内蒙古自治区","coord":[118.34519572208615,45.370218276977525]},{"name":"新疆维吾尔自治区","coord":[87.13479065593184,41.75497055053711]},{"name":"吉林省","coord":[126.12985278813787,43.57983207702637]},{"name":"辽宁省","coord":[124.02494773936439,41.105743408203125]},{"name":"甘肃省","coord":[102.87785725633012,37.69582366943361]},{"name":"河北省","coord":[115.66327227481898,39.33383178710938]},{"name":"北京市","coord":[116.62199343603638,40.25053787231445]},{"name":"山西省","coord":[112.45180235808988,37.666561126708984]},{"name":"天津市","coord":[117.35711842642581,39.406789779663086]},{"name":"陕西省","coord":[109.56294003056632,35.64754199981689]},{"name":"宁夏回族自治区","coord":[105.96110877640074,37.3081169128418]},{"name":"青海省","coord":[96.07301048277901,35.44417190551758]},{"name":"山东省","coord":[118.03833752951093,36.29800605773925]},{"name":"西藏自治区","coord":[87.47361520439412,31.6703872680664]},{"name":"河南省","coord":[113.07832397097275,33.87751102447509]},{"name":"江苏省","coord":[119.93926538201052,32.945452690124505]},{"name":"安徽省","coord":[117.15146765881019,32.024482727050774]},{"name":"四川省","coord":[102.28998890142759,30.182161331176758]},{"name":"湖北省","coord":[112.87798261431585,31.157071113586426]},{"name":"重庆市","coord":[107.870126637831,30.188085556030266]},{"name":"上海市","coord":[121.42561166015514,31.276043891906745]},{"name":"浙江省","coord":[119.75337092707514,29.175934791564945]},{"name":"湖南省","coord":[111.52770282777405,27.38110256195069]},{"name":"江西省","coord":[115.51091280655628,27.283511161804206]},{"name":"云南省","coord":[101.27053825991308,25.19783210754396]},{"name":"贵州省","coord":[106.49672346773299,26.92267990112305]},{"name":"福建省","coord":[117.9976766946587,25.939599990844727]},{"name":"广西壮族自治区","coord":[108.98706831086302,23.891559600830078]},{"name":"台湾省","coord":[120.82468432537434,23.602651596069336]},{"name":"香港特别行政区","coord":[114.21036850371561,22.374858856201172]},{"name":"海南省","coord":[109.62792940960824,19.163116455078125]},{"name":"广东省","coord":[113.32127888266032,22.873867034912106]},{"name":"澳门特别行政区","coord":[113.56819996291901,22.160347992976]}]');
  98403. ;// CONCATENATED MODULE: ./src/openlayers/mapping/webmap/config/MunicipalCenter.json
  98404. const MunicipalCenter_namespaceObject = JSON.parse('[{"name":"克拉玛依市","coord":[85.01486759299489,45.406422237230046]},{"name":"昌吉回族自治州","coord":[88.7154624754753,44.26991024636568]},{"name":"石河子市","coord":[86.0208600035924,44.239045558096805]},{"name":"霍林郭勒市","coord":[114.73479243733115,44.16058374713977]},{"name":"本溪市","coord":[124.64357865201586,41.177197783134275]},{"name":"嘉峪关市","coord":[98.16891560537093,39.76279786284264]},{"name":"莱芜市","coord":[117.65723565456207,36.27916499211527]},{"name":"神农架林区","coord":[110.48296222218153,31.581260143666697]},{"name":"天门市","coord":[113.00615321481195,30.64105781887143]},{"name":"鄂州市","coord":[114.94764081970385,30.325634953844585]},{"name":"潜江市","coord":[112.70703817700621,30.349210666019893]},{"name":"仙桃市","coord":[113.34688900729822,30.315951161935402]},{"name":"萍乡市","coord":[113.88072263074415,27.47193090553213]},{"name":"台湾省","coord":[120.14338943402045,23.596002465926095]},{"name":"东莞市","coord":[113.89443658529342,22.897826158636448]},{"name":"中山市","coord":[113.37118387764659,22.501478858616522]},{"name":"珠海市","coord":[113.21799258934986,22.23782602992192]},{"name":"北海市","coord":[109.18248083043899,21.695773689750148]},{"name":"香港","coord":[114.20689279508653,22.36016760139811]},{"name":"舟山市","coord":[122.22514712841459,30.338633120695956]},{"name":"克孜勒苏柯尔克孜","coord":[74.62910472637343,39.59886016069875]},{"name":"喀什地区","coord":[77.19899922143753,37.85462871211595]},{"name":"阿克苏地区","coord":[81.43930290016381,41.067304799230456]},{"name":"和田地区","coord":[80.69780509160952,36.95287032287055]},{"name":"阿里地区","coord":[82.536487505389,32.69566569631762]},{"name":"日喀则地区","coord":[86.5996831353606,29.54861754814263]},{"name":"那曲地区","coord":[88.32523292667608,33.20600450932715]},{"name":"玉树藏族自治州","coord":[95.2107128446203,33.90320387919257]},{"name":"迪庆藏族自治州","coord":[99.42465312188943,28.052797714348895]},{"name":"怒江傈傈族自治州","coord":[98.85737910439825,26.98345757528851]},{"name":"大理白族自治州","coord":[99.93934374816013,25.684737357453045]},{"name":"德宏傣族景颇族自","coord":[98.13830877778075,24.593421919561205]},{"name":"保山市","coord":[99.19031013453166,24.979380341662]},{"name":"临沧市","coord":[99.62483778975081,24.058807858948214]},{"name":"普洱市","coord":[100.94440267992684,23.44121660743221]},{"name":"西双版纳傣族自治","coord":[100.86105801845994,21.882475641324206]},{"name":"拉萨市","coord":[91.3684790613129,30.14176592960237]},{"name":"山南地区","coord":[92.11665242621062,28.33000201578789]},{"name":"林芝地区","coord":[94.9307847458166,29.125110156601963]},{"name":"昌都地区","coord":[97.33912235873476,30.48520825551814]},{"name":"丽江市","coord":[100.65713436205135,26.96190318191959]},{"name":"攀枝花市","coord":[101.73355913301131,26.714486678752795]},{"name":"凉山彝族自治州","coord":[102.08678551422615,27.683020519860396]},{"name":"楚雄彝族自治州","coord":[101.68264761198458,25.369603845264024]},{"name":"红河哈尼族彝族自","coord":[102.95101719613119,23.624860095239875]},{"name":"文山壮族苗族自治","coord":[104.8708359910614,23.579587266862504]},{"name":"百色市","coord":[106.69546907589859,23.98220841166522]},{"name":"崇左市","coord":[107.3277087317123,22.49769755349952]},{"name":"防城港市","coord":[107.88939931155171,21.94550204069006]},{"name":"南宁市","coord":[108.67078983716917,23.12207641861882]},{"name":"钦州市","coord":[108.8532307305186,22.157690108421384]},{"name":"玉林市","coord":[110.26918466489103,22.391823643610415]},{"name":"湛江市","coord":[109.93033457863683,21.086751055633457]},{"name":"茂名市","coord":[110.80336192333934,22.069184739040775]},{"name":"阳江市","coord":[111.70471342186183,22.108751366417575]},{"name":"江门市","coord":[112.53715618649149,22.297368082806777]},{"name":"广州市","coord":[113.4949302208309,23.28359314707863]},{"name":"清远市","coord":[113.10957368131268,24.334444053233856]},{"name":"肇庆市","coord":[112.11117530204233,23.60241158796112]},{"name":"梧州市","coord":[111.01709510772797,23.518132876753846]},{"name":"贺州市","coord":[111.50423061842756,24.4095096817199]},{"name":"桂林市","coord":[110.44046163393094,25.353966673735407]},{"name":"柳州市","coord":[109.34854449214147,24.972408051485047]},{"name":"河池市","coord":[107.81191841865586,24.649291651298164]},{"name":"黔东南苗族侗族自","coord":[108.39952601614591,26.429286420465576]},{"name":"贵阳市","coord":[106.59784062851153,26.797907456479816]},{"name":"安顺市","coord":[105.76161265300635,25.988644902171018]},{"name":"黔西南布依族苗族","coord":[105.5954078788574,25.404850939549405]},{"name":"曲靖市","coord":[103.9164335632742,25.697243690315265]},{"name":"六盘水市","coord":[104.77723228072432,26.15402255629164]},{"name":"毕节地区","coord":[105.03867422931839,27.077913968069666]},{"name":"昭通市","coord":[104.29730513046874,27.62418247971078]},{"name":"宜宾市","coord":[104.76748901448207,28.553501804266475]},{"name":"乐山市","coord":[103.56027669102787,29.160754519210577]},{"name":"自贡市","coord":[104.63272827056402,29.273152614922402]},{"name":"内江市","coord":[104.82644562304716,29.61272653799929]},{"name":"遵义市","coord":[106.82413636302059,28.191847588570702]},{"name":"达州市","coord":[107.59704170009518,31.32138258839703]},{"name":"遂宁市","coord":[105.48979445433736,30.677687821242678]},{"name":"广安市","coord":[106.56708164098042,30.43500706741521]},{"name":"泸州市","coord":[105.42591761727707,28.50277238478137]},{"name":"资阳市","coord":[104.97995126874034,30.154251886139654]},{"name":"雅安市","coord":[102.69931299964517,29.892630706195035]},{"name":"眉山市","coord":[104.07052881858888,29.894202166560405]},{"name":"甘孜藏族自治州","coord":[100.50721042614238,30.975216556269658]},{"name":"果洛藏族自治州","coord":[99.30775565051923,34.03539865224808]},{"name":"海南藏族自治州","coord":[100.39969108016373,35.90048272566899]},{"name":"黄南藏族自治州","coord":[101.5360706381689,35.10286360841902]},{"name":"赣南藏族自治州","coord":[102.97083885806067,34.326752803339026]},{"name":"陇南市","coord":[105.24780098912132,33.57031117443431]},{"name":"天水市","coord":[105.53503634660417,34.62320421368087]},{"name":"定西市","coord":[104.58787768541339,35.08900966621695]},{"name":"临夏回族自治州","coord":[103.2612870434902,35.591577124455235]},{"name":"西宁市","coord":[101.57680657999033,36.84800271717157]},{"name":"海东地区","coord":[102.30909850729282,36.287400615025646]},{"name":"海北藏族自治州","coord":[100.27122484450717,37.892557516083826]},{"name":"金昌市","coord":[102.02244049169511,38.497330414886164]},{"name":"酒泉市","coord":[95.94486678270127,40.56891536586272]},{"name":"海西蒙古族藏族自","coord":[94.67143298050689,36.022725148503724]},{"name":"巴音郭楞蒙古自治","coord":[88.18116214759745,39.556478810319916]},{"name":"哈密地区","coord":[93.84302392518026,42.95015211178875]},{"name":"叶鲁番地区","coord":[89.82035217277885,42.399368632283505]},{"name":"乌鲁木齐市","coord":[88.00048109561487,43.549986370786]},{"name":"阿勒泰地区","coord":[88.11213933257655,47.05593413019629]},{"name":"博尔塔拉蒙古自治","coord":[82.26402238163408,44.671135542630864]},{"name":"伊犁哈萨克自治州","coord":[82.80778717477179,43.53783381365267]},{"name":"阿拉善盟","coord":[103.29923966842289,40.10955801781495]},{"name":"武威市","coord":[102.73362058791429,37.94211141321436]},{"name":"兰州市","coord":[103.73793563506032,36.27379827886003]},{"name":"中卫市","coord":[105.6943786030716,37.20654236148948]},{"name":"银川市","coord":[106.20022174140034,38.52103167597483]},{"name":"石嘴山市","coord":[106.41544011793628,38.84054137571417]},{"name":"乌海市","coord":[106.8984175998405,39.54616572239788]},{"name":"鄂尔多斯市","coord":[108.43285571424619,39.24036799350715]},{"name":"巴彦淖尔市","coord":[107.45840392808307,41.30159860424196]},{"name":"包头市","coord":[110.46472193224272,41.48017783644221]},{"name":"呼和浩特市","coord":[111.48365173603975,40.498363056149884]},{"name":"乌兰察布市","coord":[112.61568977597707,41.75789561273154]},{"name":"大同市","coord":[113.7107192749083,39.898956799744184]},{"name":"朔州市","coord":[112.65428748167508,39.681772914701924]},{"name":"忻州市","coord":[112.36127575589583,38.88990233614568]},{"name":"榆林市","coord":[109.68473112169593,38.19921027134876]},{"name":"延安市","coord":[109.52425222161318,36.406522726136814]},{"name":"庆阳市","coord":[107.73052193155061,36.183821532624464]},{"name":"固原市","coord":[106.20191575442442,36.11634909496382]},{"name":"白银市","coord":[104.68634478137065,36.51582865625868]},{"name":"宝鸡市","coord":[107.33534779230747,34.3387216485855]},{"name":"汉中市","coord":[107.03534754266246,33.00142998064871]},{"name":"广元市","coord":[105.92928137563939,32.21872447205537]},{"name":"巴中市","coord":[107.03422410306194,31.99874720836291]},{"name":"南充市","coord":[106.32964805032347,31.156657700184095]},{"name":"绵阳市","coord":[104.58949560201106,31.88628780630976]},{"name":"德阳市","coord":[104.41542984932845,31.110558133718676]},{"name":"成都市","coord":[103.8852290010473,30.777258040348634]},{"name":"阿坝藏族羌族自治","coord":[102.26209319552814,32.45725845387284]},{"name":"安康市","coord":[109.14236501848015,32.77467694678074]},{"name":"十堰市","coord":[110.39934083416314,32.376209039347906]},{"name":"襄阳市","coord":[111.97539147094662,31.93399822417465]},{"name":"宜昌市","coord":[111.22204852395754,30.772457669035354]},{"name":"恩施市","coord":[109.42158366502872,30.260366574390105]},{"name":"张家界市","coord":[110.59760006538717,29.330107409240718]},{"name":"吉首市","coord":[109.72176899848378,28.681903937242495]},{"name":"铜仁地区","coord":[108.54247523485463,28.11736237519646]},{"name":"重庆市","coord":[107.86007108564992,30.186253395053196]},{"name":"怀化市","coord":[109.94325166787243,27.43919084801186]},{"name":"益阳市","coord":[112.43060358108062,28.75127294553697]},{"name":"娄底市","coord":[111.41891416951897,27.696312460064604]},{"name":"常德市","coord":[111.72571610131646,29.27189463838195]},{"name":"荆州市","coord":[112.65896596965268,30.05161542755362]},{"name":"荆门市","coord":[112.6586855902184,31.01267124474617]},{"name":"岳阳市","coord":[113.2595036144316,29.106247116930163]},{"name":"长沙市","coord":[113.15415586456598,28.222934680488425]},{"name":"湘潭市","coord":[112.51092596317824,27.69881544105668]},{"name":"株州市","coord":[113.49665538546823,27.03993794610501]},{"name":"衡阳市","coord":[112.48849636578527,26.783613569970782]},{"name":"邵阳市","coord":[110.6723832117475,26.81652287086792]},{"name":"永州市","coord":[111.8565364154186,25.768488267811968]},{"name":"韶关市","coord":[113.53420325850979,24.69848878771937]},{"name":"惠州市","coord":[114.32029589634925,23.25504544231892]},{"name":"佛山市","coord":[112.95925897403649,23.10116677189257]},{"name":"云浮市","coord":[111.78042514904234,22.840400494105687]},{"name":"深圳市","coord":[114.13138648919008,22.649563063468342]},{"name":"汕尾市","coord":[115.57412892884373,23.06989642104901]},{"name":"河源市","coord":[114.89746229844398,23.97971937124767]},{"name":"揭阳市","coord":[116.04290004239446,23.304802704715357]},{"name":"汕头市","coord":[116.7008461897183,23.35898625947344]},{"name":"潮州市","coord":[116.75405548481658,23.854381508863064]},{"name":"梅州市","coord":[116.13719397345734,24.15633544812716]},{"name":"漳州市","coord":[117.38279760543345,24.41111215459575]},{"name":"厦门市","coord":[118.04275971554665,24.675908246507944]},{"name":"龙岩市","coord":[116.69341144552507,25.20284542644492]},{"name":"泉州市","coord":[118.12035864630246,25.22984144365049]},{"name":"莆田市","coord":[118.82439690138142,25.439653480972687]},{"name":"福州市","coord":[119.1608285845262,25.99117532466728]},{"name":"三明市","coord":[117.51188176216434,26.318292906961602]},{"name":"南平市","coord":[118.16153136678187,27.306303151805437]},{"name":"抚州市","coord":[116.3455359885574,27.487043655935366]},{"name":"鹰潭市","coord":[117.01082360702333,28.241253742969946]},{"name":"吉安市","coord":[114.91377151807418,26.957486660664525]},{"name":"赣州市","coord":[115.046455717572,25.81565075681663]},{"name":"郴州市","coord":[113.1544526703492,25.871927095452524]},{"name":"新余市","coord":[114.94161795877827,27.79044654578371]},{"name":"宜春市","coord":[115.04574494880995,28.306428044943356]},{"name":"南昌市","coord":[115.9963824234495,28.664803351584705]},{"name":"九江市","coord":[115.53225905704193,29.362905920276297]},{"name":"上饶市","coord":[117.8595355766598,28.765755150094634]},{"name":"景德镇市","coord":[117.25387030721845,29.33426823662448]},{"name":"黄山市","coord":[117.85476357809696,29.969632034273722]},{"name":"池州市","coord":[117.34517113140791,30.208089337922335]},{"name":"铜陵市","coord":[117.93160431300694,30.926442655001676]},{"name":"安庆市","coord":[116.54307680610799,30.524265461641296]},{"name":"黄石市","coord":[115.02354597728443,29.924060229331015]},{"name":"咸宁市","coord":[114.26967602231792,29.652174021136048]},{"name":"黄冈市","coord":[115.2859016705373,30.65856897065683]},{"name":"武汉市","coord":[114.34552076948799,30.68836237966767]},{"name":"随州市","coord":[113.3850627838818,31.87891659924412]},{"name":"信阳市","coord":[114.81374730587638,32.0309685135914]},{"name":"驻马店市","coord":[114.07756451509235,32.896720987266114]},{"name":"商洛市","coord":[109.82044421310393,33.77403373563189]},{"name":"西安市","coord":[109.11839808451401,34.225257215515896]},{"name":"渭南市","coord":[109.75732444226935,35.025913644359306]},{"name":"铜川市","coord":[108.98695328111377,35.19235092947735]},{"name":"咸阳市","coord":[108.36398776446165,34.84311348287181]},{"name":"三门峡市","coord":[110.80049688104964,34.31818709571671]},{"name":"运城市","coord":[111.1736679525165,35.19010372283576]},{"name":"洛阳市","coord":[111.87577573098216,34.33379926109848]},{"name":"平顶山市","coord":[112.80931281928427,33.759895800153096]},{"name":"漯河市","coord":[113.83505724178012,33.70034266174508]},{"name":"许昌市","coord":[113.78762484088509,34.051835688452435]},{"name":"郑州市","coord":[113.49619951867594,34.61181797865449]},{"name":"焦作市","coord":[113.13404280173008,35.134167097471625]},{"name":"晋城市","coord":[112.7495732073233,35.63186423091449]},{"name":"长治市","coord":[112.85900842873183,36.45872910742828]},{"name":"临汾市","coord":[111.49379787924448,36.22810800777857]},{"name":"太原市","coord":[112.15628804033796,37.91704444063036]},{"name":"吕梁市","coord":[111.31901105774872,37.712740463356496]},{"name":"晋中市","coord":[113.08199599739676,37.36532613794343]},{"name":"邯郸市","coord":[114.41824047234618,36.530119932543315]},{"name":"安阳市","coord":[113.88883283163116,35.7797611183252]},{"name":"鹤壁市","coord":[114.3654094911545,35.75770487428472]},{"name":"新乡市","coord":[113.9184107718167,35.348471214026716]},{"name":"开封市","coord":[114.52801677500626,34.61371216679872]},{"name":"周口市","coord":[114.88509782391864,33.69999759722657]},{"name":"阜阳市","coord":[115.44595951398213,32.98060371610532]},{"name":"淮南市","coord":[116.68941991880993,32.79972275772595]},{"name":"蚌埠市","coord":[117.38594715783302,33.106729536033896]},{"name":"淮北市","coord":[116.69651711889378,33.69527529383458]},{"name":"宿州市","coord":[117.30175405886838,33.943330421260015]},{"name":"亳州市","coord":[116.12410804185097,33.46769392946132]},{"name":"商丘市","coord":[115.59575176872548,34.28339840831147]},{"name":"菏泽市","coord":[115.53631974831816,35.197319393220624]},{"name":"濮阳市","coord":[115.3070485514902,35.775883510964334]},{"name":"聊城市","coord":[115.8870069012884,36.40529594548765]},{"name":"邢台市","coord":[114.74259008644859,37.251396750084155]},{"name":"石家庄市","coord":[114.56923838363613,38.13141710980106]},{"name":"阳泉市","coord":[113.39216149668508,38.09075470547468]},{"name":"保定市","coord":[115.261524468934,39.09118520781398]},{"name":"衡水市","coord":[115.8182936677897,37.715661598187154]},{"name":"德州市","coord":[116.4582273790399,37.19372347888644]},{"name":"沧州市","coord":[116.76192710911863,38.20240042039232]},{"name":"廊坊市","coord":[116.50410772133856,39.27896741763884]},{"name":"天津市","coord":[117.31988934444873,39.37154482470619]},{"name":"北京市","coord":[116.59734730757869,40.237112944270976]},{"name":"张家口市","coord":[115.1823606483226,40.83732566607167]},{"name":"唐山市","coord":[117.8693184261954,39.71862889477249]},{"name":"秦皇岛市","coord":[119.30467355367742,39.990574652162564]},{"name":"承德市","coord":[117.16275671911026,41.36623845548547]},{"name":"葫芦岛市","coord":[119.9342336210531,40.5628822626519]},{"name":"朝阳市","coord":[120.11853493535794,41.471852354885755]},{"name":"赤峰市","coord":[118.50943546234379,43.25452976059767]},{"name":"锦州市","coord":[121.5167549323861,41.45933087433065]},{"name":"营口市","coord":[122.58571915054674,40.42093503997384]},{"name":"丹东市","coord":[124.33549382902183,40.46369290272115]},{"name":"辽阳市","coord":[123.34064798039414,41.152331397771356]},{"name":"盘锦市","coord":[122.06718005354679,41.05573599862555]},{"name":"阜新市","coord":[121.93889757908204,42.27641773244204]},{"name":"鞍山市","coord":[122.78904432242356,40.77781183142038]},{"name":"沈阳市","coord":[122.99508899709724,42.1162195010079]},{"name":"铁岭市","coord":[124.23100515588399,42.72666083611828]},{"name":"扶顺市","coord":[124.46027188217573,41.82955407638859]},{"name":"通辽市","coord":[122.0729370657937,43.90889130864869]},{"name":"兴安盟","coord":[120.79456431092532,45.92003249442161]},{"name":"白城市","coord":[123.10619907715235,45.25475749267784]},{"name":"齐齐哈尔市","coord":[124.5462214659102,47.55395009317394]},{"name":"大兴安岭地区","coord":[124.50992855161529,52.18438447846694]},{"name":"黑河市","coord":[127.14721400335922,49.25080134026901]},{"name":"大庆市","coord":[124.40329830095243,46.401048760966745]},{"name":"绥化市","coord":[126.5214484055605,46.76992452194825]},{"name":"松原市","coord":[124.21244334807682,44.75779381338502]},{"name":"四平市","coord":[124.27839350328821,43.52139065090318]},{"name":"通化市","coord":[125.67392830706305,41.91771808663852]},{"name":"辽源市","coord":[125.33529527643432,42.758340204944986]},{"name":"吉林市","coord":[126.83350281902375,43.60730120049175]},{"name":"长春市","coord":[125.53597875970374,44.24624314701737]},{"name":"白山市","coord":[127.16780160322108,42.093893880305075]},{"name":"哈尔滨市","coord":[127.39125008786029,45.36200668820575]},{"name":"鹤岗市","coord":[130.4703811258197,47.66520688940109]},{"name":"伊春市","coord":[128.91240831703635,47.93833794565277]},{"name":"七台河市","coord":[131.2677920224311,45.945099776108584]},{"name":"鸡西市","coord":[132.38059153660274,45.722934218318535]},{"name":"双鸭山市","coord":[132.3184817002743,46.65813679030265]},{"name":"佳木斯市","coord":[132.26174446608726,47.17569713691394]},{"name":"呼伦贝尔市","coord":[122.3210739998419,50.18176996070858]},{"name":"孝感市","coord":[113.83749892135485,31.11757234692128]},{"name":"贵港市","coord":[110.07354588052804,23.380735604767374]},{"name":"黔南布依族苗族自","coord":[107.30931767543106,26.2976919432269]},{"name":"宁德市","coord":[119.52482556634342,27.013151692716413]},{"name":"温州市","coord":[120.30037042732202,27.8699145504001]},{"name":"台州市","coord":[120.88886782713843,28.670799172772313]},{"name":"丽水市","coord":[119.56796851966463,28.170268394477755]},{"name":"衢州市","coord":[118.79479802644406,28.865874397158763]},{"name":"金华市","coord":[119.99381920686633,29.093455548185744]},{"name":"绍兴市","coord":[120.46546691682343,29.69382513836818]},{"name":"宁波市","coord":[121.42142987830871,29.70001162878972]},{"name":"杭州市","coord":[119.4405685790891,29.87218307296989]},{"name":"宣城市","coord":[118.68748382914703,30.628143499626418]},{"name":"湖州市","coord":[119.98261306633574,30.7945175862809]},{"name":"嘉兴市","coord":[120.83889215988998,30.67538495499343]},{"name":"上海市","coord":[121.37534147322967,31.25628247908459]},{"name":"苏州市","coord":[120.6906182622391,31.381280695137775]},{"name":"无锡市","coord":[120.32182300914366,31.54113306724517]},{"name":"常州市","coord":[119.61953292830165,31.611878565375576]},{"name":"南京市","coord":[118.71890548838064,31.910863187910323]},{"name":"镇江市","coord":[119.42349332902813,31.97942313430778]},{"name":"合肥市","coord":[117.30651975617157,31.79407863049138]},{"name":"六安市","coord":[116.24668220575353,31.820846193819513]},{"name":"滁州市","coord":[117.88422385307969,32.51792621904418]},{"name":"泰州市","coord":[120.03124303305091,32.56503102346783]},{"name":"南通市","coord":[120.85599446760912,32.18496706099728]},{"name":"盐城市","coord":[120.01812490612667,33.54219948734023]},{"name":"淮安市","coord":[119.0749424205415,33.39203631772854]},{"name":"宿迁市","coord":[118.45404943216346,33.666258719120265]},{"name":"徐州市","coord":[117.77482249295966,34.30847766157078]},{"name":"济宁市","coord":[116.74147276546373,35.27488504351119]},{"name":"枣庄市","coord":[117.43359942491492,34.884162021736]},{"name":"连云港市","coord":[119.01553213785074,34.54316517587849]},{"name":"临沂市","coord":[118.31478835349617,35.28173079028279]},{"name":"日照市","coord":[119.14265350444272,35.54479073199592]},{"name":"青岛市","coord":[120.27779044405756,36.3464117375903]},{"name":"威海市","coord":[122.12963327195605,37.13879077904251]},{"name":"烟台市","coord":[120.7689567423966,37.19772002195597]},{"name":"潍坊市","coord":[119.02178548592039,36.49292234053931]},{"name":"淄博市","coord":[117.92936024367185,36.60871347163638]},{"name":"泰安市","coord":[116.93810893944303,36.0423330118612]},{"name":"济南市","coord":[117.34560282551296,36.769574973846304]},{"name":"东营市","coord":[118.4915054457184,37.52194690335787]},{"name":"滨州市","coord":[117.67610299757533,37.4439597758601]},{"name":"昆明市","coord":[102.93100245594789,25.481300763922075]},{"name":"玉溪市","coord":[102.23080854291823,24.156168324611663]},{"name":"塔城地区","coord":[83.60908162840168,45.3721852373893]},{"name":"张掖市","coord":[100.47710030600572,38.704239320458385]},{"name":"南阳市","coord":[112.1400670951149,33.03033276715801]},{"name":"扬州市","coord":[119.48949608990988,32.80956776339646]},{"name":"延边朝鲜族自治州","coord":[129.3577692895626,43.24968794080283]},{"name":"牡丹江市","coord":[129.87240796405672,44.7073040108322]},{"name":"澳门","coord":[113.56289691515346,22.14602596262204]},{"name":"吴忠市","coord":[106.76894508116403,37.72566765880316]},{"name":"来宾市","coord":[109.25592217010114,23.86346274681084]},{"name":"平凉市","coord":[107.0708132782897,35.30329631658711]},{"name":"马鞍山市","coord":[118.27245878467022,31.657727937739004]},{"name":"芜湖市","coord":[118.32992684415504,31.081688223101658]},{"name":"澄迈县","coord":[110.04198076060266,19.694955078668105]},{"name":"保亭黎族苗族自治","coord":[109.6055304964257,18.6101488675304]},{"name":"乐东黎族自治县","coord":[109.04051999525574,18.643137437909203]},{"name":"儋州市","coord":[109.3431358337404,19.550974957403195]},{"name":"定安县","coord":[110.38744429685676,19.47557074114284]},{"name":"屯昌县","coord":[110.00574767630334,19.367175093044388]},{"name":"白沙黎族自治县","coord":[109.36860737761768,19.214416393082217]},{"name":"琼中黎族苗族自治","coord":[109.86691465937548,19.073671135862682]},{"name":"东方市","coord":[108.86903802405428,19.017352815445214]},{"name":"昌江黎族自治县","coord":[108.9686431884767,19.182594167127824]},{"name":"海口市","coord":[110.420654296875,19.806565564640795]},{"name":"济源市","coord":[112.38051465474433,35.07958362422394]},{"name":"五指山市","coord":[109.53595187364496,18.832908264613966]},{"name":"大连市","coord":[121.96662235866603,39.444150542439914]},{"name":"文昌市三沙市","coord":[110.81828537536748,19.756501444162936]},{"name":"三亚市","coord":[109.38424600793707,18.39186315877128]},{"name":"万宁市","coord":[110.28485046979574,18.860240588635115]},{"name":"陵水黎族自治县","coord":[109.95577603229562,18.594712684620465]},{"name":"临高县","coord":[109.71915395436967,19.79420403032508]},{"name":"琼海市","coord":[110.41650700703043,19.22315873149372]}]');
  98405. ;// CONCATENATED MODULE: ./src/openlayers/mapping/webmap/config/SampleDataInfo.json
  98406. const SampleDataInfo_namespaceObject = JSON.parse('[{"id":"SalesJan2009","fileName":"SalesJan2009","xField":"Longitude","yField":"Latitude","type":"POINT"},{"id":"Sacramentorealestatetransactions","fileName":"Ealestate transactions","xField":"longitude","yField":"latitude","type":"POINT"},{"id":"BeijingResidentialDistrict","fileName":"北京市住宅小区","xField":"SmX","yField":"SmY","type":"POINT"},{"id":"GlobalRecordOfOver7Earthquakes","fileName":"全球历史7级以上地震记录","xField":"经度","yField":"纬度","type":"POINT"},{"id":"ChinaRecordOfOver6Earthquakes","fileName":"中国历史6级以上地震记录","xField":"经度","yField":"纬度","type":"POINT"},{"id":"ChinaMeteorologicalObservationStation","fileName":"中国气象观测站","xField":"经度","yField":"纬度","type":"POINT"},{"id":"BeijingSubwayLine","fileName":"北京市地铁交通线路","type":"LINE"},{"id":"ChinaEarthquakeIntensityZone","fileName":"中国地震烈度区划面","type":"POLYGON"}]');
  98407. ;// CONCATENATED MODULE: external "ol.View"
  98408. const external_ol_View_namespaceObject = ol.View;
  98409. var external_ol_View_default = /*#__PURE__*/__webpack_require__.n(external_ol_View_namespaceObject);
  98410. ;// CONCATENATED MODULE: external "ol.interaction.MouseWheelZoom"
  98411. const external_ol_interaction_MouseWheelZoom_namespaceObject = ol.interaction.MouseWheelZoom;
  98412. var external_ol_interaction_MouseWheelZoom_default = /*#__PURE__*/__webpack_require__.n(external_ol_interaction_MouseWheelZoom_namespaceObject);
  98413. ;// CONCATENATED MODULE: external "ol.proj.proj4"
  98414. const external_ol_proj_proj4_namespaceObject = ol.proj.proj4;
  98415. ;// CONCATENATED MODULE: external "ol.proj.Units"
  98416. const external_ol_proj_Units_namespaceObject = ol.proj.Units;
  98417. var external_ol_proj_Units_default = /*#__PURE__*/__webpack_require__.n(external_ol_proj_Units_namespaceObject);
  98418. ;// CONCATENATED MODULE: external "ol.layer"
  98419. const external_ol_layer_namespaceObject = ol.layer;
  98420. ;// CONCATENATED MODULE: external "ol.format.WMTSCapabilities"
  98421. const external_ol_format_WMTSCapabilities_namespaceObject = ol.format.WMTSCapabilities;
  98422. var external_ol_format_WMTSCapabilities_default = /*#__PURE__*/__webpack_require__.n(external_ol_format_WMTSCapabilities_namespaceObject);
  98423. ;// CONCATENATED MODULE: external "ol.format.WMSCapabilities"
  98424. const external_ol_format_WMSCapabilities_namespaceObject = ol.format.WMSCapabilities;
  98425. var external_ol_format_WMSCapabilities_default = /*#__PURE__*/__webpack_require__.n(external_ol_format_WMSCapabilities_namespaceObject);
  98426. ;// CONCATENATED MODULE: external "ol.geom"
  98427. const external_ol_geom_namespaceObject = ol.geom;
  98428. ;// CONCATENATED MODULE: external "ol.source.TileWMS"
  98429. const external_ol_source_TileWMS_namespaceObject = ol.source.TileWMS;
  98430. var external_ol_source_TileWMS_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_TileWMS_namespaceObject);
  98431. ;// CONCATENATED MODULE: external "ol.render.Feature"
  98432. const external_ol_render_Feature_namespaceObject = ol.render.Feature;
  98433. var external_ol_render_Feature_default = /*#__PURE__*/__webpack_require__.n(external_ol_render_Feature_namespaceObject);
  98434. ;// CONCATENATED MODULE: external "ol.Collection"
  98435. const external_ol_Collection_namespaceObject = ol.Collection;
  98436. var external_ol_Collection_default = /*#__PURE__*/__webpack_require__.n(external_ol_Collection_namespaceObject);
  98437. // EXTERNAL MODULE: ./node_modules/lodash.difference/index.js
  98438. var lodash_difference = __webpack_require__(478);
  98439. var lodash_difference_default = /*#__PURE__*/__webpack_require__.n(lodash_difference);
  98440. ;// CONCATENATED MODULE: ./src/openlayers/mapping/WebMap.js
  98441. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  98442. * This program are made available under the terms of the Apache License, Version 2.0
  98443. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  98444. // eslint-disable-line import/extensions
  98445. // eslint-disable-line import/extensions
  98446. // eslint-disable-line import/extensions
  98447. window.proj4 = (proj4_src_default());
  98448. window.Proj4js = (proj4_src_default());
  98449. //数据转换工具
  98450. const transformTools = new (external_ol_format_GeoJSON_default())();
  98451. // 迁徙图最大支持要素数量
  98452. const MAX_MIGRATION_ANIMATION_COUNT = 1000;
  98453. //不同坐标系单位。计算公式中的值
  98454. const metersPerUnit = {
  98455. DEGREES: 2 * Math.PI * 6370997 / 360,
  98456. DEGREE: 2 * Math.PI * 6370997 / 360,
  98457. FEET: 0.3048,
  98458. METERS: 1,
  98459. METER: 1,
  98460. M: 1,
  98461. USFEET: 1200 / 3937
  98462. };
  98463. const dpiConfig = {
  98464. default: 96, // 常用dpi
  98465. iServerWMTS: 90.7142857142857 // iserver使用的wmts图层dpi
  98466. }
  98467. /**
  98468. * @class WebMap
  98469. * @category iPortal/Online Resources Map
  98470. * @classdesc 对接 iPortal/Online 地图类
  98471. * @modulecategory Mapping
  98472. * @param {Object} options - 参数
  98473. * @param {string} [options.target='map'] - 地图容器id
  98474. * @param {Object | string} [options.webMap] - webMap对象,或者是获取webMap的url地址。存在webMap,优先使用webMap, id的选项则会被忽略
  98475. * @param {number} [options.id] - 地图的id
  98476. * @param {string} [options.server] - 地图的地址,如果使用传入id,server则会和id拼接成webMap请求地址
  98477. * @param {function} [options.successCallback] - 成功加载地图后调用的函数
  98478. * @param {function} [options.errorCallback] - 加载地图失败调用的函数
  98479. * @param {string} [options.credentialKey] - 凭证密钥。例如为"key"、"token",或者用户自定义的密钥。用户申请了密钥,此参数必填
  98480. * @param {string} [options.credentialValue] - 凭证密钥对应的值,credentialKey和credentialValue必须一起使用
  98481. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie
  98482. * @param {boolean} [options.excludePortalProxyUrl] - server传递过来的url是否带有代理
  98483. * @param {Object} [options.serviceProxy] - iportal内置代理信息, 仅矢量瓦片图层上图才会使用
  98484. * @param {string} [options.tiandituKey] - 天地图的key
  98485. * @param {string} [options.googleMapsAPIKey] - 谷歌底图需要的key
  98486. * @param {string} [options.proxy] - 代理地址,当域名不一致,请求会加上代理。避免跨域
  98487. * @param {string} [options.tileFormat] - 地图瓦片出图格式,png/webp
  98488. * @param {Object} [options.mapSetting] - 地图可选参数
  98489. * @param {function} [options.mapSetting.mapClickCallback] - 地图被点击的回调函数
  98490. * @param {function} [options.mapSetting.overlays] - 地图的overlays
  98491. * @param {function} [options.mapSetting.controls] - 地图的控件
  98492. * @param {function} [options.mapSetting.interactions] - 地图控制的参数
  98493. * @param {number} [options.restDataSingleRequestCount=1000] - 自定义restData分批请求,单次请求数量
  98494. * @extends {ol.Observable}
  98495. * @usage
  98496. */
  98497. class WebMap extends (external_ol_Observable_default()) {
  98498. constructor(id, options) {
  98499. super();
  98500. if (core_Util_Util.isObject(id)) {
  98501. options = id;
  98502. this.mapId = options.id;
  98503. } else {
  98504. this.mapId = id;
  98505. }
  98506. options = options || {};
  98507. this.server = options.server;
  98508. this.successCallback = options.successCallback;
  98509. this.errorCallback = options.errorCallback;
  98510. this.credentialKey = options.credentialKey;
  98511. this.credentialValue = options.credentialValue;
  98512. this.withCredentials = options.withCredentials || false;
  98513. this.target = options.target || "map";
  98514. this.excludePortalProxyUrl = options.excludePortalProxyUrl || false;
  98515. this.serviceProxy = options.serviceProxy || null;
  98516. this.tiandituKey = options.tiandituKey;
  98517. this.googleMapsAPIKey = options.googleMapsAPIKey || '';
  98518. this.proxy = options.proxy;
  98519. //计数叠加图层,处理过的数量(成功和失败都会计数)
  98520. this.layerAdded = 0;
  98521. this.layers = [];
  98522. this.events = new Events(this, null, ["updateDataflowFeature"], true);
  98523. this.webMap = options.webMap;
  98524. this.tileFormat = options.tileFormat && options.tileFormat.toLowerCase();
  98525. this.restDataSingleRequestCount = options.restDataSingleRequestCount || 1000;
  98526. this.createMap(options.mapSetting);
  98527. if (this.webMap) {
  98528. // webmap有可能是url地址,有可能是webmap对象
  98529. core_Util_Util.isString(this.webMap) ? this.createWebmap(this.webMap) : this.getMapInfoSuccess(options.webMap);
  98530. } else {
  98531. this.createWebmap();
  98532. }
  98533. }
  98534. /**
  98535. * @private
  98536. * @function WebMap.prototype._removeBaseLayer
  98537. * @description 移除底图
  98538. */
  98539. _removeBaseLayer() {
  98540. const map = this.map;
  98541. const {layer, labelLayer} = this.baseLayer;
  98542. // 移除天地图标签图层
  98543. labelLayer && map.removeLayer(labelLayer);
  98544. // 移除图层
  98545. layer && map.removeLayer(layer);
  98546. this.baseLayer = null;
  98547. }
  98548. /**
  98549. * @private
  98550. * @function WebMap.prototype._removeLayers
  98551. * @description 移除叠加图层
  98552. */
  98553. _removeLayers() {
  98554. const map = this.map;
  98555. this.layers.forEach(({layerType, layer, labelLayer, pathLayer, dataflowService}) => {
  98556. if (!layer) {
  98557. return;
  98558. }
  98559. if (layerType === 'MIGRATION') {
  98560. layer.remove();
  98561. return;
  98562. }
  98563. if (layerType === 'DATAFLOW_POINT_TRACK' || layerType === 'DATAFLOW_HEAT') {
  98564. // 移除轨迹图层
  98565. pathLayer && map.removeLayer(pathLayer);
  98566. // 取消订阅
  98567. dataflowService && dataflowService.unSubscribe();
  98568. }
  98569. // 移除标签图层
  98570. labelLayer && map.removeLayer(labelLayer);
  98571. // 移除图层
  98572. map.removeLayer(layer)
  98573. });
  98574. this.layers = [];
  98575. }
  98576. /**
  98577. * @private
  98578. * @function WebMap.prototype.clear
  98579. * @description 清空地图
  98580. */
  98581. _clear() {
  98582. // 比例尺
  98583. this.scales = [];
  98584. // 分辨率
  98585. this.resolutionArray = [];
  98586. // 比例尺-分辨率 {scale: resolution}
  98587. this.resolutions = {};
  98588. // 计数叠加图层,处理过的数量(成功和失败都会计数)
  98589. this.layerAdded = 0;
  98590. this._removeBaseLayer();
  98591. this._removeLayers();
  98592. }
  98593. /**
  98594. * @function WebMap.prototype.refresh
  98595. * @version 10.1.0
  98596. * @description 重新渲染地图
  98597. */
  98598. refresh() {
  98599. this._clear();
  98600. this.createWebmap();
  98601. }
  98602. /**
  98603. * @private
  98604. * @function WebMap.prototype.createMap
  98605. * @description 创建地图对象以及注册地图事件
  98606. * @param {Object} mapSetting - 关于地图的设置以及需要注册的事件
  98607. */
  98608. createMap(mapSetting) {
  98609. let overlays, controls, interactions;
  98610. if (mapSetting) {
  98611. interactions = mapSetting.interactions;
  98612. overlays = mapSetting.overlays;
  98613. controls = mapSetting.controls;
  98614. }
  98615. this.map = new (external_ol_Map_default())({
  98616. interactions: interactions,
  98617. overlays: overlays,
  98618. controls: controls,
  98619. target: this.target
  98620. });
  98621. mapSetting && this.registerMapEvent({
  98622. mapClickCallback: mapSetting.mapClickCallback
  98623. });
  98624. }
  98625. /**
  98626. * @private
  98627. * @function WebMap.prototype.registerMapEvent
  98628. * @description 注册地图事件
  98629. * @param {Object} mapSetting - 关于地图的设置以及需要注册的事件
  98630. */
  98631. registerMapEvent(mapSetting) {
  98632. let map = this.map;
  98633. map.on("click", function (evt) {
  98634. mapSetting.mapClickCallback && mapSetting.mapClickCallback(evt);
  98635. });
  98636. }
  98637. /**
  98638. * @private
  98639. * @function WebMap.prototype.createWebmap
  98640. * @description 创建webmap
  98641. * @param {string} webMapUrl - 请求webMap的地址
  98642. */
  98643. createWebmap(webMapUrl) {
  98644. let mapUrl;
  98645. if (webMapUrl) {
  98646. mapUrl = webMapUrl;
  98647. } else {
  98648. let urlArr = this.server.split('');
  98649. if (urlArr[urlArr.length - 1] !== '/') {
  98650. this.server += '/';
  98651. }
  98652. mapUrl = this.server + 'web/maps/' + this.mapId + '/map';
  98653. let filter = 'getUrlResource.json?url=';
  98654. if (this.excludePortalProxyUrl && this.server.indexOf(filter) > -1) {
  98655. //大屏需求,或者有加上代理的
  98656. let urlArray = this.server.split(filter);
  98657. if (urlArray.length > 1) {
  98658. mapUrl = urlArray[0] + filter + this.server + 'web/maps/' + this.mapId + '/map.json';
  98659. }
  98660. }
  98661. }
  98662. this.getMapInfo(mapUrl);
  98663. }
  98664. /**
  98665. * @private
  98666. * @function WebMap.prototype.getMapInfo
  98667. * @description 获取地图的json信息
  98668. * @param {string} url - 请求地图的url
  98669. */
  98670. getMapInfo(url) {
  98671. let that = this,
  98672. mapUrl = url;
  98673. if (url.indexOf('.json') === -1) {
  98674. url = this.handleJSONSuffix(url);
  98675. //传递过来的url,没有包括.json,在这里加上。
  98676. mapUrl = url;
  98677. }
  98678. FetchRequest.get(that.getRequestUrl(mapUrl), null, {
  98679. withCredentials: this.withCredentials
  98680. }).then(function (response) {
  98681. return response.json();
  98682. }).then(function (mapInfo) {
  98683. that.getMapInfoSuccess(mapInfo);
  98684. }).catch(function (error) {
  98685. that.errorCallback && that.errorCallback(error, 'getMapFaild', that.map);
  98686. });
  98687. }
  98688. /**
  98689. * @private
  98690. * @function WebMap.prototype.getMapInfoSuccess
  98691. * @description 获取地图的json信息
  98692. * @param {Object} mapInfo - webMap对象
  98693. */
  98694. async getMapInfoSuccess(mapInfo) {
  98695. let that = this;
  98696. if (mapInfo.succeed === false) {
  98697. that.errorCallback && that.errorCallback(mapInfo.error, 'getMapFaild', that.map);
  98698. return;
  98699. }
  98700. let handleResult = await that.handleCRS(mapInfo.projection, mapInfo.baseLayer.url);
  98701. //存储地图的名称以及描述等信息,返回给用户
  98702. that.mapParams = {
  98703. title: mapInfo.title,
  98704. description: mapInfo.description
  98705. };
  98706. if (handleResult.action === "BrowseMap") {
  98707. that.createSpecLayer(mapInfo);
  98708. } else if (handleResult.action === "OpenMap") {
  98709. that.baseProjection = handleResult.newCrs || mapInfo.projection;
  98710. that.webMapVersion = mapInfo.version;
  98711. that.baseLayer = mapInfo.baseLayer;
  98712. // that.mapParams = {
  98713. // title: mapInfo.title,
  98714. // description: mapInfo.description
  98715. // }; //存储地图的名称以及描述等信息,返回给用户
  98716. that.isHaveGraticule = mapInfo.grid && mapInfo.grid.graticule;
  98717. if (mapInfo.baseLayer && mapInfo.baseLayer.layerType === 'MAPBOXSTYLE') {
  98718. // 添加矢量瓦片服务作为底图
  98719. that.addMVTMapLayer(mapInfo, mapInfo.baseLayer, 0).then(async () => {
  98720. that.createView(mapInfo);
  98721. if (!mapInfo.layers || mapInfo.layers.length === 0) {
  98722. that.sendMapToUser(0);
  98723. } else {
  98724. await that.addLayers(mapInfo);
  98725. }
  98726. that.addGraticule(mapInfo);
  98727. }).catch(function (error) {
  98728. that.errorCallback && that.errorCallback(error, 'getMapFaild', that.map);
  98729. });
  98730. } else {
  98731. await that.addBaseMap(mapInfo);
  98732. if (!mapInfo.layers || mapInfo.layers.length === 0) {
  98733. that.sendMapToUser(0);
  98734. } else {
  98735. await that.addLayers(mapInfo);
  98736. }
  98737. that.addGraticule(mapInfo);
  98738. }
  98739. } else {
  98740. // 不支持的坐标系
  98741. that.errorCallback && that.errorCallback({type: "Not support CS", errorMsg: `Not support CS: ${mapInfo.projection}`}, 'getMapFaild', that.map);
  98742. return;
  98743. }
  98744. }
  98745. /**
  98746. * 处理坐标系(底图)
  98747. * @private
  98748. * @param {string} crs 必传参数,值是webmap2中定义的坐标系,可能是 1、EGSG:xxx 2、WKT string
  98749. * @param {string} baseLayerUrl 可选参数,地图的服务地址;用于EPSG:-1 的时候,用于请求iServer提供的wkt
  98750. * @return {Object}
  98751. */
  98752. async handleCRS(crs, baseLayerUrl) {
  98753. let that = this, handleResult = {};
  98754. let newCrs = crs, action = "OpenMap";
  98755. if (this.isCustomProjection(crs)) {
  98756. // 去iServer请求wkt 否则只能预览出图
  98757. await FetchRequest.get(that.getRequestUrl(`${baseLayerUrl}/prjCoordSys.wkt`), null, {
  98758. withCredentials: that.withCredentials,
  98759. withoutFormatSuffix: true
  98760. }).then(function (response) {
  98761. return response.text();
  98762. }).then(async function (result) {
  98763. if(result.indexOf("<!doctype html>") === -1) {
  98764. that.addProjctionFromWKT(result, crs);
  98765. handleResult = {action, newCrs};
  98766. } else {
  98767. throw 'ERROR';
  98768. }
  98769. }).catch(function () {
  98770. action = "BrowseMap";
  98771. handleResult = {action, newCrs}
  98772. });
  98773. } else {
  98774. if (crs.indexOf("EPSG") === 0 && crs.split(":")[1] <= 0) {
  98775. // 自定义坐标系 rest map EPSG:-1(自定义坐标系) 支持编辑
  98776. // 未知坐标系情况特殊处理,只支持预览 1、rest map EPSG:-1000(没定义坐标系) 2、wms/wmts EPSG:0 (自定义坐标系)
  98777. action = "BrowseMap";
  98778. } else if (crs === 'EPSG:910111' || crs === 'EPSG:910112') {
  98779. // 早期数据存在的自定义坐标系 "EPSG:910111": "GCJ02MERCATOR", "EPSG:910112": "BDMERCATOR"
  98780. newCrs = "EPSG:3857";
  98781. } else if (crs === 'EPSG:910101' || crs === 'EPSG:910102') {
  98782. // 早期数据存在的自定义坐标系 "EPSG:910101": "GCJ02", "EPSG:910102": "BD",
  98783. newCrs = "EPSG:4326";
  98784. } else if (crs.indexOf("EPSG") !== 0) {
  98785. // wkt
  98786. that.addProjctionFromWKT(newCrs);
  98787. newCrs = that.getEpsgInfoFromWKT(crs);
  98788. }
  98789. handleResult = {action, newCrs};
  98790. }
  98791. return handleResult;
  98792. }
  98793. /**
  98794. * @private
  98795. * @function WebMap.prototype.getScales
  98796. * @description 根据级别获取每个级别对应的分辨率
  98797. * @param {Object} baseLayerInfo - 底图的图层信息
  98798. */
  98799. getScales(baseLayerInfo) {
  98800. let scales = [], resolutions = {}, res, scale, resolutionArray = [],
  98801. coordUnit = baseLayerInfo.coordUnit || external_ol_proj_namespaceObject.get(baseLayerInfo.projection).getUnits();
  98802. if (!coordUnit) {
  98803. coordUnit = this.baseProjection == "EPSG:3857" ? "m" : "degree";
  98804. }
  98805. if (baseLayerInfo.visibleScales && baseLayerInfo.visibleScales.length > 0) {
  98806. //底部设置过固定比例尺,则使用设置的
  98807. baseLayerInfo.visibleScales.forEach(scale => {
  98808. let value = 1 / scale;
  98809. res = this.getResFromScale(value, coordUnit);
  98810. scale = `1:${value}`;
  98811. //多此一举转换,因为toLocalString会自动保留小数点后三位,and当第二位小数是0就会保存小数点后两位。所有为了统一。
  98812. resolutions[this.formatScale(scale)] = res;
  98813. resolutionArray.push(res);
  98814. scales.push(scale);
  98815. }, this)
  98816. } else if (baseLayerInfo.layerType === 'WMTS') {
  98817. baseLayerInfo.scales.forEach(scale => {
  98818. res = this.getResFromScale(scale, coordUnit, 90.7);
  98819. scale = `1:${scale}`;
  98820. //多此一举转换,因为toLocalString会自动保留小数点后三位,and当第二位小数是0就会保存小数点后两位。所有为了统一。
  98821. resolutions[this.formatScale(scale)] = res;
  98822. resolutionArray.push(res);
  98823. scales.push(scale);
  98824. }, this)
  98825. } else {
  98826. let {minZoom = 0, maxZoom = 22} = baseLayerInfo, view = this.map.getView();
  98827. for (let i = minZoom; i <= maxZoom; i++) {
  98828. res = view.getResolutionForZoom(i);
  98829. scale = this.getScaleFromRes(res, coordUnit);
  98830. if (scales.indexOf(scale) === -1) {
  98831. //不添加重复的比例尺
  98832. scales.push(scale);
  98833. let attr = scale.replace(/,/g, "");
  98834. resolutions[attr] = res;
  98835. resolutionArray.push(res);
  98836. }
  98837. }
  98838. }
  98839. this.scales = scales;
  98840. this.resolutions = resolutions;
  98841. this.resolutionArray = resolutionArray;
  98842. }
  98843. /**
  98844. * @private
  98845. * @function WebMap.prototype.getResFromScale
  98846. * @description 将比例尺转换为分辨率
  98847. * @param {number} scale - 比例尺
  98848. * @param {string} coordUnit - 比例尺单位
  98849. * @param {number} dpi
  98850. */
  98851. getResFromScale(scale, coordUnit = "DEGREE", dpi = 96) {
  98852. let mpu = metersPerUnit[coordUnit.toUpperCase()];
  98853. return scale * .0254 / dpi / mpu;
  98854. }
  98855. /**
  98856. * @private
  98857. * @function WebMap.prototype.getScaleFromRes
  98858. * @description 将分辨率转换为比例尺
  98859. * @param {number} resolution - 分辨率
  98860. * @param {string} coordUnit - 比例尺单位
  98861. * @param {number} dpi
  98862. */
  98863. getScaleFromRes(resolution, coordUnit = "DEGREE", dpi = 96) {
  98864. let scale, mpu = metersPerUnit[coordUnit.toUpperCase()];
  98865. scale = resolution * dpi * mpu / .0254;
  98866. return '1:' + scale;
  98867. }
  98868. /**
  98869. * @private
  98870. * @function WebMap.prototype.formatScale
  98871. * @description 将有千位符的数字转为普通数字。例如:1,234 => 1234
  98872. * @param {number} scale - 比例尺分母
  98873. */
  98874. formatScale(scale) {
  98875. return scale.replace(/,/g, "");
  98876. }
  98877. /**
  98878. * @private
  98879. * @function WebMap.prototype.createSpecLayer
  98880. * @description 创建坐标系为0和-1000的图层
  98881. * @param {Object} mapInfo - 地图信息
  98882. */
  98883. createSpecLayer(mapInfo) {
  98884. let me = this,
  98885. baseLayerInfo = mapInfo.baseLayer,
  98886. url = baseLayerInfo.url,
  98887. baseLayerType = baseLayerInfo.layerType;
  98888. let extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y];
  98889. let proj = new external_ol_proj_namespaceObject.Projection({
  98890. extent,
  98891. units: 'm',
  98892. code: 'EPSG:0'
  98893. });
  98894. external_ol_proj_namespaceObject.addProjection(proj);
  98895. let options = {
  98896. center: mapInfo.center,
  98897. level: 0
  98898. }
  98899. //添加view
  98900. me.baseProjection = proj;
  98901. let viewOptions = {
  98902. center: options.center ? [options.center.x, options.center.y] : [0, 0],
  98903. zoom: 0,
  98904. projection: proj
  98905. }
  98906. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) < 0) { // 兼容 ol 4,5,6
  98907. viewOptions.multiWorld = true;
  98908. }
  98909. let view = new (external_ol_View_default())(viewOptions);
  98910. me.map.setView(view);
  98911. if (me.mapParams) {
  98912. me.mapParams.extent = extent;
  98913. me.mapParams.projection = mapInfo.projection;
  98914. }
  98915. if (url && url.indexOf("?token=") > -1) {
  98916. //兼容iserver地址有token的情况
  98917. me.credentialKey = 'token';
  98918. me.credentialValue = mapInfo.baseLayer.credential = url.split("?token=")[1];
  98919. url = url.split("?token=")[0];
  98920. }
  98921. let source;
  98922. if (baseLayerType === "TILE") {
  98923. url = this.handleJSONSuffix(url);
  98924. FetchRequest.get(me.getRequestUrl(url), null, {
  98925. withCredentials: this.withCredentials
  98926. }).then(function (response) {
  98927. return response.json();
  98928. }).then(function (result) {
  98929. baseLayerInfo.originResult = result;
  98930. let serverType = "IPORTAL", credential = baseLayerInfo.credential, keyfix = 'Token', keyParams = baseLayerInfo.url;
  98931. if (baseLayerInfo.url.indexOf("www.supermapol.com") > -1 || baseLayerInfo.url.indexOf("itest.supermapol.com") > -1) {
  98932. keyfix = 'Key';
  98933. keyParams = [keyParams];
  98934. serverType = "ONLINE";
  98935. }
  98936. if (credential) {
  98937. SecurityManager[`register${keyfix}`](keyParams, credential);
  98938. }
  98939. let options = {
  98940. serverType,
  98941. url,
  98942. tileGrid: TileSuperMapRest.optionsFromMapJSON(url, result).tileGrid
  98943. }
  98944. if (url && !Util_Util.isInTheSameDomain(url) && !this.isIportalProxyServiceUrl(url)) {
  98945. options.tileProxy = me.server + 'apps/viewer/getUrlResource.png?url=';
  98946. }
  98947. source = new TileSuperMapRest(options);
  98948. me.addSpecToMap(source);
  98949. }).catch(function (error) {
  98950. me.errorCallback && me.errorCallback(error, 'getMapFaild', me.map);
  98951. });
  98952. } else if (baseLayerType === "WMS") {
  98953. source = me.createWMSSource(baseLayerInfo);
  98954. me.addSpecToMap(source);
  98955. } else if (baseLayerType === "WMTS") {
  98956. FetchRequest.get(me.getRequestUrl(url, true), null, {
  98957. withCredentials: this.withCredentials
  98958. }).then(function (response) {
  98959. return response.text();
  98960. }).then(function (capabilitiesText) {
  98961. baseLayerInfo.extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y];
  98962. baseLayerInfo.scales = me.getWMTSScales(baseLayerInfo.tileMatrixSet, capabilitiesText);
  98963. baseLayerInfo.dpi = dpiConfig.iServerWMTS;
  98964. source = me.createWMTSSource(baseLayerInfo);
  98965. me.addSpecToMap(source);
  98966. }).catch(function (error) {
  98967. me.errorCallback && me.errorCallback(error, 'getMapFaild', me.map);
  98968. })
  98969. } else {
  98970. me.errorCallback && me.errorCallback({type: "Not support CS", errorMsg: `Not support CS: ${baseLayerType}`}, 'getMapFaild', me.map);
  98971. }
  98972. view && view.fit(extent);
  98973. }
  98974. /**
  98975. * @private
  98976. * @function WebMap.prototype.addSpecToMap
  98977. * @description 将坐标系为0和-1000的图层添加到地图上
  98978. * @param {Object} mapInfo - 地图信息
  98979. */
  98980. addSpecToMap(source) {
  98981. let layer = new external_ol_layer_namespaceObject.Tile({
  98982. source: source,
  98983. zIndex: 0
  98984. });
  98985. this.map.addLayer(layer);
  98986. this.sendMapToUser(0);
  98987. }
  98988. /**
  98989. * @private
  98990. * @function WebMap.prototype.getWMTSScales
  98991. * @description 获取wmts的比例尺
  98992. * @param {Object} identifier - 图层存储的标识信息
  98993. * @param {Object} capabilitiesText - wmts信息
  98994. */
  98995. getWMTSScales(identifier, capabilitiesText) {
  98996. const format = new (external_ol_format_WMTSCapabilities_default())();
  98997. let capabilities = format.read(capabilitiesText);
  98998. let content = capabilities.Contents;
  98999. let tileMatrixSet = content.TileMatrixSet;
  99000. let scales = [];
  99001. for (let i = 0; i < tileMatrixSet.length; i++) {
  99002. if (tileMatrixSet[i].Identifier === identifier) {
  99003. for (let h = 0; h < tileMatrixSet[i].TileMatrix.length; h++) {
  99004. scales.push(tileMatrixSet[i].TileMatrix[h].ScaleDenominator)
  99005. }
  99006. break;
  99007. }
  99008. }
  99009. return scales;
  99010. }
  99011. /**
  99012. * @private
  99013. * @function WebMap.prototype.addBaseMap
  99014. * @description 添加底图
  99015. * @param {string} mapInfo - 请求地图的url
  99016. */
  99017. async addBaseMap(mapInfo) {
  99018. let {baseLayer} = mapInfo, layerType = baseLayer.layerType;
  99019. //底图,使用默认的配置,不用存储的
  99020. if (layerType !== 'TILE' && layerType !== 'WMS' && layerType !== 'WMTS') {
  99021. this.getInternetMapInfo(baseLayer);
  99022. } else if (layerType === 'WMTS') {
  99023. // 通过请求完善信息
  99024. await this.getWmtsInfo(baseLayer);
  99025. } else if (layerType === 'TILE') {
  99026. await this.getTileInfo(baseLayer);
  99027. } else if(layerType === 'WMS') {
  99028. await this.getWmsInfo(baseLayer);
  99029. }
  99030. baseLayer.projection = mapInfo.projection;
  99031. if (!baseLayer.extent) {
  99032. baseLayer.extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y];
  99033. }
  99034. this.createView(mapInfo);
  99035. let layer = this.createBaseLayer(baseLayer, 0, null, null, true);
  99036. //底图增加图层类型,DV分享需要用它来识别版权信息
  99037. layer.setProperties({
  99038. layerType: layerType
  99039. });
  99040. this.map.addLayer(layer);
  99041. if (this.mapParams) {
  99042. this.mapParams.extent = baseLayer.extent;
  99043. this.mapParams.projection = mapInfo.projection;
  99044. }
  99045. if (baseLayer.labelLayerVisible) {
  99046. //存在天地图路网
  99047. let labelLayer = new external_ol_layer_namespaceObject.Tile({
  99048. source: this.createTiandituSource(baseLayer.layerType, mapInfo.projection, true),
  99049. zIndex: baseLayer.zIndex || 1,
  99050. visible: baseLayer.visible
  99051. });
  99052. this.map.addLayer(labelLayer);
  99053. // 挂载带baseLayer上,便于删除
  99054. baseLayer.labelLayer = labelLayer;
  99055. }
  99056. this.limitScale(mapInfo, baseLayer);
  99057. }
  99058. validScale(scale) {
  99059. if (!scale) {
  99060. return false;
  99061. }
  99062. const scaleNum = scale.split(':')[1];
  99063. if (!scaleNum) {
  99064. return false;
  99065. }
  99066. const res = 1 / +scaleNum;
  99067. if (res === Infinity || res >= 1) {
  99068. return false;
  99069. }
  99070. return true;
  99071. }
  99072. limitScale(mapInfo, baseLayer) {
  99073. if (this.validScale(mapInfo.minScale) && this.validScale(mapInfo.maxScale)) {
  99074. let visibleScales, minScale, maxScale;
  99075. if (baseLayer.layerType === 'WMTS') {
  99076. visibleScales = baseLayer.scales;
  99077. minScale = +mapInfo.minScale.split(':')[1];
  99078. maxScale = +mapInfo.maxScale.split(':')[1];
  99079. } else {
  99080. const scales = this.scales.map((scale) => {
  99081. return 1 / scale.split(':')[1];
  99082. });
  99083. if (Array.isArray(baseLayer.visibleScales) && baseLayer.visibleScales.length && baseLayer.visibleScales) {
  99084. visibleScales = baseLayer.visibleScales;
  99085. } else {
  99086. visibleScales = scales;
  99087. }
  99088. minScale = 1 / +mapInfo.minScale.split(':')[1];
  99089. maxScale = 1 / +mapInfo.maxScale.split(':')[1];
  99090. }
  99091. const minVisibleScale = this.findNearest(visibleScales, minScale);
  99092. const maxVisibleScale = this.findNearest(visibleScales, maxScale);
  99093. let minZoom = visibleScales.indexOf(minVisibleScale);
  99094. let maxZoom = visibleScales.indexOf(maxVisibleScale);
  99095. if (minZoom > maxZoom) {
  99096. [minZoom, maxZoom] = [maxZoom, minZoom];
  99097. }
  99098. if (minZoom !== 0 || maxZoom !== visibleScales.length - 1) {
  99099. this.map.setView(
  99100. new (external_ol_View_default())(
  99101. Object.assign({}, this.map.getView().options_, {
  99102. maxResolution: undefined,
  99103. minResolution: undefined,
  99104. minZoom,
  99105. maxZoom,
  99106. constrainResolution: false
  99107. })
  99108. )
  99109. );
  99110. this.map.addInteraction(
  99111. new (external_ol_interaction_MouseWheelZoom_default())({
  99112. constrainResolution: true
  99113. })
  99114. );
  99115. }
  99116. }
  99117. }
  99118. parseNumber(scaleStr) {
  99119. return Number(scaleStr.split(":")[1])
  99120. }
  99121. findNearest(scales, target) {
  99122. let resultIndex = 0
  99123. let targetScaleD = target;
  99124. for (let i = 1, len = scales.length; i < len; i++) {
  99125. if (
  99126. Math.abs(scales[i] - targetScaleD) <
  99127. Math.abs(scales[resultIndex] - targetScaleD)
  99128. ) {
  99129. resultIndex = i
  99130. }
  99131. }
  99132. return scales[resultIndex]
  99133. }
  99134. /**
  99135. * @private
  99136. * @function WebMap.prototype.addMVTMapLayer
  99137. * @description 添加地图服务mapboxstyle图层
  99138. * @param {Object} mapInfo - 地图信息
  99139. * @param {Object} layerInfo - mapboxstyle图层信息
  99140. */
  99141. addMVTMapLayer(mapInfo, layerInfo, zIndex) {
  99142. layerInfo.zIndex = zIndex;
  99143. // 获取地图详细信息
  99144. return this.getMapboxStyleLayerInfo(mapInfo, layerInfo).then((msLayerInfo) => {
  99145. // 创建图层
  99146. return this.createMVTLayer(msLayerInfo).then(layer => {
  99147. let layerID = core_Util_Util.newGuid(8);
  99148. if (layerInfo.name) {
  99149. layer.setProperties({
  99150. name: layerInfo.name,
  99151. layerID: layerID,
  99152. layerType: 'VECTOR_TILE'
  99153. });
  99154. }
  99155. layerInfo.visibleScale && this.setVisibleScales(layer, layerInfo.visibleScale);
  99156. //否则没有ID,对不上号
  99157. layerInfo.layer = layer;
  99158. layerInfo.layerID = layerID;
  99159. this.map.addLayer(layer);
  99160. });
  99161. }).catch(function (error){
  99162. throw error;
  99163. });
  99164. }
  99165. /**
  99166. * @private
  99167. * @function WebMap.prototype.createView
  99168. * @description 创建地图视图
  99169. * @param {Object} options - 关于地图的信息
  99170. */
  99171. createView(options) {
  99172. let oldcenter = options.center,
  99173. zoom = options.level !== undefined ? options.level : 1,
  99174. maxZoom = options.maxZoom || 22,
  99175. extent,
  99176. projection = this.baseProjection;
  99177. let center = [];
  99178. for (let key in oldcenter) {
  99179. center.push(oldcenter[key]);
  99180. }
  99181. if (center.length === 0) {
  99182. //兼容wms
  99183. center = [0, 0];
  99184. }
  99185. //与DV一致用底图的默认范围,不用存储的范围。否则会导致地图拖不动
  99186. this.baseLayerExtent = extent = options.baseLayer && options.baseLayer.extent;
  99187. if (this.mapParams) {
  99188. this.mapParams.extent = extent;
  99189. this.mapParams.projection = projection;
  99190. }
  99191. //当前中心点不在extent内,就用extent的中心点 todo
  99192. !(0,external_ol_extent_namespaceObject.containsCoordinate)(extent, center) && (center = (0,external_ol_extent_namespaceObject.getCenter)(extent));
  99193. // 计算当前最大分辨率
  99194. let baseLayer = options.baseLayer;
  99195. let maxResolution;
  99196. if ((baseLayer.visibleScales && baseLayer.visibleScales.length > 0) || (baseLayer.scales && baseLayer.scales.length > 0)) {
  99197. //底图有固定比例尺,就直接获取。不用view计算
  99198. this.getScales(baseLayer);
  99199. } else if (options.baseLayer && extent && extent.length === 4) {
  99200. let width = extent[2] - extent[0];
  99201. let height = extent[3] - extent[1];
  99202. let maxResolution1 = width / 512;
  99203. let maxResolution2 = height / 512;
  99204. maxResolution = Math.max(maxResolution1, maxResolution2);
  99205. }
  99206. // if(options.baseLayer.visibleScales && options.baseLayer.visibleScales.length > 0){
  99207. // maxZoom = options.baseLayer.visibleScales.length;
  99208. // }
  99209. this.map.setView(new (external_ol_View_default())({ zoom, center, projection, maxZoom, maxResolution }));
  99210. let viewOptions = {};
  99211. if (baseLayer.scales && baseLayer.scales.length > 0 && baseLayer.layerType === "WMTS" ||
  99212. this.resolutionArray && this.resolutionArray.length > 0) {
  99213. viewOptions = { zoom, center, projection, resolutions: this.resolutionArray, maxZoom };
  99214. } else if (baseLayer.layerType === "WMTS") {
  99215. viewOptions = { zoom, center, projection, maxZoom };
  99216. this.getScales(baseLayer);
  99217. } else {
  99218. viewOptions = { zoom, center, projection, maxResolution, maxZoom };
  99219. this.getScales(baseLayer);
  99220. }
  99221. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) < 0) { // 兼容 ol 4,5,6
  99222. viewOptions.multiWorld = true;
  99223. viewOptions.showFullExtent = true;
  99224. viewOptions.enableRotation = false;
  99225. viewOptions.constrainResolution = true; //设置此参数,是因为需要显示整数级别。为了可视比例尺中包含当前比例尺
  99226. }
  99227. this.map.setView(new (external_ol_View_default())(viewOptions));
  99228. if (options.visibleExtent) {
  99229. const view = this.map.getView();
  99230. const resolution = view.getResolutionForExtent(options.visibleExtent, this.map.getSize());
  99231. view.setResolution(resolution);
  99232. view.setCenter((0,external_ol_extent_namespaceObject.getCenter)(options.visibleExtent));
  99233. }
  99234. }
  99235. /**
  99236. * @private
  99237. * @function WebMap.prototype.createBaseLayer
  99238. * @description 创建矢量图层,包括底图及其叠加的矢量图层
  99239. * @param {Object} layerInfo - 关于地图的信息
  99240. * @param {number} index - 当前图层在地图中的index
  99241. * @param {boolean} isCallBack - 是否调用回调函数
  99242. * @param {scope} {Object} this对象
  99243. */
  99244. createBaseLayer(layerInfo, index, isCallBack, scope, isBaseLayer) {
  99245. let source, that = this;
  99246. if (scope) {
  99247. // 解决异步回调
  99248. that = scope;
  99249. }
  99250. let layerType = layerInfo.layerType; //底图和rest地图兼容
  99251. if (layerType.indexOf('TIANDITU_VEC') > -1 || layerType.indexOf('TIANDITU_IMG') > -1 ||
  99252. layerType.indexOf('TIANDITU_TER') > -1) {
  99253. layerType = layerType.substr(0, 12);
  99254. }
  99255. switch (layerType) {
  99256. case "TIANDITU_VEC":
  99257. case "TIANDITU_IMG":
  99258. case "TIANDITU_TER":
  99259. source = this.createTiandituSource(layerType, layerInfo.projection);
  99260. break;
  99261. case "BAIDU":
  99262. source = this.createBaiduSource();
  99263. break;
  99264. case 'BING':
  99265. source = this.createBingSource(layerInfo, layerInfo.projection);
  99266. break;
  99267. case "WMS":
  99268. source = this.createWMSSource(layerInfo);
  99269. break;
  99270. case "WMTS":
  99271. source = that.createWMTSSource(layerInfo);
  99272. break;
  99273. case 'TILE':
  99274. case 'SUPERMAP_REST':
  99275. source = that.createDynamicTiledSource(layerInfo, isBaseLayer);
  99276. break;
  99277. case 'CLOUD':
  99278. case 'CLOUD_BLACK':
  99279. case 'OSM':
  99280. case 'JAPAN_ORT':
  99281. case 'JAPAN_RELIEF':
  99282. case 'JAPAN_PALE':
  99283. case 'JAPAN_STD':
  99284. case 'GOOGLE_CN':
  99285. case 'GOOGLE':
  99286. source = this.createXYZSource(layerInfo);
  99287. break;
  99288. default:
  99289. break;
  99290. }
  99291. var layer = new external_ol_layer_namespaceObject.Tile({
  99292. source: source,
  99293. zIndex: layerInfo.zIndex || 1,
  99294. visible: layerInfo.visible
  99295. });
  99296. var layerID = core_Util_Util.newGuid(8);
  99297. if (layerInfo.name) {
  99298. layer.setProperties({
  99299. name: layerInfo.name,
  99300. layerID: layerID
  99301. });
  99302. }
  99303. if (layerInfo.visible === undefined || layerInfo.visible === null) {
  99304. layerInfo.visible = true;
  99305. }
  99306. layer.setVisible(layerInfo.visible);
  99307. layerInfo.opacity && layer.setOpacity(layerInfo.opacity);
  99308. //layerInfo没有存储index属性
  99309. index && layer.setZIndex(index);
  99310. //否则没有ID,对不上号
  99311. layerInfo.layer = layer;
  99312. layerInfo.layerID = layerID;
  99313. let {visibleScale, autoUpdateTime} = layerInfo, minResolution, maxResolution;
  99314. if (visibleScale) {
  99315. maxResolution = this.resolutions[visibleScale.minScale];
  99316. minResolution = this.resolutions[visibleScale.maxScale];
  99317. //比例尺和分别率是反比的关系
  99318. maxResolution > 1 ? layer.setMaxResolution(Math.ceil(maxResolution)) : layer.setMaxResolution(maxResolution * 1.1);
  99319. layer.setMinResolution(minResolution);
  99320. }
  99321. if (autoUpdateTime && !layerInfo.autoUpdateInterval) {
  99322. //自动更新
  99323. layerInfo.autoUpdateInterval = setInterval(() => {
  99324. that.updateTileToMap(layerInfo, index);
  99325. }, autoUpdateTime);
  99326. }
  99327. if (isCallBack) {
  99328. layer.setZIndex(0); // wmts
  99329. that.map.addLayer(layer);
  99330. }
  99331. return layer;
  99332. }
  99333. /**
  99334. * @private
  99335. * @function WebMap.prototype.updateTileToMap
  99336. * @description 获取底图对应的图层信息,不是用请求回来的底图信息
  99337. * @param {Object} layerInfo - 图层信息
  99338. * @param {number} layerIndex - 图层index
  99339. */
  99340. updateTileToMap(layerInfo, layerIndex) {
  99341. this.map.removeLayer(layerInfo.layer);
  99342. this.map.addLayer(this.createBaseLayer(layerInfo, layerIndex));
  99343. }
  99344. /**
  99345. * @private
  99346. * @function WebMap.prototype.getInternetMapInfo
  99347. * @description 获取底图对应的图层信息,不是用请求回来的底图信息
  99348. * @param {Object} baseLayerInfo - 底图信息
  99349. * @returns {Object} 底图的具体信息
  99350. */
  99351. getInternetMapInfo(baseLayerInfo) {
  99352. const baiduBounds = [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892];
  99353. const bounds_4326 = [-180, -90, 180, 90];
  99354. const osmBounds = [-20037508.34, -20037508.34, 20037508.34, 20037508.34];
  99355. const japanReliefBounds = [12555667.53929, 1281852.98656, 17525908.86651, 7484870.70596];
  99356. const japanOrtBounds = [-19741117.14519, -10003921.36848, 19981677.71404, 19660983.56089];
  99357. baseLayerInfo.units = "m";
  99358. switch (baseLayerInfo.layerType) {
  99359. case ('BAIDU'):
  99360. baseLayerInfo.iServerUrl = 'https://map.baidu.com/';
  99361. baseLayerInfo.epsgCode = 'EPSG:3857';
  99362. baseLayerInfo.minZoom = 1;
  99363. baseLayerInfo.maxZoom = 19;
  99364. baseLayerInfo.level = 1;
  99365. baseLayerInfo.extent = baiduBounds;
  99366. // thumbnail: this.getImagePath('bmap.png') 暂时不用到缩略图
  99367. break;
  99368. case ('CLOUD'):
  99369. baseLayerInfo.url = 'http://t2.dituhui.com/FileService/image?map=quanguo&type=web&x={x}&y={y}&z={z}';
  99370. baseLayerInfo.epsgCode = 'EPSG:3857';
  99371. baseLayerInfo.minZoom = 1;
  99372. baseLayerInfo.maxZoom = 18;
  99373. baseLayerInfo.level = 1;
  99374. baseLayerInfo.extent = baiduBounds;
  99375. break;
  99376. case ('CLOUD_BLACK'):
  99377. baseLayerInfo.url = 'http://t3.dituhui.com/MapService/getGdp?x={x}&y={y}&z={z}';
  99378. baseLayerInfo.epsgCode = 'EPSG:3857';
  99379. baseLayerInfo.minZoom = 1;
  99380. baseLayerInfo.maxZoom = 18;
  99381. baseLayerInfo.level = 1;
  99382. baseLayerInfo.extent = baiduBounds;
  99383. break;
  99384. case ('tencent'):
  99385. baseLayerInfo.epsgCode = 'EPSG:3857';
  99386. baseLayerInfo.minZoom = 1;
  99387. baseLayerInfo.maxZoom = 18;
  99388. baseLayerInfo.level = 1;
  99389. baseLayerInfo.extent = baiduBounds;
  99390. break;
  99391. case ('TIANDITU_VEC_3857'):
  99392. case ('TIANDITU_IMG_3857'):
  99393. case ('TIANDITU_TER_3857'):
  99394. baseLayerInfo.iserverUrl = 'https://map.tianditu.gov.cn/';
  99395. baseLayerInfo.epsgCode = 'EPSG:3857';
  99396. baseLayerInfo.minZoom = 0;
  99397. baseLayerInfo.maxZoom = 19;
  99398. baseLayerInfo.level = 1;
  99399. baseLayerInfo.extent = baiduBounds;
  99400. if (baseLayerInfo.layerType === "TIANDITU_TER_3857") {
  99401. baseLayerInfo.maxZoom = 14;
  99402. }
  99403. break;
  99404. case ('TIANDITU_VEC_4326'):
  99405. case ('TIANDITU_IMG_4326'):
  99406. case ('TIANDITU_TER_4326'):
  99407. baseLayerInfo.iserverUrl = 'https://map.tianditu.gov.cn/';
  99408. baseLayerInfo.epsgCode = 'EPSG:4326';
  99409. baseLayerInfo.minZoom = 0;
  99410. baseLayerInfo.maxZoom = 19;
  99411. baseLayerInfo.level = 1;
  99412. baseLayerInfo.extent = bounds_4326;
  99413. if (baseLayerInfo.layerType === "TIANDITU_TER_4326") {
  99414. baseLayerInfo.maxZoom = 14;
  99415. }
  99416. break;
  99417. case ('OSM'):
  99418. baseLayerInfo.url = 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
  99419. baseLayerInfo.epsgCode = 'EPSG:3857';
  99420. baseLayerInfo.minZoom = 1;
  99421. baseLayerInfo.maxZoom = 19;
  99422. baseLayerInfo.level = 1;
  99423. baseLayerInfo.extent = osmBounds;
  99424. baseLayerInfo.iserverUrl = 'https://www.openstreetmap.org';
  99425. break;
  99426. case ('GOOGLE'):
  99427. baseLayerInfo.url = `https://maps.googleapis.com/maps/vt?pb=!1m5!1m4!1i{z}!2i{x}!3i{y}!4i256!2m3!1e0!2sm!3i540264686!3m12!2s${this.getLang()}!3sUS!5e18!12m4!1e68!2m2!1sset!2sRoadmap!12m3!1e37!2m1!1ssmartmaps!4e0&key=${this.googleMapsAPIKey}`;
  99428. baseLayerInfo.epsgCode = 'EPSG:3857';
  99429. baseLayerInfo.minZoom = 1;
  99430. baseLayerInfo.maxZoom = 22;
  99431. baseLayerInfo.level = 1;
  99432. baseLayerInfo.extent = osmBounds;
  99433. baseLayerInfo.iserverUrl = 'https://www.google.cn/maps';
  99434. break;
  99435. case ('JAPAN_STD'):
  99436. baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png';
  99437. baseLayerInfo.epsgCode = 'EPSG:3857';
  99438. baseLayerInfo.minZoom = 1;
  99439. baseLayerInfo.maxZoom = 19;
  99440. baseLayerInfo.level = 0;
  99441. baseLayerInfo.extent = osmBounds;
  99442. break;
  99443. case ('JAPAN_PALE'):
  99444. baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png';
  99445. baseLayerInfo.epsgCode = 'EPSG:3857';
  99446. baseLayerInfo.minZoom = 2;
  99447. baseLayerInfo.maxZoom = 19;
  99448. baseLayerInfo.level = 2;
  99449. baseLayerInfo.extent = osmBounds;
  99450. break;
  99451. case ('JAPAN_RELIEF'):
  99452. baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/relief/{z}/{x}/{y}.png';
  99453. baseLayerInfo.epsgCode = 'EPSG:3857';
  99454. baseLayerInfo.minZoom = 5;
  99455. baseLayerInfo.maxZoom = 14;
  99456. baseLayerInfo.level = 5;
  99457. baseLayerInfo.extent = japanReliefBounds;
  99458. break;
  99459. case ('JAPAN_ORT'):
  99460. baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg';
  99461. baseLayerInfo.epsgCode = 'EPSG:3857';
  99462. baseLayerInfo.minZoom = 2;
  99463. baseLayerInfo.maxZoom = 12;
  99464. baseLayerInfo.level = 2;
  99465. baseLayerInfo.extent = japanOrtBounds;
  99466. break;
  99467. }
  99468. }
  99469. /**
  99470. * @private
  99471. * @function WebMap.prototype.createDynamicTiledSource
  99472. * @description 获取supermap iServer类型的地图的source。
  99473. * @param {Object} layerInfo
  99474. * @param {boolean} isBaseLayer 是否是底图
  99475. */
  99476. createDynamicTiledSource(layerInfo, isBaseLayer) {
  99477. let serverType = "IPORTAL",
  99478. credential = layerInfo.credential ? layerInfo.credential.token : undefined,
  99479. keyfix = 'Token',
  99480. keyParams = layerInfo.url;
  99481. if (layerInfo.url.indexOf("www.supermapol.com") > -1 || layerInfo.url.indexOf("itest.supermapol.com") > -1) {
  99482. keyfix = 'Key';
  99483. keyParams = [keyParams];
  99484. serverType = "ONLINE";
  99485. }
  99486. if (credential) {
  99487. SecurityManager[`register${keyfix}`](keyParams, credential);
  99488. }
  99489. // extent: isBaseLayer ? layerInfo.extent : ol.proj.transformExtent(layerInfo.extent, layerInfo.projection, this.baseProjection),
  99490. let options = {
  99491. transparent: true,
  99492. url: layerInfo.url,
  99493. wrapX: false,
  99494. serverType: serverType,
  99495. // crossOrigin: 'anonymous', //在IE11.0.9600版本,会影响通过注册服务打开的iserver地图,不出图。因为没有携带cookie会报跨域问题
  99496. // extent: this.baseLayerExtent,
  99497. // prjCoordSys: {epsgCode: isBaseLayer ? layerInfo.projection.split(':')[1] : this.baseProjection.split(':')[1]},
  99498. format: layerInfo.format
  99499. };
  99500. if(!isBaseLayer && !this.isCustomProjection(this.baseProjection )){
  99501. options.prjCoordSys = { epsgCode : this.baseProjection.split(':')[1]};
  99502. }
  99503. if (layerInfo.visibleScales && layerInfo.visibleScales.length > 0) {
  99504. let visibleResolutions = [];
  99505. for (let i in layerInfo.visibleScales) {
  99506. let resolution = core_Util_Util.scaleToResolution(layerInfo.visibleScales[i], dpiConfig.default, layerInfo.coordUnit);
  99507. visibleResolutions.push(resolution);
  99508. }
  99509. layerInfo.visibleResolutions = visibleResolutions;
  99510. let tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  99511. extent: layerInfo.extent,
  99512. resolutions: visibleResolutions
  99513. });
  99514. options.tileGrid = tileGrid;
  99515. } else {
  99516. options.extent = this.baseLayerExtent;
  99517. //bug:ISVJ-2412,不添加下列代码出不了图。参照iserver ol3出图方式
  99518. let tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  99519. extent: layerInfo.extent,
  99520. resolutions: this.getResolutionsFromBounds(layerInfo.extent)
  99521. });
  99522. options.tileGrid = tileGrid;
  99523. }
  99524. //主机名相同时不添加代理,iportal geturlResource不支持webp代理
  99525. if (layerInfo.url && !Util_Util.isInTheSameDomain(layerInfo.url) && !this.isIportalProxyServiceUrl(layerInfo.url) && layerInfo.format !== 'webp') {
  99526. options.tileProxy = this.server + 'apps/viewer/getUrlResource.png?url=';
  99527. }
  99528. let source = new TileSuperMapRest(options);
  99529. SecurityManager[`register${keyfix}`](layerInfo.url);
  99530. return source;
  99531. }
  99532. /**
  99533. * @private
  99534. * @function WebMap.prototype.getResolutionsFromBounds
  99535. * @description 获取比例尺数组
  99536. * @param {Array.<number>} bounds 范围数组
  99537. * @returns {styleResolutions} 比例尺数组
  99538. */
  99539. getResolutionsFromBounds(bounds) {
  99540. let styleResolutions = [];
  99541. let temp = Math.abs(bounds[0] - bounds[2]) / 512;
  99542. for (let i = 0; i < 22; i++) {
  99543. if (i === 0) {
  99544. styleResolutions[i] = temp;
  99545. continue;
  99546. }
  99547. temp = temp / 2;
  99548. styleResolutions[i] = temp;
  99549. }
  99550. return styleResolutions;
  99551. }
  99552. /**
  99553. * @private
  99554. * @function WebMap.prototype.createTiandituSource
  99555. * @description 创建天地图的source。
  99556. * @param layerType 图层类型
  99557. * @param projection 地理坐标系
  99558. * @param isLabel 是否有路网图层
  99559. * @returns {Tianditu} 天地图的source
  99560. */
  99561. createTiandituSource(layerType, projection, isLabel) {
  99562. let options = {
  99563. layerType: layerType.split('_')[1].toLowerCase(),
  99564. isLabel: isLabel || false,
  99565. projection: projection,
  99566. url: `https://t{0-7}.tianditu.gov.cn/{layer}_{proj}/wmts?tk=${this.tiandituKey}`
  99567. };
  99568. return new Tianditu(options);
  99569. }
  99570. /**
  99571. * @private
  99572. * @function WebMap.prototype.createBaiduSource
  99573. * @description 创建百度地图的source。
  99574. * @returns {BaiduMap} baidu地图的source
  99575. */
  99576. createBaiduSource() {
  99577. return new BaiduMap()
  99578. }
  99579. /**
  99580. * @private
  99581. * @function WebMap.prototype.createBingSource
  99582. * @description 创建bing地图的source。
  99583. * @returns {ol.source.XYZ} bing地图的source
  99584. */
  99585. createBingSource(layerInfo, projection) {
  99586. let url = 'https://dynamic.t0.tiles.ditu.live.com/comp/ch/{quadKey}?it=G,TW,L,LA&mkt=zh-cn&og=109&cstl=w4c&ur=CN&n=z';
  99587. return new (external_ol_source_XYZ_default())({
  99588. wrapX: false,
  99589. projection: projection,
  99590. crossOrigin: 'anonymous',
  99591. tileUrlFunction: function (coordinates) {
  99592. let /*quadDigits = '', */[z, x, y] = [...coordinates];
  99593. y = y > 0 ? y - 1 : -y - 1;
  99594. let index = '';
  99595. for (let i = z; i > 0; i--) {
  99596. let b = 0;
  99597. let mask = 1 << (i - 1);
  99598. if ((x & mask) !== 0) {
  99599. b++;
  99600. }
  99601. if ((y & mask) !== 0) {
  99602. b += 2;
  99603. }
  99604. index += b.toString()
  99605. }
  99606. return url.replace('{quadKey}', index);
  99607. }
  99608. })
  99609. }
  99610. /**
  99611. * @private
  99612. * @function WebMap.prototype.createXYZSource
  99613. * @description 创建图层的XYZsource。
  99614. * @param {Object} layerInfo - 图层信息
  99615. * @returns {ol.source.XYZ} xyz的source
  99616. */
  99617. createXYZSource(layerInfo) {
  99618. return new (external_ol_source_XYZ_default())({
  99619. url: layerInfo.url,
  99620. wrapX: false,
  99621. crossOrigin: 'anonymous'
  99622. })
  99623. }
  99624. /**
  99625. * @private
  99626. * @function WebMap.prototype.createWMSSource
  99627. * @description 创建wms地图source。
  99628. * @param {Object} layerInfo - 图层信息。
  99629. * @returns {ol.source.TileWMS} wms的source
  99630. */
  99631. createWMSSource(layerInfo) {
  99632. let that = this;
  99633. return new (external_ol_source_TileWMS_default())({
  99634. url: layerInfo.url,
  99635. wrapX: false,
  99636. params: {
  99637. LAYERS: layerInfo.layers ? layerInfo.layers[0] : "0",
  99638. FORMAT: 'image/png',
  99639. VERSION: layerInfo.version || "1.3.0"
  99640. },
  99641. projection: layerInfo.projection || that.baseProjection,
  99642. tileLoadFunction: function (imageTile, src) {
  99643. imageTile.getImage().src = src
  99644. }
  99645. })
  99646. }
  99647. /**
  99648. * @private
  99649. * @function WebMap.prototype.getTileLayerExtent
  99650. * @description 获取(Supermap RestMap)的图层参数。
  99651. * @param {Object} layerInfo - 图层信息。
  99652. * @param {function} callback - 获得tile图层参数执行的回调函数
  99653. * @param {function} failedCallback - 失败回调函数
  99654. */
  99655. async getTileLayerExtent(layerInfo, callback, failedCallback) {
  99656. let that = this;
  99657. // 默认使用动态投影方式请求数据
  99658. let dynamicLayerInfo = await that.getTileLayerExtentInfo(layerInfo)
  99659. if (dynamicLayerInfo.succeed === false) {
  99660. if (dynamicLayerInfo.error.code === 400) {
  99661. // dynamicLayerInfo.error.code === 400 不支持动态投影,请求restmap原始信息
  99662. let originLayerInfo = await that.getTileLayerExtentInfo(layerInfo, false);
  99663. if (originLayerInfo.succeed === false) {
  99664. failedCallback();
  99665. } else {
  99666. Object.assign(layerInfo, originLayerInfo);
  99667. callback(layerInfo);
  99668. }
  99669. } else {
  99670. failedCallback();
  99671. }
  99672. } else {
  99673. Object.assign(layerInfo, dynamicLayerInfo);
  99674. callback(layerInfo);
  99675. }
  99676. }
  99677. /**
  99678. * @private
  99679. * @function WebMap.prototype.getTileLayerExtentInfo
  99680. * @description 获取rest map的图层参数。
  99681. * @param {Object} layerInfo - 图层信息。
  99682. * @param {boolean} isDynamic - 是否请求动态投影信息
  99683. */
  99684. getTileLayerExtentInfo(layerInfo, isDynamic = true) {
  99685. let that = this,
  99686. token,
  99687. url = layerInfo.url.trim(),
  99688. credential = layerInfo.credential,
  99689. options = {
  99690. withCredentials: this.withCredentials,
  99691. withoutFormatSuffix: true
  99692. };
  99693. if (isDynamic) {
  99694. let projection = {
  99695. epsgCode: that.baseProjection.split(":")[1]
  99696. }
  99697. if (!that.isCustomProjection(that.baseProjection)) {
  99698. // bug IE11 不会自动编码
  99699. url += '.json?prjCoordSys=' + encodeURI(JSON.stringify(projection));
  99700. }
  99701. }
  99702. if (credential) {
  99703. url = `${url}&token=${encodeURI(credential.token)}`;
  99704. token = credential.token;
  99705. }
  99706. url = this.handleJSONSuffix(url);
  99707. return FetchRequest.get(that.getRequestUrl(url), null, options).then(function (response) {
  99708. return response.json();
  99709. }).then(async (result) => {
  99710. if (result.succeed === false) {
  99711. return result
  99712. }
  99713. let format = 'png';
  99714. if(that.tileFormat === 'webp') {
  99715. const isSupportWebp = await that.isSupportWebp(layerInfo.url, token);
  99716. format = isSupportWebp ? 'webp' : 'png';
  99717. }
  99718. return {
  99719. units: result.coordUnit && result.coordUnit.toLowerCase(),
  99720. coordUnit: result.coordUnit,
  99721. visibleScales: result.visibleScales,
  99722. extent: [result.bounds.left, result.bounds.bottom, result.bounds.right, result.bounds.top],
  99723. projection: `EPSG:${result.prjCoordSys.epsgCode}`,
  99724. format
  99725. }
  99726. }).catch((error) => {
  99727. return {
  99728. succeed: false,
  99729. error: error
  99730. }
  99731. });
  99732. }
  99733. /**
  99734. * @private
  99735. * @function WebMap.prototype.getTileInfo
  99736. * @description 获取rest map的图层参数。
  99737. * @param {Object} layerInfo - 图层信息。
  99738. * @param {function} callback - 获得wmts图层参数执行的回调函数
  99739. */
  99740. getTileInfo(layerInfo, callback, mapInfo) {
  99741. let that = this;
  99742. let options = {
  99743. withCredentials: this.withCredentials,
  99744. withoutFormatSuffix: true
  99745. };
  99746. if (layerInfo.url.indexOf("?token=") > -1) {
  99747. that.credentialKey = 'token';
  99748. that.credentialValue = layerInfo.credential = layerInfo.url.split("?token=")[1];
  99749. layerInfo.url = layerInfo.url.split("?token=")[0];
  99750. }
  99751. let url = this.handleJSONSuffix(layerInfo.url);
  99752. return FetchRequest.get(that.getRequestUrl(url), null, options).then(function (response) {
  99753. return response.json();
  99754. }).then(async function (result) {
  99755. // layerInfo.projection = mapInfo.projection;
  99756. // layerInfo.extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y];
  99757. // 比例尺 单位
  99758. if(result && result.code && result.code !== 200) {
  99759. throw result;
  99760. }
  99761. if (result.visibleScales) {
  99762. layerInfo.visibleScales = result.visibleScales;
  99763. layerInfo.coordUnit = result.coordUnit;
  99764. }
  99765. layerInfo.maxZoom = result.maxZoom;
  99766. layerInfo.maxZoom = result.minZoom;
  99767. let token = layerInfo.credential ? layerInfo.credential.token : undefined;
  99768. layerInfo.format = 'png';
  99769. // china_dark为默认底图,还是用png出图
  99770. if(that.tileFormat === 'webp' && layerInfo.url !== 'https://maptiles.supermapol.com/iserver/services/map_China/rest/maps/China_Dark') {
  99771. const isSupprtWebp = await that.isSupportWebp(layerInfo.url, token);
  99772. layerInfo.format = isSupprtWebp ? 'webp' : 'png';
  99773. }
  99774. // 请求结果完成 继续添加图层
  99775. if (mapInfo) {
  99776. //todo 这个貌似没有用到,下次优化
  99777. callback && callback(mapInfo, null, true, that);
  99778. } else {
  99779. callback && callback(layerInfo);
  99780. }
  99781. }).catch(function (error) {
  99782. that.errorCallback && that.errorCallback(error, 'getTileInfo', that.map)
  99783. });
  99784. }
  99785. /**
  99786. * @private
  99787. * @function WebMap.prototype.getWMTSUrl
  99788. * @description 获取wmts请求文档的url
  99789. * @param {string} url - 图层信息。
  99790. * @param {boolean} isKvp - 是否为kvp模式
  99791. */
  99792. getWMTSUrl(url, isKvp) {
  99793. let splitStr = '?';
  99794. if (url.indexOf('?') > -1) {
  99795. splitStr = '&'
  99796. }
  99797. if (isKvp) {
  99798. url += splitStr + 'SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities';
  99799. } else {
  99800. url += splitStr + '/1.0.0/WMTSCapabilities.xml';
  99801. }
  99802. return this.getRequestUrl(url, true);
  99803. }
  99804. /**
  99805. * @private
  99806. * @function WebMap.prototype.getWmtsInfo
  99807. * @description 获取wmts的图层参数。
  99808. * @param {Object} layerInfo - 图层信息。
  99809. * @param {function} callback - 获得wmts图层参数执行的回调函数
  99810. */
  99811. getWmtsInfo(layerInfo, callback) {
  99812. let that = this;
  99813. let options = {
  99814. withCredentials: that.withCredentials,
  99815. withoutFormatSuffix: true
  99816. };
  99817. const isKvp = !layerInfo.requestEncoding || layerInfo.requestEncoding === 'KVP';
  99818. return FetchRequest.get(that.getWMTSUrl(layerInfo.url, isKvp), null, options).then(function (response) {
  99819. return response.text();
  99820. }).then(function (capabilitiesText) {
  99821. const format = new (external_ol_format_WMTSCapabilities_default())();
  99822. let capabilities = format.read(capabilitiesText);
  99823. if (that.isValidResponse(capabilities)) {
  99824. let content = capabilities.Contents;
  99825. let tileMatrixSet = content.TileMatrixSet,
  99826. layers = content.Layer,
  99827. layer, idx, layerFormat, style = 'default';
  99828. for (let n = 0; n < layers.length; n++) {
  99829. if (layers[n].Identifier === layerInfo.layer) {
  99830. idx = n;
  99831. layer = layers[idx];
  99832. layerFormat = layer.Format[0];
  99833. var layerBounds = layer.WGS84BoundingBox;
  99834. // tileMatrixSetLink = layer.TileMatrixSetLink;
  99835. break;
  99836. }
  99837. }
  99838. layer && layer.Style && layer.Style.forEach(value => {
  99839. if (value.isDefault) {
  99840. style = value.Identifier;
  99841. }
  99842. });
  99843. let scales = [], matrixIds = [];
  99844. for (let i = 0; i < tileMatrixSet.length; i++) {
  99845. if (tileMatrixSet[i].Identifier === layerInfo.tileMatrixSet) {
  99846. let wmtsLayerEpsg = `EPSG:${tileMatrixSet[i].SupportedCRS.split('::')[1]}`;
  99847. for (let h = 0; h < tileMatrixSet[i].TileMatrix.length; h++) {
  99848. scales.push(tileMatrixSet[i].TileMatrix[h].ScaleDenominator);
  99849. matrixIds.push(tileMatrixSet[i].TileMatrix[h].Identifier);
  99850. }
  99851. //bug wmts出图需要加上origin,否则会出现出图不正确的情况。偏移或者瓦片出不了
  99852. let origin = tileMatrixSet[i].TileMatrix[0].TopLeftCorner;
  99853. layerInfo.origin = ["EPSG:4326", "EPSG:4490"].indexOf(wmtsLayerEpsg) > -1 ? [origin[1], origin[0]] : origin;
  99854. break;
  99855. }
  99856. }
  99857. let name = layerInfo.name, extent;
  99858. if (layerBounds) {
  99859. if (layerBounds[0] < -180) {
  99860. layerBounds[0] = -180;
  99861. }
  99862. if (layerBounds[1] < -90) {
  99863. layerBounds[1] = -90;
  99864. }
  99865. if (layerBounds[2] > 180) {
  99866. layerBounds[2] = 180;
  99867. }
  99868. if (layerBounds[3] > 90) {
  99869. layerBounds[3] = 90;
  99870. }
  99871. extent = external_ol_proj_namespaceObject.transformExtent(layerBounds, 'EPSG:4326', that.baseProjection);
  99872. } else {
  99873. extent = external_ol_proj_namespaceObject.get(that.baseProjection).getExtent()
  99874. }
  99875. layerInfo.tileUrl = that.getTileUrl(capabilities.OperationsMetadata.GetTile.DCP.HTTP.Get, layer, layerFormat, isKvp);
  99876. //将需要的参数补上
  99877. layerInfo.extent = extent;
  99878. layerInfo.name = name;
  99879. layerInfo.orginEpsgCode = layerInfo.projection;
  99880. layerInfo.overLayer = true;
  99881. layerInfo.scales = scales;
  99882. layerInfo.style = style;
  99883. layerInfo.title = name;
  99884. layerInfo.unit = "m";
  99885. layerInfo.layerFormat = layerFormat;
  99886. layerInfo.matrixIds = matrixIds;
  99887. callback && callback(layerInfo);
  99888. }
  99889. }).catch(function (error) {
  99890. that.errorCallback && that.errorCallback(error, 'getWmtsFaild', that.map)
  99891. });
  99892. }
  99893. /**
  99894. * @private
  99895. * @function WebMap.prototype.getWmsInfo
  99896. * @description 获取wms的图层参数。
  99897. * @param {Object} layerInfo - 图层信息。
  99898. */
  99899. getWmsInfo(layerInfo) {
  99900. let that = this;
  99901. let url = layerInfo.url.trim();
  99902. url += (url.indexOf('?') > -1 ? '&SERVICE=WMS&REQUEST=GetCapabilities' : '?SERVICE=WMS&REQUEST=GetCapabilities');
  99903. let options = {
  99904. withCredentials: that.withCredentials,
  99905. withoutFormatSuffix: true
  99906. };
  99907. let promise = new Promise(function (resolve) {
  99908. return FetchRequest.get(that.getRequestUrl(url, true), null, options).then(function (response) {
  99909. return response.text();
  99910. }).then(async function (capabilitiesText) {
  99911. const format = new (external_ol_format_WMSCapabilities_default())();
  99912. let capabilities = format.read(capabilitiesText);
  99913. if (capabilities) {
  99914. let layers = capabilities.Capability.Layer.Layer, proj = layerInfo.projection;
  99915. layerInfo.subLayers = layerInfo.layers[0];
  99916. layerInfo.version = capabilities.version;
  99917. for (let i = 0; i < layers.length; i++) {
  99918. // 图层名比对
  99919. if (layerInfo.layers[0] === layers[i].name) {
  99920. let layer = layers[i];
  99921. if (layer.bbox[proj]) {
  99922. let bbox = layer.bbox[proj].bbox;
  99923. // wmts 130 坐标轴是否反向,目前还无法判断
  99924. // 后续还需继续完善WKT 增加坐标轴方向值
  99925. // 目前wkt信息 来自https://epsg.io/
  99926. // 提供坐标方向值的网站 如:https://www.epsg-registry.org/export.htm?wkt=urn:ogc:def:crs:EPSG::4490
  99927. if ((layerInfo.version === "1.3.0" && layerInfo.projection === "EPSG:4326") || (layerInfo.version === "1.3.0" && layerInfo.projection === "EPSG:4490")) {
  99928. layerInfo.extent = [bbox[1], bbox[0], bbox[3], bbox[2]];
  99929. } else {
  99930. layerInfo.extent = bbox;
  99931. }
  99932. break;
  99933. }
  99934. }
  99935. }
  99936. }
  99937. resolve();
  99938. }).catch(function (error) {
  99939. that.errorCallback && that.errorCallback(error, 'getWMSFaild', that.map)
  99940. resolve();
  99941. })
  99942. });
  99943. return promise;
  99944. }
  99945. /**
  99946. * @private
  99947. * @function WebMap.prototype.getTileUrl
  99948. * @description 获取wmts的图层参数。
  99949. * @param {Object} getTileArray - 图层信息。
  99950. * @param {string} layer - 选择的图层
  99951. * @param {string} format - 选择的出图方式
  99952. * @param {boolean} isKvp - 是否是kvp方式
  99953. */
  99954. getTileUrl(getTileArray, layer, format, isKvp) {
  99955. let url;
  99956. if (isKvp) {
  99957. getTileArray.forEach(data => {
  99958. if (data.Constraint[0].AllowedValues.Value[0].toUpperCase() === 'KVP') {
  99959. url = data.href;
  99960. }
  99961. })
  99962. } else {
  99963. const reuslt = layer.ResourceURL.filter(resource => {
  99964. return resource.format === format;
  99965. })
  99966. url = reuslt[0].template;
  99967. }
  99968. return url;
  99969. }
  99970. /**
  99971. * @private
  99972. * @function WebMap.prototype.createWMTSSource
  99973. * @description 获取WMTS类型图层的source。
  99974. * @param {Object} layerInfo - 图层信息。
  99975. * @returns {ol.source.WMTS} wmts的souce
  99976. */
  99977. createWMTSSource(layerInfo) {
  99978. let extent = layerInfo.extent || external_ol_proj_namespaceObject.get(layerInfo.projection).getExtent();
  99979. // 单位通过坐标系获取 (PS: 以前代码非4326 都默认是米)
  99980. let unit = external_ol_proj_namespaceObject.get(this.baseProjection).getUnits();
  99981. return new (external_ol_source_WMTS_default())({
  99982. url: layerInfo.tileUrl || layerInfo.url,
  99983. layer: layerInfo.layer,
  99984. format: layerInfo.layerFormat,
  99985. style: layerInfo.style,
  99986. matrixSet: layerInfo.tileMatrixSet,
  99987. requestEncoding: layerInfo.requestEncoding || 'KVP',
  99988. tileGrid: this.getWMTSTileGrid(extent, layerInfo.scales, unit, layerInfo.dpi, layerInfo.origin, layerInfo.matrixIds),
  99989. tileLoadFunction: function (imageTile, src) {
  99990. if (src.indexOf('tianditu.gov.cn') >= 0) {
  99991. imageTile.getImage().src = `${src}&tk=${Util_Util.getParameters(layerInfo.url)['tk']}`;
  99992. return;
  99993. }
  99994. imageTile.getImage().src = src
  99995. }
  99996. })
  99997. }
  99998. /**
  99999. * @private
  100000. * @function WebMap.prototype.getWMTSTileGrid
  100001. * @description 获取wmts的瓦片。
  100002. * @param {Object} extent - 图层范围。
  100003. * @param {number} scales - 图层比例尺
  100004. * @param {string} unit - 单位
  100005. * @param {number} dpi - dpi
  100006. * @param {Array} origin 瓦片的原点
  100007. * @returns {ol.tilegrid.WMTS} wmts的瓦片
  100008. */
  100009. getWMTSTileGrid(extent, scales, unit, dpi, origin, matrixIds) {
  100010. let resolutionsInfo = this.getReslutionsFromScales(scales, dpi || dpiConfig.iServerWMTS, unit);
  100011. return new (external_ol_tilegrid_WMTS_default())({
  100012. origin,
  100013. extent: extent,
  100014. resolutions: resolutionsInfo.res,
  100015. matrixIds: matrixIds || resolutionsInfo.matrixIds
  100016. });
  100017. }
  100018. /**
  100019. * @private
  100020. * @function WebMap.prototype.getReslutionsFromScales
  100021. * @description 根据比例尺(比例尺分母)、地图单位、dpi、获取一个分辨率数组
  100022. * @param {Array.<number>} scales - 比例尺(比例尺分母)
  100023. * @param {number} dpi - 地图dpi
  100024. * @param {string} unit - 单位
  100025. * @param {number} datumAxis
  100026. * @returns {{res: Array, matrixIds: Array}}
  100027. */
  100028. getReslutionsFromScales(scales, dpi, unit, datumAxis) {
  100029. unit = (unit && unit.toLowerCase()) || 'degrees';
  100030. dpi = dpi || dpiConfig.iServerWMTS;
  100031. datumAxis = datumAxis || 6378137;
  100032. let res = [],
  100033. matrixIds = [];
  100034. //给个默认的
  100035. if (core_Util_Util.isArray(scales)) {
  100036. scales && scales.forEach(function (scale, idx) {
  100037. if (scale > 1.0) {
  100038. matrixIds.push(idx);
  100039. res.push(this.getResolutionFromScale(scale, dpi, unit, datumAxis));
  100040. }
  100041. }, this);
  100042. } else {
  100043. let tileMatrixSet = scales['TileMatrix'];
  100044. tileMatrixSet && tileMatrixSet.forEach(function (tileMatrix) {
  100045. matrixIds.push(tileMatrix['Identifier']);
  100046. res.push(this.getResolutionFromScale(tileMatrix['ScaleDenominator'], dpi, unit, datumAxis));
  100047. }, this);
  100048. }
  100049. return {
  100050. res: res,
  100051. matrixIds: matrixIds
  100052. };
  100053. }
  100054. /**
  100055. * @private
  100056. * @function WebMap.prototype.getResolutionFromScale
  100057. * @description 获取一个WMTS source需要的tileGrid
  100058. * @param {number} scale - 比例尺(比例尺分母)
  100059. * @param {number} dpi - 地图dpi
  100060. * @param {string} unit - 单位
  100061. * @param {number} datumAxis
  100062. * @returns {{res: Array, matrixIds: Array}}
  100063. */
  100064. getResolutionFromScale(scale, dpi = dpiConfig.default, unit, datumAxis) {
  100065. //radio = 10000;
  100066. let res;
  100067. scale = +scale;
  100068. scale = (scale > 1.0) ? (1.0 / scale) : scale;
  100069. if (unit === 'degrees' || unit === 'dd' || unit === 'degree') {
  100070. res = 0.0254 * 10000 / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / 10000;
  100071. } else {
  100072. res = 0.0254 * 10000 / dpi / scale / 10000;
  100073. }
  100074. return res;
  100075. }
  100076. /**
  100077. * @private
  100078. * @function WebMap.prototype.isValidResponse
  100079. * @description 返回信息是否符合对应类型的标准
  100080. * @param {Object} response - 返回的信息
  100081. * @returns {boolean}
  100082. */
  100083. isValidResponse(response) {
  100084. let responseEnum = ['Contents', 'OperationsMetadata'],
  100085. valid = true;
  100086. for (let i = 0; i < responseEnum.length; i++) {
  100087. if (!response[responseEnum[i]] || response.error) {
  100088. valid = false;
  100089. break;
  100090. }
  100091. }
  100092. return valid;
  100093. }
  100094. /**
  100095. * @private
  100096. * @function WebMap.prototype.addLayers
  100097. * @description 添加叠加图层
  100098. * @param {Object} mapInfo - 地图信息
  100099. */
  100100. async addLayers(mapInfo) {
  100101. let layers = mapInfo.layers,
  100102. that = this;
  100103. let features = [],
  100104. len = layers.length;
  100105. if (len > 0) {
  100106. //存储地图上所有的图层对象
  100107. this.layers = layers;
  100108. for (let index = 0; index< layers.length; index++) {
  100109. const layer = layers[index];
  100110. //加上底图的index
  100111. let layerIndex = index + 1,
  100112. dataSource = layer.dataSource,
  100113. isSampleData = dataSource && dataSource.type === "SAMPLE_DATA" && !!dataSource.name; //SAMPLE_DATA是本地示例数据
  100114. if (layer.layerType === "MAPBOXSTYLE") {
  100115. that.addMVTMapLayer(mapInfo, layer, layerIndex).then(() => {
  100116. that.layerAdded++;
  100117. that.sendMapToUser(len);
  100118. }).catch(function (error) {
  100119. that.layerAdded++;
  100120. that.sendMapToUser(len);
  100121. that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map);
  100122. });
  100123. } else if ((dataSource && dataSource.serverId) || layer.layerType === "MARKER" || layer.layerType === 'HOSTED_TILE' || isSampleData) {
  100124. //数据存储到iportal上了
  100125. let dataSource = layer.dataSource,
  100126. serverId = dataSource ? dataSource.serverId : layer.serverId;
  100127. if (!serverId && !isSampleData) {
  100128. await that.addLayer(layer, null, layerIndex);
  100129. that.layerAdded++;
  100130. that.sendMapToUser(len);
  100131. return;
  100132. }
  100133. if ((layer.layerType === "MARKER") || (dataSource && (!dataSource.accessType || dataSource.accessType === 'DIRECT')) || isSampleData) {
  100134. //原来二进制文件
  100135. let url = isSampleData ? `${that.server}apps/dataviz/libs/sample-datas/${dataSource.name}.json` : `${that.server}web/datas/${serverId}/content.json?pageSize=9999999&currentPage=1`;
  100136. url = that.getRequestUrl(url);
  100137. FetchRequest.get(url, null, {
  100138. withCredentials: this.withCredentials
  100139. }).then(function (response) {
  100140. return response.json()
  100141. }).then(async function (data) {
  100142. if (data.succeed === false) {
  100143. //请求失败
  100144. that.layerAdded++;
  100145. that.sendMapToUser(len);
  100146. that.errorCallback && that.errorCallback(data.error, 'getLayerFaild', that.map);
  100147. return;
  100148. }
  100149. if (data && data.type) {
  100150. if (data.type === "JSON" || data.type === "GEOJSON") {
  100151. data.content = data.content.type ? data.content : JSON.parse(data.content);
  100152. features = that.geojsonToFeature(data.content, layer);
  100153. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  100154. if (layer.dataSource && layer.dataSource.administrativeInfo) {
  100155. //行政规划信息
  100156. data.content.rows.unshift(data.content.colTitles);
  100157. let {divisionType, divisionField} = layer.dataSource.administrativeInfo;
  100158. let geojson = that.excelData2FeatureByDivision(data.content, divisionType, divisionField);
  100159. features = that._parseGeoJsonData2Feature({allDatas: {features: geojson.features}, fileCode: layer.projection});
  100160. } else {
  100161. features = await that.excelData2Feature(data.content, layer);
  100162. }
  100163. } else if (data.type === 'SHP') {
  100164. let content = JSON.parse(data.content);
  100165. data.content = content.layers[0];
  100166. features = that.geojsonToFeature(data.content, layer);
  100167. }
  100168. await that.addLayer(layer, features, layerIndex);
  100169. that.layerAdded++;
  100170. that.sendMapToUser(len);
  100171. }
  100172. }).catch(function (error) {
  100173. that.layerAdded++;
  100174. that.sendMapToUser(len);
  100175. that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map);
  100176. })
  100177. } else {
  100178. //关系型文件
  100179. let isMapService = layer.layerType === 'HOSTED_TILE',
  100180. serverId = dataSource ? dataSource.serverId : layer.serverId;
  100181. that.checkUploadToRelationship(serverId).then(function (result) {
  100182. if (result && result.length > 0) {
  100183. let datasetName = result[0].name,
  100184. featureType = result[0].type.toUpperCase();
  100185. that.getDataService(serverId, datasetName).then(async function (data) {
  100186. let dataItemServices = data.dataItemServices;
  100187. if (dataItemServices.length === 0) {
  100188. that.layerAdded++;
  100189. that.sendMapToUser(len);
  100190. that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map);
  100191. return;
  100192. }
  100193. if (isMapService) {
  100194. //需要判断是使用tile还是mvt服务
  100195. let dataService = that.getService(dataItemServices, 'RESTDATA');
  100196. that.isMvt(dataService.address, datasetName).then(async info => {
  100197. await that.getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType, info);
  100198. }).catch(async () => {
  100199. //判断失败就走之前逻辑,>数据量用tile
  100200. await that.getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType);
  100201. })
  100202. } else {
  100203. await that.getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType);
  100204. }
  100205. });
  100206. } else {
  100207. that.layerAdded++;
  100208. that.sendMapToUser(len);
  100209. that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map);
  100210. }
  100211. }).catch(function (error) {
  100212. that.layerAdded++;
  100213. that.sendMapToUser(len);
  100214. that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map);
  100215. })
  100216. }
  100217. } else if (dataSource && dataSource.type === "USER_DATA") {
  100218. that.addGeojsonFromUrl(layer, len, layerIndex, false);
  100219. } else if (layer.layerType === "TILE"){
  100220. that.getTileLayerExtent(layer, function (layerInfo) {
  100221. that.map.addLayer(that.createBaseLayer(layerInfo, layerIndex));
  100222. that.layerAdded++;
  100223. that.sendMapToUser(len);
  100224. }, function (e) {
  100225. that.layerAdded++;
  100226. that.sendMapToUser(len);
  100227. that.errorCallback && that.errorCallback(e, 'getLayerFaild', that.map);
  100228. })
  100229. } else if (layer.layerType === 'SUPERMAP_REST' ||
  100230. layer.layerType === "WMS" ||
  100231. layer.layerType === "WMTS") {
  100232. if (layer.layerType === "WMTS") {
  100233. that.getWmtsInfo(layer, function (layerInfo) {
  100234. that.map.addLayer(that.createBaseLayer(layerInfo, layerIndex));
  100235. that.layerAdded++;
  100236. that.sendMapToUser(len);
  100237. })
  100238. } else if(layer.layerType === "WMS") {
  100239. that.getWmsInfo(layer).then(() => {
  100240. that.map.addLayer(that.createBaseLayer(layer, layerIndex));
  100241. that.layerAdded++;
  100242. that.sendMapToUser(len);
  100243. })
  100244. } else {
  100245. layer.projection = that.baseProjection;
  100246. that.map.addLayer(that.createBaseLayer(layer, layerIndex));
  100247. that.layerAdded++;
  100248. that.sendMapToUser(len);
  100249. }
  100250. } else if (dataSource && dataSource.type === "REST_DATA") {
  100251. //从restData获取数据
  100252. that.getFeaturesFromRestData(layer, layerIndex, len);
  100253. } else if (dataSource && dataSource.type === "REST_MAP" && dataSource.url) {
  100254. //示例数据
  100255. queryFeatureBySQL(dataSource.url, dataSource.layerName, 'smid=1', null, null, function (result) {
  100256. var recordsets = result && result.result.recordsets;
  100257. var recordset = recordsets && recordsets[0];
  100258. var attributes = recordset.fields;
  100259. if (recordset && attributes) {
  100260. let fileterAttrs = [];
  100261. for (var i in attributes) {
  100262. var value = attributes[i];
  100263. if (value.indexOf('Sm') !== 0 || value === "SmID") {
  100264. fileterAttrs.push(value);
  100265. }
  100266. }
  100267. that.getFeatures(fileterAttrs, layer, async function (features) {
  100268. await that.addLayer(layer, features, layerIndex);
  100269. that.layerAdded++;
  100270. that.sendMapToUser(len);
  100271. }, function (e) {
  100272. that.layerAdded++;
  100273. that.errorCallback && that.errorCallback(e, 'getFeatureFaild', that.map);
  100274. });
  100275. }
  100276. }, function (e) {
  100277. that.errorCallback && that.errorCallback(e, 'getFeatureFaild', that.map);
  100278. })
  100279. } else if (layer.layerType === "DATAFLOW_POINT_TRACK" || layer.layerType === "DATAFLOW_HEAT") {
  100280. that.getDataflowInfo(layer, async function () {
  100281. await that.addLayer(layer, features, layerIndex);
  100282. that.layerAdded++;
  100283. that.sendMapToUser(len);
  100284. }, function (e) {
  100285. that.layerAdded++;
  100286. that.errorCallback && that.errorCallback(e, 'getFeatureFaild', that.map);
  100287. })
  100288. }
  100289. }
  100290. }
  100291. }
  100292. /**
  100293. * @private
  100294. * @function WebMap.prototype.addGeojsonFromUrl
  100295. * @description 从web服务输入geojson地址的图层
  100296. * @param {Object} layerInfo - 图层信息
  100297. * @param {number} len - 总的图层数量
  100298. * @param {number} layerIndex - 当前图层index
  100299. * @param {boolean} withCredentials - 是否携带cookie
  100300. */
  100301. addGeojsonFromUrl(layerInfo, len, layerIndex, withCredentials = this.withCredentials) {
  100302. // 通过web添加geojson不需要携带cookie
  100303. let {dataSource} = layerInfo, {url} = dataSource, that = this;
  100304. FetchRequest.get(url, null, {
  100305. withCredentials,
  100306. withoutFormatSuffix: true
  100307. }).then(function (response) {
  100308. return response.json()
  100309. }).then(async function (data) {
  100310. if (!data || data.succeed === false) {
  100311. //请求失败
  100312. if (len) {
  100313. that.errorCallback && that.errorCallback(data.error, 'autoUpdateFaild', that.map)
  100314. } else {
  100315. that.layerAdded++;
  100316. that.sendMapToUser(len);
  100317. that.errorCallback && that.errorCallback(data.error, 'getLayerFaild', that.map);
  100318. }
  100319. return;
  100320. }
  100321. var features;
  100322. if (data.type === 'CSV' || data.type === 'EXCEL') {
  100323. if (layerInfo.dataSource && layerInfo.dataSource.administrativeInfo) {
  100324. //行政规划信息
  100325. data.content.rows.unshift(data.content.colTitles);
  100326. let {divisionType, divisionField} = layerInfo.dataSource.administrativeInfo;
  100327. let geojson = that.excelData2FeatureByDivision(data.content, divisionType, divisionField);
  100328. features = that._parseGeoJsonData2Feature({allDatas: {features: geojson.features}, fileCode: layerInfo.projection});
  100329. } else {
  100330. features = await that.excelData2Feature(data.content, layerInfo);
  100331. }
  100332. } else {
  100333. var geoJson = data.content ? JSON.parse(data.content) : data;
  100334. features = that.geojsonToFeature(geoJson, layerInfo);
  100335. }
  100336. if (len) {
  100337. //上图
  100338. await that.addLayer(layerInfo, features, layerIndex);
  100339. that.layerAdded++;
  100340. that.sendMapToUser(len);
  100341. } else {
  100342. //自动更新
  100343. that.map.removeLayer(layerInfo.layer);
  100344. layerInfo.labelLayer && that.map.removeLayer(layerInfo.labelLayer);
  100345. await that.addLayer(layerInfo, features, layerIndex);
  100346. }
  100347. }).catch(function (error) {
  100348. that.layerAdded++;
  100349. that.sendMapToUser(len);
  100350. that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map);
  100351. })
  100352. }
  100353. /**
  100354. * @private
  100355. * @function WebMap.prototype.getServiceInfoFromLayer
  100356. * @description 判断使用哪种服务上图
  100357. * @param {number} layerIndex - 图层对应的index
  100358. * @param {number} len - 成功添加的图层个数
  100359. * @param {Object} layer - 图层信息
  100360. * @param {Array.<Object>} dataItemServices - 数据发布的服务
  100361. * @param {string} datasetName - 数据服务的数据集名称
  100362. * @param {string} featureType - feature类型
  100363. * @param {Object} info - 数据服务的信息
  100364. */
  100365. async getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType, info) {
  100366. let that = this;
  100367. let isMapService = info ? !info.isMvt : layer.layerType === 'HOSTED_TILE',
  100368. isAdded = false;
  100369. for (let i = 0; i < dataItemServices.length; i++) {
  100370. const service = dataItemServices[i];
  100371. if (isAdded) {
  100372. return;
  100373. }
  100374. //有服务了,就不需要循环
  100375. if (service && isMapService && service.serviceType === 'RESTMAP') {
  100376. isAdded = true;
  100377. //地图服务,判断使用mvt还是tile
  100378. that.getTileLayerInfo(service.address).then(function (restMaps) {
  100379. restMaps.forEach(function (restMapInfo) {
  100380. let bounds = restMapInfo.bounds;
  100381. layer.layerType = 'TILE';
  100382. layer.orginEpsgCode = that.baseProjection;
  100383. layer.units = restMapInfo.coordUnit && restMapInfo.coordUnit.toLowerCase();
  100384. layer.extent = [bounds.left, bounds.bottom, bounds.right, bounds.top];
  100385. layer.visibleScales = restMapInfo.visibleScales;
  100386. layer.url = restMapInfo.url;
  100387. layer.sourceType = 'TILE';
  100388. that.map.addLayer(that.createBaseLayer(layer, layerIndex));
  100389. that.layerAdded++;
  100390. that.sendMapToUser(len);
  100391. })
  100392. })
  100393. } else if (service && !isMapService && service.serviceType === 'RESTDATA') {
  100394. isAdded = true;
  100395. if (info && info.isMvt) {
  100396. let bounds = info.bounds;
  100397. layer = Object.assign(layer, {
  100398. layerType: "VECTOR_TILE",
  100399. epsgCode: info.epsgCode,
  100400. projection: `EPSG:${info.epsgCode}`,
  100401. bounds: bounds,
  100402. extent: [bounds.left, bounds.bottom, bounds.right, bounds.top],
  100403. name: layer.name,
  100404. url: info.url,
  100405. visible: layer.visible,
  100406. featureType: featureType,
  100407. serverId: layer.serverId.toString()
  100408. });
  100409. that.map.addLayer(await that.addVectorTileLayer(layer, layerIndex, 'RESTDATA'));
  100410. that.layerAdded++;
  100411. that.sendMapToUser(len);
  100412. } else {
  100413. //数据服务
  100414. isAdded = true;
  100415. //关系型文件发布的数据服务
  100416. that.getDatasources(service.address).then(function (datasourceName) {
  100417. layer.dataSource.dataSourceName = datasourceName + ":" + datasetName;
  100418. layer.dataSource.url = `${service.address}/data`;
  100419. that.getFeaturesFromRestData(layer, layerIndex, len);
  100420. });
  100421. }
  100422. }
  100423. }
  100424. if (!isAdded) {
  100425. //循环完成了,也没有找到合适的服务。有可能服务被删除
  100426. that.layerAdded++;
  100427. that.sendMapToUser(len);
  100428. that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map);
  100429. }
  100430. }
  100431. /**
  100432. * @private
  100433. * @function WebMap.prototype.getDataflowInfo
  100434. * @description 获取数据流服务的参数
  100435. * @param {Object} layerInfo - 图层信息
  100436. * @param {function} success - 成功回调函数
  100437. * @param {function} faild - 失败回调函数
  100438. */
  100439. getDataflowInfo(layerInfo, success, faild) {
  100440. let that = this;
  100441. let url = layerInfo.url, token;
  100442. url = this.handleJSONSuffix(url);
  100443. let requestUrl = that.getRequestUrl(url, false);
  100444. if (layerInfo.credential && layerInfo.credential.token) {
  100445. token = layerInfo.credential.token;
  100446. requestUrl += `?token=${token}`;
  100447. }
  100448. FetchRequest.get(requestUrl, null, {
  100449. withCredentials: this.withCredentials
  100450. }).then(function (response) {
  100451. return response.json()
  100452. }).then(function (result) {
  100453. layerInfo.featureType = "POINT";
  100454. if (result && result.featureMetaData) {
  100455. layerInfo.featureType = result.featureMetaData.featureType.toUpperCase();
  100456. }
  100457. layerInfo.wsUrl = result.urls[0].url;
  100458. success();
  100459. }).catch(function () {
  100460. faild();
  100461. });
  100462. }
  100463. /**
  100464. * @private
  100465. * @function WebMap.prototype.getFeaturesFromRestData
  100466. * @description 从数据服务中获取feature
  100467. * @param {Object} layer - 图层信息
  100468. * @param {number} layerIndex - 图层index
  100469. * @param {number} layerLength - 图层数量
  100470. */
  100471. getFeaturesFromRestData(layer, layerIndex, layerLength) {
  100472. let that = this, dataSource = layer.dataSource,
  100473. url = layer.dataSource.url,
  100474. dataSourceName = dataSource.dataSourceName || layer.name;
  100475. let requestUrl = that.formatUrlWithCredential(url), serviceOptions = {};
  100476. serviceOptions.withCredentials = this.withCredentials;
  100477. if (!this.excludePortalProxyUrl && !Util_Util.isInTheSameDomain(requestUrl)) {
  100478. serviceOptions.proxy = this.getProxy();
  100479. }
  100480. if(['EPSG:0'].includes(layer.projection)) {
  100481. // 不支持动态投影restData服务
  100482. that.layerAdded++;
  100483. that.sendMapToUser(layerLength);
  100484. that.errorCallback && that.errorCallback({}, 'getFeatureFaild', that.map);
  100485. return;
  100486. }
  100487. //因为itest上使用的https,iserver是http,所以要加上代理
  100488. getFeatureBySQL(requestUrl, [decodeURIComponent(dataSourceName)], serviceOptions, async function (result) {
  100489. let features = that.parseGeoJsonData2Feature({
  100490. allDatas: {
  100491. features: result.result.features.features
  100492. },
  100493. fileCode: that.baseProjection, //因为获取restData用了动态投影,不需要再进行坐标转换。所以此处filecode和底图坐标系一致
  100494. featureProjection: that.baseProjection
  100495. });
  100496. await that.addLayer(layer, features, layerIndex);
  100497. that.layerAdded++;
  100498. that.sendMapToUser(layerLength);
  100499. }, function (err) {
  100500. that.layerAdded++;
  100501. that.sendMapToUser(layerLength);
  100502. that.errorCallback && that.errorCallback(err, 'getFeatureFaild', that.map)
  100503. }, that.baseProjection.split("EPSG:")[1], this.restDataSingleRequestCount);
  100504. }
  100505. /**
  100506. * @private
  100507. * @function WebMap.prototype.getFeatures
  100508. * @description 从地图中获取feature
  100509. * @param {Object} fields - 图层信息
  100510. * @param {number} layerInfo - 图层index
  100511. * @param {number} success - 成功回调
  100512. * @param {number} faild - 失败回调
  100513. */
  100514. getFeatures(fields, layerInfo, success, faild) {
  100515. var that = this;
  100516. var source = layerInfo.dataSource;
  100517. var fileCode = layerInfo.projection;
  100518. queryFeatureBySQL(source.url, source.layerName, null, fields, null, function (result) {
  100519. var recordsets = result.result.recordsets[0];
  100520. var features = recordsets.features.features;
  100521. var featuresObj = that.parseGeoJsonData2Feature({
  100522. allDatas: {
  100523. features
  100524. },
  100525. fileCode: fileCode,
  100526. featureProjection: that.baseProjection
  100527. }, 'JSON');
  100528. success(featuresObj);
  100529. }, function (err) {
  100530. faild(err);
  100531. });
  100532. }
  100533. /**
  100534. * @private
  100535. * @function WebMap.prototype.sendMapToUser
  100536. * @description 将所有叠加图层叠加后,返回最终的map对象给用户,供他们操作使用
  100537. * @param {number} layersLen - 叠加图层总数
  100538. */
  100539. sendMapToUser(layersLen) {
  100540. const lens = this.isHaveGraticule ? layersLen + 1 : layersLen;
  100541. if (this.layerAdded === lens && this.successCallback) {
  100542. this.successCallback(this.map, this.mapParams, this.layers, this.baseLayer);
  100543. }
  100544. }
  100545. /**
  100546. * @private
  100547. * @function WebMap.prototype.excelData2Feature
  100548. * @description 将csv和xls文件内容转换成ol.feature
  100549. * @param {Object} content - 文件内容
  100550. * @param {Object} layerInfo - 图层信息
  100551. * @returns {Array} ol.feature的数组集合
  100552. */
  100553. async excelData2Feature(content, layerInfo) {
  100554. let rows = content.rows,
  100555. colTitles = content.colTitles;
  100556. // 解决V2恢复的数据中含有空格
  100557. for (let i in colTitles) {
  100558. if (core_Util_Util.isString(colTitles[i])) {
  100559. colTitles[i] = core_Util_Util.trim(colTitles[i]);
  100560. }
  100561. }
  100562. let fileCode = layerInfo.projection,
  100563. dataSource = layerInfo.dataSource,
  100564. baseLayerEpsgCode = this.baseProjection,
  100565. features = [],
  100566. xField = core_Util_Util.trim((layerInfo.xyField && layerInfo.xyField.xField) || (layerInfo.from && layerInfo.from.xField)),
  100567. yField = core_Util_Util.trim((layerInfo.xyField && layerInfo.xyField.yField) || (layerInfo.from && layerInfo.from.yField)),
  100568. xIdx = colTitles.indexOf(xField),
  100569. yIdx = colTitles.indexOf(yField);
  100570. // todo 优化 暂时这样处理
  100571. if (layerInfo.layerType === 'MIGRATION') {
  100572. try {
  100573. if (dataSource.type === 'PORTAL_DATA') {
  100574. const {dataMetaInfo} = await FetchRequest.get(`${this.server}web/datas/${dataSource.serverId}.json`, null, {
  100575. withCredentials: this.withCredentials
  100576. }).then(res => res.json());
  100577. // eslint-disable-next-line require-atomic-updates
  100578. layerInfo.xyField = {
  100579. xField: dataMetaInfo.xField,
  100580. yField: dataMetaInfo.yField
  100581. }
  100582. if (!dataMetaInfo.xIndex) {
  100583. xIdx = colTitles.indexOf(dataMetaInfo.xField);
  100584. yIdx = colTitles.indexOf(dataMetaInfo.yField);
  100585. } else {
  100586. xIdx = dataMetaInfo.xIndex;
  100587. yIdx = dataMetaInfo.yIndex;
  100588. }
  100589. } else if (dataSource.type === 'SAMPLE_DATA') {
  100590. // 示例数据从本地拿xyField
  100591. const sampleData = SampleDataInfo_namespaceObject.find(item => item.id === dataSource.name) || {};
  100592. xField = sampleData.xField;
  100593. yField = sampleData.yField
  100594. layerInfo.xyField = {
  100595. xField,
  100596. yField
  100597. }
  100598. xIdx = colTitles.findIndex(item => item === xField);
  100599. yIdx = colTitles.findIndex(item => item === yField);
  100600. }
  100601. } catch (error) {
  100602. console.error(error);
  100603. }
  100604. }
  100605. for (let i = 0, len = rows.length; i < len; i++) {
  100606. let rowDatas = rows[i],
  100607. attributes = {},
  100608. geomX = rows[i][xIdx],
  100609. geomY = rows[i][yIdx];
  100610. // 位置字段信息不存在 过滤数据
  100611. if (geomX !== '' && geomY !== '') {
  100612. let olGeom = new external_ol_geom_namespaceObject.Point([+geomX, +geomY]);
  100613. if (fileCode !== baseLayerEpsgCode) {
  100614. olGeom.transform(fileCode, baseLayerEpsgCode);
  100615. }
  100616. for (let j = 0, leng = rowDatas.length; j < leng; j++) {
  100617. let field = colTitles[j];
  100618. if (field === undefined || field === null) {continue;}
  100619. field = field.trim();
  100620. if (Object.keys(attributes).indexOf(field) > -1) {
  100621. //说明前面有个一模一样的字段
  100622. const newField = field + '_1';
  100623. attributes[newField] = rowDatas[j];
  100624. } else {
  100625. attributes[field] = rowDatas[j];
  100626. }
  100627. }
  100628. let feature = new (external_ol_Feature_default())({
  100629. geometry: olGeom,
  100630. attributes
  100631. });
  100632. features.push(feature);
  100633. }
  100634. }
  100635. return Promise.resolve(features);
  100636. }
  100637. /**
  100638. * @private
  100639. * @function WebMap.prototype.excelData2FeatureByDivision
  100640. * @description 行政区划数据处理
  100641. * @param {Object} content - 文件内容
  100642. * @param {Object} layerInfo - 图层信息
  100643. * @returns {Object} geojson对象
  100644. */
  100645. excelData2FeatureByDivision(content, divisionType, divisionField) {
  100646. let me = this;
  100647. let asyncInport;
  100648. if (divisionType === 'Province') {
  100649. asyncInport = window.ProvinceData;
  100650. } else if (divisionType === 'City') {
  100651. asyncInport = window.MunicipalData;
  100652. } else if (divisionType === 'GB-T_2260') {
  100653. // let geojso;
  100654. asyncInport = window.AdministrativeArea;
  100655. }
  100656. if (asyncInport) {
  100657. let geojson = me.changeExcel2Geojson(asyncInport.features, content.rows, divisionType, divisionField);
  100658. return geojson;
  100659. }
  100660. }
  100661. /**
  100662. * @private
  100663. * @function WebMap.prototype._parseGeoJsonData2Feature
  100664. * @description 将geojson的数据转换成ol.Feature
  100665. * @param {Object} metaData - 文件内容
  100666. * @returns {Array.<ol.Feature>} features
  100667. */
  100668. _parseGeoJsonData2Feature(metaData) {
  100669. let allFeatures = metaData.allDatas.features,
  100670. features = [];
  100671. for (let i = 0, len = allFeatures.length; i < len; i++) {
  100672. //不删除properties转换后,属性全都在feature上
  100673. let properties = Object.assign({}, allFeatures[i].properties);
  100674. delete allFeatures[i].properties;
  100675. let feature = transformTools.readFeature(allFeatures[i], {
  100676. dataProjection: metaData.fileCode,
  100677. featureProjection: this.baseProjection || 'ESPG:4326'
  100678. });
  100679. feature.setProperties({attributes: properties});
  100680. features.push(feature);
  100681. }
  100682. return features;
  100683. }
  100684. /**
  100685. * @private
  100686. * @function WebMap.prototype.changeExcel2Geojson
  100687. * @description 将excel和csv数据转换成标准geojson数据
  100688. * @param {Array} features - feature对象
  100689. * @param {Array} datas - 数据内容
  100690. * @param {string} divisionType - 行政区划类型
  100691. * @param {string} divisionField - 行政区划字段
  100692. * @returns {Object} geojson对象
  100693. */
  100694. changeExcel2Geojson(features, datas, divisionType, divisionField) {
  100695. let geojson = {
  100696. type: 'FeatureCollection',
  100697. features: []
  100698. };
  100699. if (datas.length < 2) {
  100700. return geojson; //只有一行数据时为标题
  100701. }
  100702. let titles = datas[0],
  100703. rows = datas.slice(1),
  100704. fieldIndex = titles.findIndex(title => title === divisionField);
  100705. rows.forEach(row => {
  100706. let feature;
  100707. if (divisionType === 'GB-T_2260') {
  100708. feature = features.find(item => item.properties.GB === row[fieldIndex])
  100709. } else {
  100710. feature = core_Util_Util.getHighestMatchAdministration(features, row[fieldIndex]);
  100711. }
  100712. //todo 需提示忽略无效数据
  100713. if (feature) {
  100714. let newFeature = window.cloneDeep(feature);
  100715. newFeature.properties = {};
  100716. row.forEach((item, idx) => {
  100717. //空格问题,看见DV多处处理空格问题,TODO统一整理
  100718. let key = titles[idx].trim();
  100719. newFeature.properties[key] = item;
  100720. });
  100721. geojson.features.push(newFeature);
  100722. }
  100723. });
  100724. return geojson;
  100725. }
  100726. /**
  100727. * @private
  100728. * @function WebMap.prototype.geojsonToFeature
  100729. * @description geojson 转换为 feature
  100730. * @param {Object} layerInfo - 图层信息
  100731. * @returns {Array} ol.feature的数组集合
  100732. */
  100733. geojsonToFeature(geojson, layerInfo) {
  100734. let allFeatures = geojson.features,
  100735. features = [];
  100736. for (let i = 0, len = allFeatures.length; i < len; i++) {
  100737. //转换前删除properties,这样转换后属性不会重复存储
  100738. let featureAttr = allFeatures[i].properties || {};
  100739. delete allFeatures[i].properties;
  100740. let feature = transformTools.readFeature(allFeatures[i], {
  100741. dataProjection: layerInfo.projection || 'EPSG:4326',
  100742. featureProjection: this.baseProjection || 'ESPG:4326'
  100743. });
  100744. //geojson格式的feature属性没有坐标系字段,为了统一,再次加上
  100745. let coordinate = feature.getGeometry().getCoordinates();
  100746. if (allFeatures[i].geometry.type === 'Point') {
  100747. // 标注图层 还没有属性值时候不加
  100748. if (allFeatures[i].properties) {
  100749. allFeatures[i].properties.lon = coordinate[0];
  100750. allFeatures[i].properties.lat = coordinate[1];
  100751. }
  100752. }
  100753. // 标注图层特殊处理
  100754. let isMarker = false;
  100755. let attributes;
  100756. let useStyle;
  100757. if (allFeatures[i].dv_v5_markerInfo) {
  100758. //因为优化代码之前,属性字段都存储在propertise上,markerInfo没有
  100759. attributes = Object.assign({}, allFeatures[i].dv_v5_markerInfo, featureAttr);
  100760. if (attributes.lon) {
  100761. //标注图层不需要
  100762. delete attributes.lon;
  100763. delete attributes.lat;
  100764. }
  100765. }
  100766. if (allFeatures[i].dv_v5_markerStyle) {
  100767. useStyle = allFeatures[i].dv_v5_markerStyle;
  100768. isMarker = true;
  100769. }
  100770. let properties;
  100771. if (isMarker) {
  100772. properties = Object.assign({}, {
  100773. attributes
  100774. }, {
  100775. useStyle
  100776. });
  100777. //feature上添加图层的id,为了对应图层
  100778. feature.layerId = layerInfo.timeId;
  100779. } else if (layerInfo.featureStyles) {
  100780. //V4 版本标注图层处理
  100781. let style = JSON.parse(layerInfo.featureStyles[i].style);
  100782. let attr = featureAttr;
  100783. let imgUrl;
  100784. if (attr._smiportal_imgLinkUrl.indexOf('http://') > -1 || attr._smiportal_imgLinkUrl.indexOf('https://') > -1) {
  100785. imgUrl = attr._smiportal_imgLinkUrl;
  100786. } else if (attr._smiportal_imgLinkUrl !== undefined && attr._smiportal_imgLinkUrl !== null &&
  100787. attr._smiportal_imgLinkUrl !== '') {
  100788. //上传的图片,加上当前地址
  100789. imgUrl = `${core_Util_Util.getIPortalUrl()}resources/markerIcon/${attr._smiportal_imgLinkUrl}`
  100790. }
  100791. attributes = {
  100792. dataViz_description: attr._smiportal_description,
  100793. dataViz_imgUrl: imgUrl,
  100794. dataViz_title: attr._smiportal_title,
  100795. dataViz_url: attr._smiportal_otherLinkUrl
  100796. };
  100797. style.anchor = [0.5, 1];
  100798. style.src = style.externalGraphic;
  100799. useStyle = style;
  100800. properties = Object.assign({}, {
  100801. attributes
  100802. }, {
  100803. useStyle
  100804. });
  100805. delete attr._smiportal_description;
  100806. delete attr._smiportal_imgLinkUrl;
  100807. delete attr._smiportal_title;
  100808. delete attr._smiportal_otherLinkUrl;
  100809. } else {
  100810. properties = {attributes: featureAttr};
  100811. }
  100812. feature.setProperties(properties);
  100813. features.push(feature);
  100814. }
  100815. return features;
  100816. }
  100817. /**
  100818. * @private
  100819. * @function WebMap.prototype.parseGeoJsonData2Feature
  100820. * @description 将从restData地址上获取的json转换成feature(从iserver中获取的json转换成feature)
  100821. * @param {Object} metaData - json内容
  100822. * @returns {Array} ol.feature的数组集合
  100823. */
  100824. parseGeoJsonData2Feature(metaData) {
  100825. let allFeatures = metaData.allDatas.features,
  100826. features = [];
  100827. for (let i = 0, len = allFeatures.length; i < len; i++) {
  100828. let properties = allFeatures[i].properties;
  100829. delete allFeatures[i].properties;
  100830. let feature = transformTools.readFeature(allFeatures[i], {
  100831. dataProjection: metaData.fileCode || 'EPSG:4326',
  100832. featureProjection: metaData.featureProjection || this.baseProjection || 'EPSG:4326'
  100833. });
  100834. //geojson格式的feature属性没有坐标系字段,为了统一,再次加上
  100835. let geometry = feature.getGeometry();
  100836. // 如果不存在geometry,也不需要组装feature
  100837. if(!geometry) {continue;}
  100838. let coordinate = geometry.getCoordinates();
  100839. if (allFeatures[i].geometry.type === 'Point') {
  100840. properties.lon = coordinate[0];
  100841. properties.lat = coordinate[1];
  100842. }
  100843. feature.setProperties({
  100844. attributes: properties
  100845. });
  100846. features.push(feature);
  100847. }
  100848. return features;
  100849. }
  100850. /**
  100851. * @private
  100852. * @function WebMap.prototype.addLayer
  100853. * @description 将叠加图层添加到地图上
  100854. * @param {Object} layerInfo - 图层信息
  100855. * @param {Array} features - 图层上的feature集合
  100856. * @param {number} index 图层的顺序
  100857. */
  100858. async addLayer(layerInfo, features, index) {
  100859. let layer, that = this;
  100860. if (layerInfo.layerType === "VECTOR") {
  100861. if (layerInfo.featureType === "POINT") {
  100862. if (layerInfo.style.type === 'SYMBOL_POINT') {
  100863. layer = this.createSymbolLayer(layerInfo, features);
  100864. } else {
  100865. layer = await this.createGraphicLayer(layerInfo, features);
  100866. }
  100867. } else {
  100868. //线和面
  100869. layer = await this.createVectorLayer(layerInfo, features)
  100870. }
  100871. } else if (layerInfo.layerType === "UNIQUE") {
  100872. layer = await this.createUniqueLayer(layerInfo, features);
  100873. } else if (layerInfo.layerType === "RANGE") {
  100874. layer = await this.createRangeLayer(layerInfo, features);
  100875. } else if (layerInfo.layerType === "HEAT") {
  100876. layer = this.createHeatLayer(layerInfo, features);
  100877. } else if (layerInfo.layerType === "MARKER") {
  100878. layer = await this.createMarkerLayer(features);
  100879. } else if (layerInfo.layerType === "DATAFLOW_POINT_TRACK") {
  100880. layer = await this.createDataflowLayer(layerInfo, index);
  100881. } else if (layerInfo.layerType === "DATAFLOW_HEAT") {
  100882. layer = this.createDataflowHeatLayer(layerInfo);
  100883. } else if (layerInfo.layerType === "RANK_SYMBOL") {
  100884. layer = await this.createRankSymbolLayer(layerInfo, features);
  100885. } else if (layerInfo.layerType === "MIGRATION") {
  100886. layer = this.createMigrationLayer(layerInfo, features);
  100887. }
  100888. let layerID = core_Util_Util.newGuid(8);
  100889. if (layer) {
  100890. layerInfo.name && layer.setProperties({
  100891. name: layerInfo.name,
  100892. layerID: layerID,
  100893. layerType: layerInfo.layerType
  100894. });
  100895. //刷新下图层,否则feature样式出不来
  100896. if (layerInfo && layerInfo.style && layerInfo.style.imageInfo) {
  100897. let img = new Image();
  100898. img.src = layerInfo.style.imageInfo.url;
  100899. img.onload = function () {
  100900. layer.getSource().changed();
  100901. };
  100902. }
  100903. if (layerInfo.layerType === 'MIGRATION') {
  100904. layer.appendTo(this.map);
  100905. // 在这里恢复图层可见性状态
  100906. layer.setVisible(layerInfo.visible);
  100907. // 设置鼠标样式为默认
  100908. layer.setCursor();
  100909. } else {
  100910. layerInfo.opacity != undefined && layer.setOpacity(layerInfo.opacity);
  100911. layer.setVisible(layerInfo.visible);
  100912. this.map.addLayer(layer);
  100913. }
  100914. layer.setZIndex(index);
  100915. const {visibleScale, autoUpdateTime} = layerInfo;
  100916. visibleScale && this.setVisibleScales(layer, visibleScale);
  100917. if (autoUpdateTime && !layerInfo.autoUpdateInterval) {
  100918. //自动更新数据
  100919. let dataSource = layerInfo.dataSource;
  100920. if (dataSource.accessType === "DIRECT" && !dataSource.url) {
  100921. // 二进制数据更新feautre所需的url
  100922. dataSource.url = `${this.server}web/datas/${dataSource.serverId}/content.json?pageSize=9999999&currentPage=1`
  100923. }
  100924. layerInfo.autoUpdateInterval = setInterval(() => {
  100925. that.updateFeaturesToMap(layerInfo, index, true);
  100926. }, autoUpdateTime);
  100927. }
  100928. }
  100929. layerInfo.layer = layer;
  100930. layerInfo.layerID = layerID;
  100931. if (layerInfo.labelStyle && layerInfo.labelStyle.labelField && layerInfo.layerType !== "DATAFLOW_POINT_TRACK") {
  100932. //存在标签专题图
  100933. //过滤条件过滤feature
  100934. features = layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features;
  100935. this.addLabelLayer(layerInfo, features);
  100936. }
  100937. }
  100938. /**
  100939. * @private
  100940. * @function WebMap.prototype.updateFeaturesToMap
  100941. * @description 更新地图上的feature,适用于专题图
  100942. * @param {Object} layerInfo - 图层信息
  100943. * @param {number} index 图层的顺序
  100944. */
  100945. updateFeaturesToMap(layerInfo, layerIndex) {
  100946. let that = this, dataSource = layerInfo.dataSource, url = layerInfo.dataSource.url,
  100947. dataSourceName = dataSource.dataSourceName || layerInfo.name;
  100948. if (dataSource.type === "USER_DATA" || dataSource.accessType === "DIRECT") {
  100949. that.addGeojsonFromUrl(layerInfo, null, layerIndex)
  100950. } else {
  100951. let requestUrl = that.formatUrlWithCredential(url), serviceOptions = {};
  100952. serviceOptions.withCredentials = this.withCredentials;
  100953. if (!this.excludePortalProxyUrl && !Util_Util.isInTheSameDomain(requestUrl) && !this.isIportalProxyServiceUrl(requestUrl)) {
  100954. serviceOptions.proxy = this.getProxy();
  100955. }
  100956. //因为itest上使用的https,iserver是http,所以要加上代理
  100957. getFeatureBySQL(requestUrl, [dataSourceName], serviceOptions, async function (result) {
  100958. let features = that.parseGeoJsonData2Feature({
  100959. allDatas: {
  100960. features: result.result.features.features
  100961. },
  100962. fileCode: layerInfo.projection,
  100963. featureProjection: that.baseProjection
  100964. });
  100965. //删除之前的图层和标签图层
  100966. that.map.removeLayer(layerInfo.layer);
  100967. layerInfo.labelLayer && that.map.removeLayer(layerInfo.labelLayer);
  100968. await that.addLayer(layerInfo, features, layerIndex);
  100969. }, function (err) {
  100970. that.errorCallback && that.errorCallback(err, 'autoUpdateFaild', that.map);
  100971. }, undefined, this.restDataSingleRequestCount);
  100972. }
  100973. }
  100974. /**
  100975. * @private
  100976. * @function WebMap.prototype.addVectorTileLayer
  100977. * @description 添加vectorTILE图层
  100978. * @param {Object} layerInfo - 图层信息
  100979. * @param {number} index 图层的顺序
  100980. * @param {string} type 创建的图层类型,restData为创建数据服务的mvt, restMap为创建地图服务的mvt
  100981. * @returns {ol.layer.VectorTile} 图层对象
  100982. */
  100983. async addVectorTileLayer(layerInfo, index, type) {
  100984. let layer;
  100985. if (type === 'RESTDATA') {
  100986. //用的是restdata服务的mvt
  100987. layer = await this.createDataVectorTileLayer(layerInfo)
  100988. }
  100989. let layerID = core_Util_Util.newGuid(8);
  100990. if (layer) {
  100991. layerInfo.name && layer.setProperties({
  100992. name: layerInfo.name,
  100993. layerID: layerID
  100994. });
  100995. layerInfo.opacity != undefined && layer.setOpacity(layerInfo.opacity);
  100996. layer.setVisible(layerInfo.visible);
  100997. layer.setZIndex(index);
  100998. }
  100999. layerInfo.layer = layer;
  101000. layerInfo.layerID = layerID;
  101001. return layer;
  101002. }
  101003. /**
  101004. * @private
  101005. * @function WebMap.prototype.createDataVectorTileLayer
  101006. * @description 创建vectorTILE图层
  101007. * @param {Object} layerInfo - 图层信息
  101008. * @returns {ol.layer.VectorTile} 图层对象
  101009. */
  101010. async createDataVectorTileLayer(layerInfo) {
  101011. //创建图层
  101012. var format = new (external_ol_format_MVT_default())({
  101013. featureClass: (external_ol_Feature_default())
  101014. });
  101015. //要加上这一句,否则坐标,默认都是3857
  101016. (external_ol_format_MVT_default()).prototype.readProjection = function () {
  101017. return new external_ol_proj_namespaceObject.Projection({
  101018. code: '',
  101019. units: (external_ol_proj_Units_default()).TILE_PIXELS
  101020. });
  101021. };
  101022. let featureType = layerInfo.featureType;
  101023. let style = await StyleUtils.toOpenLayersStyle(this.getDataVectorTileStyle(featureType), featureType);
  101024. return new external_ol_layer_namespaceObject.VectorTile({
  101025. //设置避让参数
  101026. source: new VectorTileSuperMapRest({
  101027. url: layerInfo.url,
  101028. projection: layerInfo.projection,
  101029. tileType: "ScaleXY",
  101030. format: format
  101031. }),
  101032. style: style
  101033. });
  101034. }
  101035. /**
  101036. * @private
  101037. * @function WebMap.prototype.getDataVectorTileStyle
  101038. * @description 获取数据服务的mvt上图的默认样式
  101039. * @param {string} featureType - 要素类型
  101040. * @returns {Object} 样式参数
  101041. */
  101042. getDataVectorTileStyle(featureType) {
  101043. let styleParameters = {
  101044. radius: 8, //圆点半径
  101045. fillColor: '#EE4D5A', //填充色
  101046. fillOpacity: 0.9,
  101047. strokeColor: '#ffffff', //边框颜色
  101048. strokeWidth: 1,
  101049. strokeOpacity: 1,
  101050. lineDash: 'solid',
  101051. type: "BASIC_POINT"
  101052. };
  101053. if (["LINE", "LINESTRING", "MULTILINESTRING"].indexOf(featureType) > -1) {
  101054. styleParameters.strokeColor = '#4CC8A3';
  101055. styleParameters.strokeWidth = 2;
  101056. } else if (["REGION", "POLYGON", "MULTIPOLYGON"].indexOf(featureType) > -1) {
  101057. styleParameters.fillColor = '#826DBA';
  101058. }
  101059. return styleParameters;
  101060. }
  101061. /**
  101062. * @private
  101063. * @function WebMap.prototype.getFiterFeatures
  101064. * @description 通过过滤条件查询满足的feature
  101065. * @param {string} filterCondition - 过滤条件
  101066. * @param {Array} allFeatures - 图层上的feature集合
  101067. */
  101068. getFiterFeatures(filterCondition, allFeatures) {
  101069. let condition = this.parseFilterCondition(filterCondition);
  101070. let filterFeatures = [];
  101071. for (let i = 0; i < allFeatures.length; i++) {
  101072. let feature = allFeatures[i];
  101073. let filterResult = false;
  101074. try {
  101075. const properties = feature.get('attributes');
  101076. const conditions = parseCondition(condition, Object.keys(properties));
  101077. const filterFeature = parseConditionFeature(properties);
  101078. const sql = 'select * from json where (' + conditions + ')';
  101079. filterResult = window.jsonsql.query(sql, { attributes: filterFeature });
  101080. } catch (err) {
  101081. //必须把要过滤得内容封装成一个对象,主要是处理jsonsql(line : 62)中由于with语句遍历对象造成的问题
  101082. continue;
  101083. }
  101084. if (filterResult && filterResult.length > 0) {
  101085. //afterFilterFeatureIdx.push(i);
  101086. filterFeatures.push(feature);
  101087. }
  101088. }
  101089. return filterFeatures;
  101090. }
  101091. /**
  101092. * @private
  101093. * @function WebMap.prototype.parseFilterCondition
  101094. * @description 1、替换查询语句 中的 and / AND / or / OR / = / !=
  101095. * 2、匹配 Name in ('', ''),多条件需用()包裹
  101096. * @param {string} filterCondition - 过滤条件
  101097. * @return {string} 换成组件能识别的字符串
  101098. */
  101099. parseFilterCondition(filterCondition) {
  101100. return filterCondition
  101101. .replace(/=/g, "==")
  101102. .replace(/AND|and/g, "&&")
  101103. .replace(/or|OR/g, "||")
  101104. .replace(/<==/g, "<=")
  101105. .replace(/>==/g, ">=")
  101106. .replace(/\(?[^\(]+?\s*in\s*\([^\)]+?\)\)?/gi, (res) => {
  101107. // res格式:(省份 in ('四川', '河南'))
  101108. const data = res.match(/([^(]+?)\s*in\s*\(([^)]+?)\)/i);
  101109. return data.length === 3
  101110. ? `(${data[2]
  101111. .split(",")
  101112. .map((c) => `${data[1]} == ${c.trim()}`)
  101113. .join(" || ")})`
  101114. : res;
  101115. });
  101116. }
  101117. /**
  101118. * @private
  101119. * @function WebMap.prototype.createGraphicLayer
  101120. * @description 添加大数据图层到地图上
  101121. * @param {Object} layerInfo - 图层信息
  101122. * @param {Array} features - feature的集合
  101123. * @return {ol.layer.image} 大数据图层
  101124. */
  101125. async createGraphicLayer(layerInfo, features) {
  101126. features = layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features;
  101127. let graphics = await this.getGraphicsFromFeatures(features, layerInfo.style, layerInfo.featureType);
  101128. let source = new Graphic({
  101129. graphics: graphics,
  101130. render: 'canvas',
  101131. map: this.map,
  101132. isHighLight: false
  101133. });
  101134. return new external_ol_layer_namespaceObject.Image({
  101135. source: source
  101136. });
  101137. }
  101138. /**
  101139. * @private
  101140. * @function WebMap.prototype.getGraphicsFromFeatures
  101141. * @description 将feature转换成大数据图层对应的Graphics要素
  101142. * @param {Array} features - feature的集合
  101143. * @param {Object} style - 图层样式
  101144. * @param {string} featureType - feature的类型
  101145. * @return {Array} 大数据图层要素数组
  101146. */
  101147. async getGraphicsFromFeatures(features, style, featureType) {
  101148. let olStyle = await StyleUtils.getOpenlayersStyle(style, featureType),
  101149. shape = olStyle.getImage();
  101150. let graphics = [];
  101151. //构建graphic
  101152. for (let i in features) {
  101153. let graphic = new Graphic_Graphic(features[i].getGeometry());
  101154. graphic.setStyle(shape);
  101155. graphic.setProperties({attributes: features[i].get('attributes')})
  101156. graphics.push(graphic);
  101157. }
  101158. return graphics;
  101159. }
  101160. /**
  101161. * @private
  101162. * @function WebMap.prototype.createSymbolLayer
  101163. * @description 添加符号图层
  101164. * @param {Object} layerInfo - 图层信息
  101165. * @param {Array} features - feature的集合
  101166. * @return {ol.layer.Vector} 符号图层
  101167. */
  101168. createSymbolLayer(layerInfo, features) {
  101169. let style = StyleUtils.getSymbolStyle(layerInfo.style);
  101170. return new external_ol_layer_namespaceObject.Vector({
  101171. style: style,
  101172. source: new (external_ol_source_Vector_default())({
  101173. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  101174. wrapX: false
  101175. }),
  101176. renderMode: 'image'
  101177. });
  101178. }
  101179. /**
  101180. * @private
  101181. * @function WebMap.prototype.addLabelLayer
  101182. * @description 添加标签图层
  101183. * @param {Object} layerInfo - 图层信息
  101184. * @param {Array} features -feature的集合
  101185. * @returns {ol.layer.Vector} 图层对象
  101186. */
  101187. addLabelLayer(layerInfo, features) {
  101188. let labelStyle = layerInfo.labelStyle;
  101189. let style = this.getLabelStyle(labelStyle, layerInfo);
  101190. let layer = layerInfo.labelLayer = new external_ol_layer_namespaceObject.Vector({
  101191. declutter: true,
  101192. styleOL: style,
  101193. labelField: labelStyle.labelField,
  101194. source: new (external_ol_source_Vector_default())({
  101195. features: features,
  101196. wrapX: false
  101197. })
  101198. });
  101199. layer.setStyle(features => {
  101200. let labelField = labelStyle.labelField;
  101201. let label = features.get('attributes')[labelField.trim()] + "";
  101202. if (label === "undefined") {
  101203. return null;
  101204. }
  101205. let styleOL = layer.get('styleOL');
  101206. let text = styleOL.getText();
  101207. if (text && text.setText) {
  101208. text.setText(label);
  101209. }
  101210. return styleOL;
  101211. });
  101212. this.map.addLayer(layer);
  101213. layer.setVisible(layerInfo.visible);
  101214. layer.setZIndex(1000);
  101215. const {visibleScale} = layerInfo;
  101216. visibleScale && this.setVisibleScales(layer, visibleScale);
  101217. return layer;
  101218. }
  101219. /**
  101220. * @private
  101221. * @function WebMap.prototype.setVisibleScales
  101222. * @description 改变图层可视范围
  101223. * @param {Object} layer - 图层对象。ol.Layer
  101224. * @param {Object} visibleScale - 图层样式参数
  101225. */
  101226. setVisibleScales(layer, visibleScale) {
  101227. let maxResolution = this.resolutions[visibleScale.minScale],
  101228. minResolution = this.resolutions[visibleScale.maxScale];
  101229. //比例尺和分别率是反比的关系
  101230. maxResolution > 1 ? layer.setMaxResolution(Math.ceil(maxResolution)) : layer.setMaxResolution(maxResolution * 1.1);
  101231. layer.setMinResolution(minResolution);
  101232. }
  101233. /**
  101234. * @private
  101235. * @function WebMap.prototype.getLabelStyle
  101236. * @description 获取标签样式
  101237. * @param {Object} parameters - 标签图层样式参数
  101238. * @param {Object} layerInfo - 图层样式参数
  101239. * @returns {ol.style.Style} 标签样式
  101240. */
  101241. getLabelStyle(parameters, layerInfo) {
  101242. let style = layerInfo.style || layerInfo.pointStyle;
  101243. const {radius = 0, strokeWidth = 0} = style,
  101244. beforeOffsetY = -(radius + strokeWidth);
  101245. const {
  101246. fontSize = '14px',
  101247. fontFamily,
  101248. fill,
  101249. backgroundFill,
  101250. offsetX = 0,
  101251. offsetY = beforeOffsetY,
  101252. placement = "point",
  101253. textBaseline = "bottom",
  101254. textAlign = 'center',
  101255. outlineColor = "#000000",
  101256. outlineWidth = 0
  101257. } = parameters;
  101258. const option = {
  101259. font: `${fontSize} ${fontFamily}`,
  101260. placement,
  101261. textBaseline,
  101262. fill: new (external_ol_style_Fill_default())({color: fill}),
  101263. backgroundFill: new (external_ol_style_Fill_default())({color: backgroundFill}),
  101264. padding: [3, 3, 3, 3],
  101265. offsetX: layerInfo.featureType === 'POINT' ? offsetX : 0,
  101266. offsetY: layerInfo.featureType === 'POINT' ? offsetY : 0,
  101267. overflow: true,
  101268. maxAngle: 0
  101269. };
  101270. if (layerInfo.featureType === 'POINT') {
  101271. //线面不需要此参数,否则超出线面overflow:true,也不会显示标签
  101272. option.textAlign = textAlign;
  101273. }
  101274. if (outlineWidth > 0) {
  101275. option.stroke = new (external_ol_style_Stroke_default())({
  101276. color: outlineColor,
  101277. width: outlineWidth
  101278. });
  101279. }
  101280. return new (external_ol_style_Style_default())({
  101281. text: new (external_ol_style_Text_default())(option)
  101282. });
  101283. }
  101284. /**
  101285. * @private
  101286. * @function WebMap.prototype.createVectorLayer
  101287. * @description 创建vector图层
  101288. * @param {Object} layerInfo - 图层信息
  101289. * @param {Array} features -feature的集合
  101290. * @returns {ol.layer.Vector} 矢量图层
  101291. */
  101292. async createVectorLayer(layerInfo, features) {
  101293. const {featureType, style} = layerInfo;
  101294. let newStyle;
  101295. if (featureType === 'LINE' && core_Util_Util.isArray(style) && style.length === 2) {
  101296. const [outlineStyle, strokeStyle] = style;
  101297. newStyle = (!strokeStyle.lineDash || strokeStyle.lineDash === 'solid') ? StyleUtils.getRoadPath(strokeStyle, outlineStyle)
  101298. : StyleUtils.getPathway(strokeStyle, outlineStyle);
  101299. } else {
  101300. if (core_Util_Util.isArray(style)) {
  101301. layerInfo.style = style[0];
  101302. }
  101303. newStyle = await StyleUtils.toOpenLayersStyle(layerInfo.style, layerInfo.featureType);
  101304. }
  101305. return new external_ol_layer_namespaceObject.Vector({
  101306. style: newStyle,
  101307. source: new (external_ol_source_Vector_default())({
  101308. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  101309. wrapX: false
  101310. })
  101311. });
  101312. }
  101313. /**
  101314. * @private
  101315. * @function WebMap.prototype.createHeatLayer
  101316. * @description 创建热力图图层
  101317. * @param {Object} layerInfo - 图层信息
  101318. * @param {Array} features -feature的集合
  101319. * @returns {ol.layer.Heatmap} 热力图图层
  101320. */
  101321. createHeatLayer(layerInfo, features) {
  101322. //因为热力图,随着过滤,需要重新计算权重
  101323. features = layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features;
  101324. let source = new (external_ol_source_Vector_default())({
  101325. features: features,
  101326. wrapX: false
  101327. });
  101328. let layerOptions = {
  101329. source: source
  101330. };
  101331. let themeSetting = layerInfo.themeSetting;
  101332. layerOptions.gradient = themeSetting.colors.slice();
  101333. layerOptions.radius = parseInt(themeSetting.radius);
  101334. //自定义颜色
  101335. let customSettings = themeSetting.customSettings;
  101336. for (let i in customSettings) {
  101337. layerOptions.gradient[i] = customSettings[i];
  101338. }
  101339. // 权重字段恢复
  101340. if (themeSetting.weight) {
  101341. this.changeWeight(features, themeSetting.weight);
  101342. }
  101343. return new external_ol_layer_namespaceObject.Heatmap(layerOptions);
  101344. }
  101345. /**
  101346. * @private
  101347. * @function WebMap.prototype.changeWeight
  101348. * @description 改变当前权重字段
  101349. * @param {Array} features - feature的集合
  101350. * @param {string} weightFeild - 权重字段
  101351. */
  101352. changeWeight(features, weightFeild) {
  101353. let that = this;
  101354. this.fieldMaxValue = {};
  101355. this.getMaxValue(features, weightFeild);
  101356. let maxValue = this.fieldMaxValue[weightFeild];
  101357. features.forEach(function (feature) {
  101358. let attributes = feature.get('attributes');
  101359. try {
  101360. let value = attributes[weightFeild];
  101361. feature.set('weight', value / maxValue);
  101362. } catch (e) {
  101363. that.errorCallback && that.errorCallback(e);
  101364. }
  101365. })
  101366. }
  101367. /**
  101368. * @private
  101369. * @function WebMap.prototype.getMaxValue
  101370. * @description 获取当前字段对应的最大值,用于计算权重
  101371. * @param {Array} features - feature 数组
  101372. * @param {string} weightField - 权重字段
  101373. */
  101374. getMaxValue(features, weightField) {
  101375. let values = [], that = this, attributes;
  101376. let field = weightField;
  101377. if (this.fieldMaxValue[field]) {
  101378. return;
  101379. }
  101380. features.forEach(function (feature) {
  101381. //收集当前权重字段对应的所有值
  101382. attributes = feature.get('attributes');
  101383. try {
  101384. values.push(parseFloat(attributes[field]));
  101385. } catch (e) {
  101386. that.errorCallback && that.errorCallback(e);
  101387. }
  101388. });
  101389. this.fieldMaxValue[field] = ArrayStatistic.getArrayStatistic(values, 'Maximum');
  101390. }
  101391. /**
  101392. * @private
  101393. * @function WebMap.prototype.createUniqueLayer
  101394. * @description 获取当前字段对应的最大值,用于计算权重
  101395. * @param {Object} layerInfo - 图层信息
  101396. * @param {Array} features - 所有feature结合
  101397. */
  101398. async createUniqueLayer(layerInfo, features) {
  101399. let styleSource = await this.createUniqueSource(layerInfo, features);
  101400. let layer = new external_ol_layer_namespaceObject.Vector({
  101401. styleSource: styleSource,
  101402. source: new (external_ol_source_Vector_default())({
  101403. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  101404. wrapX: false
  101405. })
  101406. });
  101407. layer.setStyle(feature => {
  101408. let styleSource = layer.get('styleSource');
  101409. let labelField = styleSource.themeField;
  101410. let label = feature.get('attributes')[labelField];
  101411. let styleGroup = styleSource.styleGroups.find(item => {
  101412. return item.value === label;
  101413. })
  101414. return styleGroup.olStyle;
  101415. });
  101416. return layer;
  101417. }
  101418. /**
  101419. * @private
  101420. * @function WebMap.prototype.createUniqueSource
  101421. * @description 创建单值图层的source
  101422. * @param {Object} parameters- 图层信息
  101423. * @param {Array} features - feature 数组
  101424. * @returns {{map: *, style: *, isHoverAble: *, highlightStyle: *, themeField: *, styleGroups: Array}}
  101425. */
  101426. async createUniqueSource(parameters, features) {
  101427. //找到合适的专题字段
  101428. let styleGroup = await this.getUniqueStyleGroup(parameters, features);
  101429. return {
  101430. map: this.map, //必传参数 API居然不提示
  101431. style: parameters.style,
  101432. isHoverAble: parameters.isHoverAble,
  101433. highlightStyle: parameters.highlightStyle,
  101434. themeField: parameters.themeSetting.themeField,
  101435. styleGroups: styleGroup
  101436. };
  101437. }
  101438. /**
  101439. * @private
  101440. * @function WebMap.prototype.getUniqueStyleGroup
  101441. * @description 获取单值专题图的styleGroup
  101442. * @param {Object} parameters- 图层信息
  101443. * @param {Array} features - feature 数组
  101444. * @returns {Array} 单值样式
  101445. */
  101446. async getUniqueStyleGroup(parameters, features) {
  101447. // 找出所有的单值
  101448. let featureType = parameters.featureType,
  101449. style = parameters.style,
  101450. themeSetting = parameters.themeSetting;
  101451. let fieldName = themeSetting.themeField;
  101452. let names = [],
  101453. customSettings = themeSetting.customSettings;
  101454. for (let i in features) {
  101455. let attributes = features[i].get('attributes');
  101456. let name = attributes[fieldName];
  101457. let isSaved = false;
  101458. for (let j in names) {
  101459. if (names[j] === name) {
  101460. isSaved = true;
  101461. break;
  101462. }
  101463. }
  101464. if (!isSaved) {
  101465. names.push(name);
  101466. }
  101467. }
  101468. //生成styleGroup
  101469. let styleGroup = [];
  101470. const usedColors = this.getCustomSettingColors(customSettings, featureType).map(item => item.toLowerCase());
  101471. const curentColors = this.getUniqueColors(themeSetting.colors || this.defaultParameters.themeSetting.colors, names.length + Object.keys(customSettings).length).map(item => item.toLowerCase());
  101472. const newColors = lodash_difference_default()(curentColors, usedColors);
  101473. for(let index = 0; index < names.length; index++) {
  101474. const name = names[index];
  101475. //兼容之前自定义是用key,现在因为数据支持编辑,需要用属性值。
  101476. let key = this.webMapVersion === "1.0" ? index : name;
  101477. let custom = customSettings[key];
  101478. if(core_Util_Util.isString(custom)) {
  101479. //兼容之前自定义只存储一个color
  101480. custom = this.getCustomSetting(style, custom, featureType);
  101481. customSettings[key] = custom;
  101482. }
  101483. if (!custom) {
  101484. custom = this.getCustomSetting(style, newColors.shift(), featureType);
  101485. }
  101486. // 转化成 ol 样式
  101487. let olStyle, type = custom.type;
  101488. if(type === 'SYMBOL_POINT') {
  101489. olStyle = StyleUtils.getSymbolStyle(custom);
  101490. } else if(type === 'SVG_POINT') {
  101491. olStyle = await StyleUtils.getSVGStyle(custom);
  101492. } else if(type === 'IMAGE_POINT') {
  101493. olStyle = StyleUtils.getImageStyle(custom);
  101494. } else {
  101495. olStyle = await StyleUtils.toOpenLayersStyle(custom, featureType);
  101496. }
  101497. styleGroup.push({
  101498. olStyle: olStyle,
  101499. style: customSettings[key],
  101500. value: name
  101501. });
  101502. }
  101503. return styleGroup;
  101504. }
  101505. /**
  101506. * @description 获取单值专题图自定义样式对象
  101507. * @param {Object} style - 图层上的样式
  101508. * @param {string} color - 单值对应的颜色
  101509. * @param {string} featureType - 要素类型
  101510. */
  101511. getCustomSetting(style, color, featureType) {
  101512. let newProps = {};
  101513. if (featureType === "LINE") {
  101514. newProps.strokeColor = color;
  101515. } else {
  101516. newProps.fillColor = color;
  101517. }
  101518. let customSetting = Object.assign(style, newProps)
  101519. return customSetting;
  101520. }
  101521. getCustomSettingColors(customSettings, featureType) {
  101522. const keys = Object.keys(customSettings);
  101523. const colors = [];
  101524. keys.forEach(key => {
  101525. //兼容之前自定义只存储一个color
  101526. if (core_Util_Util.isString(customSettings[key])) {
  101527. colors.push(customSettings[key]);
  101528. return;
  101529. }
  101530. if (featureType === "LINE") {
  101531. colors.push(customSettings[key].strokeColor);
  101532. } else {
  101533. colors.push(customSettings[key].fillColor);
  101534. }
  101535. });
  101536. return colors;
  101537. }
  101538. getUniqueColors(colors, valuesLen) {
  101539. return ColorsPickerUtil.getGradientColors(colors, valuesLen);
  101540. }
  101541. /**
  101542. * @private
  101543. * @function WebMap.prototype.createRangeLayer
  101544. * @description 创建分段图层
  101545. * @param {Object} layerInfo- 图层信息
  101546. * @param {Array} features - 所有feature结合
  101547. * @returns {ol.layer.Vector} 单值图层
  101548. */
  101549. async createRangeLayer(layerInfo, features) {
  101550. //这里获取styleGroup要用所以的feature
  101551. let styleSource = await this.createRangeSource(layerInfo, features);
  101552. let layer = new external_ol_layer_namespaceObject.Vector({
  101553. styleSource: styleSource,
  101554. source: new (external_ol_source_Vector_default())({
  101555. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  101556. wrapX: false
  101557. })
  101558. });
  101559. layer.setStyle(feature => {
  101560. let styleSource = layer.get('styleSource');
  101561. if (styleSource) {
  101562. let labelField = styleSource.themeField;
  101563. let value = Number(feature.get('attributes')[labelField.trim()]);
  101564. let styleGroups = styleSource.styleGroups;
  101565. for (let i = 0; i < styleGroups.length; i++) {
  101566. if (i === 0) {
  101567. if (value >= styleGroups[i].start && value <= styleGroups[i].end) {
  101568. return styleGroups[i].olStyle;
  101569. }
  101570. } else {
  101571. if (value > styleGroups[i].start && value <= styleGroups[i].end) {
  101572. return styleGroups[i].olStyle;
  101573. }
  101574. }
  101575. }
  101576. }
  101577. });
  101578. return layer;
  101579. }
  101580. /**
  101581. * @private
  101582. * @function WebMap.prototype.createRangeSource
  101583. * @description 创建分段专题图的图层source
  101584. * @param {Object} parameters- 图层信息
  101585. * @param {Array} features - 所以的feature集合
  101586. * @returns {Object} 图层source
  101587. */
  101588. async createRangeSource(parameters, features) {
  101589. //找到合适的专题字段
  101590. let styleGroup = await this.getRangeStyleGroup(parameters, features);
  101591. if (styleGroup) {
  101592. return {
  101593. style: parameters.style,
  101594. themeField: parameters.themeSetting.themeField,
  101595. styleGroups: styleGroup
  101596. };
  101597. } else {
  101598. return false;
  101599. }
  101600. }
  101601. /**
  101602. * @private
  101603. * @function WebMap.prototype.getRangeStyleGroup
  101604. * @description 获取分段专题图的styleGroup样式
  101605. * @param {Object} parameters- 图层信息
  101606. * @param {Array} features - 所以的feature集合
  101607. * @returns {Array} styleGroups
  101608. */
  101609. async getRangeStyleGroup(parameters, features) {
  101610. // 找出分段值
  101611. let featureType = parameters.featureType,
  101612. themeSetting = parameters.themeSetting,
  101613. style = parameters.style;
  101614. let count = themeSetting.segmentCount,
  101615. method = themeSetting.segmentMethod,
  101616. colors = themeSetting.colors,
  101617. customSettings = themeSetting.customSettings,
  101618. fieldName = themeSetting.themeField;
  101619. let values = [],
  101620. attributes;
  101621. let segmentCount = count;
  101622. let segmentMethod = method;
  101623. let that = this;
  101624. features.forEach(function (feature) {
  101625. attributes = feature.get("attributes");
  101626. try {
  101627. if (attributes) {
  101628. //过滤掉非数值的数据
  101629. let value = attributes[fieldName.trim()];
  101630. if (value !== undefined && value !== null && core_Util_Util.isNumber(value)) {
  101631. values.push(parseFloat(value));
  101632. }
  101633. } else if (feature.get(fieldName) && core_Util_Util.isNumber(feature.get(fieldName))) {
  101634. if (feature.get(fieldName)) {
  101635. values.push(parseFloat(feature.get(fieldName)));
  101636. }
  101637. }
  101638. } catch (e) {
  101639. that.errorCallback && that.errorCallback(e);
  101640. }
  101641. });
  101642. let segements;
  101643. try {
  101644. segements = ArrayStatistic.getArraySegments(values, segmentMethod, segmentCount);
  101645. } catch (e) {
  101646. that.errorCallback && that.errorCallback(e);
  101647. }
  101648. if (segements) {
  101649. let itemNum = segmentCount;
  101650. if (attributes && segements[0] === segements[attributes.length - 1]) {
  101651. itemNum = 1;
  101652. segements.length = 2;
  101653. }
  101654. //保留两位有效数
  101655. for (let key in segements) {
  101656. let value = segements[key];
  101657. if (Number(key) === 0) {
  101658. // 最小的值下舍入,要用两个等于号。否则有些值判断不对
  101659. value = Math.floor(value * 100) / 100;
  101660. } else {
  101661. // 其余上舍入
  101662. value = Math.ceil(value * 100) / 100 + 0.1; // 加0.1 解决最大值没有样式问题
  101663. }
  101664. segements[key] = Number(value.toFixed(2));
  101665. }
  101666. //获取一定量的颜色
  101667. let curentColors = colors;
  101668. curentColors = ColorsPickerUtil.getGradientColors(curentColors, itemNum, 'RANGE');
  101669. for (let index = 0; index < itemNum; index++) {
  101670. if (index in customSettings) {
  101671. if (customSettings[index]["segment"]["start"]) {
  101672. segements[index] = customSettings[index]["segment"]["start"];
  101673. }
  101674. if (customSettings[index]["segment"]["end"]) {
  101675. segements[index + 1] = customSettings[index]["segment"]["end"];
  101676. }
  101677. }
  101678. }
  101679. //生成styleGroup
  101680. let styleGroups = [];
  101681. for (let i = 0; i < itemNum; i++) {
  101682. let color = curentColors[i];
  101683. if (i in customSettings) {
  101684. if (customSettings[i].color) {
  101685. color = customSettings[i].color;
  101686. }
  101687. }
  101688. if (featureType === "LINE") {
  101689. style.strokeColor = color;
  101690. } else {
  101691. style.fillColor = color;
  101692. }
  101693. // 转化成 ol 样式
  101694. let olStyle = await StyleUtils.toOpenLayersStyle(style, featureType);
  101695. let start = segements[i];
  101696. let end = segements[i + 1];
  101697. styleGroups.push({
  101698. olStyle: olStyle,
  101699. color: color,
  101700. start: start,
  101701. end: end
  101702. });
  101703. }
  101704. return styleGroups;
  101705. } else {
  101706. return false;
  101707. }
  101708. }
  101709. /**
  101710. * @private
  101711. * @function WebMap.prototype.createMarkerLayer
  101712. * @description 创建标注图层
  101713. * @param {Array} features - 所以的feature集合
  101714. * @returns {ol.layer.Vector} 矢量图层
  101715. */
  101716. async createMarkerLayer(features) {
  101717. features && await this.setEachFeatureDefaultStyle(features);
  101718. return new external_ol_layer_namespaceObject.Vector({
  101719. source: new (external_ol_source_Vector_default())({
  101720. features: features,
  101721. wrapX: false
  101722. })
  101723. });
  101724. }
  101725. /**
  101726. * @private
  101727. * @function WebMap.prototype.createDataflowLayer
  101728. * @description 创建数据流图层
  101729. * @param {Object} layerInfo- 图层信息
  101730. * @param {number} layerIndex - 图层的zindex
  101731. * @returns {ol.layer.Vector} 数据流图层
  101732. */
  101733. async createDataflowLayer(layerInfo, layerIndex) {
  101734. let layerStyle = layerInfo.pointStyle, style;
  101735. //获取样式
  101736. style = await StyleUtils.getOpenlayersStyle(layerStyle, layerInfo.featureType);
  101737. let source = new (external_ol_source_Vector_default())({
  101738. wrapX: false
  101739. }), labelLayer, labelSource, pathLayer, pathSource;
  101740. let layer = new external_ol_layer_namespaceObject.Vector({
  101741. styleOL: style,
  101742. source: source
  101743. });
  101744. if (layerInfo.labelStyle && layerInfo.visible) {
  101745. //有标签图层
  101746. labelLayer = this.addLabelLayer(layerInfo);
  101747. //和编辑页面保持一致
  101748. labelLayer.setZIndex(1000);
  101749. labelSource = labelLayer.getSource();
  101750. }
  101751. const {visibleScale} = layerInfo;
  101752. if (layerInfo.lineStyle && layerInfo.visible) {
  101753. pathLayer = await this.createVectorLayer({style: layerInfo.lineStyle, featureType: "LINE"});
  101754. pathSource = pathLayer.getSource();
  101755. pathLayer.setZIndex(layerIndex);
  101756. this.map.addLayer(pathLayer);
  101757. visibleScale && this.setVisibleScales(pathLayer, visibleScale);
  101758. // 挂载到layerInfo上,便于删除
  101759. layerInfo.pathLayer = pathLayer;
  101760. }
  101761. let featureCache = {}, labelFeatureCache = {}, pathFeatureCache = {}, that = this;
  101762. this.createDataflowService(layerInfo, function (featureCache, labelFeatureCache, pathFeatureCache) {
  101763. return function (feature) {
  101764. that.events.triggerEvent('updateDataflowFeature', {
  101765. feature: feature,
  101766. identifyField: layerInfo.identifyField,
  101767. layerID: layerInfo.layerID
  101768. });
  101769. if (layerInfo.filterCondition) {
  101770. //过滤条件
  101771. const condition = that.parseFilterCondition(layerInfo.filterCondition);
  101772. const properties = feature.get('attributes');
  101773. const conditions = parseCondition(condition, Object.keys(properties));
  101774. const filterFeature = parseConditionFeature(properties);
  101775. const sql = 'select * from json where (' + conditions + ')';
  101776. let filterResult = window.jsonsql.query(sql, { attributes: filterFeature });
  101777. if (filterResult && filterResult.length > 0) {
  101778. that.addDataflowFeature(feature, layerInfo.identifyField, {
  101779. dataflowSource: source,
  101780. featureCache: featureCache,
  101781. labelSource: labelSource,
  101782. labelFeatureCache: labelFeatureCache,
  101783. pathSource: pathSource,
  101784. pathFeatureCache: pathFeatureCache,
  101785. maxPointCount: layerInfo.maxPointCount
  101786. });
  101787. }
  101788. } else {
  101789. that.addDataflowFeature(feature, layerInfo.identifyField, {
  101790. dataflowSource: source,
  101791. featureCache: featureCache,
  101792. labelSource: labelSource,
  101793. labelFeatureCache: labelFeatureCache,
  101794. pathSource: pathSource,
  101795. pathFeatureCache: pathFeatureCache,
  101796. maxPointCount: layerInfo.maxPointCount
  101797. });
  101798. }
  101799. }
  101800. }(featureCache, labelFeatureCache, pathFeatureCache));
  101801. this.setFeatureStyle(layer, layerInfo.directionField, layerStyle.type);
  101802. return layer;
  101803. }
  101804. /**
  101805. * @private
  101806. * @function WebMap.prototype.addDataflowFeature
  101807. * @description 添加数据流的feature
  101808. * @param {Object} feature - 服务器更新的feature
  101809. * @param {string} identifyField - 标识feature的字段
  101810. * @param {Object} options - 其他参数
  101811. */
  101812. addDataflowFeature(feature, identifyField, options) {
  101813. options.dataflowSource && this.addFeatureFromDataflowService(options.dataflowSource, feature, identifyField, options.featureCache);
  101814. options.labelSource && this.addFeatureFromDataflowService(options.labelSource, feature, identifyField, options.labelFeatureCache);
  101815. options.pathSource && this.addPathFeature(options.pathSource, feature, identifyField, options.pathFeatureCache, options.maxPointCount);
  101816. }
  101817. /**
  101818. * @private
  101819. * @function WebMap.prototype.addPathFeature
  101820. * @description 添加数据流图层中轨迹线的feature
  101821. * @param {Object} source - 轨迹线图层的source
  101822. * @param {Object} feature - 轨迹线feature
  101823. * @param {string} identifyField - 标识feature的字段
  101824. * @param {Object} featureCache - 存储feature
  101825. * @param {number} maxPointCount - 轨迹线最多点个数数量
  101826. */
  101827. addPathFeature(source, feature, identifyField, featureCache, maxPointCount) {
  101828. let coordinates = [];
  101829. var geoID = feature.get(identifyField);
  101830. if (featureCache[geoID]) {
  101831. //加过feautre
  101832. coordinates = featureCache[geoID].getGeometry().getCoordinates();
  101833. coordinates.push(feature.getGeometry().getCoordinates());
  101834. if (maxPointCount && coordinates.length > maxPointCount) {
  101835. coordinates.splice(0, coordinates.length - maxPointCount);
  101836. }
  101837. featureCache[geoID].getGeometry().setCoordinates(coordinates);
  101838. } else {
  101839. coordinates.push(feature.getGeometry().getCoordinates());
  101840. featureCache[geoID] = new (external_ol_Feature_default())({
  101841. geometry: new external_ol_geom_namespaceObject.LineString(coordinates)
  101842. });
  101843. source.addFeature(featureCache[geoID]);
  101844. }
  101845. }
  101846. /**
  101847. * @private
  101848. * @function WebMap.prototype.setFeatureStyle
  101849. * @description 设置feature样式
  101850. * @param {Object} layer - 图层对象
  101851. * @param {string} directionField - 方向字段
  101852. * @param {string} styleType - 样式的类型
  101853. */
  101854. setFeatureStyle(layer, directionField, styleType) {
  101855. let layerStyle = layer.get('styleOL');
  101856. layer.setStyle(feature => {
  101857. //有转向字段
  101858. let value, image;
  101859. if (directionField !== undefined && directionField !== "未设置" && directionField !== "None") {
  101860. value = feature.get('attributes')[directionField];
  101861. } else {
  101862. value = 0;
  101863. }
  101864. if (value > 360 || value < 0) {
  101865. return null;
  101866. }
  101867. if (styleType === "SYMBOL_POINT") {
  101868. image = layerStyle.getText();
  101869. } else {
  101870. image = layerStyle.getImage();
  101871. }
  101872. //默认用户使用的是角度,换算成弧度
  101873. let rotate = (Math.PI * value) / 180;
  101874. image && image.setRotation(rotate);
  101875. return layerStyle;
  101876. });
  101877. }
  101878. /**
  101879. * @private
  101880. * @function WebMap.prototype.createDataflowHeatLayer
  101881. * @description 创建数据流服务的热力图图层
  101882. * @param {Object} layerInfo - 图层参数
  101883. * @returns {ol.layer.Heatmap} 热力图图层对象
  101884. */
  101885. createDataflowHeatLayer(layerInfo) {
  101886. let source = this.createDataflowHeatSource(layerInfo);
  101887. let layerOptions = {
  101888. source: source
  101889. };
  101890. layerOptions.gradient = layerInfo.themeSetting.colors.slice();
  101891. layerOptions.radius = parseInt(layerInfo.themeSetting.radius);
  101892. if (layerInfo.themeSetting.customSettings) {
  101893. let customSettings = layerInfo.themeSetting.customSettings;
  101894. for (let i in customSettings) {
  101895. layerOptions.gradient[i] = customSettings[i];
  101896. }
  101897. }
  101898. return new external_ol_layer_namespaceObject.Heatmap(layerOptions);
  101899. }
  101900. /**
  101901. * @private
  101902. * @function WebMap.prototype.createDataflowHeatSource
  101903. * @description 创建数据流服务的热力图的source
  101904. * @param {Object} layerInfo - 图层参数
  101905. * @returns {ol.souce.Vector} 热力图source对象
  101906. */
  101907. createDataflowHeatSource(layerInfo) {
  101908. let that = this,
  101909. source = new (external_ol_source_Vector_default())({
  101910. wrapX: false
  101911. });
  101912. let featureCache = {};
  101913. this.createDataflowService(layerInfo, function (featureCache) {
  101914. return function (feature) {
  101915. if (layerInfo.filterCondition) {
  101916. //过滤条件
  101917. let condition = that.parseFilterCondition(layerInfo.filterCondition);
  101918. const properties = feature.get('attributes');
  101919. const conditions = parseCondition(condition, Object.keys(properties));
  101920. const filterFeature = parseConditionFeature(properties);
  101921. const sql = 'select * from json where (' + conditions + ')';
  101922. let filterResult = window.jsonsql.query(sql, { attributes: filterFeature });
  101923. if (filterResult && filterResult.length > 0) {
  101924. that.addDataflowFeature(feature, layerInfo.identifyField, {
  101925. dataflowSource: source,
  101926. featureCache: featureCache
  101927. });
  101928. }
  101929. } else {
  101930. that.addDataflowFeature(feature, layerInfo.identifyField, {
  101931. dataflowSource: source,
  101932. featureCache: featureCache
  101933. });
  101934. }
  101935. // 权重字段恢复
  101936. if (layerInfo.themeSetting.weight) {
  101937. that.changeWeight(source.getFeatures(), layerInfo.themeSetting.weight);
  101938. }
  101939. }
  101940. }(featureCache));
  101941. return source;
  101942. }
  101943. /**
  101944. * @private
  101945. * @function WebMap.prototype.addFeatureFromDataflowService
  101946. * @description 将feature添加到数据流图层
  101947. * @param {Object} source - 图层对应的source
  101948. * @param {Object} feature - 需要添加到图层的feature
  101949. * @param {Object} identifyField - feature的标识字段
  101950. * @param {Object} featureCache - 存储已添加到图层的feature对象
  101951. */
  101952. addFeatureFromDataflowService(source, feature, identifyField, featureCache) {
  101953. //判断是否有这个feature,存在feature就更新位置。
  101954. var geoID = feature.get(identifyField);
  101955. if (geoID !== undefined && featureCache[geoID]) {
  101956. /*if(that.addFeatureFinish) {
  101957. //feature全都加上图层,就缩放范围
  101958. MapManager.zoomToExtent(LayerUtil.getBoundsFromFeatures(source.getFeatures()));
  101959. that.addFeatureFinish = false;
  101960. }*/
  101961. featureCache[geoID].setGeometry(feature.getGeometry());
  101962. featureCache[geoID].setProperties(feature.getProperties());
  101963. source.changed();
  101964. } else {
  101965. source.addFeature(feature);
  101966. featureCache[geoID] = feature;
  101967. }
  101968. }
  101969. /**
  101970. * @private
  101971. * @function WebMap.prototype.createDataflowService
  101972. * @description 将feature添加到数据流图层
  101973. * @param {Object} layerInfo - 图层参数
  101974. * @param {Object} callback - 回调函数
  101975. */
  101976. createDataflowService(layerInfo, callback) {
  101977. let that = this;
  101978. let dataflowService = new DataFlowService(layerInfo.wsUrl).initSubscribe();
  101979. dataflowService.on('messageSucceeded', function (e) {
  101980. let geojson = JSON.parse(e.value.data);
  101981. let feature = transformTools.readFeature(geojson, {
  101982. dataProjection: layerInfo.projection || "EPSG:4326",
  101983. featureProjection: that.baseProjection || 'EPSG:4326'
  101984. });
  101985. feature.setProperties({attributes: geojson.properties});
  101986. callback(feature);
  101987. });
  101988. layerInfo.dataflowService = dataflowService;
  101989. }
  101990. /**
  101991. * @private
  101992. * @function WebMap.prototype.setEachFeatureDefaultStyle
  101993. * @description 为标注图层上的feature设置样式
  101994. * @param {Array} features - 所以的feature集合
  101995. */
  101996. async setEachFeatureDefaultStyle(features) {
  101997. let that = this;
  101998. features = (core_Util_Util.isArray(features) || features instanceof (external_ol_Collection_default())) ? features : [features];
  101999. for(let i = 0; i < features.length; i++) {
  102000. const feature = features[i];
  102001. let geomType = feature.getGeometry().getType().toUpperCase();
  102002. // let styleType = geomType === "POINT" ? 'MARKER' : geomType;
  102003. let defaultStyle = feature.getProperties().useStyle;
  102004. if (defaultStyle) {
  102005. if (geomType === 'POINT' && defaultStyle.text) {
  102006. //说明是文字的feature类型
  102007. geomType = "TEXT";
  102008. }
  102009. let attributes = that.setFeatureInfo(feature);
  102010. feature.setProperties({
  102011. useStyle: defaultStyle,
  102012. attributes
  102013. });
  102014. //标注图层的feature上需要存一个layerId,为了之后样式应用到图层上使用
  102015. // feature.layerId = timeId;
  102016. if (geomType === 'POINT' && defaultStyle.src &&
  102017. defaultStyle.src.indexOf('http://') === -1 && defaultStyle.src.indexOf('https://') === -1) {
  102018. //说明地址不完整
  102019. defaultStyle.src = that.server + defaultStyle.src;
  102020. }
  102021. } else {
  102022. defaultStyle = StyleUtils.getMarkerDefaultStyle(geomType, that.server);
  102023. }
  102024. feature.setStyle(await StyleUtils.toOpenLayersStyle(defaultStyle, geomType))
  102025. }
  102026. }
  102027. /**
  102028. * @private
  102029. * @function WebMap.prototype.setFeatureInfo
  102030. * @description 为feature设置属性
  102031. * @param {Array} feature - 单个feature
  102032. * @returns {Object} 属性
  102033. */
  102034. setFeatureInfo(feature) {
  102035. let attributes = feature.get('attributes'),
  102036. defaultAttr = {
  102037. dataViz_title: '',
  102038. dataViz_description: '',
  102039. dataViz_imgUrl: '',
  102040. dataViz_url: ''
  102041. },
  102042. newAttribute = Object.assign(defaultAttr, attributes);
  102043. let properties = feature.getProperties();
  102044. for (let key in newAttribute) {
  102045. if (properties[key]) {
  102046. newAttribute[key] = properties[key];
  102047. delete properties[key];
  102048. }
  102049. }
  102050. return newAttribute;
  102051. }
  102052. /**
  102053. * @private
  102054. * @function WebMap.prototype.createRankSymbolLayer
  102055. * @description 创建等级符号图层
  102056. * @param {Object} layerInfo - 图层信息
  102057. * @param {Array} features - 添加到图层上的features
  102058. * @returns {ol.layer.Vector} 矢量图层
  102059. */
  102060. async createRankSymbolLayer(layerInfo, features) {
  102061. let styleSource = await this.createRankStyleSource(layerInfo, features, layerInfo.featureType);
  102062. let layer = new external_ol_layer_namespaceObject.Vector({
  102063. styleSource,
  102064. source: new (external_ol_source_Vector_default())({
  102065. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  102066. wrapX: false
  102067. }),
  102068. renderMode: 'image'
  102069. });
  102070. layer.setStyle(feature => {
  102071. let styleSource = layer.get('styleSource');
  102072. let themeField = styleSource.parameters.themeSetting.themeField;
  102073. let value = Number(feature.get('attributes')[themeField]);
  102074. let styleGroups = styleSource.styleGroups;
  102075. for (let i = 0, len = styleGroups.length; i < len; i++) {
  102076. if (value >= styleGroups[i].start && value < styleGroups[i].end) {
  102077. return styleSource.styleGroups[i].olStyle;
  102078. }
  102079. }
  102080. });
  102081. return layer;
  102082. }
  102083. /**
  102084. * @private
  102085. * @function WebMap.prototype.createRankSymbolLayer
  102086. * @description 创建等级符号图层的source
  102087. * @param {Object} parameters - 图层信息
  102088. * @param {Array} features - 添加到图层上的features
  102089. * @param {string} featureType - feature的类型
  102090. * @returns {Object} styleGroups
  102091. */
  102092. async createRankStyleSource(parameters, features, featureType) {
  102093. let themeSetting = parameters.themeSetting,
  102094. themeField = themeSetting.themeField;
  102095. let styleGroups = await this.getRankStyleGroup(themeField, features, parameters, featureType);
  102096. return styleGroups ? {parameters, styleGroups} : false
  102097. }
  102098. /**
  102099. * @private
  102100. * @function WebMap.prototype.getRankStyleGroup
  102101. * @description 获取等级符号的style
  102102. * @param {string} themeField - 分段字段
  102103. * @param {Array} features - 添加到图层上的features
  102104. * @param {Object} parameters - 图层参数
  102105. * @param {string} featureType - feature的类型
  102106. * @returns {Array} stylegroup
  102107. */
  102108. async getRankStyleGroup(themeField, features, parameters, featureType) {
  102109. // 找出所有的单值
  102110. let values = [],
  102111. segements = [],
  102112. style = parameters.style,
  102113. themeSetting = parameters.themeSetting,
  102114. segmentMethod = themeSetting.segmentMethod || this.defaultParameters.themeSetting.segmentMethod,
  102115. segmentCount = themeSetting.segmentCount || this.defaultParameters.themeSetting.segmentCount,
  102116. customSettings = themeSetting.customSettings,
  102117. minR = parameters.themeSetting.minRadius,
  102118. maxR = parameters.themeSetting.maxRadius,
  102119. fillColor = style.fillColor,
  102120. colors = parameters.themeSetting.colors;
  102121. features.forEach(feature => {
  102122. let attributes = feature.get('attributes'),
  102123. value = attributes[themeField];
  102124. // 过滤掉空值和非数值
  102125. if (value == null || !core_Util_Util.isNumber(value)) {
  102126. return;
  102127. }
  102128. values.push(Number(value));
  102129. });
  102130. try {
  102131. segements = ArrayStatistic.getArraySegments(values, segmentMethod, segmentCount);
  102132. } catch (error) {
  102133. console.error(error);
  102134. }
  102135. // 处理自定义 分段
  102136. for (let i = 0; i < segmentCount; i++) {
  102137. if (i in customSettings) {
  102138. let startValue = customSettings[i]['segment']['start'],
  102139. endValue = customSettings[i]['segment']['end'];
  102140. startValue != null && (segements[i] = startValue);
  102141. endValue != null && (segements[i + 1] = endValue);
  102142. }
  102143. }
  102144. //生成styleGroup
  102145. let styleGroup = [];
  102146. if (segements && segements.length) {
  102147. let len = segements.length,
  102148. incrementR = (maxR - minR) / (len - 1), // 半径增量
  102149. start, end, radius = Number(((maxR + minR) / 2).toFixed(2));
  102150. // 获取颜色
  102151. let rangeColors = colors ? ColorsPickerUtil.getGradientColors(colors, len, 'RANGE') : [];
  102152. for (let j = 0; j < len - 1; j++) {
  102153. start = Number(segements[j].toFixed(2));
  102154. end = Number(segements[j + 1].toFixed(2));
  102155. // 这里特殊处理以下分段值相同的情况(即所有字段值相同)
  102156. radius = start === end ? radius : minR + Math.round(incrementR * j);
  102157. // 最后一个分段时将end+0.01,避免取不到最大值
  102158. end = j === len - 2 ? end + 0.01 : end;
  102159. // 处理自定义 半径
  102160. radius = customSettings[j] && customSettings[j].radius ? customSettings[j].radius : radius;
  102161. // 转化成 ol 样式
  102162. style.radius = radius;
  102163. style.fillColor = customSettings[j] && customSettings[j].color ? customSettings[j].color : rangeColors[j] || fillColor;
  102164. let olStyle = await StyleUtils.getOpenlayersStyle(style, featureType, true);
  102165. styleGroup.push({olStyle: olStyle, radius, start, end, fillColor: style.fillColor});
  102166. }
  102167. return styleGroup;
  102168. } else {
  102169. return false;
  102170. }
  102171. }
  102172. /**
  102173. * @private
  102174. * @function WebMap.prototype.checkUploadToRelationship
  102175. * @description 检查是否上传到关系型
  102176. * @param {string} fileId - 文件的id
  102177. * @returns {Promise<T | never>} 关系型文件一些参数
  102178. */
  102179. checkUploadToRelationship(fileId) {
  102180. let url = this.getRequestUrl(`${this.server}web/datas/${fileId}/datasets.json`);
  102181. return FetchRequest.get(url, null, {
  102182. withCredentials: this.withCredentials
  102183. }).then(function (response) {
  102184. return response.json()
  102185. }).then(function (result) {
  102186. return result;
  102187. });
  102188. }
  102189. /**
  102190. * @private
  102191. * @function WebMap.prototype.getDatasources
  102192. * @description 获取关系型文件发布的数据服务中数据源的名称
  102193. * @param {string} url - 获取数据源信息的url
  102194. * @returns {Promise<T | never>} 数据源名称
  102195. */
  102196. getDatasources(url) {
  102197. let requestUrl = this.getRequestUrl(`${url}/data/datasources.json`);
  102198. return FetchRequest.get(requestUrl, null, {
  102199. withCredentials: this.withCredentials
  102200. }).then(function (response) {
  102201. return response.json()
  102202. }).then(function (datasource) {
  102203. let datasourceNames = datasource.datasourceNames;
  102204. return datasourceNames[0];
  102205. });
  102206. }
  102207. /**
  102208. * @private
  102209. * @function WebMap.prototype.getDataService
  102210. * @description 获取上传的数据信息
  102211. * @param {string} fileId - 文件id
  102212. * @param {string} datasetName 数据服务的数据集名称
  102213. * @returns {Promise<T | never>} 数据的信息
  102214. */
  102215. getDataService(fileId, datasetName) {
  102216. let url = this.getRequestUrl(`${this.server}web/datas/${fileId}.json`);
  102217. return FetchRequest.get(url, null, {
  102218. withCredentials: this.withCredentials
  102219. }).then(function (response) {
  102220. return response.json()
  102221. }).then(function (result) {
  102222. result.fileId = fileId;
  102223. result.datasetName = datasetName;
  102224. return result;
  102225. });
  102226. }
  102227. /**
  102228. * @private
  102229. * @function WebMap.prototype.getRootUrl
  102230. * @description 获取请求地址
  102231. * @param {string} url 请求的地址
  102232. * @param {boolean} 请求是否带上Credential.
  102233. * @returns {Promise<T | never>} 请求地址
  102234. */
  102235. getRequestUrl(url, excludeCreditial) {
  102236. url = excludeCreditial ? url : this.formatUrlWithCredential(url);
  102237. //如果传入进来的url带了代理则不需要处理
  102238. if (this.excludePortalProxyUrl) {
  102239. return;
  102240. }
  102241. return Util_Util.isInTheSameDomain(url) || this.isIportalProxyServiceUrl(url) ? url : `${this.getProxy()}${encodeURIComponent(url)}`;
  102242. }
  102243. /**
  102244. * @description 给url带上凭证密钥
  102245. * @param {string} url - 地址
  102246. */
  102247. formatUrlWithCredential(url) {
  102248. if (this.credentialValue) {
  102249. //有token之类的配置项
  102250. url = url.indexOf("?") === -1 ? `${url}?${this.credentialKey}=${this.credentialValue}` :
  102251. `${url}&${this.credentialKey}=${this.credentialValue}`;
  102252. }
  102253. return url;
  102254. }
  102255. /**
  102256. * @private
  102257. * @function WebMap.prototype.getProxy
  102258. * @description 获取代理地址
  102259. * @returns {Promise<T | never>} 代理地址
  102260. */
  102261. getProxy(type) {
  102262. if (!type) {
  102263. type = 'json';
  102264. }
  102265. return this.proxy || this.server + `apps/viewer/getUrlResource.${type}?url=`;
  102266. }
  102267. /**
  102268. * @private
  102269. * @function WebMap.prototype.getTileLayerInfo
  102270. * @description 获取地图服务的信息
  102271. * @param {string} url 地图服务的url(没有地图名字)
  102272. * @returns {Promise<T | never>} 地图服务信息
  102273. */
  102274. getTileLayerInfo(url) {
  102275. let that = this, epsgCode = that.baseProjection.split('EPSG:')[1];
  102276. let requestUrl = that.getRequestUrl(`${url}/maps.json`);
  102277. return FetchRequest.get(requestUrl, null, {
  102278. withCredentials: this.withCredentials
  102279. }).then(function (response) {
  102280. return response.json()
  102281. }).then(function (mapInfo) {
  102282. let promises = [];
  102283. if (mapInfo) {
  102284. mapInfo.forEach(function (info) {
  102285. let mapUrl = that.getRequestUrl(`${info.path}.json?prjCoordSys=${encodeURI(JSON.stringify({epsgCode: epsgCode}))}`)
  102286. let promise = FetchRequest.get(mapUrl, null, {
  102287. withCredentials: that.withCredentials
  102288. }).then(function (response) {
  102289. return response.json()
  102290. }).then(function (restMapInfo) {
  102291. restMapInfo.url = info.path;
  102292. return restMapInfo
  102293. });
  102294. promises.push(promise);
  102295. });
  102296. }
  102297. return Promise.all(promises).then(function (allRestMaps) {
  102298. return allRestMaps
  102299. })
  102300. });
  102301. }
  102302. /**
  102303. * 通过wkt参数扩展支持多坐标系
  102304. *
  102305. * @param {string} wkt 字符串
  102306. * @param {string} crsCode epsg信息,如: "EPSG:4490"
  102307. *
  102308. * @returns {boolean} 坐标系是否添加成功
  102309. */
  102310. addProjctionFromWKT(wkt, crsCode) {
  102311. if (typeof (wkt) !== 'string') {
  102312. //参数类型错误
  102313. return false;
  102314. } else {
  102315. if (wkt === "EPSG:4326" || wkt === "EPSG:3857") {
  102316. return true;
  102317. } else {
  102318. let epsgCode = crsCode || this.getEpsgInfoFromWKT(wkt);
  102319. if (epsgCode) {
  102320. proj4_src_default().defs(epsgCode, wkt);
  102321. // 重新注册proj4到ol.proj,不然不会生效
  102322. if (external_ol_proj_proj4_namespaceObject && external_ol_proj_proj4_namespaceObject.register) {
  102323. external_ol_proj_proj4_namespaceObject.register((proj4_src_default()));
  102324. } else if (window.ol.proj && window.ol.proj.setProj4) {
  102325. window.ol.proj.setProj4((proj4_src_default()))
  102326. }
  102327. return true;
  102328. } else {
  102329. // 参数类型非wkt标准
  102330. return false;
  102331. }
  102332. }
  102333. }
  102334. }
  102335. /**
  102336. * 通过wkt参数获取坐标信息
  102337. *
  102338. * @param {string} wkt 字符串
  102339. * @returns {string} epsg 如:"EPSG:4326"
  102340. */
  102341. getEpsgInfoFromWKT(wkt) {
  102342. if (typeof (wkt) !== 'string') {
  102343. return false;
  102344. } else if (wkt.indexOf("EPSG") === 0) {
  102345. return wkt;
  102346. } else {
  102347. let lastAuthority = wkt.lastIndexOf("AUTHORITY") + 10,
  102348. endString = wkt.indexOf("]", lastAuthority) - 1;
  102349. if (lastAuthority > 0 && endString > 0) {
  102350. return `EPSG:${wkt.substring(lastAuthority, endString).split(",")[1].substr(1)}`;
  102351. } else {
  102352. return false;
  102353. }
  102354. }
  102355. }
  102356. /**
  102357. * @private
  102358. * @function WebMap.prototype.createMigrationLayer
  102359. * @description 创建迁徙图
  102360. * @param {Object} layerInfo 图层信息
  102361. * @param {Array} features 要素数组
  102362. * @returns {ol.layer} 图层
  102363. */
  102364. createMigrationLayer(layerInfo, features) {
  102365. // 获取图层外包DOM
  102366. if (!window.ol3Echarts.prototype.getContainer) {
  102367. window.ol3Echarts.prototype.getContainer = function () {
  102368. return this.$container;
  102369. };
  102370. }
  102371. // 设置图层可见性
  102372. if (!window.ol3Echarts.prototype.setVisible) {
  102373. window.ol3Echarts.prototype.setVisible = function (visible) {
  102374. if (visible) {
  102375. let options = this.get('options');
  102376. if (options) {
  102377. this.setChartOptions(options);
  102378. this.unset('options');
  102379. }
  102380. } else {
  102381. let options = this.getChartOptions();
  102382. this.set('options', options);
  102383. this.clear();
  102384. this.setChartOptions({});
  102385. }
  102386. };
  102387. }
  102388. // 设置图层层级
  102389. if (!window.ol3Echarts.prototype.setZIndex) {
  102390. window.ol3Echarts.prototype.setZIndex = function (zIndex) {
  102391. let container = this.getContainer();
  102392. if (container) {
  102393. container.style.zIndex = zIndex;
  102394. }
  102395. };
  102396. }
  102397. /**
  102398. * 设置鼠标样式
  102399. * .cursor-default > div {
  102400. * cursor: default !important;
  102401. * }
  102402. */
  102403. if (!window.ol3Echarts.prototype.setCursor) {
  102404. window.ol3Echarts.prototype.setCursor = function (cursor = 'default') {
  102405. let container = this.getContainer();
  102406. if (container && cursor === 'default') {
  102407. container.classList.add('cursor-default');
  102408. }
  102409. }
  102410. }
  102411. let properties = getFeatureProperties(features);
  102412. let lineData = this.createLinesData(layerInfo, properties);
  102413. let pointData = this.createPointsData(lineData, layerInfo, properties);
  102414. let options = this.createOptions(layerInfo, lineData, pointData);
  102415. let layer = new window.ol3Echarts(options, {
  102416. // hideOnMoving: true,
  102417. // hideOnZooming: true
  102418. //以下三个参数,如果不按照这样设置,会造成不可见图层时,缩放还会出现图层
  102419. hideOnMoving: false,
  102420. hideOnZooming: false,
  102421. forcedPrecomposeRerender: true
  102422. });
  102423. layer.type = 'ECHARTS';
  102424. return layer;
  102425. }
  102426. /**
  102427. * @private
  102428. * @function WebMap.prototype.createOptions
  102429. * @description 创建echarts的options
  102430. * @param {Object} layerInfo 图层信息
  102431. * @param {Array} lineData 线数据
  102432. * @param {Array} pointData 点数据
  102433. * @returns {Object} echarts参数
  102434. */
  102435. createOptions(layerInfo, lineData, pointData) {
  102436. let series;
  102437. let lineSeries = this.createLineSeries(layerInfo, lineData);
  102438. if (pointData && pointData.length) {
  102439. let pointSeries = this.createPointSeries(layerInfo, pointData);
  102440. series = lineSeries.concat(pointSeries);
  102441. } else {
  102442. series = lineSeries.slice();
  102443. }
  102444. let options = {
  102445. series
  102446. }
  102447. return options;
  102448. }
  102449. /**
  102450. * @private
  102451. * @function WebMap.prototype.createLineSeries
  102452. * @description 创建线系列
  102453. * @param {Object} layerInfo 图层参数
  102454. * @param {Array} lineData 线数据
  102455. * @returns {Object} 线系列
  102456. */
  102457. createLineSeries(layerInfo, lineData) {
  102458. let lineSetting = layerInfo.lineSetting;
  102459. let animationSetting = layerInfo.animationSetting;
  102460. let linesSeries = [
  102461. // 轨迹线样式
  102462. {
  102463. name: 'line-series',
  102464. type: 'lines',
  102465. zlevel: 1,
  102466. silent: true,
  102467. effect: {
  102468. show: animationSetting.show,
  102469. constantSpeed: animationSetting.constantSpeed,
  102470. trailLength: 0,
  102471. symbol: animationSetting.symbol,
  102472. symbolSize: animationSetting.symbolSize
  102473. },
  102474. lineStyle: {
  102475. normal: {
  102476. color: lineSetting.color,
  102477. type: lineSetting.type,
  102478. width: lineSetting.width,
  102479. opacity: lineSetting.opacity,
  102480. curveness: lineSetting.curveness
  102481. }
  102482. },
  102483. data: lineData
  102484. }
  102485. ];
  102486. if (lineData.length > MAX_MIGRATION_ANIMATION_COUNT) {
  102487. // linesSeries[0].large = true;
  102488. // linesSeries[0].largeThreshold = 100;
  102489. linesSeries[0].blendMode = 'lighter';
  102490. }
  102491. return linesSeries;
  102492. }
  102493. /**
  102494. * @private
  102495. * @function WebMap.prototype.createPointSeries
  102496. * @description 创建点系列
  102497. * @param {Object} layerInfo 图层参数
  102498. * @param {Array} pointData 点数据
  102499. * @returns {Object} 点系列
  102500. */
  102501. createPointSeries(layerInfo, pointData) {
  102502. let lineSetting = layerInfo.lineSetting;
  102503. let animationSetting = layerInfo.animationSetting;
  102504. let labelSetting = layerInfo.labelSetting;
  102505. let pointSeries = [{
  102506. name: 'point-series',
  102507. coordinateSystem: 'geo',
  102508. zlevel: 2,
  102509. silent: true,
  102510. label: {
  102511. normal: {
  102512. show: labelSetting.show,
  102513. position: 'right',
  102514. formatter: '{b}',
  102515. color: labelSetting.color,
  102516. fontFamily: labelSetting.fontFamily
  102517. }
  102518. },
  102519. itemStyle: {
  102520. normal: {
  102521. color: lineSetting.color || labelSetting.color
  102522. }
  102523. },
  102524. data: pointData
  102525. }]
  102526. if (animationSetting.show) {
  102527. // 开启动画
  102528. pointSeries[0].type = 'effectScatter';
  102529. pointSeries[0].rippleEffect = {
  102530. brushType: 'stroke'
  102531. }
  102532. } else {
  102533. // 关闭动画
  102534. pointSeries[0].type = 'scatter';
  102535. }
  102536. return pointSeries;
  102537. }
  102538. /**
  102539. * @private
  102540. * @function WebMap.prototype.createPointsData
  102541. * @param {Array} lineData 线数据
  102542. * @param {Object} layerInfo 图层信息
  102543. * @param {Array} properties 属性
  102544. * @returns {Array} 点数据
  102545. */
  102546. createPointsData(lineData, layerInfo, properties) {
  102547. let data = [],
  102548. labelSetting = layerInfo.labelSetting;
  102549. // 标签隐藏则直接返回
  102550. if (!labelSetting.show || !lineData.length) {
  102551. return data;
  102552. }
  102553. let fromData = [], toData = [];
  102554. lineData.forEach((item, idx) => {
  102555. let coords = item.coords,
  102556. fromCoord = coords[0],
  102557. toCoord = coords[1],
  102558. fromProperty = properties[idx][labelSetting.from],
  102559. toProperty = properties[idx][labelSetting.to];
  102560. // 起始字段去重
  102561. let f = fromData.find(d => {
  102562. return d.value[0] === fromCoord[0] && d.value[1] === fromCoord[1]
  102563. });
  102564. !f && fromData.push({
  102565. name: fromProperty,
  102566. value: fromCoord
  102567. })
  102568. // 终点字段去重
  102569. let t = toData.find(d => {
  102570. return d.value[0] === toCoord[0] && d.value[1] === toCoord[1]
  102571. });
  102572. !t && toData.push({
  102573. name: toProperty,
  102574. value: toCoord
  102575. })
  102576. });
  102577. data = fromData.concat(toData);
  102578. return data;
  102579. }
  102580. /**
  102581. * @private
  102582. * @function WebMap.prototype.createLinesData
  102583. * @param {Object} layerInfo 图层信息
  102584. * @param {Array} properties 属性
  102585. * @returns {Array} 线数据
  102586. */
  102587. createLinesData(layerInfo, properties) {
  102588. let data = [];
  102589. if (properties && properties.length) {
  102590. // 重新获取数据
  102591. let from = layerInfo.from,
  102592. to = layerInfo.to,
  102593. fromCoord, toCoord;
  102594. if (from.type === 'XY_FIELD' && from['xField'] && from['yField'] && to['xField'] && to['yField']) {
  102595. properties.forEach(property => {
  102596. let fromX = property[from['xField']],
  102597. fromY = property[from['yField']],
  102598. toX = property[to['xField']],
  102599. toY = property[to['yField']];
  102600. if (!fromX || !fromY || !toX || !toY) {
  102601. return;
  102602. }
  102603. fromCoord = [property[from['xField']], property[from['yField']]];
  102604. toCoord = [property[to['xField']], property[to['yField']]];
  102605. data.push({
  102606. coords: [fromCoord, toCoord]
  102607. })
  102608. });
  102609. } else if (from.type === 'PLACE_FIELD' && from['field'] && to['field']) {
  102610. const centerDatas = ProvinceCenter_namespaceObject.concat(MunicipalCenter_namespaceObject);
  102611. properties.forEach(property => {
  102612. let fromField = property[from['field']],
  102613. toField = property[to['field']];
  102614. fromCoord = centerDatas.find(item => {
  102615. return core_Util_Util.isMatchAdministrativeName(item.name, fromField);
  102616. })
  102617. toCoord = centerDatas.find(item => {
  102618. return core_Util_Util.isMatchAdministrativeName(item.name, toField);
  102619. })
  102620. if (!fromCoord || !toCoord) {
  102621. return;
  102622. }
  102623. data.push({
  102624. coords: [fromCoord.coord, toCoord.coord]
  102625. })
  102626. });
  102627. }
  102628. }
  102629. return data;
  102630. }
  102631. /**
  102632. * @private
  102633. * @function WebMap.prototype.getService
  102634. * @description 获取当前数据发布的服务中的某种类型服务
  102635. * @param {Array.<Object>} services 服务集合
  102636. * @param {string} type 服务类型,RESTDATA, RESTMAP
  102637. * @returns {Object} 服务
  102638. */
  102639. getService(services, type) {
  102640. let service = services.filter((info) => {
  102641. return info && info.serviceType === type;
  102642. });
  102643. return service[0];
  102644. }
  102645. /**
  102646. * @private
  102647. * @function WebMap.prototype.isMvt
  102648. * @description 判断当前能否使用数据服务的mvt上图方式
  102649. * @param {string} serviceUrl 数据服务的地址
  102650. * @param {string} datasetName 数据服务的数据集名称
  102651. * @returns {Object} 数据服务的信息
  102652. */
  102653. isMvt(serviceUrl, datasetName) {
  102654. let that = this;
  102655. return this.getDatasetsInfo(serviceUrl, datasetName).then((info) => {
  102656. //判断是否和底图坐标系一直
  102657. if (info.epsgCode == that.baseProjection.split('EPSG:')[1]) {
  102658. return FetchRequest.get(that.getRequestUrl(`${info.url}/tilefeature.mvt`), null, {
  102659. withCredentials: that.withCredentials
  102660. }).then(function (response) {
  102661. return response.json()
  102662. }).then(function (result) {
  102663. info.isMvt = result.error && result.error.code === 400;
  102664. return info;
  102665. }).catch(() => {
  102666. return info;
  102667. });
  102668. }
  102669. return info;
  102670. })
  102671. }
  102672. /**
  102673. * @private
  102674. * @function WebMap.prototype.getDatasetsInfo
  102675. * @description 获取数据集信息
  102676. * @param {string} serviceUrl 数据服务的地址
  102677. * @param {string} datasetName 数据服务的数据集名称
  102678. * @returns {Object} 数据服务的信息
  102679. */
  102680. getDatasetsInfo(serviceUrl, datasetName) {
  102681. let that = this;
  102682. return that.getDatasources(serviceUrl).then(function (datasourceName) {
  102683. //判断mvt服务是否可用
  102684. let url = `${serviceUrl}/data/datasources/${datasourceName}/datasets/${datasetName}.json`;
  102685. return FetchRequest.get(that.getRequestUrl(url), null, {
  102686. withCredentials: that.withCredentials
  102687. }).then(function (response) {
  102688. return response.json()
  102689. }).then(function (datasetsInfo) {
  102690. return {
  102691. epsgCode: datasetsInfo.datasetInfo.prjCoordSys.epsgCode,
  102692. bounds: datasetsInfo.datasetInfo.bounds,
  102693. url //返回的是原始url,没有代理。因为用于请求mvt
  102694. };
  102695. });
  102696. })
  102697. }
  102698. /**
  102699. * @private
  102700. * @function WebMap.prototype.isRestMapMapboxStyle
  102701. * @description 仅判断是否为restmap mvt地图服务 rest-map服务的Mapbox Style资源地址是这样的: .../iserver/services/map-Population/rest/maps/PopulationDistribution/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true
  102702. * @param {Object} layerInfo webmap中的MapStylerLayer
  102703. * @returns {boolean} 是否为restmap mvt地图服务
  102704. */
  102705. isRestMapMapboxStyle(layerInfo) {
  102706. const restMapMVTStr = '/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true&tileURLTemplate=ZXY'
  102707. let dataSource = layerInfo.dataSource;
  102708. let layerType = layerInfo.layerType;
  102709. if (dataSource && dataSource.type === "EXTERNAL"
  102710. && dataSource.url.indexOf(restMapMVTStr) > -1
  102711. && (layerType === "MAPBOXSTYLE" || layerType === "VECTOR_TILE")) {
  102712. return true
  102713. }
  102714. return false
  102715. }
  102716. /**
  102717. * @private
  102718. * @function WebMap.prototype.getMapboxStyleLayerInfo
  102719. * @description 获取mapboxstyle图层信息
  102720. * @param {Object} layerInfo 图层信息
  102721. * @returns {Object} 图层信息
  102722. */
  102723. getMapboxStyleLayerInfo(mapInfo, layerInfo) {
  102724. let _this = this;
  102725. return new Promise((resolve, reject) => {
  102726. return _this.getMapLayerExtent(layerInfo).then(layer => {
  102727. return _this.getMapboxStyle(mapInfo, layer).then(styleLayer => {
  102728. Object.assign(layer, styleLayer);
  102729. resolve(layer)
  102730. }).catch(error => {
  102731. reject(error);
  102732. })
  102733. }).catch(error => {
  102734. reject(error);
  102735. })
  102736. })
  102737. }
  102738. /**
  102739. * @private
  102740. * @function WebMap.prototype.getMapLayerExtent
  102741. * @description 获取mapboxstyle图层信息
  102742. * @param {Object} layerInfo 图层信息
  102743. * @returns {Object} 图层信息
  102744. */
  102745. getMapLayerExtent(layerInfo) {
  102746. const restMapMVTStr = '/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true&tileURLTemplate=ZXY'
  102747. let dataSource = layerInfo.dataSource;
  102748. let url = dataSource.url;
  102749. if (this.isRestMapMapboxStyle(layerInfo)) {
  102750. url = url.replace(restMapMVTStr, '')
  102751. }
  102752. url = this.getRequestUrl(url + '.json')
  102753. let credential = layerInfo.credential;
  102754. let credentialValue,keyfix;
  102755. //携带令牌(restmap用的首字母大写,但是这里要用小写)
  102756. if (credential) {
  102757. keyfix = Object.keys(credential)[0]
  102758. credentialValue = credential[keyfix];
  102759. url = `${url}?${keyfix}=${credentialValue}`;
  102760. }
  102761. return FetchRequest.get(url, null, {
  102762. withCredentials: this.withCredentials,
  102763. withoutFormatSuffix: true,
  102764. headers: {
  102765. 'Content-Type': 'application/json;chartset=uft-8'
  102766. }
  102767. }).then(function (response) {
  102768. return response.json();
  102769. }).then((result) => {
  102770. layerInfo.visibleScales = result.visibleScales;
  102771. layerInfo.coordUnit = result.coordUnit;
  102772. layerInfo.scale = result.scale;
  102773. layerInfo.epsgCode = result.prjCoordSys.epsgCode;
  102774. layerInfo.bounds = result.bounds;
  102775. return layerInfo;
  102776. }).catch(error => {
  102777. throw error;
  102778. })
  102779. }
  102780. /**
  102781. * @private
  102782. * @function WebMap.prototype.getMapboxStyle
  102783. * @description 获取mapboxstyle --- ipt中自定义底图请求mapboxstyle目前有两种url格式
  102784. * rest-map服务的Mapbox Style资源地址是这样的: .../iserver/services/map-Population/rest/maps/PopulationDistribution/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true
  102785. * restjsr片服务的Mapbox Style资源地址是这样的:.../iserver/services/map-china400/restjsr/v1/vectortile/maps/China/style.json
  102786. * @param {Object} mapboxstyle图层信息
  102787. * @returns {Object} 图层信息
  102788. */
  102789. getMapboxStyle(mapInfo, layerInfo) {
  102790. let _this = this;
  102791. let url = layerInfo.url || layerInfo.dataSource.url;
  102792. let styleUrl = url;
  102793. if (styleUrl.indexOf('/restjsr/') > -1) {
  102794. styleUrl = `${styleUrl}/style.json`;
  102795. }
  102796. styleUrl = this.getRequestUrl(styleUrl)
  102797. let credential = layerInfo.credential;
  102798. //携带令牌(restmap用的首字母大写,但是这里要用小写)
  102799. let credentialValue, keyfix;
  102800. if (credential) {
  102801. keyfix = Object.keys(credential)[0]
  102802. credentialValue = credential[keyfix];
  102803. styleUrl = `${styleUrl}?${keyfix}=${credentialValue}`;
  102804. }
  102805. return FetchRequest.get(styleUrl, null, {
  102806. withCredentials: this.withCredentials,
  102807. withoutFormatSuffix: true,
  102808. headers: {
  102809. 'Content-Type': 'application/json;chartset=uft-8'
  102810. }
  102811. }).then(function (response) {
  102812. return response.json();
  102813. }).then(styles => {
  102814. _this._matchStyleObject(styles);
  102815. let bounds = layerInfo.bounds;
  102816. // 处理携带令牌的情况
  102817. if (credentialValue) {
  102818. styles.sprite = `${styles.sprite}?${keyfix}=${credentialValue}`;
  102819. let sources = styles.sources;
  102820. let sourcesNames = Object.keys(sources);
  102821. sourcesNames.forEach(function (sourceName) {
  102822. styles.sources[sourceName].tiles.forEach(function (tiles, i) {
  102823. styles.sources[sourceName].tiles[i] = `${tiles}?${keyfix}=${credentialValue}`
  102824. })
  102825. })
  102826. }
  102827. let newLayerInfo = {
  102828. url: url,
  102829. sourceType: 'VECTOR_TILE',
  102830. layerType: 'VECTOR_TILE',
  102831. styles: styles,
  102832. extent: bounds && [bounds.left, bounds.bottom, bounds.right, bounds.top],
  102833. bounds: layerInfo.bounds,
  102834. projection: "EPSG:" + layerInfo.epsgCode,
  102835. epsgCode: layerInfo.epsgCode,
  102836. name: layerInfo.name
  102837. }
  102838. Object.assign(layerInfo, newLayerInfo)
  102839. if (layerInfo.zIndex > 0) {
  102840. // 过滤styles 非底图mapboxstyle图层才需此处理
  102841. _this.modifyMapboxstyleLayer(mapInfo, layerInfo);
  102842. }
  102843. return layerInfo;
  102844. }).catch(error => {
  102845. return error;
  102846. })
  102847. }
  102848. /**
  102849. * @private
  102850. * @function WebMap.prototype.modifyMapboxstyleLayer
  102851. * @description mapboxstyle图层:1. layer id重复问题 2.叠加图层背景色问题
  102852. * @param {Object} mapInfo 地图信息
  102853. * @param {Object} layerInfo 当前要添加到地图的图层
  102854. */
  102855. modifyMapboxstyleLayer(mapInfo, layerInfo) {
  102856. let that = this;
  102857. if (mapInfo.layers && mapInfo.layers.length === 0) {return;}
  102858. let curLayers = layerInfo.styles.layers;
  102859. if (!curLayers) {return;}
  102860. // 非底图,则移除"background"图层
  102861. curLayers = curLayers.filter(layer => layer.type !== "background");
  102862. layerInfo.styles.layers = curLayers;
  102863. // 处理mapboxstyle图层layer id重复的情况
  102864. let addedLayersArr = mapInfo.layers.filter(layer => layer.layerType === 'VECTOR_TILE' && layer.zIndex !== layerInfo.zIndex)
  102865. .map(addLayer => addLayer.styles && addLayer.styles.layers);
  102866. if (!addedLayersArr || addedLayersArr && addedLayersArr.length === 0) {return;}
  102867. addedLayersArr.forEach(layers => {
  102868. curLayers.forEach(curLayer => {
  102869. that.renameLayerId(layers, curLayer);
  102870. })
  102871. })
  102872. }
  102873. /**
  102874. * @private
  102875. * @function WebMap.prototype.renameLayerId
  102876. * @description mapboxstyle图层 id重复的layer添加后缀编码 (n)[参考mapstudio]
  102877. * @param {mapboxgl.Layer[]} layers 已添加到地图的图层组
  102878. * @param {mapboxgl.Layer} curLayer 当前图层
  102879. */
  102880. renameLayerId(layers, curLayer) {
  102881. if (layers.find((l) => l.id === curLayer.id)) {
  102882. const result = curLayer.id.match(/(.+)\((\w)\)$/);
  102883. if (result) {
  102884. curLayer.id = `${result[1]}(${+result[2] + 1})`;
  102885. } else {
  102886. curLayer.id += '(1)';
  102887. }
  102888. if (layers.find((l) => l.id === curLayer.id)) {
  102889. this.renameLayerId(layers, curLayer);
  102890. }
  102891. }
  102892. }
  102893. /**
  102894. * @private
  102895. * @function mapboxgl.supermap.WebMap.prototype._matchStyleObject
  102896. * @description 恢复 style 为标准格式。
  102897. * @param {Object} style - mapbox 样式。
  102898. */
  102899. _matchStyleObject(style) {
  102900. let {sprite, glyphs} = style;
  102901. if (sprite && typeof sprite === 'object') {
  102902. style.sprite = Object.values(sprite)[0];
  102903. }
  102904. if (glyphs && typeof glyphs === 'object') {
  102905. style.glyphs = Object.values(glyphs)[0];
  102906. }
  102907. }
  102908. /**
  102909. * @private
  102910. * @function WebMap.prototype.renameLayerId
  102911. * @description 判断url是否是iportal的代理地址
  102912. * @param {*} serviceUrl
  102913. */
  102914. isIportalProxyServiceUrl(serviceUrl) {
  102915. if (this.serviceProxy && this.serviceProxy.enable && serviceUrl) {
  102916. let proxyStr = '';
  102917. if (this.serviceProxy.proxyServerRootUrl) {
  102918. proxyStr = `${this.serviceProxy.proxyServerRootUrl}/`;
  102919. } else if (this.serviceProxy.rootUrlPostfix) {
  102920. proxyStr = `${this.serviceProxy.port}/${this.serviceProxy.rootUrlPostfix}/`;
  102921. } else if (!this.serviceProxy.rootUrlPostfix) {
  102922. proxyStr = `${this.serviceProxy.port}/`;
  102923. }
  102924. if (this.serviceProxy.port !== 80) {
  102925. return serviceUrl.indexOf(proxyStr) >= 0;
  102926. } else {
  102927. // 代理端口为80,url中不一定有端口,满足一种情况即可
  102928. return serviceUrl.indexOf(proxyStr) >= 0 || serviceUrl.indexOf(proxyStr.replace(':80', '')) >= 0;
  102929. }
  102930. } else {
  102931. return false
  102932. }
  102933. }
  102934. /**
  102935. * @private
  102936. * @function WebMap.prototype.getStyleResolutions
  102937. * @description 创建图层分辨率
  102938. * @param {Object} bounds 图层上下左右范围
  102939. * @returns {Array} styleResolutions 样式分辨率
  102940. */
  102941. getStyleResolutions(bounds, minZoom = 0, maxZoom = 22) {
  102942. let styleResolutions = [];
  102943. const TILE_SIZE = 512
  102944. let temp = Math.abs(bounds.left - bounds.right) / TILE_SIZE;
  102945. for (let i = minZoom; i <= maxZoom; i++) {
  102946. if (i === 0) {
  102947. styleResolutions[i] = temp;
  102948. continue;
  102949. }
  102950. temp = temp / 2;
  102951. styleResolutions[i] = temp;
  102952. }
  102953. return styleResolutions;
  102954. }
  102955. /**
  102956. * @private
  102957. * @function WebMap.prototype.createVisibleResolution
  102958. * @description 创建图层可视分辨率
  102959. * @param {Array.<number>} visibleScales 可视比例尺范围
  102960. * @param {Array} indexbounds
  102961. * @param {Object} bounds 图层上下左右范围
  102962. * @param {string} coordUnit
  102963. * @returns {Array} visibleResolution
  102964. */
  102965. createVisibleResolution(visibleScales, indexbounds, bounds, coordUnit) {
  102966. let visibleResolution = [];
  102967. // 1 设置了地图visibleScales的情况
  102968. if (visibleScales && visibleScales.length > 0) {
  102969. visibleResolution = visibleScales.map(scale => {
  102970. let value = 1 / scale;
  102971. let res = this.getResFromScale(value, coordUnit);
  102972. return res;
  102973. })
  102974. } else {
  102975. // 2 地图的bounds
  102976. let envelope = this.getEnvelope(indexbounds, bounds);
  102977. visibleResolution = this.getStyleResolutions(envelope);
  102978. }
  102979. return visibleResolution
  102980. }
  102981. /**
  102982. * @private
  102983. * @function WebMap.prototype.createVisibleResolution
  102984. * @description 图层边界范围
  102985. * @param {Array} indexbounds
  102986. * @param {Object} bounds 图层上下左右范围
  102987. * @returns {Object} envelope
  102988. */
  102989. getEnvelope(indexbounds, bounds) {
  102990. let envelope = {};
  102991. if (indexbounds && indexbounds.length === 4) {
  102992. envelope.left = indexbounds[0];
  102993. envelope.bottom = indexbounds[1];
  102994. envelope.right = indexbounds[2];
  102995. envelope.top = indexbounds[3];
  102996. } else {
  102997. envelope = bounds;
  102998. }
  102999. return envelope
  103000. }
  103001. /**
  103002. * @private
  103003. * @function WebMap.prototype.createMVTLayer
  103004. * @description 创建矢量瓦片图层
  103005. * @param {Object} layerInfo - 图层信息
  103006. */
  103007. createMVTLayer(layerInfo) {
  103008. // let that = this;
  103009. let styles = layerInfo.styles;
  103010. const indexbounds = styles && styles.metadata && styles.metadata.indexbounds;
  103011. const visibleResolution = this.createVisibleResolution(layerInfo.visibleScales, indexbounds, layerInfo.bounds, layerInfo.coordUnit);
  103012. const envelope = this.getEnvelope(indexbounds, layerInfo.bounds);
  103013. const styleResolutions = this.getStyleResolutions(envelope);
  103014. // const origin = [envelope.left, envelope.top];
  103015. let withCredentials = this.isIportalProxyServiceUrl(styles.sprite);
  103016. // 创建MapBoxStyle样式
  103017. let mapboxStyles = new MapboxStyles({
  103018. style: styles,
  103019. source: styles.name,
  103020. resolutions: styleResolutions,
  103021. map: this.map,
  103022. withCredentials
  103023. });
  103024. return new Promise((resolve) => {
  103025. mapboxStyles.on('styleloaded', function () {
  103026. let minResolution = visibleResolution[visibleResolution.length - 1];
  103027. let maxResolution = visibleResolution[0];
  103028. let layer = new external_ol_layer_namespaceObject.VectorTile({
  103029. //设置避让参数
  103030. declutter: true,
  103031. source: new VectorTileSuperMapRest({
  103032. style: styles,
  103033. withCredentials,
  103034. projection: layerInfo.projection,
  103035. format: new (external_ol_format_MVT_default())({
  103036. featureClass: (external_ol_render_Feature_default())
  103037. }),
  103038. wrapX: false
  103039. }),
  103040. style: mapboxStyles.featureStyleFuntion,
  103041. visible: layerInfo.visible,
  103042. zIndex: layerInfo.zIndex,
  103043. opacity: layerInfo.opacity,
  103044. minResolution,
  103045. // The maximum resolution (exclusive) below which this layer will be visible.
  103046. maxResolution: maxResolution > 1 ? Math.ceil(maxResolution) : maxResolution * 1.1
  103047. });
  103048. resolve(layer);
  103049. })
  103050. })
  103051. }
  103052. /**
  103053. * @private
  103054. * @function WebMap.prototype.isSupportWebp
  103055. * @description 判断是否支持webP
  103056. * @param {*} url 服务地址
  103057. * @param {*} token 服务token
  103058. * @returns {boolean}
  103059. */
  103060. isSupportWebp(url, token) {
  103061. // 还需要判断浏览器
  103062. let isIE = this.isIE();
  103063. if (isIE || (this.isFirefox() && this.getFirefoxVersion() < 65) ||
  103064. (this.isChrome() && this.getChromeVersion() < 32)) {
  103065. return false;
  103066. }
  103067. url = token ? `${url}/tileImage.webp?token=${token}` : `${url}/tileImage.webp`;
  103068. let isSameDomain = Util_Util.isInTheSameDomain(url), excledeCreditial;
  103069. if (isSameDomain && !token) {
  103070. // online上服务域名一直,要用token值
  103071. excledeCreditial = false;
  103072. } else {
  103073. excledeCreditial = true;
  103074. }
  103075. url = this.getRequestUrl(url, excledeCreditial);
  103076. return FetchRequest.get(url, null, {
  103077. withCredentials: this.withCredentials,
  103078. withoutFormatSuffix: true
  103079. }).then(function (response) {
  103080. if (response.status !== 200) {
  103081. throw response.status;
  103082. }
  103083. return response;
  103084. }).then(() => {
  103085. return true;
  103086. }).catch(() => {
  103087. return false;
  103088. })
  103089. }
  103090. /**
  103091. * @private
  103092. * @function WebMap.prototype.isIE
  103093. * @description 判断当前浏览器是否为IE
  103094. * @returns {boolean}
  103095. */
  103096. isIE() {
  103097. if (!!window.ActiveXObject || "ActiveXObject" in window) {
  103098. return true;
  103099. }
  103100. return false;
  103101. }
  103102. /**
  103103. * @private
  103104. * @function WebMap.prototype.isFirefox
  103105. * @description 判断当前浏览器是否为 firefox
  103106. * @returns {boolean}
  103107. */
  103108. isFirefox() {
  103109. let userAgent = navigator.userAgent;
  103110. return userAgent.indexOf("Firefox") > -1;
  103111. }
  103112. /**
  103113. * @private
  103114. * @function WebMap.prototype.isChrome
  103115. * @description 判断当前浏览器是否为谷歌
  103116. * @returns {boolean}
  103117. */
  103118. isChrome() {
  103119. let userAgent = navigator.userAgent;
  103120. return userAgent.indexOf("Chrome") > -1;
  103121. }
  103122. /**
  103123. * @private
  103124. * @function WebMap.prototype.getFirefoxVersion
  103125. * @description 获取火狐浏览器的版本号
  103126. * @returns {number}
  103127. */
  103128. getFirefoxVersion() {
  103129. let userAgent = navigator.userAgent.toLowerCase(),
  103130. version = userAgent.match(/firefox\/([\d.]+)/);
  103131. return +version[1];
  103132. }
  103133. /**
  103134. * @private
  103135. * @function WebMap.prototype.getChromeVersion
  103136. * @description 获取谷歌浏览器版本号
  103137. * @returns {number}
  103138. */
  103139. getChromeVersion() {
  103140. let userAgent = navigator.userAgent.toLowerCase(),
  103141. version = userAgent.match(/chrome\/([\d.]+)/);
  103142. return +version[1];
  103143. }
  103144. /**
  103145. * @private
  103146. * @function WebMap.prototype.addGraticule
  103147. * @description 创建经纬网
  103148. * @param {Object} mapInfo - 地图信息
  103149. */
  103150. addGraticule(mapInfo) {
  103151. if(this.isHaveGraticule) {
  103152. this.createGraticuleLayer(mapInfo.grid.graticule);
  103153. this.layerAdded++;
  103154. const lens = mapInfo.layers ? mapInfo.layers.length : 0;
  103155. this.sendMapToUser(lens);
  103156. }
  103157. }
  103158. /**
  103159. * @private
  103160. * @function WebMap.prototype.createGraticuleLayer
  103161. * @description 创建经纬网图层
  103162. * @param {Object} layerInfo - 图层信息
  103163. * @returns {ol.layer.Vector} 矢量图层
  103164. */
  103165. createGraticuleLayer(layerInfo) {
  103166. const { strokeColor, strokeWidth, lineDash, extent, visible, interval, lonLabelStyle, latLabelStyle } = layerInfo;
  103167. const epsgCode = this.baseProjection;
  103168. // 添加经纬网需要设置extent、worldExtent
  103169. let projection = new external_ol_proj_namespaceObject.get(epsgCode);
  103170. projection.setExtent(extent);
  103171. projection.setWorldExtent(external_ol_proj_namespaceObject.transformExtent(extent, epsgCode, 'EPSG:4326'));
  103172. let graticuleOptions = {
  103173. layerID: 'graticule_layer',
  103174. strokeStyle: new (external_ol_style_Stroke_default())({
  103175. color: strokeColor,
  103176. width: strokeWidth,
  103177. lineDash
  103178. }),
  103179. extent,
  103180. visible: visible,
  103181. intervals: interval,
  103182. showLabels: true,
  103183. zIndex: 9999,
  103184. wrapX: false,
  103185. targetSize: 0
  103186. };
  103187. lonLabelStyle && (graticuleOptions.lonLabelStyle = new (external_ol_style_Text_default())({
  103188. font: `${lonLabelStyle.fontSize} ${lonLabelStyle.fontFamily}`,
  103189. textBaseline: lonLabelStyle.textBaseline,
  103190. fill: new (external_ol_style_Fill_default())({
  103191. color: lonLabelStyle.fill
  103192. }),
  103193. stroke: new (external_ol_style_Stroke_default())({
  103194. color: lonLabelStyle.outlineColor,
  103195. width: lonLabelStyle.outlineWidth
  103196. })
  103197. }))
  103198. latLabelStyle && (graticuleOptions.latLabelStyle = new (external_ol_style_Text_default())({
  103199. font: `${latLabelStyle.fontSize} ${latLabelStyle.fontFamily}`,
  103200. textBaseline: latLabelStyle.textBaseline,
  103201. fill: new (external_ol_style_Fill_default())({
  103202. color: latLabelStyle.fill
  103203. }),
  103204. stroke: new (external_ol_style_Stroke_default())({
  103205. color: latLabelStyle.outlineColor,
  103206. width: latLabelStyle.outlineWidth
  103207. })
  103208. }))
  103209. const layer = new external_ol_layer_namespaceObject.Graticule(graticuleOptions);
  103210. this.map.addLayer(layer);
  103211. }
  103212. /**
  103213. * @private
  103214. * @function WebMap.prototype.getLang
  103215. * @description 检测当前cookie中的语言或者浏览器所用语言
  103216. * @returns {string} 语言名称,如zh-CN
  103217. */
  103218. getLang() {
  103219. if(this.getCookie('language')) {
  103220. const cookieLang = this.getCookie('language');
  103221. return this.formatCookieLang(cookieLang);
  103222. } else {
  103223. const browerLang = navigator.language || navigator.browserLanguage;
  103224. return browerLang;
  103225. }
  103226. }
  103227. /**
  103228. * @private
  103229. * @function WebMap.prototype.getCookie
  103230. * @description 获取cookie中某个key对应的值
  103231. * @returns {string} 某个key对应的值
  103232. */
  103233. getCookie(key) {
  103234. key = key.toLowerCase();
  103235. let value = null;
  103236. let cookies = document.cookie.split(';');
  103237. cookies.forEach(function (cookie) {
  103238. const arr = cookie.split('=');
  103239. if (arr[0].toLowerCase().trim() === key) {
  103240. value = arr[1].trim();
  103241. return;
  103242. }
  103243. });
  103244. return value;
  103245. }
  103246. /**
  103247. * @private
  103248. * @function WebMap.prototype.formatCookieLang
  103249. * @description 将从cookie中获取的lang,转换成全称,如zh=>zh-CN
  103250. * @returns {string} 转换后的语言名称
  103251. */
  103252. formatCookieLang(cookieLang) {
  103253. let lang;
  103254. switch(cookieLang) {
  103255. case 'zh':
  103256. lang = 'zh-CN';
  103257. break;
  103258. case 'ar':
  103259. lang = 'ar-EG';
  103260. break;
  103261. case 'bg':
  103262. lang = 'bg-BG';
  103263. break;
  103264. case 'ca':
  103265. lang = 'ca-ES';
  103266. break;
  103267. case 'cs':
  103268. lang = 'cs-CZ';
  103269. break;
  103270. case 'da':
  103271. lang = 'da-DK';
  103272. break;
  103273. case 'de':
  103274. lang = 'de-DE';
  103275. break;
  103276. case 'el':
  103277. lang = 'el-GR';
  103278. break;
  103279. case 'es':
  103280. lang = 'es-ES';
  103281. break;
  103282. case 'et':
  103283. lang = 'et-EE';
  103284. break;
  103285. case 'fa':
  103286. lang = 'fa-IR';
  103287. break;
  103288. case 'fl':
  103289. lang = 'fi-FI';
  103290. break;
  103291. case 'fr':
  103292. lang = 'fr-FR';
  103293. break;
  103294. case 'he':
  103295. lang = 'he-IL';
  103296. break;
  103297. case 'hu':
  103298. lang = 'hu-HU';
  103299. break;
  103300. case 'id':
  103301. lang = 'id-ID';
  103302. break;
  103303. case 'is':
  103304. lang = 'is-IS';
  103305. break;
  103306. case 'it':
  103307. lang = 'it-IT';
  103308. break;
  103309. case 'ja':
  103310. lang = 'ja-JP';
  103311. break;
  103312. case 'ko':
  103313. lang = 'ko-KR';
  103314. break;
  103315. case 'ku':
  103316. lang = 'ku-IQ';
  103317. break;
  103318. case 'mn':
  103319. lang = 'mn-MN';
  103320. break;
  103321. case 'nb':
  103322. lang = 'nb-NO';
  103323. break;
  103324. case 'ne':
  103325. lang = 'ne-NP';
  103326. break;
  103327. case 'nl':
  103328. lang = 'nl-NL';
  103329. break;
  103330. case 'pl':
  103331. lang = 'pl-PL';
  103332. break;
  103333. case 'pt':
  103334. lang = 'pt-PT';
  103335. break;
  103336. case 'ru':
  103337. lang = 'ru-RU';
  103338. break;
  103339. case 'sk':
  103340. lang = 'sk-SK';
  103341. break;
  103342. case 'sl':
  103343. lang = 'sl-SI';
  103344. break;
  103345. case 'sr':
  103346. lang = 'sr-RS';
  103347. break;
  103348. case 'sv':
  103349. lang = 'sv-SE';
  103350. break;
  103351. case 'th':
  103352. lang = 'th-TH';
  103353. break;
  103354. case 'tr':
  103355. lang = 'tr-TR';
  103356. break;
  103357. case 'uk':
  103358. lang = 'uk-UA';
  103359. break;
  103360. case 'vi':
  103361. lang = 'vi-VN';
  103362. break;
  103363. default:
  103364. lang = 'en-US';
  103365. break;
  103366. }
  103367. return lang;
  103368. }
  103369. isCustomProjection(projection) {
  103370. if(core_Util_Util.isNumber(projection)){
  103371. return [-1000,-1].includes(+projection)
  103372. }
  103373. return ['EPSG:-1000','EPSG:-1'].includes(projection);
  103374. }
  103375. handleJSONSuffix(url) {
  103376. if(!url.includes('.json')) {
  103377. if (url.includes('?')) {
  103378. let urlArr = url.split('?');
  103379. urlArr[0] = urlArr[0] + ".json";
  103380. url = urlArr.join('?');
  103381. } else {
  103382. url = url + ".json"
  103383. }
  103384. }
  103385. return url;
  103386. }
  103387. }
  103388. ;// CONCATENATED MODULE: ./src/openlayers/mapping/ImageTileSuperMapRest.js
  103389. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  103390. * This program are made available under the terms of the Apache License, Version 2.0
  103391. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  103392. /**
  103393. * @class ImageTileSuperMapRest
  103394. * @browsernamespace ol.source
  103395. * @version 10.2.0
  103396. * @category iServer Image
  103397. * @classdesc iServer影像服务图层源。根据指定的请求参数,返回影像数据栅格瓦片并渲染。
  103398. * @param {Object} options - 参数。
  103399. * @param {string} options.url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  103400. * @param {string} options.collectionId - 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  103401. * @param {string} [options.sqlFilter] 显示影像的过滤条件。相当于SQL查询中的where子句。支持st_geometry空间函数过滤。11.0版本暂不支持通过ECQL进行过滤。
  103402. * @param {ImageRenderingRule} [options.renderingRule] 指定影像显示的风格,包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。不指定时,使用发布服务时所配置的风格。
  103403. * @param {Array.<number>} [options.ids] 返回影像集合中指定ID的影像,该ID为系统维护的一个自增ID,为SuperMap SDX引擎的SmID字段内容。
  103404. * @param {Array.<string>} [options.names] 返回影像集合中指定名称影像的瓦片资源。影像名称包含文件后缀,如S-60-45.tif。
  103405. * @param {string} [options.format='png'] - 瓦片表述类型,瓦片格式目前支持png、jpg和webp三种格式。
  103406. * @param {boolean} [options.transparent=true] - 瓦片是否透明。默认透明。
  103407. * @param {boolean} [options.cacheEnabled=true] - 启用缓存。
  103408. * @param {string} [options.tileProxy] - 代理地址。
  103409. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
  103410. * @extends {ol.source.XYZ}
  103411. * @usage
  103412. */
  103413. class ImageTileSuperMapRest extends (external_ol_source_XYZ_default()) {
  103414. constructor(options) {
  103415. options = options || {};
  103416. options.format = options.format || 'png';
  103417. options.transparent = options.transparent === undefined ? true : options.transparent === true;
  103418. options.cacheEnabled = options.cacheEnabled === undefined ? true : options.cacheEnabled === true;
  103419. var attributions = options.attributions || "Map Data <span>© SuperMap iServer</span>";
  103420. var url = _createLayerUrl(options.url, options);
  103421. var superOptions = {
  103422. ...options,
  103423. attributions: attributions,
  103424. url: url
  103425. };
  103426. //需要代理时走自定义 tileLoadFunction,否则走默认的tileLoadFunction
  103427. if (!options.tileLoadFunction && options.tileProxy) {
  103428. superOptions.tileLoadFunction = tileLoadFunction;
  103429. }
  103430. super(superOptions);
  103431. var me = this;
  103432. this.options = options;
  103433. if (options.tileProxy) {
  103434. this.tileProxy = options.tileProxy;
  103435. }
  103436. function tileLoadFunction(imageTile, src) {
  103437. imageTile.getImage().src = me.tileProxy + encodeURIComponent(src);
  103438. }
  103439. function _createLayerUrl(url, options) {
  103440. var layerUrl = Util_Util.urlPathAppend(
  103441. url,
  103442. `/collections/${options.collectionId}/tile.${options.format}?x={x}&y={y}&z={z}`
  103443. );
  103444. var requestParams = _getAllRequestParams(options);
  103445. layerUrl = Util_Util.urlAppend(layerUrl, _getParamString(requestParams));
  103446. layerUrl = SecurityManager.appendCredential(layerUrl);
  103447. if (!options.cacheEnabled) {
  103448. layerUrl += '&_t=' + new Date().getTime();
  103449. }
  103450. return layerUrl;
  103451. }
  103452. function _getAllRequestParams(options) {
  103453. var params = {};
  103454. params['transparent'] = options.transparent;
  103455. params['cacheEnabled'] = !(options.cacheEnabled === false);
  103456. if (options.sqlFilter) {
  103457. params['sqlFilter'] = options.sqlFilter;
  103458. }
  103459. if (options.renderingRule) {
  103460. params['renderingRule'] = JSON.stringify(options.renderingRule);
  103461. }
  103462. if (options.ids) {
  103463. params['ids'] = options.ids.join(',');
  103464. }
  103465. if (options.names) {
  103466. params['names'] = options.names.join(',');
  103467. }
  103468. return params;
  103469. }
  103470. function _getParamString(obj) {
  103471. var params = [];
  103472. for (var i in obj) {
  103473. params.push(encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]));
  103474. }
  103475. return params.join('&');
  103476. }
  103477. }
  103478. }
  103479. ;// CONCATENATED MODULE: external "ol.layer.Tile"
  103480. const external_ol_layer_Tile_namespaceObject = ol.layer.Tile;
  103481. var external_ol_layer_Tile_default = /*#__PURE__*/__webpack_require__.n(external_ol_layer_Tile_namespaceObject);
  103482. ;// CONCATENATED MODULE: ./src/openlayers/mapping/InitMap.js
  103483. window.proj4 = (proj4_src_default());
  103484. /**
  103485. * @function initMap
  103486. * @description 根据 SuperMap iServer 服务参数,创建地图与图层。目前仅支持SuperMap iServer 地图服务,创建的图层为 ol.Tile。
  103487. * @category BaseTypes Util
  103488. * @version 11.0.1
  103489. * @param {number} url - 服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
  103490. * @param {Object} options - 参数。
  103491. * @param {Object} [options.mapOptions] - 地图配置,参数设置参考 {@link https://openlayers.org/en/v6.15.1/apidoc/module-ol_Map-Map.html}。
  103492. * @param {Object} [options.viewOptions] - 视图配置,参数设置参考 {@link https://openlayers.org/en/v6.15.1/apidoc/module-ol_View-View.html} ,未设置的情况下,默认使用 SuperMap iServer 服务参数进行设置。
  103493. * @param {Object} [options.layerOptions] - 图层配置,参数设置参考 {@link https://openlayers.org/en/v6.15.1/apidoc/module-ol_layer_Tile-TileLayer.html} ,未设置的情况下,默认使用 SuperMap iServer 服务参数进行设置。
  103494. * @param {Object} [options.sourceOptions] - 数据源配置,参数设置参考 {@link TileSuperMapRest} ,未设置的情况下,默认使用 SuperMap iServer 服务参数进行设置。
  103495. * @returns {Object} 实例对象,对象包括地图实例,图层实例,数据源实例。
  103496. * @usage
  103497. * ```
  103498. * // 浏览器
  103499. * <script type="text/javascript" src="{cdn}"></script>
  103500. * <script>
  103501. * const initMap = {namespace}.initMap;
  103502. *
  103503. * </script>
  103504. * // ES6 Import
  103505. * import { initMap } from '{npm}';
  103506. *
  103507. * initMap(url, { mapOptions, viewOptions, layerOptions, sourceOptions })
  103508. * ```
  103509. * */
  103510. function initMap(url, options = {}) {
  103511. const { mapOptions, viewOptions, layerOptions, sourceOptions } = options;
  103512. return new Promise((resolve, reject) => {
  103513. new MapService(url).getMapInfo(async function (serviceResult) {
  103514. if (!serviceResult || !serviceResult.result) {
  103515. reject('service is not work!');
  103516. }
  103517. let { prjCoordSys, bounds } = serviceResult.result;
  103518. if (!(0,external_ol_proj_namespaceObject.get)(`EPSG:${prjCoordSys.epsgCode}`) && prjCoordSys.type !== 'PCS_NON_EARTH') {
  103519. const wkt = await getWkt(url);
  103520. registerProj(prjCoordSys.epsgCode, wkt, bounds);
  103521. }
  103522. let map = createMap(serviceResult.result, mapOptions, viewOptions);
  103523. let { layer, source } = createLayer(url, serviceResult.result, sourceOptions, layerOptions);
  103524. map.addLayer(layer);
  103525. resolve({
  103526. map,
  103527. source,
  103528. layer
  103529. });
  103530. });
  103531. });
  103532. }
  103533. /**
  103534. * @function viewOptionsFromMapJSON
  103535. * @category BaseTypes Util
  103536. * @version 11.0.1
  103537. * @description 通过 iServer REST 地图参数构造 ol 视图对象。
  103538. * @param {Object} mapJSONObj - 地图 JSON 对象。
  103539. * @param {number} [level=22] - 地图最大级别。
  103540. * @returns {Object} ol视图参数,包括中心点、投影、级别、分辨率数组。
  103541. */
  103542. function viewOptionsFromMapJSON(mapJSONObj, level = 22) {
  103543. let { bounds, dpi, center, visibleScales, scale, coordUnit, prjCoordSys } = mapJSONObj;
  103544. const mapCenter =
  103545. center.x && center.y ? [center.x, center.y] : [(bounds.left + bounds.right) / 2, (bounds.bottom + bounds.top) / 2];
  103546. const extent = [bounds.left, bounds.bottom, bounds.right, bounds.top];
  103547. let projection = core_Util_Util.getProjection(prjCoordSys, extent);
  103548. var resolutions = core_Util_Util.scalesToResolutions(visibleScales, bounds, dpi, coordUnit, level);
  103549. const zoom = core_Util_Util.getZoomByResolution(core_Util_Util.scaleToResolution(scale, dpi, coordUnit), resolutions);
  103550. return {
  103551. center: mapCenter,
  103552. projection,
  103553. zoom,
  103554. resolutions
  103555. };
  103556. }
  103557. function createMap(result, mapOptions, viewOptions) {
  103558. let view = viewOptionsFromMapJSON(result);
  103559. var map = new (external_ol_Map_default())({
  103560. target: 'map',
  103561. view: new (external_ol_View_default())({ ...view, ...viewOptions }),
  103562. ...mapOptions
  103563. });
  103564. return map;
  103565. }
  103566. function registerProj(epsgCode, wkt, bounds) {
  103567. const extent = [bounds.left, bounds.bottom, bounds.right, bounds.top];
  103568. let epsgCodeStr = `EPSG:${epsgCode}`;
  103569. !(0,external_ol_proj_namespaceObject.get)(epsgCodeStr) && proj4_src_default().defs(epsgCodeStr, wkt);
  103570. if (external_ol_proj_proj4_namespaceObject && external_ol_proj_proj4_namespaceObject.register) {
  103571. external_ol_proj_proj4_namespaceObject.register((proj4_src_default()));
  103572. var prj = (0,external_ol_proj_namespaceObject.get)(epsgCodeStr);
  103573. prj.setExtent(extent);
  103574. }
  103575. }
  103576. function createLayer(url, result, sourceOptions, layerOptions) {
  103577. let options = TileSuperMapRest.optionsFromMapJSON(url, result, true);
  103578. options = { ...options, ...sourceOptions };
  103579. var source = new TileSuperMapRest(options);
  103580. var layer = new (external_ol_layer_Tile_default())({
  103581. source,
  103582. ...layerOptions
  103583. });
  103584. return { layer, source };
  103585. }
  103586. function getWkt(url) {
  103587. return new Promise((resolve) => {
  103588. new MapService(url).getWkt(function (res) {
  103589. let wkt = res.result.data;
  103590. resolve(wkt);
  103591. });
  103592. });
  103593. }
  103594. ;// CONCATENATED MODULE: ./src/openlayers/mapping/index.js
  103595. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  103596. * This program are made available under the terms of the Apache License, Version 2.0
  103597. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  103598. ;// CONCATENATED MODULE: ./src/openlayers/index.js
  103599. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  103600. * This program are made available under the terms of the Apache License, Version 2.0
  103601. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  103602. ;// CONCATENATED MODULE: ./src/openlayers/namespace.js
  103603. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  103604. * This program are made available under the terms of the Apache License, Version 2.0
  103605. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  103606. /* control */
  103607. /* core */
  103608. /* mapping */
  103609. /* overlay */
  103610. /* service */
  103611. if (window && window.ol) {
  103612. let ol = window.ol;
  103613. ol.supermap = { ...SuperMap, ...ol.supermap };
  103614. ol.supermap.control = ol.supermap.control || {};
  103615. // control
  103616. ol.supermap.control.ChangeTileVersion = ChangeTileVersion;
  103617. ol.supermap.control.Logo = Logo;
  103618. ol.supermap.control.ScaleLine = ScaleLine;
  103619. // core
  103620. ol.supermap.StyleUtils = StyleUtils;
  103621. ol.supermap.Util = core_Util_Util;
  103622. // mapping
  103623. ol.source.BaiduMap = BaiduMap;
  103624. ol.source.ImageSuperMapRest = ImageSuperMapRest;
  103625. ol.source.SuperMapCloud = SuperMapCloud;
  103626. ol.source.ImageTileSuperMapRest = ImageTileSuperMapRest;
  103627. ol.source.Tianditu = Tianditu;
  103628. ol.source.TileSuperMapRest = TileSuperMapRest;
  103629. ol.supermap.WebMap = WebMap;
  103630. // overlay
  103631. ol.style.CloverShape = CloverShape;
  103632. ol.Graphic = Graphic_Graphic;
  103633. ol.style.HitCloverShape = HitCloverShape;
  103634. ol.source.GeoFeature = GeoFeature;
  103635. ol.source.Theme = theme_Theme_Theme;
  103636. ol.supermap.ThemeFeature = ThemeFeature;
  103637. ol.supermap.MapboxStyles = MapboxStyles;
  103638. ol.supermap.VectorTileStyles = VectorTileStyles;
  103639. ol.source.DataFlow = DataFlow;
  103640. ol.source.Graph = Graph_Graph;
  103641. ol.source.Graphic = Graphic;
  103642. ol.source.HeatMap = HeatMap;
  103643. ol.source.Label = Label_Label;
  103644. ol.source.Mapv = Mapv;
  103645. ol.source.Range = Range;
  103646. ol.source.RankSymbol = RankSymbol_RankSymbol;
  103647. ol.source.Turf = Turf;
  103648. ol.source.FGB = FGB;
  103649. ol.source.Unique = Unique;
  103650. ol.source.VectorTileSuperMapRest = VectorTileSuperMapRest;
  103651. ol.supermap.GraphMap = GraphMap;
  103652. // service
  103653. ol.supermap.AddressMatchService = AddressMatchService;
  103654. ol.supermap.ChartService = ChartService;
  103655. ol.supermap.DataFlowService = DataFlowService;
  103656. ol.supermap.DatasetService = DatasetService;
  103657. ol.supermap.DatasourceService = DatasourceService;
  103658. ol.supermap.FeatureService = FeatureService;
  103659. ol.supermap.FieldService = FieldService;
  103660. ol.supermap.GridCellInfosService = GridCellInfosService;
  103661. ol.supermap.GeoprocessingService = GeoprocessingService;
  103662. ol.supermap.LayerInfoService = LayerInfoService;
  103663. ol.supermap.MapService = MapService;
  103664. ol.supermap.MeasureService = MeasureService;
  103665. ol.supermap.NetworkAnalyst3DService = NetworkAnalyst3DService;
  103666. ol.supermap.NetworkAnalystService = NetworkAnalystService;
  103667. ol.supermap.ProcessingService = ProcessingService;
  103668. ol.supermap.QueryService = QueryService;
  103669. ol.supermap.ServiceBase = ServiceBase;
  103670. ol.supermap.SpatialAnalystService = SpatialAnalystService;
  103671. ol.supermap.ThemeService = ThemeService;
  103672. ol.supermap.TrafficTransferAnalystService = TrafficTransferAnalystService;
  103673. ol.supermap.WebPrintingJobService = WebPrintingJobService;
  103674. ol.supermap.ImageService = ImageService;
  103675. ol.supermap.ImageCollectionService = ImageCollectionService;
  103676. ol.supermap.KnowledgeGraphService = KnowledgeGraphService;
  103677. ol.supermap.initMap = initMap;
  103678. ol.supermap.viewOptionsFromMapJSON = viewOptionsFromMapJSON;
  103679. // 处理命名空间重名问题
  103680. ol.supermap.CommonUtil = Util_Util;
  103681. }
  103682. })();
  103683. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  103684. (() => {
  103685. "use strict";
  103686. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  103687. * This program are made available under the terms of the Apache License, Version 2.0
  103688. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  103689. })();
  103690. /******/ })()
  103691. ;